Environment Module 與 Intel Toolkits 超算的環境架設筆記

Environment Module安裝:

官方教學:

https://modules.readthedocs.io/en/latest/INSTALL.html

Requirements:

yum install -y python3
pip3 install runtest
yum install -y tcl
yum install -y tcl-devel
yum install -y dejagnu
yum install -y gcc
yum install -y autoconf
yum install -y autopoint
yum install -y python3-sphinx

Install :

cd /opt
curl -LJO https://github.com/cea-hpc/modules/releases/download/v5.0.1/modules-5.0.1.tar.gz
tar zxf modules-5.0.1.tar.gz
cd modules-5.0.1
./configure
make
make install

Add the Path :

用在單用戶:

echo source /opt/modules-5.0.1/init/bash >> ~/.bashrc  # 加了為了定位你那個module environment 可用
echo export MODULEPATH=/usr/local/Modules/modulefiles/ >> ~/bashrc       # 加了為了定位你module av 的路徑

source ~/.bashrc

用在全局用戶:

echo source /opt/modules-5.0.1/init/bash >> /etc/profile

echo export MODULEPATH=/usr/local/Modules/modulefiles/ >> /etc/profile

source /etc/profile

Options install:

yum install -y vim 
yum install -y wget

Options suggest:

can install the module to /opt/

options install htop:

yum -y install epel-release
yum -y install htop


Intel® oneAPI Toolkits安裝:

Intel® oneAPI Toolkits 官方:

https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html#gs.pbd7ts

Intel® oneAPI HPC Toolkit :

# Online Installer (current version: CentOS 7)
cd /opt
wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18479/l_HPCKit_p_2022.1.2.117.sh
sudo sh ./l_HPCKit_p_2022.1.2.117.sh

Intel® oneAPI Base Toolkit:

# Online Installer (current version: CentOS 7)
cd /opt
wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18487/l_BaseKit_p_2022.1.2.146.sh
sudo sh ./l_BaseKit_p_2022.1.2.146.sh

Build the Module Files link

cd /opt/intel/oneapi/
./modulefiles-setup.sh
#絕對要記得 因為用來設定環境變數 source setvars.sh echo source /opt/intel/oneapi/setvars.sh >> /etc/profile echo source /opt/intel/oneapi/setvars.sh >> ~/.bashrc module use /opt/intel/oneapi/modulefiles # 把output 的module file 加到 module 中 # 設定為所以user都能用

Module Environment介紹:

安裝完成後,會默認在/usr/share/Module目錄下產生一系列文件夾,其中init中放了在各種系統下初始化這個程序的腳本,我的終端是bash,所以使用如下命令初始化。 source /usr/share/Module/init/bash 我把它加在.bashrc下了。 注:得用絕對路徑source,如果只在那個文件夾下使用命令source bash會提示bash:是一個二進製文件暫時不知道為什麼。

modulefile的書寫

  1. 搜索路徑 順便說下module-environment的使用方法。 使用module load xxx命令後,系統就會在特定路徑下去尋找名字為xxx的文件,然後按照該文件裡面的內容來修改環境變量。 這個特定的路徑默認是在/usr/share/modules/modulefile和一些其他的地方。如果想修改或者說添加一些別的路徑,可以通過在初始化文件中添加命令修改MODULEPATH來達到目的。 在/usr/share/module/init/bash中最後一行添加 export MODULEPATH=/YOUR/PATH/:$MODULEPATH 注:如果在.bashrc 文件中直接修改MODULEPATH是沒有用的,不知道為什麼。可能是我中間有什麼地方錯了。
  2. 文件書寫 在文件開頭一定要寫上 #%Module1.0 這個是識別這個文件為modulefile的,沒有他這個文件不會被識別 有幾個命令,其實命令有很多,我只說一些暫時能用的上的 prepend 要修改的環境變量 路徑 這個命令會把路徑添加到對應的環境變量中 setenv 環境變量名 值 修改環境變量值。 conflict modulefile 如果這個modulefile 已經被加載,那麼當前的modulefile將不能被加載。 最後會放上一個例子使用
  3. 一些命令。 module avail 顯示可以使用的模塊 module load 加載模塊 module unload 卸載模塊 module list 顯示已經加載的模塊

Comments