Skip to content
Snippets Groups Projects
Verified Commit d8e097be authored by baptiste.coudray's avatar baptiste.coudray
Browse files

Updated slurm_gen

parent adbe50bd
No related branches found
No related tags found
No related merge requests found
...@@ -2,50 +2,56 @@ ...@@ -2,50 +2,56 @@
import subprocess import subprocess
def slurm_gpu(version, ntasks, mem_per_cpu, time): def slurm_gpu(file, version, ntasks, mem_per_cpu, time):
return f"""#!/bin/sh return f"""#!/bin/sh
#SBATCH --job-name=gol.out #SBATCH --job-name={file[0]}.out
#SBATCH --output=gol-{version}-{ntasks}.out.o%j #SBATCH --output={file[0]}-{version}-{ntasks}.out.o%j
#SBATCH --ntasks={ntasks} #SBATCH --ntasks={ntasks}
#SBATCH --cpus-per-task=1 #SBATCH --cpus-per-task=1
#SBATCH --partition=shared-gpu #SBATCH --partition=shared-gpu
#SBATCH --gpus=rtx:{ntasks} #SBATCH --gpus=rtx:{min(ntasks, 8)}
#SBATCH --mem-per-cpu={mem_per_cpu} #SBATCH --mem-per-cpu={mem_per_cpu}
#SBATCH --time={time} #SBATCH --time={time}
srun /home/users/c/coudrayb/projet-de-bachelor/game_of_life/cmake-build-release/game_of_life_{version}_bench {ntasks if ntasks < 16 else 8} 30000 30000 srun {file[1]}_{version}_bench {min(ntasks, 8)} 30000 30000
""" """
def slurm_cpu(version, ntasks, mem_per_cpu, time): def slurm_cpu(file, version, ntasks, mem_per_cpu, time):
return f"""#!/bin/sh return f"""#!/bin/sh
#SBATCH --job-name=gol.out #SBATCH --job-name={file[0]}.out
#SBATCH --output=gol-{version}-{ntasks}.out.o%j #SBATCH --output={file[0]}-{version}-{ntasks}.out.o%j
#SBATCH --ntasks={ntasks} #SBATCH --ntasks={ntasks}
#SBATCH --cpus-per-task=1 #SBATCH --cpus-per-task=1
#SBATCH --partition=public-bigmem #SBATCH --partition=shared-cpu
#SBATCH --mem-per-cpu={mem_per_cpu} #SBATCH --mem-per-cpu={mem_per_cpu}
#SBATCH --time={time} #SBATCH --time={time}
srun /home/users/c/coudrayb/projet-de-bachelor/game_of_life/cmake-build-release/game_of_life_{version}_bench 1 30000 30000 srun {file[1]}_{version}_bench 1 30000 30000
""" """
HOURS = ["00:20:00", "06:00:00", "03:00:00", "02:00:00", "01:00:00", "01:00:00", "01:00:00"] FILES = [
["elem"], ["/home/users/c/coudrayb/projet-de-bachelor/elementary/cmake-build-release/elementary"],
["gol"], ["/home/users/c/coudrayb/projet-de-bachelor/game_of_life/cmake-build-release/game_of_life"],
["lbm"], ["/home/users/c/coudrayb/projet-de-bachelor/lattice_boltzmann/cmake-build-release/lattice_boltzmann"]
]
HOURS = ["12:00:00", "06:00:00", "03:00:00", "02:00:00", "01:00:00", "01:00:00", "01:00:00"]
def main(): def main():
for version in ["cuda"]: for version in ["cuda"]:
for i in range(0, 3): for i in range(0, 8):
ntasks = 2 ** i ntasks = 2 ** i
mem_per_cpu = "8000" if ntasks <= 2 else "4000" mem_per_cpu = "8000" if ntasks <= 2 else "4000"
time = HOURS[0] file = FILES[0]
time = HOURS[i]
if version == "seq" or version == "mc": if version == "seq" or version == "mc":
content = slurm_cpu(version, ntasks, mem_per_cpu, time) content = slurm_cpu(file, version, ntasks, mem_per_cpu, time)
else: else:
content = slurm_gpu(version, ntasks, mem_per_cpu, time) content = slurm_gpu(file, version, ntasks, mem_per_cpu, time)
filename = f"srun_{version}_{ntasks}.sh" filename = f"srun_{version}_{ntasks}.sh"
with open(filename, "w") as fh: with open(filename, "w") as fh:
fh.write(content) fh.write(content)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment