Instead of allocating two nodes interactivly, we shall submit a job and let the scheduler run the task in batch mode.
For this we create a batch script:
cat > submission_script.sbatch << EOF
#!/bin/bash
#SBATCH --job-name=hello-world-job
#SBATCH --ntasks=4
#SBATCH --output=%x_%j.out
mpirun ${HOME}/hello
# Since the hello-world example will be very shortlived, let's wait a bit
sleep 60
EOF
Let us submit a job.
sbatch submission_script.sbatch
This will release the node first (exit
) and submit a job.
Once finished you can check out the log file.
cat hello-world-job_*.out