You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 22 Next »

1. Use cases:

1.1. Wrapper modes:

  • interactive - user code is run directly from wrapper
  • batch - user executable is sent to a queue

1.2. Execution modes

User code can be run in mode:

  • Sequential
  • Parallel:
    • MPI
      • MPICH
      • OpenMPI
    • and/or OpenMP

1.3. Debugging modes:

  • standalone - debugger launches executable containing user code in a separate process
  • attach - debugger attaches to running process executing user code

1.4. Sandbox

"Sandbox" - a directory, in which actor will be run. Before execution of user codes wrapped by FC2K generated actor, directory will be changed to "sandbox", and after actor finishes, current directory will be switched back to previous value. The name (path) of "sandbox" directory will be created automatically or specified by user in actor configuration dialog. 

Actor will use existing directory or will create it, if directory not exists. 

Typical usage: checkpointing, caching intermediate results,  usage of additional information (input, config files) not provided in workflow.

2. Wrapper API - current status


def actor_name(integer0, integer1, double0, double1, core_profiles0, core_profiles1, equilibrium0, exec_type='mpi_local', mpi_process = 4, strip_output = True):


2.1. Input arguments required by user C++/F method

  • Number and an order of arguments must  be exactly the same as in user method
  • Types of arguments
    • IDS
    • Primitive type
    • Array of primitive types
    • String

2.2. Execution type

  • Named argument (exec_type='').
  • Current values of exec_type :
    • ctypes - interactive execution (yes - this name is REALLY CONFUSING)
    • mpi_local - run as MPI job
    • dbg - to keep compatibility with obsolete 'debug' argument of wrapper

2.3. Additional arguments 

Auxiliary keyword arguments:

  • mpi_processes  - integer - number of MPI processes
  • lib_opt  - boolean - determines of alternative user library should be used, instead of the default one
  • get_output_idss  - boolean - determines, what actually will be returned if returned argument is IDS: an IDS object, or metadata describing it
  • strip_output  - boolean - it determines (if returned argument is a string) it it should be stripped or not
  • dbgmode  - boolean - unknown purpose

2.4. Returned values

Output values:

  • None - if nothing is returned from called F/C++ method 
  • A single object -  if called method returns only one value
  • A tuple of objects - if called methods returns more than one value. It contains also diagnostic_info if being used.

3. Weaknesses of current solution

  • very long list of arguments - it is easy to make a mistake:
    • providing  incorrect number of arguments 
    • providing incorrect order of arguments
  • lack of important information, so many features are not handled:
    • no debug mode
    • MPI parameters - only number of nodes is specified
    • no batch mode  

4. Wrapper API - new design


def actor_name(code_args = None, xml_parameters = None, job_settings = None):
	return None.  

# no returned values!


4.1. Assumptions:

  • NO BACKWARD COMPATIBILITY (warning)
  • All input arguments (user method arg and info determining how to launch job ) 'structured' within classes
  • Classes will be defined for:
    • user code arguments - autogenerated
    • XML input parameters
    • job settings
  • The order of arguments  will be arbitrary - implemented as arguments list (*args) or keyword arguments list (**kwargs)
  • All arguments will be optional. If object of given class will be not provided - default values will be used.

4.2. Benefits of proposed solution

  • Just a few arguments passed to wrapper (and not several)
  • Information passed to wrapper is well structured (classes keeping all arguments and settings)
  • Proposed solution prevents from errors resulting from incorrect order/type/number of arguments
  • List of arguments can be easily extended - no API changes required

4.3. Arguments required by user C++/F method

  • All arguments 'packed' within a class <ActorName>Arguments
  • Class will be automatically generated, and copied to a wrapper package
  • Order of attributes corresponds to order of  user function arguments
  • Every attribute is a class ToolNameArgument keeping not only value but also metadata describing argument:
    • Name
    • Type of value
    • Value
    • IN or OUT
  • Attributes' setters/getters will be overridden - user will set only value of argument 
    • To reduce complexity visible by user
    • To check if arg type is correct


# AUTO GENERATED !
class <ActorName>Arguments :  
  def __init__(self):
    self.arg1 = ToolNameArgument( 'InVar', int, None, IN)
    self.arg2 = ToolNameArgument( 'OutVar', double, None, OUT)
	self.diagnostic_info = ToolNameDiagnosticInfo()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameArgument :
  def __init__(self, name, type, sub_type, intent):
    self.name =  name #'argument name'
	self.type = type # (INT, DOUBLE, STRING, COMPLEX, IDS)
	self.sub_type = sub_type  #'equilibrium'  for IDSes only
	self.intent = intent # (IN/OUT)
	self.value  = 7. # to be set by user
    
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameDiagnosticInfo :
  def __init__(self):
    self.status  
	self.message


4.4. XML parameters of user  C++/F method

  • Not passed as wrapper argument
  • Defined (path to XML file) at the time of actor creation by ToolName  


class ToolNameXMLParamaters :  
  def __init__(self):
    self.parameters = # file name or string or... (?)
    self.default_parameters = # file name or string or ... (?)
	self.schema = # file name or string or ... (?)


4.5. Job settings

  • A class passed as wrapper arguments
  • Tree (of classes) describing job settings
  • ToolNameJobSettings class:
    • batch_job - class ToolNameBatchJob:
      • queue
      • ???
    • debug - class ToolNameDebug
      • debugger - TotalView/gdb
      • mode - attach/standalone
    • mpi - class ToolNameMPI
      • mpi parameters - TBD
      • ???
    • open_mp - class ToolNameOpenMP
      • openMP parameters - TBD
      • ???
    • sandbox
      • path to sandbox
      • sandbox 'lifetime'


class ToolNameJobSettings : 
  def __init__(self):
    self.batch_job = ToolNameBatchJob()
    self.debug = ToolNameDebug()
    self.mpi = ToolNameMPI()
	self.open_mp = ToolNameOpenMP()
	self.sandbox = ToolNameSandbox()
	self.?????  #any other info needed?

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameBatchJob :
  def __init__(self):
	self.queue = 
	self.TBD

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameDebug :
  def __init__(self):
	self.debugger #TotalView/gdb
	self.mode     #attach/standalone
	self.TBD

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameMPI :
  def __init__(self):
	self.TBD
	self.debug_switch

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameOpenMP :
  def __init__(self):
	self.TBD

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameSandbox :
  def __init__(self):
	self.path
	self.lifetime
	self.TBD


4.6. Wrapper outcome

  • OUT arguments - wrapper will update fields of <ActorName>Arguments class

5. Open points

  1. Programming conventions (PEP 8?)
    1. https://www.python.org/dev/peps/pep-0008/
  2. Incompatibility with existing Python actors!
  3. Only IN and OUT arguments (no INOUT arguments)
  4. Arrays as an inout of user method- only "dynamic" - i.e. of variable size 
  5. Wrapper results:
    1. OUT arguments - wrapper will update fields of <ActorName>Arguments class
    2. INCOMPATIBILITY 
  6. Diagnostic info 
    1. Info returned from user method
      1. status flag
      2. user defined message
    2. 'Q: can it be mandatory in user sbrt?
  7.  Sandbox:
    1. Do we need this feature?
  8. Alternative library:
    1. Do we need this feature?




  • No labels