gpu optimizations

This commit is contained in:
Dobromir Popov
2025-09-06 14:20:19 +03:00
parent a4bc412ca8
commit b475590b61
9 changed files with 491 additions and 210 deletions

77
rin/miner/BUILD_GUIDE.md Normal file
View File

@@ -0,0 +1,77 @@
# RinHash Miner - Simple Build Guide
## 🚀 Quick Build Commands
### 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
```
### 1. Build GPU Library (ROCm/HIP)
```bash
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
/opt/rocm-6.4.3/bin/hipcc -c -O3 -fPIC sha3-256.hip.cu -o build/sha3-256.o
# Link shared library
/opt/rocm-6.4.3/bin/hipcc -shared -O3 build/rinhash.o build/sha3-256.o -o rocm-direct-output/gpu-libs/librinhash_hip.so -L/opt/rocm-6.4.3/lib -lamdhip64
# Install system-wide
sudo cp rocm-direct-output/gpu-libs/librinhash_hip.so /usr/local/lib/
sudo ldconfig
```
### 2. Build CPU Miner
```bash
cd /home/db/Downloads/rinhash/cpuminer-opt-rin
# Configure and build
./autogen.sh
./configure
make
# Or rebuild if already configured:
make clean && make
```
## ✅ Test Mining
### CPU Only
```bash
./cpuminer -a rinhash -o stratum+tcp://192.168.0.188:3333 -u db.test -p x -t 4
```
### GPU Accelerated
```bash
./cpuminer -a rinhashgpu -o stratum+tcp://192.168.0.188:3333 -u db.test -p x -t 4
```
## 📊 Expected Performance
| Algorithm | Threads | Expected Hash Rate |
|-----------|---------|-------------------|
| `rinhash` (CPU) | 4 | ~200-400 H/s |
| `rinhashgpu` (GPU) | 4 | ~800-1200 H/s |
## 🔧 Build Files
**GPU Library**: `/usr/local/lib/librinhash_hip.so` (252KB)
**CPU Miner**: `./cpuminer` (executable)
## 🚨 Troubleshooting
- **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
## 📝 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