I want to set number of task per node as variable in slurm like: #SBATCH --ntasks-per-node=s*2; (s is number of socket per node that I pass it as parameter to my program). The code is as followed: a part of test.c file:
if (argc < 3)
{
fprintf(stderr, "Usage: mpiexec program <#sockets>\n");
exit(1);
}
s = atoi(argv[1]);
bash script(slurm):
#!/bin/bash
#SBATCH --job-name=test
#SBATCH --time=00:30:00
#SBATCH --account=1234
#SBATCH --output=./test.out
#SBATCH --nodes=4
#SBATCH --mem-per-cpu=3900M
#SBATCH --ntasks-per-node=s*2 ???
#SBATCH --exclusive
source /cluster/bin/jobsetup
module load intel/2015.3
module load openmpi.intel/1.8.6
cd ~/filedir
mpirun --map-by ppr:2:socket --report-bindings ./test 4 > ./test
if I set ntasks-per-node a fixed amount like 8, it works fine. But how I can set it based on the parameter that I passed it to my program? I would appreciate for any help.