xmrig / xmrig-cuda

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

could you please add linux binaries for cuda 10 and cuda 11? #93

Open aleqx opened 3 years ago

aleqx commented 3 years ago

Would make everyone's life easier, including yourself (less requests for help with building or building errors)

DeeDeeRanged commented 3 years ago

I have one compiled on Debian testing cuda 11. If you want you can try it out. libxmrig-cuda.so.zip

aleqx commented 3 years ago

@DeeDeeRanged thanks for the kind offer, but I was making the point that these should be published with each release automatically for all to benefit (auto builders can do that).

krishnaTORQUE commented 3 years ago

I have one compiled on Debian testing cuda 11. If you want you can try it out. libxmrig-cuda.so.zip

Can you please share those commands step by step?

DeeDeeRanged commented 3 years ago

Sorry for the late reply.

On Debian testing/bullseye for GTX1050 or higher (NO legacy drivers): All official debian testing/bullseye repo's with main contrib non-free enabled.

  1. install/check if git build-essential cmake libuv1-dev libssl-dev and libhwloc-dev are installed.
  2. install/check if proprietary non-free nvidia-driver libcuda1 and nvidia-smi are installed (it should install all the relevant drivers needed).
  3. install nvidia-cuda-toolkit (this should install the cuda driverw needed)
  4. reboot if neccessary
  5. open a teminal.
  6. mkdir github
  7. cd github
  8. git clone https://github.com/xmrig/xmrig-cuda.git
  9. mkdir xmrig-cuda/build && cd xmrig-cuda/build
  10. cmake .. -DCUDA_TOOLKIT_ROOT_DIR=/usr/lib/nvidia-cuda-toolkit
  11. make -j$(nproc)
  12. Wait till everything is finished as it may take a while depending on your system.
  13. Ignore warnings
  14. If build is succesfull you have a libxmrig-cuda.so in the build directory.
  15. cp/move libxmrig-cuda.so to the directory where xmrig is installed/untarred

I am in the proces making a script for myself which checks/installs the required packages and compiles the lot, but I want to make sure it's working correctly and compiles libxmrig-cuda.so reproducible.

Hope the above helps.

DeeDeeRanged commented 3 years ago

@DeeDeeRanged thanks for the kind offer, but I was making the point that these should be published with each release automatically for all to benefit (auto builders can do that).

You would need a variety of nvidia cards as cuda ranges from cuda 8 to cuda 11. Haven't seen any cuda 12 yet on linux.

Spudz76 commented 3 years ago

It's a bit more involved since for the library to work there would have to be versions built for every Ubuntu and every CUDA toolkit which means like 11 * (14, 16, 18, 20, 21) = 55 different builds. As opposed to one build per CUDA toolkit for Windows because Windows DLLs load on whatever Windows version just fine (no glibc or other basic kernels changing).

Better scripts to walk-through the building yourself are probably the real answer.

DeeDeeRanged commented 3 years ago

I figured it was something like that. It's one of the reasons I am trying to make a script that might work on different versions of Debian/Ubuntu. With the walkthrough I've tried to be as clear/sensible as I could be as I don't know the level of skills of ppl.

bigmac5753 commented 2 years ago

This command cmake .. -DCUDA_LIB=/usr/lib/x86_64-linux-gnu/stubs/libcuda.so -DCUDA_TOOLKIT_ROOT_DIR=/usr/lib/nvidia-cuda-toolkit gives this error:

  Could NOT find CUDA (missing: CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS
  CUDA_CUDART_LIBRARY) (Required is at least version "8.0")
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindCUDA.cmake:1104 (find_package_handle_standard_args)
  cmake/CUDA-Version.cmake:14 (find_package)
  CMakeLists.txt:3 (include)
DeeDeeRanged commented 2 years ago

Which distro and videocard? Are "git build-essential cmake libuv1-dev libssl-dev libhwloc-dev nvidia-driver libcuda1 and nvidia-smi" installed, check if /usr/lib/x86_64-linux-gnu/stubs/libcuda.so and /usr/lib/nvidia-cuda-toolkit are available.

Spudz76 commented 2 years ago

CUDA Toolkit is usually in /usr/local/cuda or /usr/local/cuda-11.4 (or whichever version) if the symlink wasn't generated.

Do not supply anything but the CUDA_TOOLKIT_ROOT_DIR, *_LIB are intended to be set internally not overridden (if the rootdir doesn't work by itself, the toolkit is broken/incomplete).

DeeDeeRanged commented 2 years ago

@Spudz76

CUDA Toolkit is usually in /usr/local/cuda or /usr/local/cuda-11.4 (or whichever version) if the symlink wasn't generated.

Do not supply anything but the CUDA_TOOLKIT_ROOT_DIR, *_LIB are intended to be set internally not overridden (if the rootdir doesn't work by itself, the toolkit is broken/incomplete).

You are correct abt. only using -DCUDA_TOOLKIT_ROOT_DIR=/usr/lib/nvidia-cuda-toolkit just did a build and it works on both my Debian systems.

The instructions on https://xmrig.com/docs/miner/build/ubuntu are for Ubuntu with the cuda downloaded/installed from Nvidia directly and derived the build instructions from there to use it with Debian official repositories.

Thanks for the pointer.

Spudz76 commented 2 years ago

To mess things up more, I use the Nvidia packages but have put them on my own repo mirror so it picks them up off the Internet. Similar to if Nvidia themselves bothered to host a live repo...

But the result is functionally the same as using the Nvidia installer minus the "local repo" hack it uses.

And thus I don't really know where the Debian upstream cuda goes, it's old-ish so I've always ignored it. Maybe the search locations need updated so there is less need to specify the ROOT.

DeeDeeRanged commented 2 years ago

You'll find video drivers and so on depending if your running stable + backports or testing in line with ubuntu and are quite uptodate. Just checked ubuntu is putting the nvidia-toolkit also in the same place as debian. So for debian and ubuntu using the drivers and toolkit from the debian/ubuntu repos works fine. No need to use the ones from nvidia direct.