Files
mines/rin/miner/hip-output/build-hip-linux.sh
Dobromir Popov c5be4c88c1 rockm
2025-09-05 13:22:21 +03:00

92 lines
2.2 KiB
Bash

#!/bin/bash
# RinHash HIP Build Script for Linux
# This script builds the HIP implementation of RinHash for AMD GPUs
echo "======================================"
echo " RinHash HIP Miner Build Script"
echo "======================================"
# Check if hipcc is available
if ! command -v hipcc &> /dev/null; then
echo "ERROR: hipcc not found in PATH"
echo "Please install ROCm/HIP toolkit"
echo "On Ubuntu/Debian: sudo apt install rocm-dev hip-runtime-amd"
echo "Or download from: https://rocm.docs.amd.com/en/latest/deploy/linux/quick_start.html"
exit 1
fi
echo "HIP compiler found:"
hipcc --version
echo ""
# Check if cmake is available
if ! command -v cmake &> /dev/null; then
echo "ERROR: CMake not found in PATH"
echo "Please install cmake: sudo apt install cmake"
exit 1
fi
echo "CMake found:"
cmake --version | head -1
echo ""
echo "Building RinHash HIP miner..."
echo ""
# Create build directory
mkdir -p build
cd build
# Configure with CMake
cmake -G "Ninja" \
-DHIP_PLATFORM=amd \
-DCMAKE_BUILD_TYPE=Release \
..
if [ $? -ne 0 ]; then
echo "CMake configuration failed!"
echo "Trying without Ninja..."
cmake -DHIP_PLATFORM=amd \
-DCMAKE_BUILD_TYPE=Release \
..
if [ $? -ne 0 ]; then
echo "CMake configuration failed completely!"
exit 1
fi
fi
# Build
cmake --build . -j$(nproc)
if [ $? -eq 0 ]; then
echo ""
echo "======================================"
echo " BUILD SUCCESSFUL!"
echo "======================================"
echo ""
echo "Executable created:"
echo " build/rinhash-hip-miner"
echo ""
echo "To test the miner:"
echo " cd build && ./rinhash-hip-miner --help"
echo ""
echo "To check AMD GPU availability:"
echo " rocm-smi"
echo ""
else
echo ""
echo "======================================"
echo " BUILD FAILED!"
echo "======================================"
echo ""
echo "Common issues:"
echo "1. Missing ROCm development libraries"
echo "2. Incompatible HIP version"
echo "3. Missing development tools"
echo ""
exit 1
fi
echo "Build completed successfully!"