Skip to content

Loading prerequesites

Julius edited this page Jul 8, 2024 · 2 revisions

In order to build successfully, the compiler needs access to all available package locations at any time. Here is a list ensuring all environment variables are set and loaded.

# BLAS AND LAPACK
export WABBIT_BLAS_ROOT=[insert]
export WABBIT_LAPACK_ROOT=[insert]
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${WABBIT_BLAS_ROOT}:${WABBIT_LAPACK_ROOT}

# OpenMPI
export WABBIT_OPENMPI_INSTALL=[insert]
export PATH=${PATH}:${WABBIT_OPENMPI_INSTALL}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${WABBIT_OPENMPI_INSTALL}/lib:${WABBIT_OPENMPI_INSTALL}/lib64

# HDF5
export HDF_ROOT=[insert]
export HDF_SOURCE=${HDF_ROOT}/..  # if configured with $PWD/install
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HDF_ROOT}/lib:${HDF_ROOT}/lib64
LD_RUN_PATH=${LD_LIBRARY_PATH}

# WABBIT Python Tools
export WABBIT_PT_ROOT=[insert]
export PATH=${PATH}:${WABBIT_PT_ROOT}/bin
export PYTHONPATH=${PYTHONPATH}:${WABBIT_PT_ROOT}

These can be stored in a file in the wabbit folder and loaded with source or loaded automatically when added to $HOME/.bashrc.

Loading prerequisites using modules

Environment Modules is a package to quickly load and unload packages or libraries. Following a short description to set up modules and the necessary modulefiles in order to setup a working implementation for WABBIT.

Compile modules from source

Modules depends on TCL which we will need to build first. Download TCL from source, then unpack it and change into the folder unix, then run:

./configure --prefix=$PWD/../install
make -j8
make -j8 install
cd ../install
ln -s ./bin/tclsh* ./bin/tclsh
export TCL_INSTALL=$PWD

Now modules can be downloaded from source, unpacked and installed with:

./configure --prefix=$PWD/install --with-tclsh=$TCL_INSTALL/bin/tclsh
make -j8
make -j8 install

At last, in order to load modules on startup we need to add the following lines to the .bashrc-file. Ensure to change [insert] to the correct paths.

TCL_INSTALL=[insert]
Modules_SRC=[insert]
export PATH=${PATH}:${TCL_INSTALL}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${TCL_INSTALL}/lib:${TCL_INSTALL}/lib64
source ${Modules_INSTALL}/init/bash

Now, modulefiles can be inserted into the folder in the modules installation. It should be visible when running module avail with the example modules listed. These can be removed and others inserted.

Different modulefiles

Following modulefiles for the different prerequesites, save them in file called [package] or [package]/[version] in the modulefiles folder and load them with ml package. Make sure to adapt [insert] in the file by the corresponding path. Different versions can be added easily, add conflict [package] in each of the versions modulefile in order to constrict the loading.

Modulefile for OpenMPI

#%Module1.0
## Specify the location where openmpi is installed
set OPENMPI_ROOT [Insert]

## append variables
prepend-path PATH $OPENMPI_ROOT/bin
prepend-path LD_LIBRARY_PATH $OPENMPI_ROOT/lib
prepend-path LD_LIBRARY_PATH $OPENMPI_ROOT/lib64

Modulefile for HDF5

#%Module1.0
## Specify the location where HDF5 is installed
setenv HDF_ROOT [Insert]
setenv HDF_SOURCE $env(HDF_ROOT)/..

## Set the LD_LIBRARY_PATH environment variable
prepend-path LD_LIBRARY_PATH $env(HDF_ROOT)/lib
prepend-path LD_LIBRARY_PATH $env(HDF_ROOT)/lib64

## Set the LD_RUN_PATH environment variable
setenv LD_RUN_PATH $env(LD_LIBRARY_PATH)

Modulefile for BLAS

#%Module1.0
## Specify the location where blas is installed
set BLAS_ROOT [Insert]

## append variables
prepend-path LD_LIBRARY_PATH $BLAS_ROOT

Modulefile for LAPACK

#%Module1.0
## Specify the location where lapack is installed
set LAPACK_ROOT [insert]

## append variables
prepend-path LD_LIBRARY_PATH $LAPACK_ROOT

Modulefile for WABBIT Python Tools

#%Module1.0
## Specify the location where the python tools are located
set PYTHON_TOOLS_PATH [insert]

## append variables
prepend-path PATH $PYTHON_TOOLS_PATH/bin
if { [info exists ::env(PYTHONPATH)] } {
	prepend-path PYTHONPATH "${PYTHON_TOOLS_PATH}"
} else {
	setenv PYTHONPATH "${PYTHON_TOOLS_PATH}"
}