This directory contains utility scripts for building, testing, and managing the TileXR project.
Purpose: Core environment configuration script that must be sourced before any build or test operations.
Usage:
source scripts/common_env.shWhat it does:
- Sets
TILEXR_HOME,TILEXR_CANN_HOME,TILEXR_TEMP_HOME - Detects CPU architecture (
TILEXR_OS_ARCH) - Detects SOC name and device count
- Configures CANN version (default: 9.1.0)
- Sets up PATH and LD_LIBRARY_PATH for CANN toolkit
Environment variables:
TILEXR_CANN_VER: CANN version (9.1.0, 9.0.0-beta.1, 8.5.0)TILEXR_SOC_NAME: Detected chip name (Ascend910B, etc.)TILEXR_HOME: Repository root directory
Purpose: Utility functions used by other scripts.
Functions:
soc_name: Detect NPU chip typeops_name: Get operator package namedevice_count: Count available NPU devices
Purpose: Download and install CANN toolkit from Huawei OBS.
Usage:
bash scripts/cann_download_install.shWhat it does:
- Downloads CANN toolkit, kernels, and nnae packages
- Installs to
${TILEXR_CANN_HOME} - Configures environment variables
Requirements: Root user, internet connection
Purpose: Install CANN from local packages (if already downloaded).
Usage:
bash scripts/cann_local_install.shPurpose: Download fixed-version source archives used by prepare.sh.
Usage:
bash scripts/download_open_source_deps.sh
bash scripts/download_open_source_deps.sh --checkWhat it does:
- Downloads archives into
3rdparty/open_source/ - Verifies every archive with SHA256
- Reuses valid existing archives
Purpose: Build and install hcomm submodule.
Usage:
bash scripts/hcomm_build_install.shWhat it does:
- Builds
3rdparty/hcomm - Installs to
3rdparty/hcomm/install
Purpose: Clean rebuild of hcomm (removes build directory first).
Usage:
bash scripts/hcomm_clean_build_install.shPurpose: Install pre-built hcomm binaries.
Usage:
bash scripts/hcomm_local_install.shPurpose: Build ops-transformer and run operators.
Usage:
bash scripts/ops_build_run.shWhat it does:
- Builds
3rdparty/ops-transformer - Runs operator tests
- Generates operator binaries
Purpose: Run ops-transformer operators without rebuilding.
Usage:
bash scripts/ops_only_run.shUse case: After modifying operator code, quickly test without full rebuild.
Purpose: Run operator test suite.
Usage:
bash scripts/run_ops_test.shPurpose: Build HCCL test suite.
Usage:
bash scripts/test_build.shPurpose: Run AllReduce collective communication test.
Usage:
bash scripts/test_allreduce.shWhat it does:
- Launches multi-rank test via mpirun
- Tests AllReduce operation across NPU devices
Purpose: Filter and search device logs.
Usage:
bash scripts/plog_grep.sh <pattern>Examples:
bash scripts/plog_grep.sh ERROR # Find all errors
bash scripts/plog_grep.sh WARNING # Find warnings
bash scripts/plog_grep.sh "AllGather" # Search for specific operationLog location: /var/log/npu/plog/
Purpose: Test NPU device connectivity.
Usage:
bash scripts/device_connect.shPurpose: Fix common NPU driver issues.
Usage:
bash scripts/driver_fix.shWhat it does:
- Resets NPU devices
- Clears driver state
Requirements: Root user
Purpose: Monitor NPU device status in real-time.
Usage:
bash scripts/watch.shPurpose: Complete first-time setup script.
Usage:
bash scripts/prepare.shWhat it does:
- Runs CANN installation
- Builds all dependencies (hcomm, ops-transformer)
- Sets up environment
Use case: First-time repository setup
# 1. Install CANN
bash scripts/cann_download_install.sh
# 2. Build dependencies
bash scripts/hcomm_build_install.sh
bash scripts/ops_build_run.sh
# 3. Build TileXR
source scripts/common_env.sh
mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=../install ..
make -j$(nproc) && make installbash scripts/prepare.sh# Source environment
source scripts/common_env.sh
# Rebuild operators after changes
bash scripts/ops_only_run.sh
# Run tests
bash scripts/test_allreduce.sh
# Check logs
bash scripts/plog_grep.sh ERROR# Check device status
bash scripts/device_connect.sh
# Monitor devices
bash scripts/watch.sh
# Fix driver issues
bash scripts/driver_fix.sh
# Search logs
bash scripts/plog_grep.sh "your_search_term"- Root user required: Most scripts need root access for NPU device operations
- Source common_env.sh: Always source before building or testing
- CANN version: Default is 9.1.0, configurable via
TILEXR_CANN_VER - Submodules: Ensure
git submodule update --init --recursivehas been run