diff --git a/UD_any/launchBatches.py b/UD_any/launchBatches.py index 407efde90b54ee5bd29e06489462c187fc4ca108..7d8739098670bbda6f9211d5ab8c2f3575943b69 100755 --- a/UD_any/launchBatches.py +++ b/UD_any/launchBatches.py @@ -66,7 +66,10 @@ def launchTrainSlurm(mode, expName, arguments, nbHours, seed) : filename = "train.{}.slurm".format(expName) sFile = open(filename, "w") - print("""#! /usr/bin/env bash + hostname = os.getenv("HOSTNAME") + + if hostname == "jean-zay1" : + print("""#! /usr/bin/env bash #SBATCH --job-name=train:{} #SBATCH --output={}.stdout @@ -86,7 +89,29 @@ module load python/3.7.5 ./train.sh {} bin/{} {} --silent --seed {} """.format(expName, expName, expName, "qos_gpu-t4" if nbHours > 20 else "qos_gpu-t3", nbHours, mode, expName, arguments, seed), file=sFile) - sFile.close() + sFile.close() + elif hostname == "sms.liscluster" : + print("""#! /usr/bin/env bash + +#SBATCH --job-name=train:{} +#SBATCH --output={}.stdout +#SBATCH --error={}.stderr +#SBATCH --open-mode=append +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=1 +#SBATCH --gres=gpu +#SBATCH --hint=nomultithread +#SBATCH --partition=gpu +#SBATCH --time={}:00:00 + +module purge + +./train.sh {} bin/{} {} --silent --seed {} +""".format(expName, expName, expName, nbHours, mode, expName, arguments, seed), file=sFile) + sFile.close() + else : + print("ERROR : Unknown hostname \'%s\'"%hostname) + exit(1) subprocess.Popen("sbatch {}".format(filename), shell=True).wait() ############################################################################### @@ -135,7 +160,10 @@ def launchEvalSlurm(mode, expName, nbHours) : filename = "eval.{}.slurm".format(expName) sFile = open(filename, "w") - print("""#! /usr/bin/env bash + hostname = os.getenv("HOSTNAME") + + if hostname == "jean-zay1" : + print("""#! /usr/bin/env bash #SBATCH --job-name=eval:{} #SBATCH --output={}.stdout @@ -154,7 +182,30 @@ module load python/3.7.5 ./evaluate.sh {} bin/{} --silent """.format(expName, expName, expName, nbHours, mode, expName), file=sFile) - sFile.close() + sFile.close() + elif hostname == "sms.liscluster" : + print("""#! /usr/bin/env bash + +#SBATCH --job-name=eval:{} +#SBATCH --output={}.stdout +#SBATCH --error={}.stderr +#SBATCH --open-mode=append +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=1 +#SBATCH --gres=gpu +#SBATCH --hint=nomultithread +#SBATCH --partition=gpu +#SBATCH --time={}:00:00 + +module purge + +./evaluate.sh {} bin/{} --silent +""".format(expName, expName, expName, nbHours, mode, expName), file=sFile) + sFile.close() + else : + print("ERROR : Unknown hostname \'%s\'"%hostname) + exit(1) + subprocess.Popen("sbatch {}".format(filename), shell=True).wait() ###############################################################################