Skip to main content

Module env_setup

Module env_setup 

Source
Expand description

enhanced_setup_environment.sh equivalent — GPU filtering, system deps, env file, ROCm optimization.

Ports scripts/enhanced_setup_environment.sh (1411 lines) to native Rust. This is the most complex bootstrap script, handling:

  • GPU detection and filtering (discrete vs integrated)
  • System dependency checking (kernel, ROCm, packages, Python)
  • Environment file creation (~/.mlstack_env)
  • ROCm optimization settings (HSA_OVERRIDE_GFX_VERSION, MIOpen, channel selection)

§Validation Assertions

  • VAL-VBA-014: GPU filtering detects AMD GPUs via ROCm, sets HIP_VISIBLE_DEVICES
  • VAL-VBA-015: System dependency checking covers kernel, ROCm, packages, Python
  • VAL-VBA-016: Environment file creation produces shell-sourceable ~/.mlstack_env
  • VAL-VBA-017: ROCm optimization: HSA_OVERRIDE_GFX_VERSION, ROCM_MATH_LIBS, MIOPEN_DEBUG, channel selection

Structs§

DependencyCheckResult
Result of checking a single system dependency.
EnvFileResult
Result of environment file creation.
GpuArchInfo
GPU architecture information detected from the system.
GpuFilterResult
Result of GPU detection and filtering.
SystemDependency
A system dependency to check.

Functions§

check_all_dependencies
Check all required system dependencies.
check_system_dependency
Check a single system dependency.
create_env_file
Create the ~/.mlstack_env file with all required variables.
detect_correct_gpu_arch
Detect the correct GPU architecture from marketing name.
detect_discrete_gpus
Detect discrete AMD GPUs, filtering out integrated GPUs.
generate_env_file_content
Generate the environment file content.
generate_fish_env_file_content
Generate a fish-compatible environment file.
is_integrated_gpu_name
Check if a GPU name indicates an integrated GPU.
rocm_version_is_therock
True when version is a TheRock-based ROCm runtime (7.14+ or 10.x+).
setup_environment
Run the complete enhanced setup environment.