p-doom/crowd-code-dataset-0.2 huggingface dataset:
[content] build_uv.sh (shellscript)
    
# =============================================================================
# Create a Unified CUDA Home (The "Symlink Farm")
# =============================================================================
# PyTorch extensions (TransformerEngine, Apex) require a "Monolithic" CUDA layout.
# PyPI splits headers across multiple packages (runtime vs nvcc).
# We must recursively merge them into a single directory to fix relative includes.
# =============================================================================

SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])")
NVIDIA_PATH="$SITE_PACKAGES/nvidia"
export CUDA_HOME="$BASE_DIR/miles-venv/cuda_home"

echo "Creating unified CUDA_HOME at $CUDA_HOME..."
# Ensure clean start to avoid stale links
rm -rf "$CUDA_HOME"
mkdir -p "$CUDA_HOME/include" "$CUDA_HOME/lib" "$CUDA_HOME/bin" "$CUDA_HOME/nvvm/libdevice"

# Function to recursively symlink files (merging directories)
# This prevents one package's folder from replacing another's
create_symlinks() {
    src="$1"
    dest="$2"
    if [ -d "$src" ]; then
        pushd "$src" > /dev/null
        # Replicate directory structure
        find . -type d -exec mkdir -p "$dest/{}" \;
        # Symlink files
        find . -type f -exec ln -sf "$src/{}" "$dest/{}" \;
        popd > /dev/null
    fi
}

# 1. Merge standard directories from all nvidia packages
for pkg in cuda_nvcc cuda_runtime cuda_cupti cuda_nvrtc cuda_cccl cudnn nccl; do
    create_symlinks "$NVIDIA_PATH/$pkg/include" "$CUDA_HOME/include"
    create_symlinks "$NVIDIA_PATH/$pkg/lib"     "$CUDA_HOME/lib"
    create_symlinks "$NVIDIA_PATH/$pkg/bin"     "$CUDA_HOME/bin"
    
    # Some packages (like cudnn sometimes) put libs in lib64 or directly in the root
    if [ -d "$NVIDIA_PATH/$pkg/lib64" ]; then
        create_symlinks "$NVIDIA_PATH/$pkg/lib64" "$CUDA_HOME/lib"
    fi
done

# 2. Fix NVVM (libdevice) path
# nvcc expects ../nvvm/libdevice/libdevice.10.bc relative to its bin location
# In pip wheels, this is buried in nvidia/cuda_nvcc/nvvm
create_symlinks "$NVIDIA_PATH/cuda_nvcc/nvvm" "$CUDA_HOME/nvvm"

# =============================================================================
# Export Paths based on the new Unified Home
# =============================================================================
export PATH="$CUDA_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$CUDA_HOME/lib:$LD_LIBRARY_PATH"
export CPATH="$CUDA_HOME/include:$CPATH"
export LIBRARY_PATH="$CUDA_HOME/lib:$LIBRARY_PATH"

# Sanity Check
if [ ! -f "$CUDA_HOME/include/crt/host_defines.h" ]; then
    echo "CRITICAL ERROR: crt/host_defines.h is missing."
    echo "The symlink merge failed. Installation will likely fail."
    exit 1
fi
[content] build_uv.sh (shellscript)

# =============================================================================
# Install PyTorch with CUDA 12.9 (bundled CUDA runtime)
# =============================================================================
echo "Installing PyTorch with CUDA 12.9..."
# Pin cuda-python to avoid installing cuda 13.0 for sglang
uv pip install cuda-python==12.9.1
uv pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu129
[content] build_uv.sh (shellscript)
uv pip install \
    "cuda-toolkit==12.9.1" \
    nvidia-cusparse-cu12 \
    nvidia-cublas-cu12 \
    nvidia-cufft-cu12 \
    nvidia-cusolver-cu12 \
    nvidia-curand-cu12 \
    nvidia-cudnn-cu12 \
    nvidia-nccl-cu12 \
    nvidia-nvtx-cu12
[content] build_uv.sh (shellscript)
NVCC_APPEND_FLAGS="--threads 4" \
APEX_CPP_EXT=1 \
APEX_CUDA_EXT=1 \
APEX_PARALLEL_BUILD=8 \
uv pip install -v --no-cache-dir \
    --no-build-isolation \
    git+https://github.com/NVIDIA/apex.git@10417aceddd7d5d05d7cbf7b0fc2daad1105f8b4