Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to get started? #451

Open
proevilz opened this issue Feb 3, 2023 · 15 comments
Open

Question: How to get started? #451

proevilz opened this issue Feb 3, 2023 · 15 comments

Comments

@proevilz
Copy link

proevilz commented Feb 3, 2023

Hello,

I'm looking for some advice on this project.
Looking through the readme, I'm quite confused as to how to get up and running with this.

Do I need to run the docker images in order to run node code on my GPU?
Or do I just pull in the npm packages and code as normal? (Just tried that, and it fails as it's requiring Linux...) Does this mean I cannot run this on Windows/OSX ?

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 3, 2023

The RAPIDS libraries are built on top of NVIDIA CUDA, which doesn't run on MacOS. We use Linux-specific features, so we don't build packages for the Windows CUDA toolkit. However, we do support running RAPIDS in the Windows subsystem for Linux (WSL2).

If you can run under WSL (or on Linux) with NVIDIA driver 510.47.03 or newer (which is the one that aligns with CTK 11.6.2), you can use the libraries in either of these two ways:

  1. Use or extend our runtime base images with the libraries pre-installed (example)
  2. Install the modules with npm or yarn:
    # Specify CUDA 11 so the installer doesn't detect and try
    # to download libs for CUDA 12 if you have that installed
    RAPIDSAI_CUDA_VERSION=11 \
      npm install @rapidsai/cudf

You can also use Linux or WSL to contribute to the libraries themselves, and the easiest way to do that is to develop in our dev containers.

@proevilz
Copy link
Author

proevilz commented Feb 3, 2023

I ran the "Running code in the runtime images" example code in the terminal, and that worked... but I'm trying to get this setup like a normal code project and that doesn't seem to be the way.

Using example 2 in Ubuntu with WSL, I get this
image

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 3, 2023

That's unexpected. What version of npm are you using? It must be installing the packages out of order.

Try this:

# Remove node_modules in case it's in a broken state
rm -rf node_modules

export RAPIDSAI_CUDA_VERSION=11
npm install @rapidsai/core
npm install @rapidsai/cudf

In the meantime, I'll look into fixing our npx invocations in the install script. npm should be executing the rapidsai-install-native-module script from the @rapidsai/core package, which should be downloaded as a dependency of @rapidsai/cudf before its install script runs.

@proevilz
Copy link
Author

proevilz commented Feb 3, 2023

proevilz@DESKTOP-52J01RR:~/test-app$ npm -v
8.19.3

image

As a test, I tried to install react through npm i react and that worked successfully. I appreciate your support with this.

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 3, 2023

It seems something changed with npm recently. We'll need to skip running package scripts when we install @rapidsai/core.

Try with the --ignore-scripts option, then continue as normal:

export RAPIDSAI_CUDA_VERSION=11
npm i --ignore-scripts @rapidsai/core
npm i @rapidsai/cudf

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 3, 2023

yarn add @rapidsai/cudf should also work. I installed the dependencies in this repo just a few days ago.

@proevilz
Copy link
Author

proevilz commented Feb 3, 2023

Thanks trxcllnt.
I attempted the --ignore-scripts and that successfully installed @rapidsai/core. However, unless I pass --ignore-scripts for @rapidsai/cudf too, it gives me the same error.

After installing both with --ignore-scripts I attempted to run a JS file with with an import from cudf and this was the result. Forgive my ignorance if this is an unrelated error, however, I am able to swap the import out for something else such as React and then the code executes successfully. Based on that, I assume this is an issue with the libraries? I tried running it both in powershell and the ubuntu terminal. In the ubuntu one, I've tried node 16 & 18 where as in powershell, I tried v18. The result is the same.

image

@proevilz
Copy link
Author

proevilz commented Feb 3, 2023

Attempting with yarn after removing node_modules and package files, this happens:
image

So perhaps I need to upgrade my linux distro from 18 to 20+?

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 3, 2023

Oh yes, we build with the Ubuntu20.04 toolchain. node 18 has dropped Ubuntu18.04, so have too.

As for the earlier error, that's what I'd expect to see if the libraries aren't actually downloaded.

The rapidsai-install-native-module script is part of the @rapidsai/core package. The other modules all depend on core, and run rapidsai-install-native-module when they're installed.

The native modules are huge and we can't upload them to npm. The npm packages are just shell packages with the JS source code. rapidsai-install-native-module detects what version of CUDA you're using, then downloads the actual libraries from our GitHub releases.

At the moment I'm not sure what changed about npm to break this, but I'd suggest using yarn if you can.

@proevilz
Copy link
Author

proevilz commented Feb 3, 2023

I installed ubuntu 20.04 and tried both node v16/v18. Installing the packages with yarn / node v16 'appeared' to install fine, then when attempting to run the index.js file, this is the result 😞
image

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 3, 2023

Do you have the CUDA driver installed in WSL? libnvrtc can't be statically linked, but it should be packaged with the driver.

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 4, 2023

Actually, it seems libnvrtc can be statically linked since CTK 11.5. I'll try that out and see if we can get down to only needing the libcuda.so driver itself.

@proevilz
Copy link
Author

proevilz commented Feb 4, 2023

I have the latest game ready driver installed for Windows 10, with the GPU being an RTX 3090. Looking at this page, I assume that's all that's needed?

Once a Windows NVIDIA GPU driver is installed on the system, CUDA becomes available within WSL 2. The CUDA driver installed on Windows host will be stubbed inside the WSL 2 as libcuda.so, therefore users must not install any NVIDIA GPU Linux driver within WSL 2.

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 4, 2023

Sounds like that'll give you the CUDA driver (libcuda.so), but it seems the Windows driver doesn't provide libnvrtc.so to WSL.

You shouldn't need the entire CUDA toolkit since we statically link as much as we can. I think all you need is the libnvrtc runtime library, which you can install this way:

# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_network
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
# This assumes your driver aligns with the CUDA 12.0 release
# Change this version to match your driver if necessary.
sudo apt-get -y install cuda-nvrtc-12-0

@trxcllnt
Copy link
Collaborator

trxcllnt commented Feb 4, 2023

Good news! Updating to CMake v3.26-rc1 allows us to statically link libnvrtc and eliminate the need for users to have the nvrtc runtime package installed.

The bad news is I had to fix CMake to get it to link, so we'll have to wait till v3.26-rc2 is released before we can use it.

I think you're the first person to try using node-rapids in WSL without either docker or the full CUDA toolkit, so thanks for your patience as we iron out these few wrinkles 🙏.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants