TimeloopFE
Loading...
Searching...
No Matches
timeloopfe.common.backend_calls Namespace Reference

Call Timeloop from Python. More...

Functions

 delayed_import ()
 
str _specification_to_yaml_string (BaseSpecification specification, bool for_model=False)
 Converts specification into YAML string, which may require transpilation.
 
Tuple[List[str], str] _pre_call (BaseSpecification specification, str output_dir, Optional[List[str]] extra_input_files=None, bool for_model=False)
 Prepare to call Timeloop or Accelergy from Python !
 
Union[int, subprocess.Popen] _call (str call, List[str] input_paths, str output_dir, Optional[Dict[str, str]] environment=None, Optional[str] dump_intermediate_to=None, Optional[str] log_to=None, List[str] extra_args=(), bool return_proc=False)
 Call a Timeloop or Accelergy command from Python.
 
Union[int, subprocess.Popen] _parse_output (BaseSpecification specification, str output_dir, Union[int, subprocess.Popen] result, bool for_model=False)
 
Union[int, subprocess.Popen] call_mapper (BaseSpecification specification, str output_dir, Optional[Dict[str, str]] environment=None, Optional[List[str]] extra_input_files=None, Optional[str] dump_intermediate_to=None, Optional[Union[str, Any]] log_to=None, List[str] extra_args=(), bool return_proc=False)
 Call Timeloop Mapper from Python.
 
Union[int, subprocess.Popen] call_model (BaseSpecification specification, str output_dir, Optional[Dict[str, str]] environment=None, Optional[List[str]] extra_input_files=None, Optional[str] dump_intermediate_to=None, Optional[Union[str, Any]] log_to=None, List[str] extra_args=(), bool return_proc=False)
 Call Timeloop Model from Python.
 
Union[int, subprocess.Popen] call_accelergy_verbose (BaseSpecification specification, str output_dir, Optional[Dict[str, str]] environment=None, Optional[List[str]] extra_input_files=None, Optional[str] dump_intermediate_to=None, Optional[Union[str, Any]] log_to=None, List[str] extra_args=(), bool return_proc=False)
 Call Accelergy from Python.
 
 call_stop (Optional[subprocess.Popen] proc=None, Optional[int] max_wait_time=None, bool force=False)
 Stop Timeloop subprocesses.
 
"AccelergyInvocationResult" accelergy_app (BaseSpecification specification, str output_dir, Optional[List[str]] extra_input_files=None)
 Call the PyTimeloop Accelergy interface.
 
 to_mapper_app (BaseSpecification specification, str output_dir, Optional[List[str]] extra_input_files=None)
 Create a PyTimeloop MapperApp object from a specification.
 
 to_model_app (BaseSpecification specification, str output_dir, Optional[List[str]] extra_input_files=None)
 Create a PyTimeloop ModelApp object from a specification.
 

Variables

bool DELAYED_IMPORT_DONE = False
 

Detailed Description

Call Timeloop from Python.

Function Documentation

◆ _call()

Union[int, subprocess.Popen] timeloopfe.common.backend_calls._call ( str call,
List[str] input_paths,
str output_dir,
Optional[Dict[str, str]] environment = None,
Optional[str] dump_intermediate_to = None,
Optional[str] log_to = None,
List[str] extra_args = (),
bool return_proc = False )
protected

Call a Timeloop or Accelergy command from Python.

Args: call (str): Which command to call. input_paths (List[str]): The content of the input file. output_dir (str): The directory to run Timeloop in. environment (Optional[Dict[str, str]]): A dictionary of environment variables to pass. dump_intermediate_to (Optional[str]): If not None, dump the input content to this file before calling. log_to (Optional[str]): If not None, log the output of the call to this file or file-like object. extra_args (List[str]): A list of extra arguments to pass to the call. return_proc (bool): If True, return the subprocess.Popen object instead of the return code.

Returns: Union[int, subprocess.Popen]: The return code of the call, or the subprocess.Popen object if return_proc is True.

◆ _parse_output()

Union[int, subprocess.Popen] timeloopfe.common.backend_calls._parse_output ( BaseSpecification specification,
str output_dir,
Union[int, subprocess.Popen] result,
bool for_model = False )
protected

◆ _pre_call()

Tuple[List[str], str] timeloopfe.common.backend_calls._pre_call ( BaseSpecification specification,
str output_dir,
Optional[List[str]] extra_input_files = None,
bool for_model = False )
protected

Prepare to call Timeloop or Accelergy from Python !

Parameters
specificationThe specification with which to call Timeloop. !
output_dirThe directory to run Timeloop in. !
extra_input_filesA list of extra input files to pass to Timeloop. !
for_modelWhether the result is for Timeloop model or mapper

◆ _specification_to_yaml_string()

str timeloopfe.common.backend_calls._specification_to_yaml_string ( BaseSpecification specification,
bool for_model = False )
protected

Converts specification into YAML string, which may require transpilation.

!

Parameters
specificationThe specification with which to call Timeloop. !
for_modelWhether the result is for Timeloop model or mapper

◆ accelergy_app()

"AccelergyInvocationResult" timeloopfe.common.backend_calls.accelergy_app ( BaseSpecification specification,
str output_dir,
Optional[List[str]] extra_input_files = None )

Call the PyTimeloop Accelergy interface.

