This commit is contained in:
Dobromir Popov
2025-09-08 01:38:23 +03:00
parent 2d2653551b
commit 9a2d14de90
10 changed files with 545 additions and 17 deletions

View File

@@ -5,7 +5,7 @@
### Prerequisites
```bash
sudo apt update
sudo apt install build-essential autotools-dev autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev zlib1g-dev git automake libtool
sudo apt install build-essential autotools-dev autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev zlib1g-dev git automake libtool docker.io
```
### 1. Build GPU Library (ROCm/HIP)
@@ -15,7 +15,7 @@ cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner/gpu/RinHash-hip
# Compile GPU kernel
/opt/rocm-6.4.3/bin/hipcc -c -O3 -fPIC rinhash.hip.cu -o build/rinhash.o
# Compile SHA3 component
# Compile SHA3 component
/opt/rocm-6.4.3/bin/hipcc -c -O3 -fPIC sha3-256.hip.cu -o build/sha3-256.o
# Link shared library
@@ -26,7 +26,18 @@ sudo cp rocm-direct-output/gpu-libs/librinhash_hip.so /usr/local/lib/
sudo ldconfig
```
### 2. Build CPU Miner
### 2. Build Windows CPU Miner (Docker Cross-Compilation)
```bash
cd /home/db/Downloads/rinhash/cpuminer-opt-rin
# Build Windows executable using Docker (recommended method)
sudo docker run --rm -v "$(pwd):/work" -v "$(pwd)/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean && rm -rf Makefile Makefile.in configure config.* && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64 -DNO_CURL' LDFLAGS='-static' && make -j4 && cp cpuminer.exe /output/"
# Verify build success
ls -la build/win/cpuminer.exe
```
### 3. Alternative: Build Linux CPU Miner
```bash
cd /home/db/Downloads/rinhash/cpuminer-opt-rin
@@ -53,25 +64,148 @@ make clean && make
## 📊 Expected Performance
| Algorithm | Threads | Expected Hash Rate |
|-----------|---------|-------------------|
| `rinhash` (CPU) | 4 | ~200-400 H/s |
| `rinhashgpu` (GPU) | 4 | ~800-1200 H/s |
| Algorithm | Platform | Threads | Expected Hash Rate |
|-----------|----------|---------|-------------------|
| `rinhash` (CPU) | Linux | 4 | ~200-400 H/s |
| `rinhash` (CPU) | Windows | 4 | ~180-360 H/s |
| `rinhashgpu` (GPU) | Linux | 4 | ~800-1200 H/s |
| `rinhashgpu` (GPU) | Windows | 4 | ~700-1000 H/s |
## 🔧 Build Files
### Linux
**GPU Library**: `/usr/local/lib/librinhash_hip.so` (252KB)
**CPU Miner**: `./cpuminer` (executable)
### Windows
**CPU Miner**: `cpuminer.exe` (executable)
**GPU Library**: `librinhash_cuda.dll` (if CUDA build)
**Dependencies**: Various `.dll` files (libcurl, jansson, etc.)
## 🚨 Troubleshooting
### Linux Issues
- **GPU not found**: Check ROCm installation at `/opt/rocm-6.4.3/`
- **Library missing**: Run `sudo ldconfig` after installing
- **Compilation errors**: Install missing dependencies listed above
- **Segmentation fault**: Use simple algorithms without load control
### Windows Issues
- **MSYS2 issues**: Use MinGW 64-bit terminal, not regular MSYS2
- **CUDA not found**: Install CUDA Toolkit and Visual Studio Build Tools
- **Missing DLLs**: Include required DLL files when distributing
- **Performance**: Windows may have 10-20% lower performance than Linux
- **Build failures**: Ensure Visual Studio Build Tools are installed for CUDA
## 🪟 Windows Build Instructions
### Prerequisites for Windows
#### Option 1: Docker Desktop (Easiest - Recommended)
```bash
# Install Docker Desktop for Windows from https://www.docker.com/products/docker-desktop
# Make sure Docker Desktop is running
```
#### Option 2: MSYS2 (Advanced)
```bash
# Download and install MSYS2 from https://www.msys2.org/
# Open MSYS2 MinGW 64-bit terminal and run:
pacman -Syu
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-curl mingw-w64-x86_64-jansson mingw-w64-x86_64-openssl mingw-w64-x86_64-gmp mingw-w64-x86_64-zlib mingw-w64-x86_64-autotools mingw-w64-x86_64-pkg-config
```
### Windows CPU Miner Build
#### Using Docker from Windows (Recommended)
```powershell
# Open PowerShell or Command Prompt in Windows
cd C:\path\to\your\rinhash\cpuminer-opt-rin
# Build Windows executable using Docker (NO_CURL fallback for networking)
docker run --rm -v "${PWD}:/work" -v "${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean && rm -rf Makefile Makefile.in configure config.* && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64 -DNO_CURL' LDFLAGS='-static' && make -j4 && cp cpuminer.exe /output/"
# Verify build success
dir build\win\cpuminer.exe
```
```cmd
REM Alternative Windows Command Prompt version
cd C:\path\to\your\rinhash\cpuminer-opt-rin
docker run --rm -v "%CD%:/work" -v "%CD%/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean && rm -rf Makefile Makefile.in configure config.* && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64 -DNO_CURL' LDFLAGS='-static' && make -j4 && cp cpuminer.exe /output/"
dir build\win\cpuminer.exe
```
#### Using Docker from Linux Host
```bash
# Cross-compile for Windows
cd /home/db/Downloads/rinhash/cpuminer-opt-rin
sudo docker run --rm -v "$(pwd):/work" -v "$(pwd)/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean && rm -rf Makefile Makefile.in configure config.* && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64 -DNO_CURL' LDFLAGS='-static' && make -j4 && cp cpuminer.exe /output/"
```
#### Using MSYS2 (Advanced)
```bash
# Open MSYS2 MinGW 64-bit terminal
cd /c/path/to/mines/rin/miner/cpuminer-opt-rin
# Configure and build
./autogen.sh
./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer"
make -j$(nproc)
```
### Windows GPU Build Options
#### CUDA Build (NVIDIA GPUs)
```bash
# Prerequisites: Install CUDA Toolkit and Visual Studio
cd gpu/RinHash-cuda
build-cuda.bat
```
#### ROCm Build (AMD GPUs) - Limited Support
```bash
# Note: ROCm on Windows has limited support
# Consider using WSL2 with ROCm instead
cd gpu/RinHash-hip
# Use Linux build instructions in WSL2
```
### Windows Testing
#### CPU Only (NO_CURL Direct Socket)
```cmd
REM Navigate to build directory
cd C:\path\to\rinhash\cpuminer-opt-rin\build\win
REM Test CPU mining (direct socket connection, no curl dependency)
cpuminer.exe -a rinhash -o stratum+tcp://192.168.0.188:3333 -u db.test -p x -t 4
```
#### GPU Accelerated (if available)
```cmd
REM Test GPU mining (requires GPU library)
cpuminer.exe -a rinhashgpu -o stratum+tcp://192.168.0.188:3333 -u db.test -p x -t 1
```
#### Production Mining (Zergpool Example)
```cmd
REM Real mining pool example
cpuminer.exe -a rinhash -o stratum+tcp://rinhash.mine.zergpool.com:7148 -u bc1qjn4m6rmrveuxhk02a5qhe4r6kdcsvvt3vhdn9j -p c=BTC,mc=RIN,ID=StrixHalo -t 8
```
#### Debugging Network Issues
```cmd
REM Enable verbose logging to debug connection issues
cpuminer.exe -a rinhash -o stratum+tcp://pool.example.com:3333 -u test -p x -t 1 -D
```
## 📝 Notes
- GPU implementation uses 4 blocks × 256 threads = 1024 GPU threads
- Automatic fallback to CPU if GPU library unavailable
- Thread count (`-t`) affects CPU threads, not GPU load directly
- Windows builds are primarily for CPU mining; GPU support is limited