pyccel.codegen.pipeline module

Contents

pyccel.codegen.pipeline module#

Contains the execute_pyccel function which carries out the main steps required to execute pyccel

pyccel.codegen.pipeline.execute_pyccel(fname, *, syntax_only=False, semantic_only=False, convert_only=False, verbose=0, time_execution=False, folder=None, language=None, compiler_family=None, flags=None, wrapper_flags=None, include=(), libdir=(), modules=(), libs=(), debug=None, accelerators=(), output_name=None, compiler_export_file=None, conda_warnings='basic', context_dict=None)[source]#

Run Pyccel on the provided code.

Carry out the main steps required to execute Pyccel: - Parses the python file (syntactic stage) - Annotates the abstract syntax tree (semantic stage) - Generates the translated file(s) (codegen stage) - Compiles the files to generate an executable and/or a shared library.

Parameters:
  • fname (str) – Name of the Python file to be translated.

  • syntax_only (bool, optional) – Indicates whether the pipeline should stop after the syntax stage. Default is False.

  • semantic_only (bool, optional) – Indicates whether the pipeline should stop after the semantic stage. Default is False.

  • convert_only (bool, optional) – Indicates whether the pipeline should stop after the codegen stage. Default is False.

  • verbose (int, default=0) – Indicates the level of verbosity.

  • time_execution (bool, default=False) – Show the time spent in each of Pyccel’s internal stages.

  • folder (str, optional) – Path to the working directory. Default is the folder containing the file to be translated.

  • language (str, optional) – The target language Pyccel is translating to. Default is ‘fortran’.

  • compiler_family (str, optional) – The compiler used to compile the generated files. Default is ‘GNU’. This can also contain the name of a json file describing a compiler.

  • flags (str, optional) – The flags passed to the compiler. Default is provided by the Compiler.

  • wrapper_flags (str, optional) – The flags passed to the compiler to compile the C wrapper. Default is provided by the Compiler.

  • include (list, optional) – List of include directory paths.

  • libdir (list, optional) – List of paths to directories containing the required libraries.

  • modules (list, optional) – List of files that must be compiled in order to compile this module.

  • libs (list, optional) – List of required libraries.

  • debug (bool, optional) – Indicates whether the file should be compiled in debug mode. The default value is taken from the environment variable PYCCEL_DEBUG_MODE. If no such environment variable exists then the default is False.

  • accelerators (iterable, optional) – Tool used to accelerate the code (e.g., OpenMP, OpenACC).

  • output_name (str, optional) – Name of the generated module. Default is the same name as the translated file.

  • compiler_export_file (str, optional) – Name of the JSON file to which compiler information is exported. Default is None.

  • conda_warnings (str, optional) – Specify the level of Conda warnings to display (choices: off, basic, verbose), Default is ‘basic’.

  • context_dict (dict[str, object], optional) – A dictionary containing any variables that are available in the calling context. This can allow certain constants to be defined outside of the function passed to epyccel.