Create User Modules
Important Notes
The template we provide works when user software is installed in the user's home in the following path:
/home/<case_ID>/.usr/local/<software_name>/<version>
This will allow you to use, in most cases, the Module File Template that we give you.The template provided only works when the subdirectories' names inside <version> match:
bin, include, lib, and lib/pkgconfig.Sometimes lib and include are missing. If any of these two directories is missing, it might not affect the runtime execution of the software.
Some software does not install with this configuration of directories. In this case, the module needs to be adapted.
Creating a User Module
After installing software in your $HOME directory as explained above (please read the important notes), and before using it, a user module file needs to be created.
On Rider, all module files are written in Lua. You do not need to have programing experience with Lua to create a module file: we will use the template below.
Steps for installing the module
Please make sure that you read and follow carefully these instructions. Otherwise, your user module may not work.
We will use the following example:
Suppose that we have installed the software Bison with version 3.0.4. Then the installation directory would be:
/home/<case_ID>/.usr/local/bison/3.0.4
To use this version of Bison, we need to create the module file like this:
Copy the template into a text file. Save it with the following name: 3.0.4.lua
This version should be exactly the same as the version directory in the installation path.
Copy the module file into the following directory:
$HOME/.usr/local/share/modulefiles/bison
Notice that the directory name for Bison matches the installation directory. This part is key: if the names do not match, and the versions of the Lua file and installation path do not match, the module file will not construct the correct paths and the software will not be usable.
Explore the structure of the subdirectories. Run:
ls $HOME/.usr/local/bison/3.0.4
Output:
bin lib shareAdapt the module file to the structure: we can see that the include directory is missing. We could just ignore it and use the template as is. We can also delete the lines that refer to the include directory in our module. For example, we could delete the lines:
prepend_path("CPLUS_INCLUDE_PATH",pathJoin(base,"include"))
prepend_path("C_INCLUDE_PATH",pathJoin(base,"include"))If it is the first time you create a user module file, please log out and log in again.
Sometimes one needs to rebuild the cache to make the module visible:
module --ignore-cache avail
The module file should be ready for use.
If you want the software accessible to the group:
crate a modulefile in a package directory at /home/<PIcaseID>/.usr/local/share/modulefiles
ask the group members to append the module before loading it
module use /home/<PIcaseID>/.usr/local/share/modulefiles
Other Commands for Adapting the Module
Some software require dependencies in order to run. You can load those dependencies at the same time as you load the user module by using the function load:
load("module1", "module2", ... , "moduleN")
If you need to create shell environment variables, you can do that from within the module file instead of modifying configuration files such us your bashrc. This avoids conflicts with other modules and configurations. You can add as many variables as you need (each one in a new line). The function is called setenv and it takes two string arguments. The first argument is the shell variable name, and the second argument is the value of the variable:
setenv("VARIABLE_NAME_1","VALUE_OF_THE_VARIABLE")
setenv("VARIABLE_NAME_2","VALUE_OF_THE_VARIABLE")
Some binary packages require newer version of libraries than are available in the system (e.g. /usr/lib64). Specifically, the CXXABI_1.3.8 or CXXABI_1.3.9 objects may be indicated missing
<package> /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found
The system version indicated here does not include this version of CXXABI_1.3.8, however, this library is present on the system in an updated version. To resolve the problem, the LD_LIBRARY_PATH variable needs to include a reference to the newer version. This can be accomplished by loading the gcc/6.3.0 module, or in the Intel hierarchy, loading 'base', and 'gcc/6' modules. Finally, then the user module file can be modified by means of the process listed above, that is: load("base","gcc/6")
Alternatively, the LD_LIBRARY_PATH variable may be set in the modulefile to directly reference the library directory.
User Modulefile Template
-- -*- PKG_NAME Module File -*-
local pkgName = myModuleName()
local pkgVersion = myModuleVersion()
local pkgNameVer = myModuleFullName()
local base = pathJoin(os.getenv("HOME"),".usr/local", pkgNameVer)
whatis("Name: "..pkgName)
whatis("Version: "..pkgVersion)
whatis("Category: library,software")
whatis("Description: package description")
prepend_path("PATH",pathJoin(base,"bin"))
prepend_path("CPLUS_INCLUDE_PATH",pathJoin(base,"include"))
prepend_path("C_INCLUDE_PATH",pathJoin(base,"include"))
prepend_path("LD_LIBRARY_PATH",pathJoin(base,"lib"))
prepend_path("LIBRARY_PATH",pathJoin(base,"lib"))
prepend_path("PKG_CONFIG_PATH",pathJoin(base,"lib/pkgconfig"))
Issues or Questions ?
Contact us at hpc-supportATcase.edu