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
240b113f
Commit
240b113f
authored
4 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Added device argument to launchBatches.py
parent
b74a8e24
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
+29
-20
29 additions, 20 deletions
UD_any/launchBatches.py
with
29 additions
and
20 deletions
UD_any/launchBatches.py
+
29
−
20
View file @
240b113f
...
...
@@ -7,7 +7,7 @@ import time
###############################################################################
def
printUsageAndExit
()
:
print
(
"
USAGE : %s (train | eval) (bash | oar | slurm) batchesDescription.py (--time nbHours)
"
%
sys
.
argv
[
0
],
file
=
sys
.
stderr
)
print
(
"
USAGE : %s (train | eval) (bash | oar | slurm)
(gpu | cpu)
batchesDescription.py (--time nbHours)
"
%
sys
.
argv
[
0
],
file
=
sys
.
stderr
)
exit
(
1
)
###############################################################################
...
...
@@ -18,11 +18,11 @@ def prepareExperiment(lang, template, expName) :
###############################################################################
###############################################################################
def
launchTrain
(
mode
,
expName
,
arguments
,
launcher
,
nbHours
,
seed
)
:
def
launchTrain
(
device
,
mode
,
expName
,
arguments
,
launcher
,
nbHours
,
seed
)
:
if
launcher
==
"
bash
"
:
launchTrainBash
(
mode
,
expName
,
arguments
,
seed
)
elif
launcher
==
"
oar
"
:
launchTrainOar
(
mode
,
expName
,
arguments
,
nbHours
,
seed
)
launchTrainOar
(
device
,
mode
,
expName
,
arguments
,
nbHours
,
seed
)
elif
launcher
==
"
slurm
"
:
launchTrainSlurm
(
mode
,
expName
,
arguments
,
nbHours
,
seed
)
else
:
...
...
@@ -41,7 +41,7 @@ def nbMaxLongJobs() :
###############################################################################
###############################################################################
def
launchTrainOar
(
mode
,
expName
,
arguments
,
nbHours
,
seed
)
:
def
launchTrainOar
(
device
,
mode
,
expName
,
arguments
,
nbHours
,
seed
)
:
bestEffort
=
getOarNbLongJobs
()
>=
nbMaxLongJobs
()
command
=
"
oarsub
"
...
...
@@ -50,8 +50,12 @@ def launchTrainOar(mode, expName, arguments, nbHours, seed) :
command
+=
"
-n train:%s
"
%
expName
command
+=
"
-E %s.stderr
"
%
expName
command
+=
"
-O %s.stdout
"
%
expName
command
+=
"
-p
\"
gpu IS NOT NULL%s
\"
"
%
getBestHostConstraint
()
command
+=
"
-l walltime=%d:00:00
"
%
nbHours
if
device
==
"
gpu
"
:
command
+=
"
-p
\"
gpu IS NOT NULL%s
\"
"
%
getBestHostConstraint
()
command
+=
"
-l walltime=%d:00:00
"
%
nbHours
else
:
command
+=
"
-p
\"
gpu IS NULL
\"
"
command
+=
"
-l /core=4,walltime=%d:00:00
"
%
nbHours
command
+=
"
\'
"
+
"
./train.sh %s bin/%s %s --silent --seed
"
%
(
mode
,
expName
,
arguments
,
seed
)
+
"
\'
"
subprocess
.
Popen
(
command
,
shell
=
True
).
wait
()
...
...
@@ -88,11 +92,11 @@ module load python/3.7.5
###############################################################################
###############################################################################
def
launchEval
(
mode
,
expName
,
launcher
,
nbHours
)
:
def
launchEval
(
device
,
mode
,
expName
,
launcher
,
nbHours
)
:
if
launcher
==
"
bash
"
:
launchEvalBash
(
mode
,
expName
)
elif
launcher
==
"
oar
"
:
launchEvalOar
(
mode
,
expName
,
nbHours
)
launchEvalOar
(
device
,
mode
,
expName
,
nbHours
)
elif
launcher
==
"
slurm
"
:
launchEvalSlurm
(
mode
,
expName
,
nbHours
)
else
:
...
...
@@ -106,7 +110,7 @@ def launchEvalBash(mode, expName) :
###############################################################################
###############################################################################
def
launchEvalOar
(
mode
,
expName
,
nbHours
)
:
def
launchEvalOar
(
device
,
mode
,
expName
,
nbHours
)
:
bestEffort
=
getOarNbLongJobs
()
>=
nbMaxLongJobs
()
and
nbHours
>
10
command
=
"
oarsub
"
...
...
@@ -115,8 +119,12 @@ def launchEvalOar(mode, expName, nbHours) :
command
+=
"
-n eval:%s
"
%
expName
command
+=
"
-E %s.stderr
"
%
expName
command
+=
"
-O %s.stdout
"
%
expName
command
+=
"
-p
\"
gpu IS NOT NULL%s
\"
"
%
getBestHostConstraint
()
command
+=
"
-l walltime=%d:00:00
"
%
nbHours
if
device
==
"
gpu
"
:
command
+=
"
-p
\"
gpu IS NOT NULL%s
\"
"
%
getBestHostConstraint
()
command
+=
"
-l walltime=%d:00:00
"
%
nbHours
else
:
command
+=
"
-p
\"
gpu IS NULL
\"
"
command
+=
"
-l /core=4,walltime=%d:00:00
"
%
nbHours
command
+=
"
\"
"
+
"
./evaluate.sh %s bin/%s --silent
"
%
(
mode
,
expName
)
+
"
\"
"
subprocess
.
Popen
(
command
,
shell
=
True
).
wait
()
...
...
@@ -233,23 +241,24 @@ def getBestHostConstraint() :
###############################################################################
if
__name__
==
"
__main__
"
:
if
len
(
sys
.
argv
)
<
4
:
if
len
(
sys
.
argv
)
<
5
:
printUsageAndExit
()
mode
=
sys
.
argv
[
1
]
launcher
=
sys
.
argv
[
2
]
batchesDescription
=
sys
.
argv
[
3
]
device
=
sys
.
argv
[
3
]
batchesDescription
=
sys
.
argv
[
4
]
nbHours
=
92
if
len
(
sys
.
argv
)
>
4
:
if
sys
.
argv
[
4
]
==
"
--time
"
:
if
5
not
in
range
(
4
,
len
(
sys
.
argv
))
:
if
len
(
sys
.
argv
)
>
5
:
if
sys
.
argv
[
5
]
==
"
--time
"
:
if
6
not
in
range
(
5
,
len
(
sys
.
argv
))
:
printUsageAndExit
()
nbHours
=
int
(
sys
.
argv
[
5
])
nbHours
=
int
(
sys
.
argv
[
6
])
else
:
printUsageAndExit
()
if
mode
not
in
[
"
train
"
,
"
eval
"
]
or
launcher
not
in
[
"
bash
"
,
"
oar
"
,
"
slurm
"
]
:
if
mode
not
in
[
"
train
"
,
"
eval
"
]
or
launcher
not
in
[
"
bash
"
,
"
oar
"
,
"
slurm
"
]
or
device
not
in
[
"
cpu
"
,
"
gpu
"
]
:
printUsageAndExit
()
desc
=
__import__
(
os
.
path
.
splitext
(
batchesDescription
)[
0
])
...
...
@@ -261,9 +270,9 @@ 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
,
seed
=
100
+
i
)
launchTrain
(
device
,
xp
[
'
mode
'
],
xp
[
'
expName
'
],
xp
[
'
arguments
'
],
launcher
,
nbHours
,
seed
=
100
+
i
)
else
:
launchEval
(
xp
[
'
mode
'
],
xp
[
'
expName
'
],
launcher
,
nbHours
)
launchEval
(
device
,
xp
[
'
mode
'
],
xp
[
'
expName
'
],
launcher
,
nbHours
)
###############################################################################
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