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

Added a script to easily launch experiments on Mesocentre cluster

parent d2321d8b
Branches
No related tags found
No related merge requests found
......@@ -7,3 +7,4 @@ data/*\.as
eval/UD_any-GSD.res
eval/stderr.log
config
*\.slurm
#! /usr/bin/python3
import sys
import os
import time
prefix = "#SBATCH "
account = "-A b177"
shell = "#! /bin/bash"
partitionStr = "-p %s"
jobNameStr = "-J %s"
memPerCPU = "--mem-per-cpu=4GB"
nbCpusStr = "--ntasks-per-node=%d"
timeStr = "-t %s"
stdoutStr = "-o %x.stdout"
stderrStr = "-e %x.stderr"
modules = ["userspace/all", "boost/gcc72/1.65.1"]
configPrefix = "UD_ROOT=~/ud/ud-treebanks-all/"
commandStr = "./train.sh . %s %s --interactive 0 %s"
def waitUntilDirExists(dirPath) :
while not os.path.isdir(dirPath) :
time.sleep(0.5)
def launchExperiment(jobName,lang,template,nbCpus=1,partition='skylake',time='1-00',moreArgs='') :
slurmFile = open('script.slurm', 'w')
jobName += '_' + lang
print(shell, file=slurmFile)
print(prefix+account, file=slurmFile)
print(prefix+jobNameStr%jobName, file=slurmFile)
print(prefix+partitionStr%partition, file=slurmFile)
print(prefix+memPerCPU, file=slurmFile)
print(prefix+nbCpusStr%nbCpus, file=slurmFile)
print(prefix+timeStr%time, file=slurmFile)
print(prefix+stdoutStr, file=slurmFile)
print(prefix+stderrStr, file=slurmFile)
print("", file=slurmFile)
print("module purge", file=slurmFile)
for module in modules :
print("module load %s"%module, file=slurmFile)
print("", file=slurmFile)
print(commandStr%(template,jobName,moreArgs), file=slurmFile)
slurmFile.close()
print(configPrefix+lang+'/', file=open('config', 'w'))
os.system("cd data && make clean && make && cd ..")
os.system("sbatch script.slurm")
waitUntilDirExists('bin/'+jobName+'/data/')
if __name__ == "__main__" :
templatesExperiments = \
[\
{'jobName' : 'morpho_classic','template' : 'morpho_parts','moreArgs' : '-n 10'},\
{'jobName' : 'tagger_classic','template' : 'tagger','moreArgs' : '-n 10'},\
]\
langs = ["UD_French-GSD", "UD_Hebrew-HTB"]
for experience in templatesExperiments :
for lang in langs :
experience['lang'] = lang
launchExperiment(**experience)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment