aiida_quantumespresso.utils.resources#

Utilities for calculation job resources.

Module Contents#

Functions#

create_scheduler_resources(scheduler, base, goal)

Return a dictionary with scheduler resources.

cmdline_remove_npools(cmdline)

Remove all options related to npools in the settings.cmdline input.

get_default_options([max_num_machines, ...])

Return an instance of the options dictionary with the minimally required parameters for a CalcJob.

aiida_quantumespresso.utils.resources.create_scheduler_resources(scheduler, base, goal)[source]#

Return a dictionary with scheduler resources.

This function will take a dictionary ‘base’, which contains scheduler resource settings that can be set for the ‘resources’ key in the ‘options’ input of a CalcJob, and update it with target scheduler resource value from the dictionary ‘goal’, checking that the resource settings are allowed for the specific scheduler implementation. The function should than return a dictionary that can be used directly in the ‘options’ input of the CalcJob. Any keys in either ‘base’ or ‘goal’ that are not recognized as valid resource keys by the scheduler class, will be removed and will be kept otherwise. For settings that appear both in ‘base’ and ‘goal’, the value in ‘goal’ will be used.

Parameters:
  • scheduler – instance of the Scheduler class

  • base – dictionary with base scheduler resource settings

  • goal – dictionary with target scheduler resource settings

Returns:

dictionary that can be used for the ‘resources’ key in the ‘options’ dictionary of a CalcJob

aiida_quantumespresso.utils.resources.cmdline_remove_npools(cmdline)[source]#

Remove all options related to npools in the settings.cmdline input.

The cmdline setting is a list of strings that typically looks something like:

cmdline = [‘-nk’, ‘4’, ‘-ntg’, ‘8’]

This function will remove all occurrences of ‘-nk’, ‘-npool’, ‘-npools’, which are all synonymous flags, and the directly following element, which should be the integer

Parameters:

cmdline – the cmdline setting which is a list of string directives

Returns:

the new cmdline setting

aiida_quantumespresso.utils.resources.get_default_options(max_num_machines=1, max_wallclock_seconds=1800, with_mpi=False)[source]#

Return an instance of the options dictionary with the minimally required parameters for a CalcJob.

Parameters:
  • max_num_machines – set the number of nodes, default=1

  • max_wallclock_seconds – set the maximum number of wallclock seconds, default=1800

  • with_mpi – whether to run the calculation with MPI enabled