Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMC-SOG
experiments
hybrid
Commits
8b3b362e
Commit
8b3b362e
authored
Feb 18, 2022
by
Jaime Arias
Browse files
doc: add documentation to new methods
parent
d26a3ff8
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/sbatch_generator.py
View file @
8b3b362e
...
...
@@ -26,7 +26,7 @@ oar_header = """\
#!/bin/bash
#
#OAR --name {experiment_name}
#OAR --resource /nodes={nodes}/cpu=1/core={threads},walltime={timeout}
#OAR --resource /nodes={nodes}/cpu=1/core={threads},walltime={timeout}
:00:00
#OAR --stderr {error_file}
#OAR --stdout {output_file}
...
...
@@ -213,7 +213,7 @@ def tool_command(tool_dict, threads, model_name, model_instance, formula, paths)
def
srun
(
command
,
nodes
,
threads
,
timeout
,
job_name
,
output_folder
):
"""Generates the string to execute a task on the cluster
"""Generates the string to execute a task on the cluster
Magi
Parameters
----------
...
...
@@ -223,6 +223,8 @@ def srun(command, nodes, threads, timeout, job_name, output_folder):
Number of nodes used to run the task
threads : int
Number of threads used to run the task
timeout : int
Timeout of the task
job_name : str
Name of the task
output_folder : str
...
...
@@ -239,10 +241,32 @@ def srun(command, nodes, threads, timeout, job_name, output_folder):
def
mpi_run
(
command
,
nodes
,
threads
,
timeout_minutes
,
job_name
,
output_folder
):
"""Generates the string to execute a task on the cluster Grid5000
Parameters
----------
command : str
Command to be executed
nodes : int
Number of nodes used to run the task
threads : int
Number of threads used to run the task
timeout_minutes : int
Timeout of the task in minutes
job_name : str
Name of the task
output_folder : str
absolute path where the logs will be saved
Returns
-------
str
OAR command
"""
error_file
=
f
"
{
output_folder
}
/
{
job_name
}
.err"
output_file
=
f
"
{
output_folder
}
/
{
job_name
}
.out"
timeout
=
timeout_minutes
*
60
return
f
"
mpirun -machinefile $OAR_NODEFILE --npernode
{
nodes
}
-cpus-per-proc
{
threads
}
--timeout
{
timeout
}
{
command
}
>
{
output_file
}
2>
{
error_file
}
"
return
f
'
mpirun
--mca orte_rsh_agent "oarsh"
-machinefile $OAR_NODEFILE --npernode
{
nodes
}
-cpus-per-proc
{
threads
}
--timeout
{
timeout
}
{
command
}
>
{
output_file
}
2>
{
error_file
}
'
def
generate_experiment_name
(
tool_dict
):
...
...
@@ -293,6 +317,8 @@ def generate_oar(
Timeout of the experiment
paths : dict
Dictionary with the paths of the project
oar_timeout : string
Walltime of the ressources reservation in the grid5000 cluster
"""
tool_name
=
tool_dict
[
"name"
]
model_name
=
model_dict
[
"name"
]
...
...
@@ -468,7 +494,7 @@ def explode_tool(tool):
def
generate_multiple_batchs
(
tools
,
models
,
formulas
,
nodes_list
,
threads_list
,
timeout
,
paths
,
launcher
tools
,
models
,
formulas
,
nodes_list
,
threads_list
,
timeout
,
paths
):
"""Generates the slurm batch for several experiments
...
...
@@ -488,8 +514,6 @@ def generate_multiple_batchs(
Time in minutes of each experiment
paths : dict
Dictionary with the paths of the project
cluster : string
Name of the cluster
"""
for
tool_dict
in
tools
:
tools_dict
=
explode_tool
(
tool_dict
)
...
...
@@ -498,27 +522,19 @@ def generate_multiple_batchs(
for
model
in
models
:
for
nodes
in
nodes_list
:
for
threads
in
threads_list
:
if
launcher
==
"slurm"
:
generate_sbatch
(
tool
,
nodes
,
threads
,
model
,
formulas
,
timeout
,
paths
)
elif
launcher
==
"oar"
:
generate_oar
(
tool
,
nodes
,
threads
,
model
,
formulas
,
timeout
,
paths
)
else
:
print
(
f
"
{
launcher
}
is not supported"
)
sys
.
exit
(
0
)
generate_sbatch
(
tool
,
nodes
,
threads
,
model
,
formulas
,
timeout
,
paths
)
generate_oar
(
tool
,
nodes
,
threads
,
model
,
formulas
,
timeout
,
paths
)
if
__name__
==
"__main__"
:
# Default paths
paths
=
create_default_paths
()
# slurm or oar
launcher
=
"oar"
# Timeout: 20 minutes
# Timeout in minutes: 20 minutes
timeout
=
20
# Number of nodes
...
...
@@ -558,9 +574,11 @@ if __name__ == "__main__":
"name"
:
"pmc-sog"
,
"parameters"
:
{
"parallelisation"
:
[
"otfPOR"
,
"otfPRPOR"
,
],
# 'otf', 'otfPR', 'otfP', 'otfC',
"otf"
,
# Construction performing Model checking on the fly while trying to build whole SOG (without POR)
"otfPR"
,
# otf with progressive construction of the SOG during model checking (without POR)
"otfPOR"
,
# otf with POR
"otfPRPOR"
,
# otfPR with POR
],
"strategy"
:
[
"Cou99(poprem)"
,
"Cou99(poprem shy)"
],
# , 'default']
}
# }, {
...
...
@@ -572,6 +590,4 @@ if __name__ == "__main__":
}
]
generate_multiple_batchs
(
tools
,
models
,
formulas
,
nodes
,
threads
,
timeout
,
paths
,
launcher
)
generate_multiple_batchs
(
tools
,
models
,
formulas
,
nodes
,
threads
,
timeout
,
paths
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment