Skip to content
Snippets Groups Projects
Commit 265848ed authored by Franck Dary's avatar Franck Dary
Browse files

Using more cpu when launching on slurm

parent 6fefbd73
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,52 @@ def launchSlurmArray(names, commands, jobName, device, nbHours, limit) : ...@@ -12,7 +12,52 @@ def launchSlurmArray(names, commands, jobName, device, nbHours, limit) :
commandList = " ".join(commands) commandList = " ".join(commands)
if "jean-zay" in hostname : if ".cluster" in hostname :
print("""#! /usr/bin/env bash
#SBATCH --array=0-{}%{}
#SBATCH --job-name={}
#SBATCH --output=%A_%a.out
#SBATCH --error=%A_%a.err
#SBATCH --open-mode=append
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --partition=skylake
#SBATCH -A b250
#SBATCH --time={}:00:00
module purge
module load userspace/all
module load gcc/10.2.0
module load python3/3.8.6
names=({})
commands=({})
newOut=${{names[$SLURM_ARRAY_TASK_ID]}}".stdout"
newErr=${{names[$SLURM_ARRAY_TASK_ID]}}".stderr"
oldOut=$SLURM_ARRAY_JOB_ID"_"$SLURM_ARRAY_TASK_ID".out"
oldErr=$SLURM_ARRAY_JOB_ID"_"$SLURM_ARRAY_TASK_ID".err"
tmpFile=$SLURM_ARRAY_JOB_ID"_"$SLURM_ARRAY_TASK_ID".tmp"
touch $newOut
cp $newOut $tmpFile
mv $oldOut $newOut
cat $tmpFile >> $newOut
touch $newErr
cp $newErr $tmpFile
mv $oldErr $newErr
cat $tmpFile >> $newErr
rm $tmpFile
eval "${{commands[$SLURM_ARRAY_TASK_ID]}}"
""".format(len(names)-1, limit, jobName, nbHours, " ".join(names), " ".join(commands)), file=sFile)
sFile.close()
elif "jean-zay" in hostname :
print("""#! /usr/bin/env bash print("""#! /usr/bin/env bash
#SBATCH --array=0-{}%{} #SBATCH --array=0-{}%{}
...@@ -66,8 +111,7 @@ eval "${{commands[$SLURM_ARRAY_TASK_ID]}}" ...@@ -66,8 +111,7 @@ eval "${{commands[$SLURM_ARRAY_TASK_ID]}}"
#SBATCH --error=%A_%a.err #SBATCH --error=%A_%a.err
#SBATCH --open-mode=append #SBATCH --open-mode=append
#SBATCH --ntasks=1 #SBATCH --ntasks=1
#SBATCH --cpus-per-task=1 #SBATCH --cpus-per-task=4
#SBATCH --hint=nomultithread
#SBATCH --partition={} #SBATCH --partition={}
#SBATCH --time={}:00:00 #SBATCH --time={}:00:00
......
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