Skip to content

Commit

Permalink
resource setup specific for hq
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Aug 22, 2024
1 parent 7d2bf05 commit b1d853c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/aiidalab_qe/plugins/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@

def set_component_resources(component, code_info):
"""Set the resources for a given component based on the code info."""
if code_info: # Ensure code_info is not None or empty
component.metadata.options.resources = {
"num_machines": code_info["nodes"],
"num_mpiprocs_per_machine": code_info["ntasks_per_node"],
"num_cores_per_mpiproc": code_info["cpus_per_task"],
}
if code_info: # Ensure code_info is not None or empty (# XXX: ? from jyu, need to pop a warning to plugin developer or what?)
code: orm.Code = code_info["code"]
if code.computer.scheduler_type == "hyperqueue":
component.metadata.options.resources = {
"num_cpus": code_info["nodes"] * code_info["ntasks_per_node"] * code_info["cpus_per_task"]
}
else:
# XXX: jyu should properly deal with None type of scheduler_type which can be "core.direct" (will be replaced by hyperqueue) and "core.slurm" ...
component.metadata.options.resources = {
"num_machines": code_info["nodes"],
"num_mpiprocs_per_machine": code_info["ntasks_per_node"],
"num_cores_per_mpiproc": code_info["cpus_per_task"],
}

component.metadata.options["max_wallclock_seconds"] = code_info[
"max_wallclock_seconds"
]
Expand Down

0 comments on commit b1d853c

Please sign in to comment.