Use CUDA in WIne and Bottles

We can use nvidia-libs to run Windows application that uses CUDA with WIne and Bottles on NixOS.

Requirements:

  1. Wine or Bottles is installed on your NixOS. I use:

    packages = with.pkgs [
        wineWowPackages.waylandFull
        bottles
    ]
    
  2. The Nvidia driver is installed. You can read the NixOS WIki. I believe if $ nvidia-smi run fine we are good to go.

  3. Download and extract the compiled nvidia-libs from here.

  4. Go inside the extracted folder as your working directory.

Wine:

  1. Make sure your default WINEPREFIX path at ~/.wine exists. If not, run $ wine bin/cudatest.exe to generate it. So should see Failed to load nvcuda.dll at the end of the log.
  2. Install the nvidia-libs by $ WINEPREFIX=~/.wine bash ./setup_nvlibs.sh install
  3. Set the environment variable $ export LD_LIBRARY_PATH=/run/opengl-driver/lib:$LD_LIBRARY_PATH
  4. Run the test again $ wine bin/cudatest.exe. You should see your GPU card mentioned.

Bottles:

  1. Create a bottles. Default setting would do fine. Says the bottle name is CudaTest and it is in ~/.local/share/bottles/bottles/CudaTest

  2. Replace bottles_setup.sh with the one from the master branch since the release version we downloaded might be out-dated.

  3. Run the script with our bottles name as argument $ bash ./bottles_setup.sh CudaTest. You can optionally install experimental version of nvapi.

  4. We may need to restart the bottles application.

  5. Now go to CudaTest→Option→Settings. If we install optional nvapi we should see dxvk-nvapi-vX.X.X-XX-XXXXXXXX in Components→DXVK NVAPI. The Display→Discrete Graphics needs to be enabled.

  6. Go back to CudaTest main menu. Add shortcut to cudatest.exe by Programs→Add Shortcuts…→ pick the cudatest.exe from bin folder.

  7. Launch it by Programs→cudatest→context menu (3 dot on the right)→Launch with terminal(top left icon).

4 Likes