hpc_utils

libra_py.hpc_utils.distribute(Nmin, Nmax, max_steps, submit_templ, exp_files, prefixes, do_submit)[source]

This function creates a number of jobs from the pool of input files which start from `Nmin` to `Nmax` with the maximal number of input files in one job given by `max_steps`. It also starts the job in a given directory

Parameters
  • Nmin (int) – minimal index of the file (a part of the file name) in the pool

  • Nmax (int) – maximal index of the file (a part of the file name) in the pool

  • max_steps (int) – how many files to handle in one job

  • submit_templ (string) – the filename of the PBS/SLURM submit file that contains all the information on how to run the jobs involving a subset of files, but doesn’t specify which particular files to handle. These parameters will be automatically setup by this funciton

  • exp_files (list of strings) – is a list of the input files defining how to do an export of QE wavefunctions

  • prefixes (list of strings) – is a list of prefixes of the files to be distributed

  • do_submit (int) –

    a flag to choose if we actually want to submit the jobs (do_submit==1 || ==2 || ==3 ) or only distribute the files (otherwise):

    • 0: only discribute files, no actual execution

    • 1: distribute and submit using PBS

    • 2: distribute and submit using SLURM

    • 3: distribute and submit using PYTHON no scheduling systems - good for runs on a local computer

Returns

just organizes the execution of the calculations

Return type

None

libra_py.hpc_utils.job(Nstart, Nend, job_dir, prefixes)[source]

This function prepares a group of input files to be executed as a single job note the <job> here refers to a single PBS/SLURM submission file and may be executed on several processors.

Parameters
  • Nstart (int) – index of a starting parameter

  • Nend (int) – index of a finishing parameter

  • job_dir (string) – name of the directory where this file will be printed out to

  • prefix (string) – the template file name [e.g. “x.scf”].

Returns

just moves the files

Return type

None

Example

>>> job(0, 5, "job0", "x.scf")
Will:
1. Create a directory "job0"
2. Move filex x.scf.0.in to x.scf.5.in to the directory "job0"
libra_py.hpc_utils.make_submit(Nstart, Nend, job_dir, submit_templ)[source]

This function makes a PBS/SLURM submit file in a given job directory using a template file. The function looks for the placeholders specified by “param1= ” and “param2= ” and appends actual values of these parameters as needed.

Parameters
  • Nstart (int) – index of a starting parameter

  • Nend (int) – index of a finishing parameter

  • job_dir (string) – name of the directory where this file will be printed out to

  • submit_templ (string) – the template file name

Returns

but generates actual submit files

Return type

None

libra_py.hpc_utils.substitute(filename_template, out_filename, params)[source]

Make a copy of a template file but with some variables replaced

Parameters
  • filename_template (string) – the name of the file that serves as a template

  • out_filename (string) – the name of the output (result) file

  • params (dictionary) – the keys of this dictionary should are the strings (more generally regular expressions) looked for, the values - are the strings with which found regexes will be substituted.

Returns

but creates the out_filename files

Return type

None