Optix on WSL (Windows Subsystem for Linux)

With the experimental support for CUDA on WSL out I was wondering if Optix is also able to run on WSL. I tried a sample project earlier but was not able to get it to run. Although I am still not sure if I did it right ;)

So should I even bother trying to get it to run or is Optix not yet supported?

I haven’t heard of anyone on the team even trying OptiX on WSL yet, but we’d certainly like to support it officially as soon as CUDA on WSL is official.

What is the issue you ran into? Maybe the fix is easy… fingers crossed. Were you able to build the OptiX sample in WSL? Are you able to build and run any of the CUDA SDK samples?


David.

I just tried again. I also reinstalled CUDA because I couldn’t find its samples directory earlier. I am now on CUDA 11. Compiling and running the CUDA sample “BlackScholes” did work, it did recognize my GPU (showed “GPU Device 0: “Pascal” with compute ability 6.1”).

Now to OptiX: I tried the OptiX 7 SDK and after changing “sm_30” in the CMakeLists.txt file to “sm_35” it did compile (Probably because of CUDA 11?). But running “./optixHello” gave me
Caught exception: OPTIX_ERROR_LIBRARY_NOT_FOUND: Optix call 'optixInit()' failed: /opt/optix7/NVIDIA-OptiX-SDK-7.0.0-linux64/SDK/optixHello/optixHello.cpp:125)

But I have not configured my system for X11 forwarding to Windows so maybe it just couldn’t display the window? Although the above was the only error message and it seems to be an OptiX problem.

Anyways, thanks for the quick reply!

Edit: ./optixHello -f test gave me the same error message. So probably not a “opening a window” problem…

Edit2: Retried OptiX SDK optixHello with CUDA 10.2, still the same error.

Hello,

Yes some of the Optix libraries that are usually part of the native linux driver package and and needed for Optix 7.0 are not yet there for WSL (older versions of Optix might work without it). So these apps won’t run until they get added.

Thanks and sorry you ran into this, we will post an update when we will have more to share about this.

No problem! I continued to investigate and installed some libraries from your repos:

libnvidia-cfg1-450
libnvidia-common-450
libnvidia-compute-450
libnvidia-decode-450
libnvidia-encode-450
libnvidia-extra-450
libnvidia-fbc1-450
libnvidia-gl-450
libnvidia-ifr1-450

But this time I got this error:

$ ./optixHello
[ 2][       ERROR]: Specified 0 as the CUDA context, but the current CUDA context could not be queried. (CUDA error string: initialization error, CUDA error code: 3)
Caught exception: OPTIX_ERROR_CUDA_NOT_INITIALIZED: Optix call 'optixDeviceContextCreate( cuCtx, &options, &context )' failed: /opt/optix7/NVIDIA-OptiX-SDK-7.0.0-linux64/SDK/optixHello/optixHello.cpp:129)

So as you said, rboissel, it seems some libraries are still missing. Thanks for the heads-up!

Yes you are running optix7. and this requires extra driver components that we haven’t yet added to the WSL driver package.
We will post an update when this gets added to WSL.

Thanks,

I am running Optix 6.5.0 and am having similar issues running on Ubuntu wsl. When running cuda 11.1 samples, everything works as expected. When I run optixHello I get:
“freeglt (./optixHello): failed to open display”

And when I run optixDeviceQuery I get:
“OptiX Error: A supported NVIDIA GPU could not be found”

Does anyone know if there’s any support or a work around to get OptiX working on wsl?

With OptiX 6.5.0 the issue would be exactly the same root cause as described above.
The OptiX core implementation for that also lives inside a display driver component and if that is not present inside this WSL environment, it’s not possible to run OptiX 6 or 7 based applications.

The “failed to open display” error from freeglut is a separate issue and would indicate that there is a problem with your display configuration and maybe the OpenGL implementation running.