xmrig / xmrig-cuda

NVIDIA CUDA plugin for XMRig miner
GNU General Public License v3.0
365 stars 154 forks source link

Driver does not support CUDA 11.2 API! Update your nVidia driver! #80

Open BobbyBlock opened 3 years ago

BobbyBlock commented 3 years ago

Getting this error every time I run XMRig

Driver does not support CUDA 11.2 API! Update your nVidia driver!
 * CUDA         disabled (no devices)

Driver is up to date as is everything else, this is what I get when running nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.45.01    Driver Version: 455.45.01    CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 970     Off  | 00000000:1D:00.0  On |                  N/A |
|  2%   48C    P8    18W / 163W |    304MiB /  4041MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       500      G   /usr/lib/Xorg                     120MiB |
|    0   N/A  N/A       698      G   /usr/bin/plasmashell              119MiB |
|    0   N/A  N/A      1325      G   ...gAAAAAAAAA --shared-files       14MiB |
|    0   N/A  N/A      1576      G   ...AAAAAAAAA= --shared-files       32MiB |
|    0   N/A  N/A      2647      G   /usr/lib/firefox/firefox            2MiB |
|    0   N/A  N/A      4321      G   /usr/lib/firefox/firefox            2MiB |
+-----------------------------------------------------------------------------+

I'm running a 970 which is still supported by CUDA 11 so I have no idea what the issue is. I know CUDA 11.2 is very new so that may have broke somthing

SourceCodeDeleted commented 3 years ago

I am in the same situtation.

Does the a old version of the API work better? @BobbyBlock

Here is an archive of it. https://developer.nvidia.com/cuda-11.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=deblocal

Spudz76 commented 3 years ago

Your driver clearly says it supports up to 11.1 (nvidia-smi output) So, Compile with the toolkit 11.1 not 11.2 Or await/upgrade to a driver that knows 11.2

zxfrank commented 3 years ago

This is my attempt with cuda 11.2...

cmake .. -DCUDA_LIB=/usr/local/cuda-11.2/lib64 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.2/bin -DCMAKE_C_COMPILER=$(which gcc-8) -DCMAKE_CXX_COMPILER=$(which g++-8)
-- Found CUDA: /usr/local/cuda-11.2/bin (found suitable version "11.2", minimum required is "8.0") 

;  Valid CUDA Toolkit Map:
;   8.x for Fermi/Kepler          /Maxwell/Pascal,
;   9.x for       Kepler          /Maxwell/Pascal/Volta,
;  10.x for       Kepler          /Maxwell/Pascal/Volta/Turing,
;  11.x for       Kepler (in part)/Maxwell/Pascal/Volta/Turing/Ampere

;Reference https://developer.nvidia.com/cuda-gpus#compute for arch and family name

CMake Error at cmake/CUDA.cmake:71 (message):
  Unsupported CUDA architecture '30' specified.  Use CUDA v10.x maximum,
  Kepler (30) was dropped at v11.
Call Stack (most recent call first):
  CMakeLists.txt:76 (include)

-- Configuring incomplete, errors occurred!
See also "xmrig-cuda/build/CMakeFiles/CMakeOutput.log".
See also "xmrig-cuda/build/CMakeFiles/CMakeError.log".

I don't have much time to spend, I'll try later

Spudz76 commented 3 years ago

Do not specify all the CUDA details, only provide the toolkit base location with CUDA_TOOLKIT_ROOT_DIR, the rest is - and should only be - detected by CMake. My build script:

CC=/usr/bin/gcc-8 CXX=/usr/bin/g++-8 \
 cmake /usr/src/xmrig-cuda \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_VERBOSE_MAKEFILE=ON \
  -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2 \
  -DCUDA_VERBOSE_BUILD=ON \
  -DCUDA_ARCH=30\;52 \

It clearly told you what is wrong: image

EDIT: If you don't actually have an arch30 card, then supply the CUDA_ARCH with what card(s) you actually have. Otherwise it will try to add every GPU it knows about which is a waste of time and space.

The main bug is you've put /bin on the end of the actual toolkit root.

jamsoft commented 3 years ago

Could someone upload a compiled 11.2 version?

I've installed the plugin but when I start it always reports that Cuda is disabled. I have a 3090 on the system.

jamsoft commented 3 years ago

Actually, scratch that.

I've got a 3090 with the latest drivers. I've downloaded the 11.1 XRig cuda driver, went through the setup process.

Initially I couldn't get it running. I rebooted, setup the permissions to unblock XRig from the ransomeware policy. Then I removed the config.json file from where XRig.exe lives.

I then executed my batch command I got from my pool homepage and low and behold, CUDA processing kicked in.

So any 30xx card with 11.2 should work fine with the 11.1 Cuda XRig driver.

strategist922 commented 3 years ago

@jamsoft Could you share your compile setting ? thanks in advance. I have both 3090 and 1080ti, cannot find the correct way to compile the library under linxu following is my command.

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DCUDA_VERBOSE_BUILD=ON -DCUDA_ARCH=30 -DCMAKE_C_COMPILER=$(which gcc) -DCMAKE_CXX_COMPILER=$(which g++)

Spudz76 commented 3 years ago

