编译Environtment Modules

官方网站

http://modules.sourceforge.net/


编译安装Environtment Modules

安装编译RPM需要的开发包

(py38) $ sudo yum install -y gettext-devel tcl-devel python-sphinx dejagnu tclx-devel libX11-devel

克隆代码

(py38) $ REMOTE_GIT_FILE=git://github.com/cea-hpc/modules.git \
LOCAL_GIT_FILE=$HOME/github/modules.git \
time -p bash -c 'git clone --bare $REMOTE_GIT_FILE $LOCAL_GIT_FILE'

检查git branches和tags,选一个看着顺眼的版本,比如v4.4.1

(py38) $ GIT_DIR=$HOME/github/modules.git \
time -p bash -c '
git --bare --git-dir=$GIT_DIR fetch --all --prune; 
git --bare --git-dir=$GIT_DIR describe --all --long;
git --bare --git-dir=$GIT_DIR branch --list --all; 
git --bare --git-dir=$GIT_DIR tag;'

签出v4.4.1代码

两种方式checkout代码:

  • checkout-index
  • add worktree

checkout-index把index里的文件checkout出来

(py38) $ GIT_DIR=$HOME/github/modules.git \
USER_CODE_DIR=$HOME/code \
CODE_GIT_TAG=v4.4.1 \
GIT_WORK_TREE=$USER_CODE_DIR/modules-$CODE_GIT_TAG \
time -p bash -c '
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR reset --soft FETCH_HEAD;
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR reset --soft $CODE_GIT_TAG;
git --bare --git-dir=$GIT_DIR --work-tree=$GIT_WORK_TREE clean -fxd;
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR checkout-index --force --all --prefix=$GIT_WORK_TREE/;
git --bare --git-dir=$GIT_DIR --work-tree=$GIT_WORK_TREE describe --all --long;'
  • add worktree 添加一份代码目录
(py38) $ GIT_DIR=$HOME/github/modules.git \
USER_CODE_DIR=$HOME/code \
CODE_GIT_TAG=v4.4.1 \
GIT_WORK_TREE=$USER_CODE_DIR/modules-$CODE_GIT_TAG \
time -p bash -c '
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR reset --soft FETCH_HEAD;
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR reset --soft $CODE_GIT_TAG;
git --bare --git-dir=$GIT_DIR --work-tree=$GIT_WORK_TREE clean -fxd;
rm --force $GIT_WORK_TREE/.git;
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR worktree prune --verbose;
git --bare --git-dir=$GIT_DIR worktree add $GIT_WORK_TREE $CODE_GIT_TAG;
git --bare --git-dir=$GIT_DIR --work-tree=$GIT_WORK_TREE describe --all --long;'

配置、编译工程,安装到应用目录,生成RPM打包文件,

(py38) $ GIT_DIR=$HOME/github/modules.git \
USER_CODE_DIR=$HOME/code \
CODE_GIT_TAG=v4.4.1 \
GIT_WORK_TREE=$USER_CODE_DIR/modules-$CODE_GIT_TAG \
bash -c '
cd $GIT_WORK_TREE;
rm --force $GIT_WORK_TREE/.git;
git --bare --git-dir=$GIT_DIR --work-tree=$USER_CODE_DIR worktree prune --verbose;
ln --symbolic $GIT_DIR $GIT_WORK_TREE/.git;
./configure --prefix=$HOME/application/modules/$CODE_GIT_TAG;
make dist-bzip2; rpmbuild -tb modules-4.4.1.tar.bz2;
make --jobs install;'

配置启动bash时初始化module

(py38) $ echo ". $HOME/application/modules/v4.4.1/init/bash" >> ~/.bashrc
(py38) $ echo "export MODULEPATH+=:$HOME/ascii/modulefiles" >> ~/.bashrc
(py38) $ sudo bash -c 'echo "$HOME/ascii/modulefiles" >> /usr/share/Modules/init/.modulespath'

Module file实例

AOCC 2.1 module file内容实例

(py38) $ cat ~/ascii/modulefiles/aocc-compiler/2.1.0 
#%Module1.0#####################################################################
 
proc ModulesHelp { } {
    global version AOCChome
    puts stderr "\tAOCC \n"
    puts stderr "\tloads AOCC compiler setup \n"
}
 
module-whatis "loads AOCC compiler setup "
 
set AOCChome /lustre/application/compiler/aocc-compiler-2.1.0
prepend-path PATH $AOCChome/bin
prepend-path LIBRARY_PATH $AOCChome/lib
prepend-path LIBRARY_PATH $AOCChome/lib32
prepend-path LD_LIBRARY_PATH $AOCChome/lib
prepend-path LD_LIBRARY_PATH $AOCChome/lib32
prepend-path C_INCLUDE_PATH $AOCChome/include
prepend-path CPLUS_INCLUDE_PATH $AOCChome/include
prepend-path LIBRARY_PATH /usr/lib64:/usr/lib
prepend-path LD_LIBRARY_PATH /usr/lib64:/usr/lib

查看AOCC 2.1 module file信息

(py38) $ module show aocc-compiler/2.1.0 
-------------------------------------------------------------------
/lustre/home/dajiji/ascii/modulefiles/aocc-compiler/2.1.0:

module-whatis   {loads AOCC compiler setup }
prepend-path    PATH /lustre/application/compiler/aocc-compiler-2.1.0/bin
prepend-path    LIBRARY_PATH /lustre/application/compiler/aocc-compiler-2.1.0/lib
prepend-path    LIBRARY_PATH /lustre/application/compiler/aocc-compiler-2.1.0/lib32
prepend-path    LD_LIBRARY_PATH /lustre/application/compiler/aocc-compiler-2.1.0/lib
prepend-path    LD_LIBRARY_PATH /lustre/application/compiler/aocc-compiler-2.1.0/lib32
prepend-path    C_INCLUDE_PATH /lustre/application/compiler/aocc-compiler-2.1.0/include
prepend-path    CPLUS_INCLUDE_PATH /lustre/application/compiler/aocc-compiler-2.1.0/include
prepend-path    LIBRARY_PATH /usr/lib64:/usr/lib
prepend-path    LD_LIBRARY_PATH /usr/lib64:/usr/lib
-------------------------------------------------------------------

你可能感兴趣的:(编译Environtment Modules)