Create a Module File to Load Your Conda Environment

Goal: Demonstrate creating a module file to load a Conda environment.


Remember what a module is

We use the LMOD module system to setup our environment by loading modules of compilers, languages, libraries and applications…

Although typically the module are setup by ARCC, you can create your own module files for software and environments that you have installed (within home/project). You can create your own module files that expose and load these.


Module File Basic Template

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

Example:

[]$ cd /project/<project-name>/software [] mkdir -p modules/tensorflow [] cd modules/tensorflow [] vim 2.16.lua
# 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/<project-name>/software/tensorflow/2.16/bin/")

Use Your Module Files

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

[]$ module avail -------------- /apps/s/lmod/mf/opt/linux-rhel9-x86_64/containers --------------- stress-ng/0.17.08 ...

Using Your Module

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

Your environment will be updated by setting appropriate environment variables.


Notice the sysconfig

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


Running our TF Code