@strategist922 the -DCUDA_ARCH=30 means you've told it to only compile for Kepler cores (like GTX770) and nothing else. So of course that won't ever work for 1080ti (arch 61) or 3090 (arch 86).

Try with -DCUDA_ARCH=61\;86 and then it will be able to drive those cards.

Also to force compiler use environment var prefixing of CC=$(which gcc) CXX=$(which g++) cmake .. -D(and so on) instead of the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER

My build script for Cuda11.0 and 1060 (arch 61)

CC=/usr/bin/gcc-9 CXX=/usr/bin/g++-9 \
 cmake /usr/src/xmrig-cuda \
  -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.0 \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_VERBOSE_MAKEFILE=ON \
  -DCUDA_VERBOSE_BUILD=ON \
  -DCUDA_SHOW_REGISTER=ON \
  -DCUDA_ARCH=61 \
DeeDeeRanged commented 3 years ago

Debian bullseye/testing Notebook GTX 1050M Desktop GTX 1070

From the official testing repo: Nvidia-driver 460.56-1 (plus dependencies or whatever) nvidia-cuda-toolkit 11.2.1-2 libhwloc-plugins 2.4.1+dfsg-1 libhwloc-contrib-plugins 2.4.1+dfsg-2

git clone https://github.com/xmrig/xmrig-cuda.git mkdir xmrig-cuda/build && cd xmrig-cuda/build Changed cmake to: cmake .. -DCUDA_LIB=/usr/lib/x86_64-linux-gnu/stubs/libcuda.so -DCUDA_TOOLKIT_ROOT_DIR=/usr/lib/nvidia-cuda-toolkit

Only warnings I get are: /home/user/github/xmrig-cuda/src/RandomX/randomx_cuda.hpp(319): warning: pointless comparison of unsigned integer with zero

/home/user/github/xmrig-cuda/src/cuda_extra.cu: In function ‘void cryptonight_extra_cpu_prepare(nvid_ctx, uint32_t, const xmrig_cuda::Algorithm&)’: /home/user/github/xmrig-cuda/src/cuda_extra.cu:415:170: warning: passing argument 5 to ‘restrict’-qualified parameter aliases with argument 6 [-Wrestrict] 415 | CUDA_CHECK_KERNEL(ctx->device_id, cryptonight_extra_gpu_prepare<<<grid, block >>>(wsize, ctx->d_input, ctx->inputlen, startNonce, | ^
/home/user/github/xmrig-cuda/src/cuda_extra.cu: In function ‘int cuda_get_deviceinfo(nvid_ctx
)’: /home/user/github/xmrig-cuda/src/cuda_extra.cu:571:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare] 571 | if (ctx->device_blocks > max_blocks) { | ~~~^~~~~~

libxmrig-cuda.so is succesfully build and working on notebook and desktop (not that it makes a lot of difference in hashrate, but it is a nice exercise.

Now if someone can enlighten me on the warnings I'll be a happy camper.

If anyone wants to try libxmrig-cuda.so.zip

Spudz76 commented 3 years ago

I've seen those warnings forever, they are not actually a problem.

DeeDeeRanged commented 3 years ago

I know they are only warnings but it would have been nice to know why specially the "/home/user/github/xmrig-cuda/src/RandomX/randomx_cuda.hpp(319): warning: pointless comparison of unsigned integer with zero" as that seems to take forever when building the libxmrig-cuda.so :-) Just out of curiousity.

Spudz76 commented 3 years ago

nvcc parts just take a while, normally, even if that warning was not there. You can enable options on CMake commandline:

  -DCMAKE_VERBOSE_MAKEFILE=ON \
  -DCUDA_VERBOSE_BUILD=ON \
  -DCUDA_SHOW_REGISTER=ON \

And then it will appear to be doing things while it's taking forever, rather than chewing quietly. I have never run a build without those options so perhaps I don't notice how slow it might be because it has more lively output (looks busy).

RCTORONTO commented 3 years ago

@strategist922 the -DCUDA_ARCH=30 means you've told it to only compile for Kepler cores (like GTX770) and nothing else. So of course that won't ever work for 1080ti (arch 61) or 3090 (arch 86).

Try with -DCUDA_ARCH=61\;86 and then it will be able to drive those cards.

Also to force compiler use environment var prefixing of CC=$(which gcc) CXX=$(which g++) cmake .. -D(and so on) instead of the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER

My build script for Cuda11.0 and 1060 (arch 61)

CC=/usr/bin/gcc-9 CXX=/usr/bin/g++-9 \
 cmake /usr/src/xmrig-cuda \
  -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.0 \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_VERBOSE_MAKEFILE=ON \
  -DCUDA_VERBOSE_BUILD=ON \
  -DCUDA_SHOW_REGISTER=ON \
  -DCUDA_ARCH=61 \

if I have a rig only with a specific arch will there be any significant benefit to compiling for just that other than the overall size of the shared object library?

RCTORONTO commented 3 years ago

my comment was for Spudz76

Spudz76 commented 3 years ago

Saves compile time mostly, and size, yes.

The default arch string may also not include every GPU variant. I am not too familiar with which, since I have used custom CUDA_ARCH string since day 0.