Running compiled tests or executables in parallel?

+1 vote
asked Oct 25, 2017 by clairem (160 points)

I wish to run a simulation in parallel using the runner file created from an scons compile. I am doing it through the runner rather than directly through the scons command as I pass different seeds as arguments to the executable. My build command is: scons b=GccOptNative_2, however then when I run the simulation from the runner I am only getting one processor; the PetscTools::GetNumProcs() query in my code returns 1. Is it possible to run directly from the executable in parallel, and if so how do I do this?

To be clear, the two commands I run are:

scons b=GccOptNative_2 co=1 projects/ClaireM/test/TestSimpleAsymmetricSimulation.hpp

.projects/ClaireM/build/optimised_native/TestSimpleAsymmetricSimulationRunner -seed 0

1 Answer

+2 votes
answered Oct 25, 2017 by GaryM (940 points)
selected Oct 26, 2017 by clairem
Best answer

Yes you can run compiled executables in parallel, for this use mpirun, e.g.

mpirun -np 2 projects/ClaireM/build/optimised_native/TestSimpleAsymmetricSimulationRunner -seed 0

Where the '2' is how many cores you want to run on. That may be enough.

But if this throws errors about libraries not being available then you will need the same libraries on the environment variable LD_LIBRARY_PATH as scons sets up, to work out what these are you can run:

scons offline_mode=1 b=GccOptNative_2 global

and this will produce a file in the chaste source folder. This is a template for HPC submission script. It defines a line that looks like

export LD_LIBRARY_PATH=...

which you can copy to your terminal before running mpirun and/or put in your .bashrc file to run on startup.

commented Oct 26, 2017 by clairem (160 points)

Using mpirun worked perfectly. Thanks Gary.

Welcome to Chaste Q&A, where you can ask questions and receive answers from other members of the community of Chaste developers and users.

See the Chaste wiki for installation instructions, guides and tutorials.