wip- to clean
This commit is contained in:
94
rin/miner/Dockerfile.rocm-complete
Normal file
94
rin/miner/Dockerfile.rocm-complete
Normal file
@@ -0,0 +1,94 @@
|
||||
# Complete Dockerfile for building RinHash with ROCm GPU support and cpuminer integration
|
||||
FROM rocm/dev-ubuntu-22.04:5.7-complete
|
||||
|
||||
# Install build tools and dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
git \
|
||||
wget \
|
||||
curl \
|
||||
pkg-config \
|
||||
autotools-dev \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
libcurl4-openssl-dev \
|
||||
libjansson-dev \
|
||||
libssl-dev \
|
||||
libgmp-dev \
|
||||
zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set environment variables for ROCm
|
||||
ENV ROCM_PATH=/opt/rocm
|
||||
ENV HIP_PATH=/opt/rocm
|
||||
ENV PATH=$PATH:/opt/rocm/bin
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib
|
||||
|
||||
# Create build directories
|
||||
WORKDIR /build
|
||||
|
||||
# Copy RinHash HIP source files
|
||||
COPY gpu/RinHash-hip/ /build/rinhash-hip/
|
||||
|
||||
# Copy cpuminer source files
|
||||
COPY cpuminer/cpuminer-opt-rin/ /build/cpuminer/
|
||||
|
||||
# Build RinHash HIP library first
|
||||
WORKDIR /build/rinhash-hip
|
||||
RUN mkdir -p build && \
|
||||
cd build && \
|
||||
cmake -G "Ninja" \
|
||||
-DHIP_PLATFORM=amd \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
.. && \
|
||||
cmake --build . -j$(nproc) && \
|
||||
cmake --install .
|
||||
|
||||
# Create shared library for cpuminer integration
|
||||
RUN cd /build/rinhash-hip && \
|
||||
hipcc -shared -fPIC -O3 \
|
||||
-I. \
|
||||
rinhash.hip.cu sha3-256.hip.cu \
|
||||
-o /usr/local/lib/librinhash_hip.so \
|
||||
-lhip_hcc -lhip_device
|
||||
|
||||
# Build cpuminer with ROCm support
|
||||
WORKDIR /build/cpuminer
|
||||
|
||||
# Configure cpuminer
|
||||
RUN ./autogen.sh && \
|
||||
./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer" \
|
||||
CPPFLAGS="-I/usr/local/include" \
|
||||
LDFLAGS="-L/usr/local/lib -lrinhash_hip"
|
||||
|
||||
# Build cpuminer
|
||||
RUN make -j$(nproc)
|
||||
|
||||
# Create output directory
|
||||
RUN mkdir -p /output
|
||||
|
||||
# Copy built binaries to output
|
||||
RUN cp cpuminer /output/ && \
|
||||
cp /usr/local/lib/librinhash_hip.so /output/ && \
|
||||
cp /usr/local/bin/rinhash-hip-miner /output/ 2>/dev/null || true
|
||||
|
||||
# Create a simple test script
|
||||
RUN echo '#!/bin/bash\n\
|
||||
echo "Testing ROCm GPU support..."\n\
|
||||
if command -v rocm-smi &> /dev/null; then\n\
|
||||
echo "ROCm devices found:"\n\
|
||||
rocm-smi --showid\n\
|
||||
else\n\
|
||||
echo "ROCm runtime not available - GPU acceleration disabled"\n\
|
||||
fi\n\
|
||||
echo "Available algorithms:"\n\
|
||||
./cpuminer --help | grep -A 20 "algorithms:"\n\
|
||||
' > /output/test-rocm.sh && chmod +x /output/test-rocm.sh
|
||||
|
||||
# Default command
|
||||
CMD ["sh", "-c", "echo 'Build completed successfully! Binaries available in /output/' && ls -la /output/"]
|
||||
|
Reference in New Issue
Block a user