Shared library errors when using optirun

I’m just trying Julia’s CUDA packages for the first time, and am having problems launching Julia with optirun. I’m hoping that there are other people out there trying to run Julia with optirun, and that they may have figured out a solution. Knowing that this isn’t a common problem with optirun would also be great.

When I launch Julia with optirun, I get a bunch of shared library warnings:

$ optirun julia
WARNING: Error during initialization of module Random:
ErrorException("could not load library "libdSFMT"
libdSFMT.so: cannot open shared object file: No such file or directory")
WARNING: Error during initialization of module LinearAlgebra:
ErrorException("could not load library "libopenblas64_"
libopenblas64_.so: cannot open shared object file: No such file or directory")
┌ Error: Error during initialization of module CHOLMOD
│   exception =
│    could not load library "libcholmod"
│    libcholmod.so: cannot open shared object file: No such file or directory
│    Stacktrace:
│     [1] dlopen(::String, ::UInt32) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Libdl/src/Libdl.jl:97 (repeats 2 times)
│     [2] __init__() at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/SuiteSparse/src/cholmod.jl:81
└ @ SuiteSparse.CHOLMOD /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/SuiteSparse/src/cholmod.jl:168
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.1 (2018-09-29)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

I found this issue about the rpaths of the libraries shipped with Julia, which even mentions optirun triggering this problem.

I’m running Julia 1.0.1 (official) on Fedora 29, with Bumblebee, Cuda 9.0, and a GTX 1050. Using optirun with other programs, e.g. Matlab, works fine and allows me to use Cuda and my discrete GPU.

Hm. It looks like it may not be necessary to use optirun in the first place. If I just make sure my dGPU is on and launch Julia, it seems like things are working.

$ cat /proc/acpi/bbswitch 
0000:01:00.0 ON
$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.1 (2018-09-29)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using CUDAdrv

julia> dev = CuDevice(0)
CuDevice(0): GeForce GTX 1050

julia> ctx = CuContext(dev)
CuContext(Ptr{Nothing} @0x0000000001fa3550, true, true)

julia> destroy!(ctx)
1 Like

Sorry for Necro posting but how did you turn it on? And also your solution doesn’t really explain why optirun doesn’t work. I’m having the same issue. Python works fine with optirun and pytorch so the drivers are correctly installed.

Hey sorry just saw this. I’m using bbswitch, so I turned my dGPU on by doing:

sudo su -c 'echo "ON" > /proc/acpi/bbswitch'

I then make sure the CUDA modules are loaded

sudo modprobe nvidia

then CUDA stuff seems to work without optirun. Just open julia normally and try building CUDAdrv.

I can’t explain what I don’t understand, I just know that optirun didn’t work for me. However it makes some sense to me, since my understanding of optirun is that it configures a VirtualGL backend to act as a renderer for programs. Since the GPU packages aren’t rendering and are only using CUDA, then maybe optirun isn’t necessary? I don’t really know.

1 Like

Seems to work! Thanks. :pray::tada::blush:

1 Like