Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I want to run a program that runs and creates a checkpoint file. Then I want to run several variant configurations that all start from that checkpoint.

For example, if I run:

sbatch -n 1 -t 12:00:00 --mem=16g program.sh

And program.sh looks like this:

#!/bin/sh
./set_checkpoint
sbatch -n 1 -t 12:00:00 --mem=16g cpt_restore_config1.sh
sbatch -n 1 -t 12:00:00 --mem=16g cpt_restore_config2.sh
sbatch -n 1 -t 12:00:00 --mem=16g cpt_restore_config3.sh
sbatch -n 1 -t 12:00:00 --mem=16g cpt_restore_config4.sh

Does this implement the desired effect?

I would be interested to know if you actually managed to run this. I tried with a similar script and it didn't work. I don't think it's possible to just sbatch this type of script as suggested in the answer below. – Michele Pellegrino Mar 30 at 12:59 @MichelePellegrino Yep! I use it all the time in my work. What's the error that you have? – Sam Thomas Apr 2 at 3:47 Well, the error is simply that calling the script with sbatch program.sh literally yields no output. No job is started and I don't even get any output in the standard error. – Michele Pellegrino Apr 3 at 7:35 Is this dependent on the contents of program.sh? Does it work without making the recursive call (i.e., just stating echo Hello world)? I'm wondering if there is a small error going on here, because this behavior seems odd and inconsistent with what I have experienced. – Sam Thomas Apr 10 at 17:12 I confirm: tried to run echo hello-world > test-$SLURM_JOB_PARTITION.txt and submit to three different partitions using a script similar to yours. Nothing in the slurm output and error, no test output file created... – Michele Pellegrino Apr 12 at 7:02

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.