Skip to content

Commit

Permalink
Updated the message for NumCore used for parallel processing
Browse files Browse the repository at this point in the history
  • Loading branch information
biswajitmb committed Dec 12, 2020
1 parent ae95879 commit cd91cfe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions darpanx/darpanx_mlcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def __init__(self,NK_dir=None, LayerMaterial=None, Repetition=None, NumStack=Non
try:
NumCore=int(NumCore)
if NumCore > 0:
cpu=mulp.cpu_count()
if NumCore > cpu:
print("%% DarpanX_message: NumCore is exciding the maximum value. Set NumCore = "+str(cpu))
NumCore=cpu
print("%% DarpanX_status: Parallel processing is using with no.cores = "+str(NumCore))
self.NumCore=NumCore
else: print("%% DarpanX_Error: < NumCore > should be an integer, like 1,2,3...")
Expand Down
5 changes: 5 additions & 0 deletions darpanx/darpanx_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from os import path
from darpanx.get_dir import*
import sys
import multiprocessing as mlp
'''
#-----------------------------------------------
Perpose:
Expand Down Expand Up @@ -536,6 +537,10 @@ def read_infile(UserInFile):
NumCore=l2[l1.index('NumCore')][1:-1]
NumCore=int(NumCore)
if NumCore > 0:
cpu=mlp.cpu_count()
if NumCore > cpu:
print("%% DarpanX_message: NumCore is exciding the maximum value. Set NumCore = "+str(cpu))
NumCore=cpu
print("%% DarpanX_message: Parallel processing is using with no.cores = "+str(NumCore))
else: print("%% DarpanX_Error: < NumCore > should be an integer, like 1,2,3...")
except:NumCore=None
Expand Down

0 comments on commit cd91cfe

Please sign in to comment.