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 as PATH. Automatically loaded when starting an interactive non-login shell. Use source ~/.bashrc to apply changes.
~/.zshrc User-defined Zsh shell behavior and environment, similar to .bashrc. Automatically loaded when starting an interactive Zsh shell. Use source ~/.zshrc to 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 as PATH, 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 as MKLROOT, MKL_LIBDIR, MKL_INCLUDE_DIR, etc.

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

  HOME  User home directory path — modifying it will relocate configuration files and break existing settings.
  SHELL User shell type — modifying it may break existing configuration.

Danger

Do not include 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 a non-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 [[ ! -o interactive ]]; then
        return
    fi
    

  • TCSH/CSH

    if (! $?prompt) then
        exit
    endif
    

7.1.3 Module Tool Usage

The module tool 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

module use /cvmfs/slurm.ihep.ac.cn/alma9/modulefiles

7.1.3.2 Finding Available Software and Versions

module avail

7.1.3.3 Loading a Software Environment

module load <module_file>
# Example:
module load cmake/3.18.4
# Check the loaded cmake path
which cmake

7.1.3.4 Viewing Loaded Modules

module list

7.1.3.5 Unloading Software

# Unload a specific software environment
module unload <module_file>

# Unload all loaded software environments
module purge

7.1.3.6 Module Help

module help

FAQ

See FAQ.

🤖 AI 助手
💬 快速提问 ×

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