編譯Environtment Modules

官方網(wǎng)站

http://modules.sourceforge.net/


編譯安裝Environtment Modules

安裝編譯RPM需要的開(kāi)發(fā)包

(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,選一個(gè)看著順眼的版本,比如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出來(lái)

(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;'

配置、編譯工程,安裝到應(yīng)用目錄,生成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;'

配置啟動(dòng)bash時(shí)初始化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實(shí)例

AOCC 2.1 module file內(nèi)容實(shí)例

(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
-------------------------------------------------------------------
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容