Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon_data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
macaon_data
Commits
d6c37255
Commit
d6c37255
authored
4 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Allowing multiline commands to be launched from launchBatches.py
parent
ff1a5ee6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
UD_any/launchBatches.py
+46
-10
46 additions, 10 deletions
UD_any/launchBatches.py
with
46 additions
and
10 deletions
UD_any/launchBatches.py
+
46
−
10
View file @
d6c37255
...
@@ -21,7 +21,7 @@ def prepareExperiment(lang, template, expName) :
...
@@ -21,7 +21,7 @@ def prepareExperiment(lang, template, expName) :
def
addNamesAndCommandsTrain
(
names
,
commands
,
mode
,
expName
,
arguments
,
seed
)
:
def
addNamesAndCommandsTrain
(
names
,
commands
,
mode
,
expName
,
arguments
,
seed
)
:
names
.
append
(
"
\"
"
+
expName
+
"
\"
"
)
names
.
append
(
"
\"
"
+
expName
+
"
\"
"
)
commands
.
append
(
"
\"
"
+
"
./train.sh {} bin/{} {} --silent --seed {}
"
.
format
(
mode
,
expName
,
arguments
,
seed
)
+
"
\"
"
)
commands
.
append
(
"
'
"
+
"
./train.sh {} bin/{} {} --silent --seed {}
"
.
format
(
mode
,
expName
,
arguments
,
seed
)
+
"
'
"
)
###############################################################################
###############################################################################
###############################################################################
###############################################################################
...
@@ -63,13 +63,31 @@ module load python/3.7.5
...
@@ -63,13 +63,31 @@ module load python/3.7.5
names=({})
names=({})
commands=({})
commands=({})
mv $SLURM_ARRAY_JOB_ID
"
_
"
$SLURM_ARRAY_TASK_ID
"
.out
"
${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stdout
"
newOut=${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stdout
"
mv $SLURM_ARRAY_JOB_ID
"
_
"
$SLURM_ARRAY_TASK_ID
"
.err
"
${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stderr
"
newErr=${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stderr
"
${{commands[$SLURM_ARRAY_TASK_ID]}}
oldOut=$SLURM_ARRAY_JOB_ID
"
_
"
$SLURM_ARRAY_TASK_ID
"
.out
"
"""
.
format
(
len
(
names
),
limit
,
mode
,
jobName
,
"
qos_gpu-t4
"
if
nbHours
>
20
else
"
qos_gpu-t3
"
,
nbHours
,
"
"
.
join
(
names
),
"
"
.
join
(
commands
)),
file
=
sFile
)
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
,
mode
,
jobName
,
"
qos_gpu-t4
"
if
nbHours
>
20
else
"
qos_gpu-t3
"
,
nbHours
,
"
"
.
join
(
names
),
"
"
.
join
(
commands
)),
file
=
sFile
)
sFile
.
close
()
sFile
.
close
()
elif
hostname
==
"
sms.liscluster
"
:
elif
hostname
==
"
sms.liscluster
"
:
print
(
"""
#! /usr/bin/env bash
print
(
'''
#! /usr/bin/env bash
#SBATCH --array=0-{}%{}
#SBATCH --array=0-{}%{}
#SBATCH --job-name={}:{}
#SBATCH --job-name={}:{}
...
@@ -88,10 +106,28 @@ module purge
...
@@ -88,10 +106,28 @@ module purge
names=({})
names=({})
commands=({})
commands=({})
mv $SLURM_ARRAY_JOB_ID
"
_
"
$SLURM_ARRAY_TASK_ID
"
.out
"
${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stdout
"
newOut=${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stdout
"
mv $SLURM_ARRAY_JOB_ID
"
_
"
$SLURM_ARRAY_TASK_ID
"
.err
"
${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stderr
"
newErr=${{names[$SLURM_ARRAY_TASK_ID]}}
"
.stderr
"
${{commands[$SLURM_ARRAY_TASK_ID]}}
oldOut=$SLURM_ARRAY_JOB_ID
"
_
"
$SLURM_ARRAY_TASK_ID
"
.out
"
"""
.
format
(
len
(
names
),
limit
,
mode
,
jobName
,
"
cpu
"
if
device
==
"
cpu
"
else
"
gpu
\n
#SBATCH --gres=gpu
"
,
nbHours
,
"
"
.
join
(
names
),
commandList
),
file
=
sFile
)
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
,
mode
,
jobName
,
"
cpu
"
if
device
==
"
cpu
"
else
"
gpu
\n
#SBATCH --gres=gpu
"
,
nbHours
,
"
"
.
join
(
names
),
commandList
),
file
=
sFile
)
sFile
.
close
()
sFile
.
close
()
else
:
else
:
print
(
"
ERROR : Unknown hostname
\'
%s
\'
"
%
hostname
)
print
(
"
ERROR : Unknown hostname
\'
%s
\'
"
%
hostname
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment