docker cuda
This commit is contained in:
59
rin/miner/Dockerfile.cuda-linux
Normal file
59
rin/miner/Dockerfile.cuda-linux
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Dockerfile for building RinHash CUDA implementation on Linux
|
||||||
|
FROM nvidia/cuda:12.2-devel-ubuntu22.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Install build tools and dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
git \
|
||||||
|
wget \
|
||||||
|
curl \
|
||||||
|
pkg-config \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create build directory
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# Copy source files
|
||||||
|
COPY gpu/RinHash-cuda/ /build/
|
||||||
|
|
||||||
|
# Build the CUDA implementation
|
||||||
|
RUN mkdir -p bin && \
|
||||||
|
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
|
||||||
|
|
||||||
|
# Build test program
|
||||||
|
RUN 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
|
||||||
|
|
||||||
|
# Create output directory for built binaries
|
||||||
|
RUN mkdir -p /output
|
||||||
|
|
||||||
|
# Default command to copy binaries to output
|
||||||
|
CMD ["sh", "-c", "cp bin/* /output/ && echo 'Build completed successfully! Binaries copied to /output/'"]
|
||||||
85
rin/miner/build-cuda-linux-docker.sh
Normal file
85
rin/miner/build-cuda-linux-docker.sh
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
#!/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!"
|
||||||
Reference in New Issue
Block a user