will hang until 6 CPU cores are available, while the 3 tasks are independent I would like one to start proceeding on the only 2 CPU cores available. How to do that?
Jun 3, 1:33pm
To achieve your goal—running 3 independent tasks with 2 CPUs each, but allowing tasks to start as soon as 2 CPUs are available (rather than waiting for all 6 CPUs to be free)—you need to avoid over-subscribing the node while still allowing task packing.
Solution: Use --ntasks-per-node and --cpus-per-task with --wait=0
By default, srun waits for all requested resources to be available before launching any tasks. To allow tasks to start as soon as their required CPUs are free, use the --wait=0 flag (or --no-kill if you want to ensure tasks don't get killed if resources are reallocated).
However, the most reliable way is to submit each task separately or use job arrays with resource constraints per task.
Option 1: Submit Tasks Individually
Run each task as a separate srun command, each requesting 2 CPUs: