Skip to content

7.1 User Environment

7.1.1 Shell Version

The computing environment supports bash, tcsh, and zsh.

7.1.2 Home Directory

File Function Notes
~/.bashrc User-defined Bash shell behavior and environment. You can set environment variables such asPATH. Automatically loaded when starting an interactive non-login shell. Usesource ~/.bashrcto apply changes.
~/.zshrc User-defined Zsh shell behavior and environment, similar to.bashrc. Automatically loaded when starting an interactive Zsh shell. Usesource ~/.zshrcto apply changes.
~/.bash_profile Login shell configuration for environment variables and startup programs. Loaded only during user login.

Danger

Environment variables that require caution: 1. System path variables such asPATH,LD_LIBRARY_PATH, etc. 2. Scheduler/job submission variables, Slurm related:SLURM_JOB_ID,SLURM_NTASKS,SLURM_SUBMIT_DIR, etc. 3. Compiler and math library variables such asMKLROOT,MKL_LIBDIR,MKL_INCLUDE_DIR, etc.

Critical system variables should not be modified in~/.bashrc; use them in scheduler submission scripts instead. For example:

HOMEUserhomedirectorypath—modifyingitwillrelocateconfigurationfilesandbreakexistingsettings.SHELLUsershelltype—modifyingitmaybreakexistingconfiguration.

Danger

Do notinclude blocking interactive operations in rc files

If your rc files (.bashrc,.zshrc,.tcshrc, etc.) contain blocking input (e.g.,read, waiting for user confirmation) or similar interactive programs, platforms such as INK may fail when submitting jobs or creating files under your identity. This is anon-standard configuration pattern.

Solution: Add a non-interactive session guard in your rc file to exit when the session is non-interactive:

  • BASH

    [[$-!=*i*]]&&return

  • ZSH

    if[[!-ointeractive]];thenreturnfi

  • TCSH/CSH

    if(!$?prompt)thenexitendif

7.1.3 Module Tool Usage

Themoduletool is a dynamic environment management tool commonly used in HPC environments. It allows users to flexibly modify their shell environment by loading and unloading module files, making it easy to manage software packages and dependencies.

7.1.3.1 Adding a Modulefile Path

moduleuse/cvmfs/slurm.ihep.ac.cn/alma9/modulefiles

7.1.3.2 Finding Available Software and Versions

moduleavail

7.1.3.3 Loading a Software Environment

moduleload# Example:moduleloadcmake/3.18.4# Check the loaded cmake pathwhichcmake

7.1.3.4 Viewing Loaded Modules

modulelist

7.1.3.5 Unloading Software

# Unload a specific software environmentmoduleunload# Unload all loaded software environmentsmodulepurge

7.1.3.6 Module Help

modulehelp

FAQ

SeeFAQ.

AI 助手
快速提问 ×

有问题?输入后跳转到对话页继续交流

Baidu
map