Args: specification (BaseSpecification): The specification with which to call Accelergy. output_dir (str): The directory to run Accelergy in. extra_input_files (Optional[List[str]]): A list of extra input files to pass to Accelergy

Returns: AccelergyInvocationResult: The result of the Accelergy invocation.

◆ call_accelergy_verbose()

Union[int, subprocess.Popen] timeloopfe.common.backend_calls.call_accelergy_verbose ( BaseSpecification specification,
str output_dir,
Optional[Dict[str, str]] environment = None,
Optional[List[str]] extra_input_files = None,
Optional[str] dump_intermediate_to = None,
Optional[Union[str, Any]] log_to = None,
List[str] extra_args = (),
bool return_proc = False )

Call Accelergy from Python.

Args: specification (BaseSpecification): The specification with which to call Accelergy. output_dir (str): The directory to run Accelergy in. environment (Optional[Dict[str, str]]): A dictionary of environment variables to pass to Accelergy. extra_input_files (Optional[List[str]]): A list of extra input files to pass to Accelergy dump_intermediate_to (Optional[str]): If not None, dump the input content to this file before calling Accelergy. log_to (Optional[Union[str, Any]]): If not None, log the output of the Accelergy call to this file or file-like object. extra_args (List[str]): A list of extra arguments to pass to Accelergy. return_proc (bool): If True, return the subprocess.Popen object instead of the return code.

◆ call_mapper()

Union[int, subprocess.Popen] timeloopfe.common.backend_calls.call_mapper ( BaseSpecification specification,
str output_dir,
Optional[Dict[str, str]] environment = None,
Optional[List[str]] extra_input_files = None,
Optional[str] dump_intermediate_to = None,
Optional[Union[str, Any]] log_to = None,
List[str] extra_args = (),
bool return_proc = False )

Call Timeloop Mapper from Python.

Args: specification (BaseSpecification): The specification with which to call Timeloop. output_dir (str): The directory to run Timeloop in. environment (Optional[Dict[str, str]]): A dictionary of environment variables to pass to Timeloop. extra_input_files (Optional[List[str]]): A list of extra input files to pass to Timeloop dump_intermediate_to (Optional[str]): If not None, dump the input content to this file before calling Timeloop. log_to (Optional[Union[str, Any]]): If not None, log the output of the Timeloop call to this file or file-like object. extra_args (List[str]): A list of extra arguments to pass to Timeloop. return_proc (bool): If True, return the subprocess.Popen object instead of the return code.

Returns: Union[int, subprocess.Popen]: The return code of the call, or the subprocess.Popen object if return_proc is True.

◆ call_model()

Union[int, subprocess.Popen] timeloopfe.common.backend_calls.call_model ( BaseSpecification specification,
str output_dir,
Optional[Dict[str, str]] environment = None,
Optional[List[str]] extra_input_files = None,
Optional[str] dump_intermediate_to = None,
Optional[Union[str, Any]] log_to = None,
List[str] extra_args = (),
bool return_proc = False )

Call Timeloop Model from Python.

Args: specification (BaseSpecification): The specification with which to call Timeloop. output_dir (str): The directory to run Timeloop in. environment (Optional[Dict[str, str]]): A dictionary of environment variables to pass to Timeloop extra_input_files (Optional[List[str]]): A list of extra input files to pass to Timeloop dump_intermediate_to (Optional[str]): If not None, dump the input content to this file before calling Timeloop. log_to (Optional[Union[str, Any]]): If not None, log the output of the Timeloop call to this file or file-like object. extra_args (List[str]): A list of extra arguments to pass to Timeloop. return_proc (bool): If True, return the subprocess.Popen object instead of the return code.

Returns: Union[int, subprocess.Popen]: The return code of the call, or the subprocess.Popen object if return_proc is True.

◆ call_stop()

timeloopfe.common.backend_calls.call_stop ( Optional[subprocess.Popen] proc = None,
Optional[int] max_wait_time = None,
bool force = False )

Stop Timeloop subprocesses.

Args: proc (Optional[subprocess.Popen]): The subprocess to stop. If None, stop all Timelojson processes. max_wait_time (Optional[int]): The maximum time to wait for the process to stop. If 0, do not wait. force (bool): If True, force kill the process instead of sending SIGINT.

◆ delayed_import()

timeloopfe.common.backend_calls.delayed_import ( )

◆ to_mapper_app()

timeloopfe.common.backend_calls.to_mapper_app ( BaseSpecification specification,
str output_dir,
Optional[List[str]] extra_input_files = None )

Create a PyTimeloop MapperApp object from a specification.

Args: specification (BaseSpecification): The specification with which to call Timeloop. output_dir (str): The directory to run Timeloop in. extra_input_files (Optional[List[str]]): A list of extra input files to pass to Timeloop

Returns: MapperApp: The MapperApp object.

◆ to_model_app()

timeloopfe.common.backend_calls.to_model_app ( BaseSpecification specification,
str output_dir,
Optional[List[str]] extra_input_files = None )

Create a PyTimeloop ModelApp object from a specification.

Args: specification (BaseSpecification): The specification with which to call Timeloop. output_dir (str): The directory to run Timeloop in. extra_input_files (Optional[List[str]]): A list of extra input files to pass to Timeloop

Returns: ModelApp: The ModelApp object.

Variable Documentation

◆ DELAYED_IMPORT_DONE

bool timeloopfe.common.backend_calls.DELAYED_IMPORT_DONE = False