100 lines
2.7 KiB
Bash
100 lines
2.7 KiB
Bash
#!/bin/bash
|
|
# RinHash CUDA Build Script for Linux/WSL
|
|
# This script builds the CUDA implementation of RinHash
|
|
|
|
echo "======================================"
|
|
echo " RinHash CUDA Miner Build Script"
|
|
echo "======================================"
|
|
|
|
# Check if NVCC is available
|
|
if ! command -v nvcc &> /dev/null; then
|
|
echo "ERROR: NVCC not found in PATH"
|
|
echo "Please install CUDA Toolkit"
|
|
echo "On Ubuntu/Debian: sudo apt install nvidia-cuda-toolkit"
|
|
echo "Or download from: https://developer.nvidia.com/cuda-downloads"
|
|
exit 1
|
|
fi
|
|
|
|
echo "NVCC found:"
|
|
nvcc --version
|
|
echo ""
|
|
|
|
# Check if gcc/g++ is available
|
|
if ! command -v gcc &> /dev/null; then
|
|
echo "ERROR: GCC not found in PATH"
|
|
echo "Please install build-essential: sudo apt install build-essential"
|
|
exit 1
|
|
fi
|
|
|
|
echo "GCC found:"
|
|
gcc --version | head -1
|
|
echo ""
|
|
|
|
echo "Building RinHash CUDA miner..."
|
|
echo ""
|
|
|
|
# Create output directory
|
|
mkdir -p bin
|
|
|
|
# Compile with NVCC (enable device linking for dynamic parallelism)
|
|
nvcc -O3 -std=c++11 \
|
|
-arch=sm_50 \
|
|
-gencode arch=compute_50,code=sm_50 \
|
|
-gencode arch=compute_52,code=sm_52 \
|
|
-gencode arch=compute_60,code=sm_60 \
|
|
-gencode arch=compute_61,code=sm_61 \
|
|
-gencode arch=compute_70,code=sm_70 \
|
|
-gencode arch=compute_75,code=sm_75 \
|
|
-gencode arch=compute_80,code=sm_80 \
|
|
-gencode arch=compute_86,code=sm_86 \
|
|
-I. \
|
|
rinhash.cu sha3-256.cu \
|
|
-o bin/rinhash-cuda-miner \
|
|
-lcuda -lcudart -lcudadevrt
|
|
|
|
# Also build test program
|
|
echo "Building test program..."
|
|
nvcc -O3 -std=c++11 \
|
|
-arch=sm_50 \
|
|
-gencode arch=compute_50,code=sm_50 \
|
|
-gencode arch=compute_52,code=sm_52 \
|
|
-gencode arch=compute_60,code=sm_60 \
|
|
-gencode arch=compute_61,code=sm_61 \
|
|
-gencode arch=compute_70,code=sm_70 \
|
|
-gencode arch=compute_75,code=sm_75 \
|
|
-gencode arch=compute_80,code=sm_80 \
|
|
-gencode arch=compute_86,code=sm_86 \
|
|
-I. \
|
|
test_miner.cu rinhash.cu sha3-256.cu \
|
|
-o bin/test_miner \
|
|
-lcuda -lcudart -lcudadevrt
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "======================================"
|
|
echo " BUILD SUCCESSFUL!"
|
|
echo "======================================"
|
|
echo ""
|
|
echo "Executables created:"
|
|
echo " - bin/rinhash-cuda-miner (main miner)"
|
|
echo " - bin/test_miner (test program)"
|
|
echo ""
|
|
echo "To test the miner:"
|
|
echo " ./bin/test_miner"
|
|
echo ""
|
|
else
|
|
echo ""
|
|
echo "======================================"
|
|
echo " BUILD FAILED!"
|
|
echo "======================================"
|
|
echo ""
|
|
echo "Common issues:"
|
|
echo "1. Missing CUDA runtime libraries"
|
|
echo "2. Incompatible CUDA version"
|
|
echo "3. Missing development tools"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
echo "Build completed successfully!"
|