设置环境变量
使用MPI的用户,需要配置环境变量,可通过environment-modules工具方式配置环境变量。
- 使用PuTTY工具,以Hyper MPI普通用户(例如“hmpi_user”)登录至作业执行节点。
- 安装environment-modules工具。
- 执行yum install -y environment-modules,安装environment-modules。
- 执行以下命令,查看environment-modules是否安装成功。
若module命令不可用,执行source /usr/share/Modules/init/bash命令使module命令生效。
回显如下类似信息,说明environment-modules安装成功。
Modules Release 4.1.1 (2018-02-17)
- 在environment-modules工具安装路径下创建并编辑“Hmpi_modulefiles”配置文件。
- 执行以下命令创建并打开“Hmpi_modulefiles”配置文件。
- 按“i”进入编辑模式,添加如下内容。
#%Module1.0 # HMPI module for use with 'environment-modules' package: conflict mpi prepend-path OPAL_PREFIX /path/to/install/hmpi/ prepend-path PATH /path/to/install/hmpi/bin:/path/to/install/hucx/bin:/path/to/install/xucg/bin prepend-path LD_LIBRARY_PATH /path/to/install/hmpi/lib:/path/to/install/hucx/lib:/path/to/install/xucg/lib prepend-path INCLUDE /path/to/install/hmpi/include:/path/to/install/hucx/include:/path/to/install/xucg/include
其中,/path/to/install:表示environment-modules工具的安装路径。若用户不指定安装路径,则会安装在默认路径/usr/share/Modules/modulefiles下。
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 执行以下命令,在工具安装路径下加载环境变量。
module load /path/to/install/Hmpi_modulefiles
- 执行以下命令,将Hyper MPI环境变量写到用户的“~/.bashrc”文件中。
用户的“~/.bashrc”文件会默认保存在共享目录中,若共享目录下不存在该文件,请修改所有节点的“~/.bashrc”。
父主题: 安装介绍