You wish to launch several commands in a same time in a job.
- For running all commands in parallel without waiting the end of the precedent command, add a & at the end of the command.
- However, as soon as a job is launched, the job ends without having the time to run the commands.
- For solving this problem, add the wait command at the end of your script (of course, don’t add the & at the end of this command)
- Add #SBATCH –ntasks-per-node=N so that commands/tasks do not run on a same core of the node.
- Example of a script
#!/bin/sh #SBATCH --job-name=job #SBATCH –ntasks-per-node=N # A number between 1 and the number of cores of the node. N should be equals to the number of tasks. ... ./my_cmd1& ./my_cmd2& ./my_cmd3& ./my_cmd4& ... ./my_cmdN& wait