diff --git a/darpanx/darpanx_mlcal.py b/darpanx/darpanx_mlcal.py index fb7cec7..0bbe5f0 100644 --- a/darpanx/darpanx_mlcal.py +++ b/darpanx/darpanx_mlcal.py @@ -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...") diff --git a/darpanx/darpanx_utilities.py b/darpanx/darpanx_utilities.py index f8241e9..1c365b4 100644 --- a/darpanx/darpanx_utilities.py +++ b/darpanx/darpanx_utilities.py @@ -24,6 +24,7 @@ from os import path from darpanx.get_dir import* import sys +import multiprocessing as mlp ''' #----------------------------------------------- Perpose: @@ -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