The other question that you have linked to gives you exactly what you need, but you have to adapt it slightly, as it is written for OpenMP applications whose number of threads is controlled by the OMP_NUM_THREADS
environment variable.
Here are the most important parts of the job script:
#BSUB -n 4
- request 4 slots
#BSUB -R "span[ptile=1]"
- request that slots are distributed one per node; this option in combination with the previous one spans the job over 4 different nodes and instructs LSF to put one slot per host in the generated host file
#BSUB -x
- request exclusive access to the nodes
The above three options would instruct LSF to allocate 4 nodes and it will reserve one slot on each node. Since also exclusive access is being requested, no other jobs will share the same nodes with the job and you can start as many threads as you like per node. Then all you need is to call Open MPI's mpiexec
and if LSF integration was compiled in your Open MPI setup, it will automatically pick up the host list from LSF and start one process per node.
A sample LSF job file would look like this:
#BSUB -n 4
#BSUB -R "span[ptile=1]"
#BSUB -x
mpiexec -np 4 ./myprocess --numthreads=12
Make sure you also request enough run time with the -W
option and a sufficient amount of memory with the -M
option. Memory in LSF (as well as in most other distributed resource managers) is requested per slot, therefore you should specify the maximum amount of memory that any instance of ./myprocess
would consume.
If LSF integration is not compiled in your Open MPI distribution, the process is somewhat more involved as you would have to parse the LSF hosts file and create an Open MPI hosts file from the former.