python: add set number of threads interface
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/32/head
parent
9b86db48c1
commit
65ca6bfc44
|
@ -217,7 +217,7 @@ bool openEMS::parseCommandLineArgument( const char *argv )
|
||||||
}
|
}
|
||||||
else if (strncmp(argv,"--numThreads=",13)==0)
|
else if (strncmp(argv,"--numThreads=",13)==0)
|
||||||
{
|
{
|
||||||
m_engine_numThreads = atoi(argv+13);
|
this->SetNumberOfThreads(atoi(argv+13));
|
||||||
cout << "openEMS - fixed number of threads: " << m_engine_numThreads << endl;
|
cout << "openEMS - fixed number of threads: " << m_engine_numThreads << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,8 @@ public:
|
||||||
void SetTimeStepFactor(double val) {m_TS_fac=val;}
|
void SetTimeStepFactor(double val) {m_TS_fac=val;}
|
||||||
void SetMaxTime(double val) {m_maxTime=val;}
|
void SetMaxTime(double val) {m_maxTime=val;}
|
||||||
|
|
||||||
|
void SetNumberOfThreads(unsigned int val) {m_engine_numThreads = val;}
|
||||||
|
|
||||||
void DebugMaterial() {DebugMat=true;}
|
void DebugMaterial() {DebugMat=true;}
|
||||||
void DebugOperator() {DebugOp=true;}
|
void DebugOperator() {DebugOp=true;}
|
||||||
void DebugBox() {m_debugBox=true;}
|
void DebugBox() {m_debugBox=true;}
|
||||||
|
|
|
@ -39,6 +39,8 @@ cdef extern from "openEMS/openems.h":
|
||||||
void SetTimeStepFactor(double val)
|
void SetTimeStepFactor(double val)
|
||||||
void SetMaxTime(double val)
|
void SetMaxTime(double val)
|
||||||
|
|
||||||
|
void SetNumberOfThreads(int val)
|
||||||
|
|
||||||
void Set_BC_Type(int idx, int _type)
|
void Set_BC_Type(int idx, int _type)
|
||||||
int Get_BC_Type(int idx)
|
int Get_BC_Type(int idx)
|
||||||
void Set_BC_PML(int idx, unsigned int size)
|
void Set_BC_PML(int idx, unsigned int size)
|
||||||
|
|
|
@ -410,7 +410,7 @@ cdef class openEMS:
|
||||||
continue
|
continue
|
||||||
grid.AddLine(n, hint[n])
|
grid.AddLine(n, hint[n])
|
||||||
|
|
||||||
def Run(self, sim_path, cleanup=False, setup_only=False, debug_pec=False, verbose=None):
|
def Run(self, sim_path, cleanup=False, setup_only=False, debug_pec=False, verbose=None, **kw):
|
||||||
""" Run(sim_path, cleanup=False, setup_only=False, verbose=None)
|
""" Run(sim_path, cleanup=False, setup_only=False, verbose=None)
|
||||||
|
|
||||||
Run the openEMS FDTD simulation.
|
Run the openEMS FDTD simulation.
|
||||||
|
@ -419,6 +419,9 @@ cdef class openEMS:
|
||||||
:param cleanup: bool -- remove exisiting sim_path to cleanup old results
|
:param cleanup: bool -- remove exisiting sim_path to cleanup old results
|
||||||
:param setup_only: bool -- only perform FDTD setup, do not run simulation
|
:param setup_only: bool -- only perform FDTD setup, do not run simulation
|
||||||
:param verbose: int -- set the openEMS verbosity level 0..3
|
:param verbose: int -- set the openEMS verbosity level 0..3
|
||||||
|
|
||||||
|
Additional keyword parameter:
|
||||||
|
:param numThreads: int -- set the number of threads (default 0 --> max)
|
||||||
"""
|
"""
|
||||||
if cleanup and os.path.exists(sim_path):
|
if cleanup and os.path.exists(sim_path):
|
||||||
shutil.rmtree(sim_path)
|
shutil.rmtree(sim_path)
|
||||||
|
@ -431,6 +434,8 @@ cdef class openEMS:
|
||||||
self.thisptr.SetVerboseLevel(verbose)
|
self.thisptr.SetVerboseLevel(verbose)
|
||||||
if debug_pec:
|
if debug_pec:
|
||||||
self.thisptr.DebugPEC()
|
self.thisptr.DebugPEC()
|
||||||
|
if 'numThreads' in kw:
|
||||||
|
self.thisptr.SetNumberOfThreads(int(kw['numThreads']))
|
||||||
assert os.getcwd() == sim_path
|
assert os.getcwd() == sim_path
|
||||||
_openEMS.WelcomeScreen()
|
_openEMS.WelcomeScreen()
|
||||||
cdef int EC
|
cdef int EC
|
||||||
|
|
Loading…
Reference in New Issue