86 lines
2.1 KiB
Bash
86 lines
2.1 KiB
Bash
#!/bin/bash
|
|
# Build script for RinHash CUDA implementation using Docker
|
|
# This script builds the CUDA miner in a containerized environment
|
|
|
|
echo "================================================"
|
|
echo " RinHash CUDA 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 CUDA compilation..."
|
|
echo ""
|
|
|
|
# Build the Docker image
|
|
docker build -f Dockerfile.cuda-linux -t rinhash-cuda-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 (try with sudo)"
|
|
echo "3. Network connectivity issues"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Docker image built successfully!"
|
|
echo ""
|
|
|
|
# Create output directory
|
|
mkdir -p cuda-output
|
|
|
|
echo "Running container to build CUDA binaries..."
|
|
echo ""
|
|
|
|
# Run the container and extract binaries
|
|
docker run --rm \
|
|
-v "$(pwd)/cuda-output:/output" \
|
|
rinhash-cuda-builder
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "==============================================="
|
|
echo " BUILD SUCCESSFUL!"
|
|
echo "==============================================="
|
|
echo ""
|
|
echo "Binaries created in cuda-output/:"
|
|
ls -la cuda-output/
|
|
echo ""
|
|
echo "To test the miner (requires NVIDIA GPU):"
|
|
echo " ./cuda-output/test_miner"
|
|
echo ""
|
|
echo "To run the miner:"
|
|
echo " ./cuda-output/rinhash-cuda-miner"
|
|
echo ""
|
|
else
|
|
echo ""
|
|
echo "==============================================="
|
|
echo " BUILD FAILED!"
|
|
echo "==============================================="
|
|
echo ""
|
|
echo "Check the error messages above for details."
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
echo "CUDA build completed successfully!"
|