Skip to content

[mpi4py] [package list]

mpi4py/3.1.4-rocm-5.4.5-python-3.10-singularity-20240207 (mpi4py-3.1.4-rocm-5.4.5-python-3.10-singularity-20240207.eb)

Install with the EasyBuild-user module in partition/container:

module load LUMI partition/container EasyBuild-user
eb mpi4py-3.1.4-rocm-5.4.5-python-3.10-singularity-20240207.eb
The module will be available in all versions of the LUMI stack and in the CrayEnv stack.

To access module help after installation use module spider mpi4py/3.1.4-rocm-5.4.5-python-3.10-singularity-20240207.

EasyConfig:

easyblock = 'MakeCp'

name =          'mpi4py'
version =       '3.1.4'
versionsuffix = '-rocm-5.4.5-python-3.10-singularity-20231110'

local_sif =    'lumi-mpi4py-rocm-5.4.5-python-3.10-mpi4py-3.1.4-dockerhash-6f5094cb4f33.sif'
#local_docker = 'lumi-mpi4py-rocm-5.4.5-python-3.10-mpi4py-3.1.4.docker'

homepage = 'https://github.com/mpi4py/mpi4py'

whatis = [
    'Description: MPI for Python (mpi4py) provides bindings of the Message Passing Interface (MPI) standard for the Python programming language'
]

description = """
This module provides a container with mpi4py %(version)s and cupy. 

The module defines a number of environment variables:
*   SIF and SIFMPI4PY: The full path and name of the Singularity SIF file 
    to use with singularity exec etc.
*   SINGULAIRTY_BINDPATH: Mounts the necessary directories from the system,
    including /users, /project, /scratch and /flash so that you should be
    able to use your regular directories in the container.
*   RUNSCRIPTS and RUNSCRIPTSMPI4PY: The directory with some sample
    runscripts.


Note that this container uses a Conda environment internally. When in
the container, the command to activate the container is contained in the
environment variable WITH_CONDA.
"""

docurls = [
    'mpi4py web-based manual: https://mpi4py.readthedocs.io/en/'
]

toolchain = SYSTEM

sources = [
    {
        'filename':    local_sif,
        'extract_cmd': '/bin/cp %s .'
    },
#    {
#        'filename':    local_docker,
#        'extract_cmd': '/bin/cp %s .'
#    },
]

skipsteps = ['build']

files_to_copy = [
    ([local_sif],    '.'),
#    ([local_docker], 'share/docker-defs/')    
]

local_runscript_python_simple="""
#!/bin/bash -e

# Start conda environment inside the container
\$WITH_CONDA

# Run application
python "\$@"

"""

postinstallcmds = [
    'mkdir -p %(installdir)s/runscripts',
    f'cat >%(installdir)s/runscripts/python-conda-simple <<EOF {local_runscript_python_simple}EOF',
    'chmod a+x %(installdir)s/runscripts/python-conda-simple'
]

sanity_check_paths = {
    # We deliberately don't check for local_sif as the user is allowed to remove that file
    # but may still want to regenerate the module which would then fail in the sanity check.
    #'files': [f'share/docker-defs/{local_docker}'],
    'files': [],
    'dirs':  ['runscripts'],
}

modextravars = {
    # SIF variables currently set by a function via modluafooter.
    #'SIF':             '%(installdir)s/' + local_sif,
    #'SIFMPI4PY':       '%(installdir)s/' + local_sif,
    'RUNSCRIPTS':       '%(installdir)s/runscripts',
    'RUNSCRIPTSMPI4PY': '%(installdir)s/runscripts',
    'SINGULARITY_BIND': '/var/spool/slurmd,/opt/cray,/usr/lib64/libcxi.so.1,/usr/lib64/libjansson.so.4,' +
                        '%(installdir)s/runscripts:/runscripts,' + 
                        '/pfs,/scratch,/projappl,/project,/flash,/appl'
}

modluafooter = f"""
-- Call a routine to set the various environment variables.
create_container_vars( '{local_sif}', 'mpi4py', '%(installdir)s' )
"""

moduleclass = 'devel'

[mpi4py] [package list]