HPC/Applications/python: Difference between revisions

From CNM Wiki
Jump to navigation Jump to search
mNo edit summary
Line 2: Line 2:
Python on Carbon can be accessed through several routes, each giving access to associated software.
Python on Carbon can be accessed through several routes, each giving access to associated software.
The routes are shown below.
The routes are shown below.
<div style="background: #FFEF7F; margin-top: 1.5em; margin-bottom: 1.5em;">
{{caution|Python packages installed under one route usually cannot be accessed through another route.}}
'''Caution''': Be aware that Python packages installed under one route usually cannot be accessed through another route.
</div>


== Base distributions ==
== Base distributions ==
Line 13: Line 11:
<!-- '''<font color="green">python</font>/<font color="green">''pyMajor.pyMinor''</font>'''/<font color="#c80">''compilerName-compMajor.compMinor''</font>/<font color="#888">''pyMajor.pyMinor.pyPatch''-''carbonBuild''</font> -->
<!-- '''<font color="green">python</font>/<font color="green">''pyMajor.pyMinor''</font>'''/<font color="#c80">''compilerName-compMajor.compMinor''</font>/<font color="#888">''pyMajor.pyMinor.pyPatch''-''carbonBuild''</font> -->


== Python interpreters and packages as bundled with the OS ==
== OS-provided bundles ==
; Module nomenclature:
; Module nomenclature:
: <code>'''python-''osname'''''/''pyMajor.pyMinor''/''compilerName-compMajor.compMinor''/''pyMajor.pyMinor.pyPatch''</code>
: <code>'''python-''osname'''''/''pyMajor.pyMinor''/''compilerName-compMajor.compMinor''/''pyMajor.pyMinor.pyPatch''</code>
; Contains:
; Contains:
:* The Python interpreter that comes with the operating system, which is required for many system internals and for system-provided add-on packages (installed via rpm or yum).
:* The Python interpreter that comes with the operating system, and which is required for many system internals and for system-provided add-on packages (installed via rpm or yum).
These module normally do not need to be loaded.
These modules normally do not need to be loaded.
They are included here for visibility in the module system,
They are included here for visibility in the module system,
and as a prerequisite for (usually older) modules which provide Python packages outside of Conda or Pip.
and as a prerequisite for (usually older) modules which provide Python packages outside of Conda or Pip.

Revision as of 17:21, January 11, 2018

Python on Carbon can be accessed through several routes, each giving access to associated software. The routes are shown below.

Caution: Python packages installed under one route usually cannot be accessed through another route.

Base distributions

Module nomenclature
python/pyMajor.pyMinor/compilerName-compMajor.compMinor/pyMajor.pyMinor.pyPatch-moduleBuild
Contains
  • A Python interpreter and the standard packages, as distributed from python.org.

OS-provided bundles

Module nomenclature
python-osname/pyMajor.pyMinor/compilerName-compMajor.compMinor/pyMajor.pyMinor.pyPatch
Contains
  • The Python interpreter that comes with the operating system, and which is required for many system internals and for system-provided add-on packages (installed via rpm or yum).

These modules normally do not need to be loaded. They are included here for visibility in the module system, and as a prerequisite for (usually older) modules which provide Python packages outside of Conda or Pip. Such packages are usually tied to the version of the Python interpreter under which they were installed.

Suites with vendor-distributed package set

Module nomenclature
python-distributor/pyMajor.pyMinor/distMajor/distributor_defined_version[…]-moduleBuild
Contains
  • Python software suite with the package selection as distributed by the vendor.

Python-based software suites with a broad sope became popular in recent years. They typically contain:

  • A Python interpreter.
  • The Conda/pip package management systems.
  • A wide-ranging set of Python-native packages, extensions, and add-on executables, often including:
    • Idle – Python Integrated DeveLopment Environment
    • iPython and juPyter – Interactive computation system
    • Cython – Compiler for a superset of Python and C/C++
  • All libraries and supporting binaries required by the above, e.g.:
    • BLAS/LAPACK – Linear algebra libraries
    • Tcl – Interpreter for the Tool Command Language
    • MPI – Runtime environment for parallel applications using Message Passing Interface, including the mpirun or mpiexec launch commands.


The last item can be problematic because libraries and supporting binaries included in a Python suite can interfere with other software modules on Carbon. For access by users, HPC software typically leverages conventional Unix environment variables like PATH, LD_LIBRARY_PATH, and PYTHONPATH. These environment variables are interpreted front-to-back, which implies priorities and can easily lead to resources from one module overshadowing those from another when they use the same name.

In particular, a Python suite with an included MPI runtime makes parallel computing easily accessible under Python, but this means a "mere python module" can clash with other MPI implementations used on Carbon. Loading a module for a Python suite that contains MPI and a separate MPI module at the same time can be done but then requires more detail for the MPI launcher in job scripts. Without that, non-obvious failures will result for either bundled parallel applications within the Python suite or (worse) unrelated compiled applications on Carbon.

Caveat: Avoid loading modules at the same time for both a Python suite with an included MPI and a separate MPI implementation, especially in your dot-files (.bashrc, .modules-el*).

Various workarounds for MPI clashes exist:

  • Altering the module load order.
  • Launching MPI with qualified paths like $FOO_HOME/bin/mpirun.
  • If MPI is not needed on the Python side, use a custom virtual environment with MPI excluded.

Please contact mailto:[email protected] for help.

Suites with customized package set

Module nomenclature
python-env-distributor/pyMajor.pyMinor/distMajor/pyVersion[…]-moduleBuild
A default selection of packages deemed useful for jobs on Carbon.
python-env-distributor-purpose/pyMajor.pyMinor/distMajor/pyVersion[…]-moduleBuild
Same, with alternative package selections. (TBD)
Contains
  • Python software suite with the package selection customized for Carbon.
This is usually implemented as a Conda "environment" derived from a vendor-distributed Conda suite.