Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An Introduction to Writing Modulefiles: Module files are scripted using Lua and define core environment elements required to setup and use something.

Example:

Code Block
[salexan5@mblog2 ~]$ cd /project/arcc<project-name>/software
[salexan5@mblog2 software] mkdir -p modules/tensorflow
[salexan5@mblog2 software] cd modules/tensorflow
[salexan5@mblog2 tensorflow] vim 2.16.lua
Code Block
# 2.16.lua
whatis(" Name: TensorFlow ")
whatis(" Version : 2.16 ")
whatis(" Short Description: An end-to-end platform for machine learning.")
prepend_path("PATH","/project/arcc<project-name>/software/tensorflow/2.16/bin/")

...

Info

To expose your module files you need to tell the module system where to look using the module use <path> command.

Code Block
[salexan5@mblog1 ~]$ module avail
-------------- /apps/s/lmod/mf/opt/linux-rhel9-x86_64/containers ---------------
   stress-ng/0.17.08
...
Code Block
# Expose your module files.
[salexan5@mblog1 ~]$ module use /project/arcc<project-name>/software/modules/
Code Block
[salexan5@mblog1 ~]$ module avail
------------------------ /project/arcc<project-name>/software/modules ------------------------
   tensorflow/2.16
-------------- /apps/s/lmod/mf/opt/linux-rhel9-x86_64/containers ---------------
   stress-ng/0.17.08
...
Code Block
[salexan5@mblog2 ~]$ module spider tensorflow
----------------------------------------------------------------------------
  tensorflow: tensorflow/2.16
----------------------------------------------------------------------------
    This module can be loaded directly: module load tensorflow/2.16

...

Info

Loading a local module has the same effect as using a System module.

Your environment will be updated by setting appropriate environment variables.

Code Block
[salexan5@mblog1 ~@mblog1]$ salloc -A arcc<project-name> -t 10:00
salloc: Granted job allocation 845851
salloc: Nodes mbcpu-001 are ready for job
[salexan5@mbcpu@mbcpu-001 ~]$ module use /project/arcc<project-name>/software/modules/
[salexan5@mbcpu@mbcpu-001 ~]$ module load tensorflow/2.16
[salexan5@mbcpu@mbcpu-001 ~]$ python --version
Python 3.11.9

[salexan5@mblog2 tensorflow@mbcpu-001]$ which python
/project/arcc<project-name>/software/tensorflow/2.16/bin/python

...

Info

After loading our module and exposing the conda environment, notice how the sysconfig is based around this environment.

Code Block
[salexan5@mblog2 tensorflow@mbcpu-001]$ python -m sysconfig
Platform: "linux-x86_64"
Python version: "3.11"
Current installation scheme: "posix_prefix"
Paths:
        data = "/project/arcc<project-name>/software/tensorflow/2.16"
        ...
        stdlib = "/project/arcc<project-name>/software/tensorflow/2.16/lib/python3.11"
Variables:
        ...
        userbase = "/cluster/medbow/project/arcc<project-name>/software/tensorflow/2.16"

...

Info

All the conda and pip package installs within this conda environment are available.

Code Block
[salexan5@mbcpu@mbcpu-001 ~]$ python -c "import tensorflow as tf; print(\"TensorFlow Version: \" + str( tf.__version__))"
...
TensorFlow Version: 2.16.1
[salexan5@mbcpu@mbcpu-001 ~]$ exit
exit
salloc: Relinquishing job allocation 845851

...

 Add label