xmrig/xmrig-nvidia

Cannot build xmrig nvidia on Ubuntu 22.04

sapmi opened this issue · 4 comments

I have the latest drivers, cuda, and the tool kit. Cmake is fine going smoothly. I am using the following because I had a "gpu arcitechture is not compatible error"

So I cmake:

cmake .. -DCUDA_ARCH="61" -DWITH_HTTPD=OFF -DWITH_AEON=OFF (I have a 1060 so I have 6.1 architecture

then make ...

make - then here is the error

[ 1%] Building NVCC (Device) object CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_extra.cu.o
/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_extra.cu: In function ‘void cryptonight_extra_cpu_prepare(nvid_ctx*, uint32_t, xmrig::Algo, xmrig::Variant)’:
/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_extra.cu:416:182: warning: passing argument 5 to ‘restrict’-qualified parameter aliases with argument 6 [-Wrestrict]
416 | CUDA_CHECK_KERNEL(ctx->device_id, cryptonight_extra_gpu_prepare<xmrig::CRYPTONIGHT, xmrig::VARIANT_AUTO><<<grid, block >>>(wsize, ctx->d_input, ctx->inputlen, startNonce,
| ~~ ^
[ 3%] Building NVCC (Device) object CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_core.cu.o
/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(84): error: identifier "int2float" is undefined
float4::x = int2float(x0.x);
^

/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(220): error: identifier "float_as_int" is undefined
int_as_float(float_as_int(a.x) & b),
^

/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(220): error: identifier "int_as_float" is undefined
int_as_float(float_as_int(a.x) & b),
^

/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(230): error: identifier "float_as_int" is undefined
int_as_float(float_as_int(a.x) | b),
^

/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(230): error: identifier "int_as_float" is undefined
int_as_float(float_as_int(a.x) | b),
^

/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(240): error: identifier "float_as_int" is undefined
int_as_float(float_as_int(a.x) ^ b),
^

/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(240): error: identifier "int_as_float" is undefined
int_as_float(float_as_int(a.x) ^ b),
^

7 errors detected in the compilation of "/home/sapmi/Downloads/xmrig-nvidia/src/nvidia/cuda_core.cu".
CMake Error at xmrig-cuda_generated_cuda_core.cu.o.Release.cmake:280 (message):
Error generating file
/home/sapmi/Downloads/xmrig-nvidia/build/CMakeFiles/xmrig-cuda.dir/src/nvidia/./xmrig-cuda_generated_cuda_core.cu.o

make[2]: *** [CMakeFiles/xmrig-cuda.dir/build.make:77: CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_core.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/xmrig-cuda.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Seems to be a data type error. My drivers may be too new for this?

I have the same exact error on a Debian 12 system running latest:

# cmake -DWITH_HTTPD=OFF -DCUDA_ARCH="80" -DWITH_AEON=OFF ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found UV: /usr/lib/x86_64-linux-gnu/libuv.so  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda (found suitable version "12.4", minimum required is "8.0") 
-- Found NVML: /usr/local/cuda/include  
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.11")  
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Looking for syslog.h
-- Looking for syslog.h - found
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/xmrig-nvidia/build
# make
[  1%] Building NVCC (Device) object CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_extra.cu.o
/opt/xmrig-nvidia/src/nvidia/cuda_extra.cu: In function ‘void cryptonight_extra_cpu_prepare(nvid_ctx*, uint32_t, xmrig::Algo, xmrig::Variant)’:
/opt/xmrig-nvidia/src/nvidia/cuda_extra.cu:416:182: warning: passing argument 5 to ‘restrict’-qualified parameter aliases with argument 6 [-Wrestrict]
  416 |         CUDA_CHECK_KERNEL(ctx->device_id, cryptonight_extra_gpu_prepare<xmrig::CRYPTONIGHT, xmrig::VARIANT_AUTO><<<grid, block >>>(wsize, ctx->d_input, ctx->inputlen, startNonce,
      |                                                                                                                                                                                 ~~   ^                            
[  3%] Building NVCC (Device) object CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_core.cu.o
/opt/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(84): error: identifier "int2float" is undefined
    float4::x = int2float(x0.x);
                ^

/opt/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(220): error: identifier "float_as_int" is undefined
    int_as_float(float_as_int(a.x) & b),
                 ^

/opt/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(220): error: identifier "int_as_float" is undefined
    int_as_float(float_as_int(a.x) & b),
    ^

/opt/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(230): error: identifier "float_as_int" is undefined
    int_as_float(float_as_int(a.x) | b),
                 ^

/opt/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(230): error: identifier "int_as_float" is undefined
    int_as_float(float_as_int(a.x) | b),
    ^

/opt/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(240): error: identifier "float_as_int" is undefined
    int_as_float(float_as_int(a.x) ^ b),
                 ^

/opt/xmrig-nvidia/src/nvidia/cuda_cryptonight_gpu.hpp(240): error: identifier "int_as_float" is undefined
    int_as_float(float_as_int(a.x) ^ b),
    ^

7 errors detected in the compilation of "/opt/xmrig-nvidia/src/nvidia/cuda_core.cu".
CMake Error at xmrig-cuda_generated_cuda_core.cu.o.Release.cmake:280 (message):
  Error generating file
  /opt/xmrig-nvidia/build/CMakeFiles/xmrig-cuda.dir/src/nvidia/./xmrig-cuda_generated_cuda_core.cu.o


make[2]: *** [CMakeFiles/xmrig-cuda.dir/build.make:77: CMakeFiles/xmrig-cuda.dir/src/nvidia/xmrig-cuda_generated_cuda_core.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/xmrig-cuda.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
#
# uname -a
Linux MYBOX 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
# dpkg -l | grep -i cuda
ii  cuda-cccl-12-4                                              12.4.99-1                                 amd64        CUDA CCCL
ii  cuda-command-line-tools-12-4                                12.4.0-1                                  amd64        CUDA command-line tools
ii  cuda-compiler-12-4                                          12.4.0-1                                  amd64        CUDA compiler
ii  cuda-crt-12-4                                               12.4.99-1                                 amd64        CUDA crt
ii  cuda-cudart-12-4                                            12.4.99-1                                 amd64        CUDA Runtime native Libraries
ii  cuda-cudart-dev-12-4                                        12.4.99-1                                 amd64        CUDA Runtime native dev links, headers
ii  cuda-cuobjdump-12-4                                         12.4.99-1                                 amd64        CUDA cuobjdump
ii  cuda-cupti-12-4                                             12.4.99-1                                 amd64        CUDA profiling tools runtime libs.
ii  cuda-cupti-dev-12-4                                         12.4.99-1                                 amd64        CUDA profiling tools interface.
ii  cuda-cuxxfilt-12-4                                          12.4.99-1                                 amd64        CUDA cuxxfilt
ii  cuda-documentation-12-4                                     12.4.99-1                                 amd64        CUDA documentation
ii  cuda-driver-dev-12-4                                        12.4.99-1                                 amd64        CUDA Driver native dev stub library
ii  cuda-drivers                                                550.54.14-1                               amd64        CUDA Driver meta-package, branch-agnostic
ii  cuda-drivers-550                                            550.54.14-1                               amd64        CUDA Driver meta-package, branch-specific
ii  cuda-gdb-12-4                                               12.4.99-1                                 amd64        CUDA-GDB
ii  cuda-keyring                                                1.1-1                                     all          GPG keyring for the CUDA repository
ii  cuda-libraries-12-4                                         12.4.0-1                                  amd64        CUDA Libraries 12.4 meta-package
ii  cuda-libraries-dev-12-4                                     12.4.0-1                                  amd64        CUDA Libraries 12.4 development meta-package
ii  cuda-nsight-12-4                                            12.4.99-1                                 amd64        CUDA nsight
ii  cuda-nsight-compute-12-4                                    12.4.0-1                                  amd64        NVIDIA Nsight Compute
ii  cuda-nsight-systems-12-4                                    12.4.0-1                                  amd64        NVIDIA Nsight Systems
ii  cuda-nvcc-12-4                                              12.4.99-1                                 amd64        CUDA nvcc
ii  cuda-nvdisasm-12-4                                          12.4.99-1                                 amd64        CUDA disassembler
ii  cuda-nvml-dev-12-4                                          12.4.99-1                                 amd64        NVML native dev links, headers
ii  cuda-nvprof-12-4                                            12.4.99-1                                 amd64        CUDA Profiler tools
ii  cuda-nvprune-12-4                                           12.4.99-1                                 amd64        CUDA nvprune
ii  cuda-nvrtc-12-4                                             12.4.99-1                                 amd64        NVRTC native runtime libraries
ii  cuda-nvrtc-dev-12-4                                         12.4.99-1                                 amd64        NVRTC native dev links, headers
ii  cuda-nvtx-12-4                                              12.4.99-1                                 amd64        NVIDIA Tools Extension
ii  cuda-nvvm-12-4                                              12.4.99-1                                 amd64        CUDA nvvm
ii  cuda-nvvp-12-4                                              12.4.99-1                                 amd64        CUDA Profiler tools
ii  cuda-opencl-12-4                                            12.4.99-1                                 amd64        CUDA OpenCL native Libraries
ii  cuda-opencl-dev-12-4                                        12.4.99-1                                 amd64        CUDA OpenCL native dev links, headers
ii  cuda-profiler-api-12-4                                      12.4.99-1                                 amd64        CUDA Profiler API
ii  cuda-repo-debian12-12-4-local                               12.4.0-550.54.14-1                        amd64        cuda repository configuration files
ii  cuda-sanitizer-12-4                                         12.4.99-1                                 amd64        CUDA Sanitizer
ii  cuda-toolkit-12-4                                           12.4.0-1                                  amd64        CUDA Toolkit 12.4 meta-package
ii  cuda-toolkit-12-4-config-common                             12.4.99-1                                 all          Common config package for CUDA Toolkit 12.4.
ii  cuda-toolkit-12-config-common                               12.4.99-1                                 all          Common config package for CUDA Toolkit 12.
ii  cuda-toolkit-config-common                                  12.4.99-1                                 all          Common config package for CUDA Toolkit.
ii  cuda-tools-12-4                                             12.4.0-1                                  amd64        CUDA Tools meta-package
ii  cuda-visual-tools-12-4                                      12.4.0-1                                  amd64        CUDA visual tools
ii  libcuda1:amd64                                              550.54.14-1                               amd64        NVIDIA CUDA Driver Library
ii  libcudadebugger1:amd64                                      550.54.14-1                               amd64        NVIDIA CUDA Debugger Library
ii  libcufile-12-4                                              1.9.0.20-1                                amd64        Library for GPU Direct Storage with CUDA 12.4
ii  libcusolver-12-4                                            11.6.0.99-1                               amd64        CUDA solver native runtime libraries
ii  libcusolver-dev-12-4                                        11.6.0.99-1                               amd64        CUDA solver native dev links, headers
ii  libnvcuvid1:amd64                                           550.54.14-1                               amd64        NVIDIA CUDA Video Decoder runtime library
ii  nvidia-cuda-mps                                             550.54.14-1                               amd64        NVIDIA CUDA Multi Process Service (MPS)
#
# lspci -s 01:00.0 -v
01:00.0 VGA compatible controller: NVIDIA Corporation GN20-P0-R-K2 [GeForce RTX 3050 6GB Laptop GPU] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: ASUSTeK Computer Inc. GN20-P0-R-K2 [GeForce RTX 3050 6GB Laptop GPU]
	Physical Slot: 0
	Flags: bus master, fast devsel, latency 0, IRQ 94, IOMMU group 12
	Memory at dc000000 (32-bit, non-prefetchable) [size=16M]
	Memory at 7c00000000 (64-bit, prefetchable) [size=8G]
	Memory at 7e00000000 (64-bit, prefetchable) [size=32M]
	I/O ports at f000 [size=128]
	Expansion ROM at dd000000 [virtual] [disabled] [size=512K]
	Capabilities: [60] Power Management version 3
	Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [78] Express Legacy Endpoint, MSI 00
	Capabilities: [b4] Vendor Specific Information: Len=14 <?>
	Capabilities: [100] Virtual Channel
	Capabilities: [250] Latency Tolerance Reporting
	Capabilities: [258] L1 PM Substates
	Capabilities: [128] Power Budgeting <?>
	Capabilities: [420] Advanced Error Reporting
	Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
	Capabilities: [900] Secondary PCI Express
	Capabilities: [bb0] Physical Resizable BAR
	Capabilities: [c1c] Physical Layer 16.0 GT/s <?>
	Capabilities: [d00] Lane Margining at the Receiver <?>
	Capabilities: [e00] Data Link Feature <?>
	Kernel driver in use: nvidia
	Kernel modules: nvidia

I have tried with those lines and all give the same result:

# cmake -DWITH_HTTPD=OFF -DCUDA_ARCH="87" ..
# cmake -DWITH_HTTPD=OFF -DCUDA_ARCH="86" ..
# cmake -DWITH_HTTPD=OFF -DCUDA_ARCH="80" ..
# cmake -DWITH_HTTPD=OFF -DCUDA_ARCH="80" -DWITH_AEON=OFF ..

Based on https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-compilation I could be using any of sm80, sm86 or sm87 yet none work.

After following the suggestion of @metal3d under xmrig/xmrig-cuda#138 it still did not fixed my issue.

I'm also experiencing this issue. Same exact error output. From what I'm vaguely understanding is it's entirely a fault of the script.

I now use the Nvidia docker image to build and launch xmrig. It avoids installing heavy dependencies inside the system.

Using podman works.