Commit 8b3b362e authored by Jaime Arias's avatar Jaime Arias
Browse files

doc: add documentation to new methods

parent d26a3ff8
...@@ -26,7 +26,7 @@ oar_header = """\ ...@@ -26,7 +26,7 @@ oar_header = """\
#!/bin/bash #!/bin/bash
# #
#OAR --name {experiment_name} #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 --stderr {error_file}
#OAR --stdout {output_file} #OAR --stdout {output_file}
...@@ -213,7 +213,7 @@ def tool_command(tool_dict, threads, model_name, model_instance, formula, paths) ...@@ -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): 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 Parameters
---------- ----------
...@@ -223,6 +223,8 @@ def srun(command, nodes, threads, timeout, job_name, output_folder): ...@@ -223,6 +223,8 @@ def srun(command, nodes, threads, timeout, job_name, output_folder):
Number of nodes used to run the task Number of nodes used to run the task
threads : int threads : int
Number of threads used to run the task Number of threads used to run the task
timeout : int
Timeout of the task
job_name : str job_name : str
Name of the task Name of the task
output_folder : str output_folder : str
...@@ -239,10 +241,32 @@ def srun(command, nodes, threads, timeout, job_name, output_folder): ...@@ -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): 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" error_file = f"{output_folder}/{job_name}.err"
output_file = f"{output_folder}/{job_name}.out" output_file = f"{output_folder}/{job_name}.out"
timeout = timeout_minutes * 60 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): def generate_experiment_name(tool_dict):
...@@ -293,6 +317,8 @@ def generate_oar( ...@@ -293,6 +317,8 @@ def generate_oar(
Timeout of the experiment Timeout of the experiment
paths : dict paths : dict
Dictionary with the paths of the project Dictionary with the paths of the project
oar_timeout : string
Walltime of the ressources reservation in the grid5000 cluster
""" """
tool_name = tool_dict["name"] tool_name = tool_dict["name"]
model_name = model_dict["name"] model_name = model_dict["name"]
...@@ -468,7 +494,7 @@ def explode_tool(tool): ...@@ -468,7 +494,7 @@ def explode_tool(tool):
def generate_multiple_batchs( 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 """Generates the slurm batch for several experiments
...@@ -488,8 +514,6 @@ def generate_multiple_batchs( ...@@ -488,8 +514,6 @@ def generate_multiple_batchs(
Time in minutes of each experiment Time in minutes of each experiment
paths : dict paths : dict
Dictionary with the paths of the project Dictionary with the paths of the project
cluster : string
Name of the cluster
""" """
for tool_dict in tools: for tool_dict in tools:
tools_dict = explode_tool(tool_dict) tools_dict = explode_tool(tool_dict)
...@@ -498,27 +522,19 @@ def generate_multiple_batchs( ...@@ -498,27 +522,19 @@ def generate_multiple_batchs(
for model in models: for model in models:
for nodes in nodes_list: for nodes in nodes_list:
for threads in threads_list: for threads in threads_list:
if launcher == "slurm": generate_sbatch(
generate_sbatch( tool, nodes, threads, model, formulas, timeout, paths
tool, nodes, threads, model, formulas, timeout, paths )
) generate_oar(
elif launcher == "oar": tool, nodes, threads, model, formulas, timeout, paths
generate_oar( )
tool, nodes, threads, model, formulas, timeout, paths
)
else:
print(f"{launcher} is not supported")
sys.exit(0)
if __name__ == "__main__": if __name__ == "__main__":
# Default paths # Default paths
paths = create_default_paths() paths = create_default_paths()
# slurm or oar # Timeout in minutes: 20 minutes
launcher = "oar"
# Timeout: 20 minutes
timeout = 20 timeout = 20
# Number of nodes # Number of nodes
...@@ -558,9 +574,11 @@ if __name__ == "__main__": ...@@ -558,9 +574,11 @@ if __name__ == "__main__":
"name": "pmc-sog", "name": "pmc-sog",
"parameters": { "parameters": {
"parallelisation": [ "parallelisation": [
"otfPOR", "otf", # Construction performing Model checking on the fly while trying to build whole SOG (without POR)
"otfPRPOR", "otfPR", # otf with progressive construction of the SOG during model checking (without POR)
], # 'otf', 'otfPR', 'otfP', 'otfC', "otfPOR", # otf with POR
"otfPRPOR", # otfPR with POR
],
"strategy": ["Cou99(poprem)", "Cou99(poprem shy)"], # , 'default'] "strategy": ["Cou99(poprem)", "Cou99(poprem shy)"], # , 'default']
} }
# }, { # }, {
...@@ -572,6 +590,4 @@ if __name__ == "__main__": ...@@ -572,6 +590,4 @@ if __name__ == "__main__":
} }
] ]
generate_multiple_batchs( generate_multiple_batchs(tools, models, formulas, nodes, threads, timeout, paths)
tools, models, formulas, nodes, threads, timeout, paths, launcher
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment