Skip to content

[TensorFlow] [package list]

TensorFlow/2.11.1-rocm-5.5.1-python-3.10-horovod-0.28.1-singularity-20231110 (TensorFlow-2.11.1-rocm-5.5.1-python-3.10-horovod-0.28.1-singularity-20231110.eb)

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

module load LUMI partition/container EasyBuild-user
eb TensorFlow-2.11.1-rocm-5.5.1-python-3.10-horovod-0.28.1-singularity-20231110.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 TensorFlow/2.11.1-rocm-5.5.1-python-3.10-horovod-0.28.1-singularity-20231110.

EasyConfig:

easyblock = 'MakeCp'

name =          'TensorFlow'
version =       '2.11.1'
versionsuffix = '-rocm-5.5.1-python-3.10-horovod-0.28.1-singularity-20231110'

local_sif =    'lumi-tensorflow-rocm-5.5.1-python-3.10-tensorflow-2.11.1-horovod-0.28.1-dockerhash-9c9351c30d4c.sif'
local_docker = 'lumi-tensorflow-rocm-5.5.1-python-3.10-tensorflow-2.11.1-horovod-0.28.1.docker'

homepage = 'https://www.tensorflow.org/'

whatis = [
    'Description: TensorFlow, a machine learning package'
]

description = """
This module provides a container with TensorFlow %(version)s. 

The module defines a number of environment variables:
*   SIF and SIFTENSORFLOW: 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 RUNSCRIPTSPYTORCH: 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.
"""

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}'],
    'dirs':  [],
}

modextravars = {
    # SIF variables currently set by a function via modluafooter.
    #'SIF':                 '%(installdir)s/' + local_sif,
    #'SIFTENSORFLOW':       '%(installdir)s/' + local_sif,
    'RUNSCRIPTS':           '%(installdir)s/runscripts',
    'RUNSCRIPTSTENSORFLOW': '%(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}', '%(name)s', '%(installdir)s' )
"""

moduleclass = 'devel'

[TensorFlow] [package list]