fix: Update documentation for miner-cuda plugin and improve build instructions

This commit is contained in:
snider 2025-12-31 01:53:44 +00:00
parent 9592971678
commit dd8a1807c5

View file

@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview
xmrig-cuda is a CUDA plugin for XMRig cryptocurrency miner, providing NVIDIA GPU acceleration. It compiles to a shared library (`libxmrig-cuda.so` on Linux, `xmrig-cuda.dll` on Windows) that XMRig loads at runtime.
miner-cuda (xmrig-cuda fork) is a CUDA plugin for XMRig cryptocurrency miner, providing NVIDIA GPU acceleration. It compiles to a shared library (`libminer-cuda.so` on Linux, `miner-cuda.dll` on Windows) that XMRig loads at runtime.
## Build Commands
@ -26,11 +26,16 @@ cmake -DWITH_DRIVER_API=OFF ..
# Custom CUDA toolkit path
cmake -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12 ..
# Debug build with register usage and intermediate files
cmake -DCUDA_SHOW_REGISTER=ON -DCUDA_KEEP_FILES=ON ..
# Debug build options
cmake -DCUDA_SHOW_REGISTER=ON .. # Show registers per kernel
cmake -DCUDA_KEEP_FILES=ON .. # Keep intermediate PTX files
cmake -DCUDA_SHOW_CODELINES=ON .. # Enable cuda-gdb/cuda-memcheck line info
# Use clang as CUDA compiler (if available)
cmake -DCUDA_COMPILER=clang ..
```
**Output:** `libxmrig-cuda.so` (Linux) or `xmrig-cuda.dll` + NVRTC DLLs (Windows)
**Output:** `libminer-cuda.so` (Linux) or `miner-cuda.dll` + NVRTC DLLs (Windows)
## Architecture
@ -75,26 +80,37 @@ Automatically configured based on CUDA toolkit version:
| `WITH_RANDOMX` | ON* | RandomX algorithms (*OFF if CUDA < 9.0) |
| `WITH_KAWPOW` | ON* | KawPow/RavenCoin (*requires Driver API) |
| `WITH_CN_R` | ON | CryptoNight-R (*requires Driver API) |
| `WITH_CN_LITE` | ON | CryptoNight-Lite family |
| `WITH_CN_HEAVY` | ON | CryptoNight-Heavy family |
| `WITH_CN_PICO` | ON | CryptoNight-Pico algorithm |
| `WITH_CN_FEMTO` | ON | CryptoNight-UPX2 algorithm |
| `WITH_ARGON2` | OFF | Argon2 family (unsupported) |
| `CUDA_ARCH` | auto | GPU compute capabilities to target |
| `XMRIG_LARGEGRID` | ON | Support >128 CUDA blocks |
| `CUDA_COMPILER` | nvcc | CUDA compiler (nvcc or clang) |
## File Layout
```
src/
├── xmrig-cuda.cpp # Main plugin implementation
├── xmrig-cuda.h # C API header
├── xmrig-cuda.h # C API header (exported functions)
├── cryptonight.h # nvid_ctx struct and GPU context
├── cuda_core.cu # Core CUDA kernels
├── cuda_extra.cu # CUDA utilities
├── CryptonightR.cu # CN-R with runtime compilation
├── crypto/ # Algorithm definitions
├── RandomX/ # RandomX per-coin implementations
├── KawPow/ # KawPow with DAG support
├── cuda_extra.cu # CUDA utilities and memory management
├── CryptonightR.cu # CN-R with runtime NVRTC compilation
├── cuda_*.hpp # Algorithm-specific kernel headers (aes, blake, jh, keccak, groestl, skein)
├── crypto/ # Algorithm definitions and common code
├── common/ # Shared utilities
├── RandomX/ # RandomX per-coin implementations (monero, wownero, arqma, graft, yada)
├── KawPow/ # KawPow with DAG support (raven)
└── 3rdparty/cub/ # NVIDIA CUB library
cmake/
├── CUDA.cmake # CUDA toolchain and arch detection
├── CUDA-Version.cmake # CUDA version detection
└── flags.cmake # Compiler flags
├── CUDA.cmake # CUDA toolchain, arch detection, source lists
├── CUDA-Version.cmake # CUDA version detection and compiler selection
├── flags.cmake # Compiler flags
├── cpu.cmake # CPU architecture detection
└── os.cmake # OS detection
```
## Platform Notes