From 27c5bdbb5cfa088dc978db9f28c1bc636595ee8b Mon Sep 17 00:00:00 2001 From: Jeroen Ubbink Date: Tue, 14 Jul 2026 09:28:04 +0200 Subject: [PATCH] Fix build with CUDA 13.1 and newer glibc nvcc's crt/math_functions.h declares rsqrt/rsqrtf without noexcept, which conflicts with glibc >= 2.39's C23 rsqrt declaration (pulled in via the _GNU_SOURCE that g++ defines by default), causing a hard compile error. Compile GPURummage.cu with -Xcompiler -U_GNU_SOURCE to avoid the conflict. Also make CUDA and CCAP overridable (?=) instead of hardcoded, and default CUDA to /usr/local/cuda so the Makefile isn't pinned to one toolkit version. Verified: builds cleanly against CUDA 13.1 and successfully mines matching npub addresses on an RTX 5070 Ti (CCAP=120). Co-Authored-By: Claude Sonnet 5 --- Makefile | 6 +++--- docs/BUILD.md | 24 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 75b5fda..5d53e79 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ OBJET = $(addprefix $(OBJDIR)/, \ rummage.o \ ) -CCAP = 86 -CUDA = /usr/local/cuda-11.8 +CCAP ?= 86 +CUDA ?= /usr/local/cuda CXX = g++ CXXCUDA = /usr/bin/g++ @@ -42,7 +42,7 @@ NVCC = $(CUDA)/bin/nvcc all: rummage $(OBJDIR)/GPU/GPURummage.o: $(SRCDIR)/GPU/GPURummage.cu - $(NVCC) -allow-unsupported-compiler --compile --compiler-options -fPIC -ccbin $(CXXCUDA) -m64 -O2 -I$(SRCDIR) -I$(CUDA)/include \ + $(NVCC) -allow-unsupported-compiler --compile --compiler-options -fPIC -Xcompiler -U_GNU_SOURCE -ccbin $(CXXCUDA) -m64 -O2 -I$(SRCDIR) -I$(CUDA)/include \ -DNOSTR_BLOCKS_PER_GRID=$(NOSTR_BLOCKS_PER_GRID) \ -DNOSTR_THREADS_PER_BLOCK=$(NOSTR_THREADS_PER_BLOCK) \ -DKEYS_PER_THREAD_BATCH=$(KEYS_PER_THREAD_BATCH) \ diff --git a/docs/BUILD.md b/docs/BUILD.md index 7db9fb9..afaa8bb 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -9,7 +9,7 @@ For known good configurations and performance results, see [PERFORMANCE.md](PERF ### Linux (CUDA) **Required:** -- CUDA Toolkit (11.x or 12.x) +- CUDA Toolkit (11.x, 12.x, or 13.x) - GMP library (GNU Multiple Precision) - g++ compiler @@ -112,6 +112,7 @@ CCAP = 86 ``` **Common compute capabilities:** +- RTX 50-series (Blackwell): `120` - RTX 40-series (Ada): `89` - RTX 30-series (Ampere): `86` - RTX 20-series (Turing): `75` @@ -120,13 +121,17 @@ CCAP = 86 Find your GPU's compute capability at: https://developer.nvidia.com/cuda-gpus +`CCAP` can also be overridden without editing the Makefile, e.g. `make CCAP=120`. + ## CUDA Installation Path -Update the CUDA path if installed in a non-standard location: +The Makefile defaults to `CUDA = /usr/local/cuda`, which is normally a symlink to +whichever version you last installed. If you have multiple CUDA versions installed +and need a specific one, override it on the command line instead of editing the +Makefile: -**In Makefile, line 21:** -```make -CUDA = /usr/local/cuda-11.8 +```bash +make CUDA=/usr/local/cuda-11.8 ``` Check your CUDA version: @@ -134,6 +139,15 @@ Check your CUDA version: nvcc --version ``` +**Newer glibc (2.39+) build error:** +``` +error: exception specification is incompatible with that of previous function "rsqrt" +``` +This happens because recent glibc versions declare `rsqrt`/`rsqrtf` (C23 extensions) +with a different exception specification than CUDA's `math_functions.h`. The Makefile +already compiles `GPURummage.cu` with `-Xcompiler -U_GNU_SOURCE` to avoid pulling in +those glibc declarations, which resolves the conflict on CUDA 11.8 through 13.x. + ## GPU Performance Tuning For optimal performance, tune these parameters in the Makefile: