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

launchBatches now uses seed program argument

parent 8ebef9f9
No related branches found
No related tags found
No related merge requests found
......@@ -18,20 +18,20 @@ def prepareExperiment(lang, template, expName) :
###############################################################################
###############################################################################
def launchTrain(mode, expName, arguments, launcher, nbHours) :
def launchTrain(mode, expName, arguments, launcher, nbHours, seed) :
if launcher == "bash" :
launchTrainBash(mode, expName, arguments)
launchTrainBash(mode, expName, arguments, seed)
elif launcher == "oar" :
launchTrainOar(mode, expName, arguments, nbHours)
launchTrainOar(mode, expName, arguments, nbHours, seed)
elif launcher == "slurm" :
launchTrainSlurm(mode, expName, arguments, nbHours)
launchTrainSlurm(mode, expName, arguments, nbHours, seed)
else :
printUsageAndExit()
###############################################################################
###############################################################################
def launchTrainBash(mode, expName, arguments) :
subprocess.Popen("./train.sh %s bin/%s %s --silent"%(mode,expName,arguments),
def launchTrainBash(mode, expName, arguments, seed) :
subprocess.Popen("./train.sh %s bin/%s %s --silent --seed %d"%(mode,expName,arguments,seed),
shell=True, stdout=open("%s.stdout"%expName,'w'), stderr=open("%s.stderr"%expName,'w'))
###############################################################################
......@@ -41,7 +41,7 @@ def nbMaxLongJobs() :
###############################################################################
###############################################################################
def launchTrainOar(mode, expName, arguments, nbHours) :
def launchTrainOar(mode, expName, arguments, nbHours, seed) :
bestEffort = getOarNbLongJobs() >= nbMaxLongJobs()
command = "oarsub"
......@@ -52,13 +52,13 @@ def launchTrainOar(mode, expName, arguments, nbHours) :
command += " -O %s.stdout"%expName
command += " -p \"gpu IS NOT NULL%s\""%getBestHostConstraint()
command += " -l walltime=%d:00:00"%nbHours
command += " \'" + "./train.sh %s bin/%s %s --silent"%(mode,expName,arguments) + "\'"
command += " \'" + "./train.sh %s bin/%s %s --silent --seed"%(mode,expName,arguments,seed) + "\'"
subprocess.Popen(command, shell=True).wait()
###############################################################################
###############################################################################
def launchTrainSlurm(mode, expName, arguments, nbHours) :
def launchTrainSlurm(mode, expName, arguments, nbHours, seed) :
filename = "train.{}.slurm".format(expName)
sFile = open(filename, "w")
......@@ -80,8 +80,8 @@ module purge
module load gcc/9.1.0
module load python/3.7.5
./train.sh {} bin/{} {} --silent
""".format(expName, expName, expName, "qos_gpu-t4" if nbHours > 20 else "qos_gpu-t3", nbHours, mode, expName, arguments), file=sFile)
./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()
subprocess.Popen("sbatch {}".format(filename), shell=True).wait()
......@@ -261,7 +261,7 @@ if __name__ == "__main__" :
xp['expName'] = xp['expName'].split('.')[0]+"."+lang+"."+str(i)
if mode == "train" :
prepareExperiment(xp['lang'],xp['template'],xp['expName'])
launchTrain(xp['mode'],xp['expName'],xp['arguments'],launcher,nbHours)
launchTrain(xp['mode'],xp['expName'],xp['arguments'],launcher,nbHours,seed=100+i)
else :
launchEval(xp['mode'],xp['expName'],launcher,nbHours)
......
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