QuaLiKiz-Pythontools
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun Class Reference

Defines everything needed for a single run of QuaLiKiz. More...

Inheritance diagram for qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, parent_dir, name, binaryrelpath, qualikiz_plan=None, stdout=None, stderr=None, verbose=False, labellist=None, metadata=None)
 Initialize an empty QuaLiKiz run. More...
 
def prepare (self, overwrite=None, overwrite_meta=None)
 Write all Run folders to file This will generate a folders for each run. More...
 
def generate_input (self, dotprint=False, conversion=None)
 Generate the input binaries for a QuaLiKiz run. More...
 
def inputbinaries_exist (self)
 Check if the input binaries exist Currently only checks for R0.bin. More...
 
def estimate_walltime (self, cores)
 Estimate the walltime needed to run This directely depends on the CPU time needed and cores needed to run. More...
 
def estimate_cputime (self, cores)
 Estimate the cpu time needed to run Currently just uses a worst-case assumtion. More...
 
def calculate_tasks (self, cores, HT=False, threads_per_core=2)
 Calulate the amount of MPI tasks needed based on the cores used. More...
 
def from_dir (cls, dir, binaryrelpath=None, stdout=default_stdout, stderr=default_stderr, verbose=False)
 Reconstruct Run from directory Try to reconstruct the Run from a directory. More...
 
def clean (self)
 Cleans run folder to state before it was run. More...
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def to_netcdf (self, kwargs)
 Convert the output and debug to netCDF. More...
 
def is_done (self)
 

Public Attributes

 rundir
 
 stdout
 
 stderr
 
 binaryrelpath
 
 qualikiz_plan
 
 labellist
 
 metadata
 

Static Public Attributes

string parameterspath = 'parameters.json'
 Default path where the parameters json is. More...
 
string metadatapath = 'metadata.json'
 
string labellistpath = 'labels.txt'
 Relative path to the labellist. More...
 
string outputdir = 'output'
 Relative path to the output folder. More...
 
string primitivedir = 'output/primitive'
 Relative path to the primitive output folder. More...
 
string debugdir = 'debug'
 Relative path to the debug folder. More...
 
string inputdir = 'input'
 Relative path to the input folder. More...
 
string python_debugdir = 'meta'
 
string default_stderr = 'stderr.run'
 Default name to write STDERR to. More...
 
string default_stdout = 'stdout.run'
 Default name to write STDOUT to. More...
 

Detailed Description

Defines everything needed for a single run of QuaLiKiz.

Constructor & Destructor Documentation

◆ __init__()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.__init__ (   self,
  parent_dir,
  name,
  binaryrelpath,
  qualikiz_plan = None,
  stdout = None,
  stderr = None,
  verbose = False,
  labellist = None,
  metadata = None 
)

Initialize an empty QuaLiKiz run.

Parameters
parent_dirParent of where the run folder will be.
nameThe name of the QuaLiKiz Run. This will be the name of the folder that will be generated
binaryrelpathThe name of the binary that needs to be run. Usually a path relative to the run folder.
qualikiz_planThe QuaLiKizPlan, usually read from json. Will load the parameter_template by default
stdoutPath to the STDOUT file.
stderrPath to the STDERR file.
verbosePrint verbose information when initializing.
labellistA list of labels to be saved [LEGACY!]

Member Function Documentation

◆ __eq__()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.__eq__ (   self,
  other 
)

◆ __ne__()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.__ne__ (   self,
  other 
)

◆ calculate_tasks()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.calculate_tasks (   self,
  cores,
  HT = False,
  threads_per_core = 2 
)

Calulate the amount of MPI tasks needed based on the cores used.

Parameters
coresThe amount of physical cores to use
HTFlag to use HyperThreading. By default False.
threads_per_coreAmount of threads per core when hyperthreading. Usually 2, but can be 3 or 4 for KNL nodes
Returns
Tasks to use to run this QuaLiKizRun

◆ clean()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.clean (   self)

Cleans run folder to state before it was run.

◆ estimate_cputime()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.estimate_cputime (   self,
  cores 
)

Estimate the cpu time needed to run Currently just uses a worst-case assumtion.

In reality cpus_per_dimxn should depend on the dimxn per core. It also depends on the amount of stable points in the run, which is not known a-priori.

Parameters
coresThe amount of physical cores to use
Returns
Estimated cputime in seconds

◆ estimate_walltime()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.estimate_walltime (   self,
  cores 
)

Estimate the walltime needed to run This directely depends on the CPU time needed and cores needed to run.

Currently uses worst-case estimate.

Parameters
coresThe amount of physical cores to use
Returns
Estimated walltime in seconds

◆ from_dir()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.from_dir (   cls,
  dir,
  binaryrelpath = None,
  stdout = default_stdout,
  stderr = default_stderr,
  verbose = False 
)

Reconstruct Run from directory Try to reconstruct the Run from a directory.

Gives a warning if STDOUT and STDERR cannot be found on their given or default location.

Parameters
dirRoot directory of the Run
binarylinkpathPath to the link pointing to the QuaLiKiz binary
stdoutWhere to look for the STDOUT file
stderrWhere to look for the STDERR file
Returns
Reconstructed QuaLiKizRun

◆ generate_input()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.generate_input (   self,
  dotprint = False,
  conversion = None 
)

Generate the input binaries for a QuaLiKiz run.

Parameters
dotprintPrint a dot after each generation. Used for debugging.
conversionFunction will be called as conversion(input_dir). Can be used to convert input files to older version.

◆ inputbinaries_exist()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.inputbinaries_exist (   self)

Check if the input binaries exist Currently only checks for R0.bin.

Change this if the QuaLiKiz input files ever change!

Returns
True if the input binaries exist

◆ is_done()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.is_done (   self)

◆ prepare()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.prepare (   self,
  overwrite = None,
  overwrite_meta = None 
)

Write all Run folders to file This will generate a folders for each run.

Note that this will not generate the input files, just the skeleton needed. For large runs the input generation can take a while. Generate input binaries using the generate_input function.

Parameters
overwriteOverwrite the directory if it exists. Prompts the user by default.

◆ to_netcdf()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.to_netcdf (   self,
  kwargs 
)

Convert the output and debug to netCDF.

Member Data Documentation

◆ binaryrelpath

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.binaryrelpath

◆ debugdir

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.debugdir = 'debug'
static

Relative path to the debug folder.

◆ default_stderr

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.default_stderr = 'stderr.run'
static

Default name to write STDERR to.

◆ default_stdout

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.default_stdout = 'stdout.run'
static

Default name to write STDOUT to.

◆ inputdir

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.inputdir = 'input'
static

Relative path to the input folder.

◆ labellist

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.labellist

◆ labellistpath

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.labellistpath = 'labels.txt'
static

Relative path to the labellist.

◆ metadata

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.metadata

◆ metadatapath

string qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.metadatapath = 'metadata.json'
static

◆ outputdir

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.outputdir = 'output'
static

Relative path to the output folder.

◆ parameterspath

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.parameterspath = 'parameters.json'
static

Default path where the parameters json is.

◆ primitivedir

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.primitivedir = 'output/primitive'
static

Relative path to the primitive output folder.

◆ python_debugdir

string qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.python_debugdir = 'meta'
static

◆ qualikiz_plan

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.qualikiz_plan

◆ rundir

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.rundir

◆ stderr

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.stderr

◆ stdout

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizRun.stdout

The documentation for this class was generated from the following file: