7.1 环境配置¶
本节介绍计算环境的 Shell 类型、home 目录配置文件,以及使用 module 工具加载软件环境的方法。
7.1.1 Shell 版本¶
计算环境支持 bash、tcsh、zsh
7.1.2 home 目录¶
| File | 功能 | 注意事项 |
|---|---|---|
~/.bashrc |
用于用户自定义 Bash shell 的行为和环境。你可以在 .bashrc 文件中设置环境变量,比如修改 PATH 路径以添加自己的程序目录等。 |
当用户启动一个交互式非登录 shell 时(即打开新的终端窗口或标签),.bashrc 文件会被自动加载。修改完成后需要使用 source ~/.bashrc 使其生效,建议每次修改前对该文件做备份,以便误操作后最大程度恢复 |
~/.zshrc |
用于用户自定义 Zsh shell 的行为和环境,功能与 .bashrc 类似。 |
当用户启动交互式 Zsh shell 时,.zshrc 文件会被自动加载。修改完成后使用 source ~/.zshrc 使其生效。 |
~/.bash_profile |
登录 shell 后的配置文件,用于设置用户环境变量和启动程序。 | 仅在用户登录时加载 |
需谨慎修改的环境变量
-
系统路径类变量,如
PATH, LD_LIBRARY_PATH等。 -
调度器/作业提交相关变量,Slurm 相关:SLURM_JOB_ID, SLURM_NTASKS, SLURM_SUBMIT_DIR 等。
-
编译器与数学库相关变量,如
MKLROOT, MKL_LIBDIR, MKL_INCLUDE_DIR等。
系统关键变量不建议在 ~/.bashrc 中修改,而是在调度器提交脚本中使用。不建议修改的系统关键变量例如:
rc 文件中禁止包含阻塞式交互操作
如果用户的 rc 文件(.bashrc、.zshrc、.tcshrc 等)中包含阻塞式输入(如 read、等待用户确认等)或类似的交互式执行程序,INK 等平台在使用用户身份提交作业或创建文件时可能会失败。这是一种 不规范的配置模式 。
解决方案:在 rc 文件中添加非交互式会话防护,如果是非交互式会话登录,则退出 rc。代码如下:
-
BASH
-
ZSH
-
TCSH/CSH
7.1.3 module 工具使用说明¶
module 工具是一种常用于高性能计算环境的动态环境管理工具。它允许用户通过加载和卸载模块文件来灵活地修改其 shell 环境,从而方便地管理软件包和依赖。主要功能包括列出可用模块、加载和卸载模块、显示当前加载的模块以及查看模块详细信息。使用 module 工具,用户可以轻松切换不同的软件版本,确保环境的一致性和灵活性。
添加 modulefile 路径¶
查找可用的软件及版本¶
输出示例:
------------------------------ /cvmfs/slurm.ihep.ac.cn/alma9/modulefiles ------------------------------------
anaconda/24.3.0 intel_oneapi/compiler-rt32/2024.1.0 intel_oneapi/tbb32/2021.12
cmake/3.18.4 intel_oneapi/compiler-rt32/latest intel_oneapi/tbb32/latest
cmake/3.26.4 intel_oneapi/compiler/2024.1.0 intel_oneapi/vtune/2024.1
cmake/3.29.1 intel_oneapi/compiler/latest intel_oneapi/vtune/latest
cp2k/2023.1-gcc11 intel_oneapi/compiler32/2024.1.0 lammps/2024.02.07
cp2k/2024.1-gcc11 intel_oneapi/compiler32/latest lapack/3.11.0-gcc11
cuda/11.0-cvmfs intel_oneapi/dal/2024.0.0 lume-astra/0.6.1
cuda/11.1-cvmfs intel_oneapi/dal/latest molpro/2015-gcc11
cuda/11.2-cvmfs intel_oneapi/debugger/2024.1.0 mpi/mpich/4.1.3
cuda/11.7-cvmfs intel_oneapi/debugger/latest mpi/mpich/4.2.1
cuda/12.2-cvmfs intel_oneapi/dev-utilities/2024.0.0 mpi/mvapich/2.3.7
cuda/12.4 intel_oneapi/dev-utilities/latest mpi/mvapich/3.4.3
cuda/12.4-cvmfs intel_oneapi/dnnl/3.4.0 openmpi/4.1.4-gcc11
cuDNN/8.0.5-cuda11.0 intel_oneapi/dnnl/latest orca/5.0.4-gcc11
cuDNN/8.1.1-cuda11 intel_oneapi/dpct/2024.1.0 python/2.7.18
cuDNN/8.9.7-cuda11 intel_oneapi/dpct/latest python/3.7.16
cuDNN/8.9.7-cuda12 intel_oneapi/dpl/2022.5 python/3.8.19
cuDNN/9.0.0-cuda11 intel_oneapi/dpl/latest python/3.9.18
cuDNN/9.0.0-cuda12 intel_oneapi/ifort/2024.1.0 python/3.10.14
elegant/1.0 intel_oneapi/ifort/latest python/3.11.8
epics/7.0.7 intel_oneapi/ifort32/2024.1.0 python/3.12.2
fftw/3.3.10-gcc11 intel_oneapi/ifort32/latest pytorch/2.0.1-cu117-py310
gcc/7.5.0 intel_oneapi/intel_ipp_ia32/2021.11 pytorch/2.2.0-cu121-py310
gcc/9.5.0 intel_oneapi/intel_ipp_ia32/latest quickpic/develop
gcc/10.4.0 intel_oneapi/intel_ipp_intel64/2021.11 scalapack/2.2.1
gcc/11.4.0 intel_oneapi/intel_ipp_intel64/latest scow/1.0
gcc/12.3.0 intel_oneapi/intel_ippcp_ia32/2021.11 tensorflow/2.4.0-cu110-py38
gimic/2.0 intel_oneapi/intel_ippcp_ia32/latest tensorflow/2.11.0-cu112-py310
gromacs/2023.4-gcc11 intel_oneapi/intel_ippcp_intel64/2021.11 tensorflow/2.15.0-cu122-py310
hdf5/1.10.11 intel_oneapi/intel_ippcp_intel64/latest tensorflow/2.16.1-cu123-py310
intel_oneapi/advisor/2024.1 intel_oneapi/mkl/2024.1 TensorRT/7.2.3.4-cuda11.0-cudnn8.1
intel_oneapi/advisor/latest intel_oneapi/mkl/latest TensorRT/7.2.3.4-cuda11.1-cudnn8.1
intel_oneapi/ccl/2021.12.0 intel_oneapi/mkl32/2024.1 TensorRT/8.6.1.6-cuda11.8
intel_oneapi/ccl/latest intel_oneapi/mkl32/latest TensorRT/8.6.1.6-cuda12.0
intel_oneapi/compiler-intel-llvm/2024.1.0 intel_oneapi/mpi/2021.12 TensorRT/10.0.1.6-cuda11.8
intel_oneapi/compiler-intel-llvm/latest intel_oneapi/mpi/latest TensorRT/10.0.1.6-cuda12.4
intel_oneapi/compiler-intel-llvm32/2024.1.0 intel_oneapi/oclfpga/2024.1.0 tfpwa/tf2.4.0
intel_oneapi/compiler-intel-llvm32/latest intel_oneapi/oclfpga/latest vmd/1.9.4
intel_oneapi/compiler-rt/2024.1.0 intel_oneapi/tbb/2021.12 warpx/24.02
intel_oneapi/compiler-rt/latest intel_oneapi/tbb/latest
加载软件环境¶
输出示例:
查看已加载软件¶
输出示例:
卸载软件环境¶
查看 module 命令帮助¶
输出示例:
Modules Release 5.3.0 (2023-05-14)
Usage: module [options] [command] [args ...]
Loading / Unloading commands:
add | load modulefile [...] Load modulefile(s)
try-add | try-load modfile [...] Load modfile(s), no complain if not found
add-any | load-any modfile [...] Load first available modulefile in list
rm | unload modulefile [...] Remove modulefile(s)
purge Unload all loaded modulefiles
reload Unload then load all loaded modulefiles
switch | swap [mod1] mod2 Unload mod1 and load mod2
refresh Refresh loaded module volatile components
reset Restore initial environment
Listing / Searching commands:
list [-a] [-t|-l|-j] [-S|-C] [mod ...]
List all or matching loaded modules
avail [-a] [-t|-l|-j] [-S|-C] [-d|-L] [--indepth|--no-indepth] [mod ...]
List all or matching available modules
aliases [-a] List all module aliases
whatis [-a] [-j] [modulefile ...] Print whatis information of modulefile(s)
apropos | keyword | search [-a] [-j] str
Search all name and whatis containing str
is-loaded [modulefile ...] Test if any of the modulefile(s) are loaded
is-avail modulefile [...] Is any of the modulefile(s) available
info-loaded modulefile Get full name of matching loaded module(s)
...
常见问题(FAQ)¶
见常见问题。
🤖 AI 助手
💬 快速提问
×
有问题?输入后跳转到对话页继续交流