---
# System prepended metadata

title: Module file

---

# Module file
## gcc
```shell=
#%Module

conflict gcc
set          BASEPATH           /usr
prepend-path PATH               $BASEPATH/bin
prepend-path LD_LIBRARY_PATH    $BASEPATH/lib:$BASEPATH/lib64
```
## fftw3
```shell=
#%Module

set FFTW_DIR /root/fftw-build/3.3.8-shared-gcc840-avx2-broadwell
set FFTW_DIR /root/fftw-build/3.3.8-shared-icc20-avx2-broadwell

prepend-path CPLUS_INCLUDE_PATH $FFTW_DIR/include
prepend-path LD_LIBRARY_PATH $FFTW_DIR/lib
prepend-path LIBRARY_PATH $FFTW_DIR/lib
```
## openmpi
```shell=
#%Module

conflict intel
set             TOP_DIR         /root/openmpi
prepend-path    PATH            ${TOP_DIR}/bin
prepend-path    LD_LIBRARY_PATH ${TOP_DIR}/lib
prepend-path    MANPATH         ${TOP_DIR}/share/man
```
## cuda
```shell=
vim /usr/share/Modules/modulefiles/cuda/10.2
#%Module
conflict        cuda
set             CUDA_PATH           /usr/local/cuda-10.2
setenv          CUDA_DIR            ${CUDA_PATH}
prepend-path    PATH                ${CUDA_PATH}/bin
prepend-path    LD_LIBRARY_PATH     ${CUDA_PATH}/lib64

vim /usr/share/Modules/modulefiles/cuda/10.0

#%Module
conflict        cuda
set             CUDA_PATH           /usr/local/cuda-10.0
setenv          CUDA_DIR            ${CUDA_PATH}
prepend-path    PATH                ${CUDA_PATH}/bin
prepend-path    LD_LIBRARY_PATH     ${CUDA_PATH}/lib64
```
## UCX
```shell=
###hpcx提供的ucx

#%Module

conflict ucx
set             TOP_DIR         /root/hpcx-v2.6.0-gcc-MLNX_OFED_LINUX-4.6-1.0.1.1-ubuntu16.04-x86_64/ucx/mt
prepend-path    PATH            ${TOP_DIR}/bin
prepend-path    LD_LIBRARY_PATH ${TOP_DIR}/lib
prepend-path    HPCX_UCX_DIR    ${TOP_DIR}
prepend-path    PKG_CONFIG_PATH ${TOP_DIR}/lib/pkgconfig
prepend-path    CPATH           ${TOP_DIR}/include

###自己編的ucx

#%Module
conflict ucx
set             TOP_DIR         /root/ucx
prepend-path    PATH            ${TOP_DIR}/bin
prepend-path    LD_LIBRARY_PATH ${TOP_DIR}/lib
prepend-path    HPCX_UCX_DIR    ${TOP_DIR}
prepend-path    CPATH           ${TOP_DIR}/include
```
## Intel
```shell=
git clone https://git.code.sf.net/p/env2/code env2-code


echo "#%Module" > /usr/share/modules/modulefiles/icc
perl /root/env2-code/env2 -from bash -to modulecmd \
"/opt/intel/compilers_and_libraries_2020.0.166/linux/bin/compilervars.sh intel64" >> /usr/share/modules/modulefiles/icc

echo "#%Module" > /usr/share/modules/modulefiles/mkl
perl /root/env2-code/env2 -from bash -to modulecmd \
"/opt/intel/compilers_and_libraries_2020.0.166/linux/mkl/bin/mklvars.sh intel64" >> /usr/share/modules/modulefiles/mkl

echo "#%Module" > /usr/share/modules/modulefiles/impi
perl /root/env2-code/env2 -from bash -to modulecmd \
"/opt/intel/compilers_and_libraries_2020.0.166/linux/mpi/intel64/bin/mpivars.sh" >> /usr/share/modules/modulefiles/impi
```
## tcl
```shell=
#%Module

conflict tcl
set             TOP_DIR         /root/tcl
prepend-path    PATH            ${TOP_DIR}/bin
prepend-path    LD_LIBRARY_PATH ${TOP_DIR}/lib
prepend-path    CPATH           ${TOP_DIR}/include
prepend-path    MANPATH         ${TOP_DIR}/man
```
[include](https://stackoverflow.com/questions/558803/how-to-add-a-default-include-path-for-gcc-in-linux)
