Newer
Older
def slurm_gpu(file, version, ntasks, mem_per_cpu, time):
#SBATCH --job-name={file[0]}.out
#SBATCH --output={file[0]}-{version}-{ntasks}.out.o%j
#SBATCH --ntasks={ntasks}
#SBATCH --cpus-per-task=1
#SBATCH --partition=shared-gpu
#SBATCH --mem-per-cpu={mem_per_cpu}
#SBATCH --time={time}
module load CUDA
srun {file[1]}_{version}_bench {min(ntasks, 8)} {file[2]} {file[2]} {file[2]}
def slurm_cpu(file, version, ntasks, mem_per_cpu, time):
#SBATCH --job-name={file[0]}.out
#SBATCH --output={file[0]}-{version}-{ntasks}.out.o%j
#SBATCH --ntasks={ntasks}
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu={mem_per_cpu}
#SBATCH --time={time}
srun {file[1]}_{version}_bench 1 {file[2]} {file[2]} {file[2]}
["elem"], ["/home/users/c/coudrayb/projet-de-bachelor/elementary/cmake-build-release/elementary", 300000000],
["gol"], ["/home/users/c/coudrayb/projet-de-bachelor/game_of_life/cmake-build-release/game_of_life", 30000],
["lbm"], ["/home/users/c/coudrayb/projet-de-bachelor/lattice_boltzmann/cmake-build-release/lattice_boltzmann", 300]
]
HOURS = ["12:00:00", "06:00:00", "03:00:00", "02:00:00", "01:00:00", "01:00:00", "01:00:00"]
content = slurm_cpu(file, version, ntasks, mem_per_cpu, time)
content = slurm_gpu(file, version, ntasks, mem_per_cpu, time)
filename = f"srun_{version}_{ntasks}.sh"
with open(filename, "w") as fh:
fh.write(content)
subprocess.run(["/usr/bin/sbatch", filename])
if __name__ == '__main__':
main()