CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [PyFoam] start Runner from python with machinefile (https://www.cfd-online.com/Forums/openfoam-community-contributions/122757-start-runner-python-machinefile.html)

Blub August 27, 2013 10:35

start Runner from python with machinefile
 
Hello everyone,

I have a small issue with pyFoam: I wrote a script for my local machine and it uses this to call the solver

Code:

machine=LAMMachine(nr=no_proc)
theRun=AnalyzedRunner(analyzer,
argv=[solver,"-case",work.name],
silent=False,
lam=machine)
theRun.start()

this works fine. However I now want to do the same on a cluster where I need to provide the nodefile / machinfile for mpirun.

I tried the following:

Code:

machine=LAMMachine(machines=nodefile,nr=no_proc)
theRun=AnalyzedRunner(analyzer,
argv=["potentialFreeSurfaceAPMFoam","-case",work.name],
silent=True,
lam=machine)
theRun.start()

Unfortunately that didn't do the trick, so I am using brute force by executing:

Code:

run_str="mpirun -hostfile "+nodefile+" -np "+str(no_proc)+" "+ solver +" -case "+work.name+ " -parallel &> solver."+outputName_nospc+".log"
os.system(run_str)

which works.

Any suggestions on how to setup the correct call for pyFoamRunner will be appreciated :)

Thanks in advance,
Arne

gschaider August 28, 2013 09:28

Quote:

Originally Posted by Blub (Post 448332)
Hello everyone,

I have a small issue with pyFoam: I wrote a script for my local machine and it uses this to call the solver

Code:

machine=LAMMachine(nr=no_proc)
theRun=AnalyzedRunner(analyzer,
argv=[solver,"-case",work.name],
silent=False,
lam=machine)
theRun.start()

this works fine. However I now want to do the same on a cluster where I need to provide the nodefile / machinfile for mpirun.

I tried the following:

Code:

machine=LAMMachine(machines=nodefile,nr=no_proc)
theRun=AnalyzedRunner(analyzer,
argv=["potentialFreeSurfaceAPMFoam","-case",work.name],
silent=True,
lam=machine)
theRun.start()

Unfortunately that didn't do the trick, so I am using brute force by executing:

Code:

run_str="mpirun -hostfile "+nodefile+" -np "+str(no_proc)+" "+ solver +" -case "+work.name+ " -parallel &> solver."+outputName_nospc+".log"
os.system(run_str)

which works.

Any suggestions on how to setup the correct call for pyFoamRunner will be appreciated :)

Thanks in advance,
Arne

"That didn't do the trick" is not really a description of a bug that allows me to help you. Does it hang? Does it crash? Does the machine emit pink smoke and green Leprechauns dance around you?

Additional questions: Does the parallel script work on the local machine? Is the Distro on the local machine the same as on the cluster? Are you from Ireland (answer only required in case of the Lepreachauns)?

See slide 53 and following of http://openfoamwiki.net/images/8/84/...ining_OFW8.pdf and try to set
Code:

[Debug]
ParallelExecution: True

This should output additional information (amongst it the actual call to mpirun). Either change the settings so that this call replicates your successful call or try to replicate the call that PyFoam generates on a local shell


All times are GMT -4. The time now is 11:52.