87 lines
2.3 KiB
Bash
87 lines
2.3 KiB
Bash
#!/bin/bash
|
|
# Build script for RinHash HIP implementation using Docker
|
|
# This script builds the HIP miner in a containerized ROCm environment
|
|
|
|
echo "================================================"
|
|
echo " RinHash HIP/ROCm Linux Docker Build Script"
|
|
echo "================================================"
|
|
|
|
# Check if Docker is available
|
|
if ! command -v docker &> /dev/null; then
|
|
echo "ERROR: Docker not found in PATH"
|
|
echo "Please install Docker first"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Docker found:"
|
|
docker --version
|
|
echo ""
|
|
|
|
# Build directory setup
|
|
BUILD_DIR="$(dirname "$0")"
|
|
cd "$BUILD_DIR" || exit 1
|
|
|
|
echo "Building Docker image for HIP/ROCm compilation..."
|
|
echo ""
|
|
|
|
# Build the Docker image
|
|
sudo docker build -f Dockerfile.hip-linux -t rinhash-hip-builder .
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo ""
|
|
echo "==============================================="
|
|
echo " DOCKER BUILD FAILED!"
|
|
echo "==============================================="
|
|
echo ""
|
|
echo "Common issues:"
|
|
echo "1. Docker not properly installed"
|
|
echo "2. Insufficient permissions"
|
|
echo "3. Network connectivity issues"
|
|
echo "4. ROCm base image not available"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Docker image built successfully!"
|
|
echo ""
|
|
|
|
# Create output directory
|
|
mkdir -p hip-output
|
|
|
|
echo "Running container to build HIP binaries..."
|
|
echo ""
|
|
|
|
# Run the container and extract binaries
|
|
sudo docker run --rm \
|
|
-v "$(pwd)/hip-output:/output" \
|
|
rinhash-hip-builder
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "==============================================="
|
|
echo " BUILD SUCCESSFUL!"
|
|
echo "==============================================="
|
|
echo ""
|
|
echo "Binaries created in hip-output/:"
|
|
ls -la hip-output/
|
|
echo ""
|
|
echo "To test the miner (requires AMD GPU with ROCm):"
|
|
echo " ./hip-output/rinhash-hip-miner --help"
|
|
echo ""
|
|
echo "Note: To run on AMD GPU, you'll need ROCm runtime installed:"
|
|
echo " sudo apt install rocm-dev hip-runtime-amd"
|
|
echo ""
|
|
else
|
|
echo ""
|
|
echo "==============================================="
|
|
echo " BUILD FAILED!"
|
|
echo "==============================================="
|
|
echo ""
|
|
echo "Check the error messages above for details."
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
echo "HIP build completed successfully!"
|