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

CUDA not working #415

Closed
Flock1 opened this issue Sep 8, 2020 · 9 comments
Closed

CUDA not working #415

Flock1 opened this issue Sep 8, 2020 · 9 comments

Comments

@Flock1
Copy link

Flock1 commented Sep 8, 2020

Hi,

I am very new to Julia, hence please don't mind the naiveness of the query. I have installed Julia and installed the CUDA package. However, when I try to test or check the version, I get an error:

 CUDA.version()
┌ Error: Could not initialize CUDA
│   exception =
│    could not load library "libcuda"
│    libcuda.so: cannot open shared object file: No such file or directory
│    Stacktrace:
│     [1] dlopen(::String, ::UInt32; throw_error::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
│     [2] dlopen at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109 [inlined]
│     [3] #dlopen#2 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:105 [inlined]
│     [4] dlopen at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:105 [inlined] (repeats 2 times)
│     [5] (::CUDA.var"#2956#cache_fptr!#617")() at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:31
│     [6] macro expansion at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:39 [inlined]
│     [7] __configure__(::Bool) at /home/sarvagya/.julia/packages/CUDA/dZvbp/src/initialization.jl:90
│     [8] (::CUDA.var"#609#610"{Bool})() at /home/sarvagya/.julia/packages/CUDA/dZvbp/src/initialization.jl:29
│     [9] lock(::CUDA.var"#609#610"{Bool}, ::ReentrantLock) at ./lock.jl:161
│     [10] _functional(::Bool) at /home/sarvagya/.julia/packages/CUDA/dZvbp/src/initialization.jl:26
│     [11] functional(::Bool) at /home/sarvagya/.julia/packages/CUDA/dZvbp/src/initialization.jl:19
│     [12] libcuda at /home/sarvagya/.julia/packages/CUDA/dZvbp/src/initialization.jl:50 [inlined]
│     [13] (::CUDA.var"#676#cache_fptr!#7")() at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:31
│     [14] macro expansion at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:39 [inlined]
│     [15] macro expansion at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/cudadrv/libcuda.jl:28 [inlined]
│     [16] macro expansion at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/cudadrv/error.jl:108 [inlined]
│     [17] cuDriverGetVersion(::Base.RefValue{Int32}) at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:93
│     [18] version() at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/cudadrv/version.jl:10
│     [19] top-level scope at REPL[2]:1
│     [20] eval(::Module, ::Any) at ./boot.jl:331
│     [21] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:134
│     [22] repl_backend_loop(::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:195
│     [23] start_repl_backend(::REPL.REPLBackend, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:180
│     [24] run_repl(::REPL.AbstractREPL, ::Any; backend_on_current_task::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:292
│     [25] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
│     [26] (::Base.var"#806#808"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:399
│     [27] #invokelatest#1 at ./essentials.jl:710 [inlined]
│     [28] invokelatest at ./essentials.jl:709 [inlined]
│     [29] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:383
│     [30] exec_options(::Base.JLOptions) at ./client.jl:313
│     [31] _start() at ./client.jl:506
└ @ CUDA ~/.julia/packages/CUDA/dZvbp/src/initialization.jl:97
ERROR: AssertionError: CUDA.jl did not successfully initialize, and is not usable.
Stacktrace:
 [1] libcuda at /home/sarvagya/.julia/packages/CUDA/dZvbp/src/initialization.jl:50 [inlined]
 [2] (::CUDA.var"#676#cache_fptr!#7")() at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:31
 [3] macro expansion at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:39 [inlined]
 [4] macro expansion at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/cudadrv/libcuda.jl:28 [inlined]
 [5] macro expansion at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/cudadrv/error.jl:108 [inlined]
 [6] cuDriverGetVersion(::Base.RefValue{Int32}) at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/utils/call.jl:93
 [7] version() at /home/sarvagya/.julia/packages/CUDA/dZvbp/lib/cudadrv/version.jl:10
 [8] top-level scope at REPL[2]:1

What should I do? NVIDIA driver and CUDA are installed on my machine.

@maleadt
Copy link
Member

maleadt commented Sep 8, 2020

libcuda.so: cannot open shared object file: No such file or directory

It doesn't find libcuda, are you sure the NVIDIA driver is properly installed?
And you don't need to install CUDA, CUDA.jl will provide its own.

@Flock1
Copy link
Author

Flock1 commented Sep 8, 2020

I think it's installed properly because this is what I get when I run nvidia-smi:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+

@maleadt
Copy link
Member

maleadt commented Sep 8, 2020

nvidia-smi working is unrelated to libcuda availability. Did you look in your system for libcuda? It needs to be installed in a location that can be found by the dynamic linker, if not your system is badly configured (i.e. Libdl.find_library("libcuda") should return something). You can force a directory to be searched in by setting LD_LIBRARY_PATH, but generally you need an entry in /etc/ld.so.conf.d if libcuda isn't installed in a default location.

@Flock1
Copy link
Author

Flock1 commented Sep 8, 2020

I search for libcuda and these are some of the results I got:

/usr/lib/i386-linux-gnu/libcuda.so
/usr/lib/i386-linux-gnu/libcuda.so.1
/usr/lib/i386-linux-gnu/libcuda.so.440.100
/usr/lib/x86_64-linux-gnu/libcuda.so.1
/usr/lib/x86_64-linux-gnu/libcuda.so.440.100

@maleadt
Copy link
Member

maleadt commented Sep 8, 2020

Please try my other suggestions...

@Flock1
Copy link
Author

Flock1 commented Sep 8, 2020

For Libdl.find_library("libcuda"), I got this output:
bash: syntax error near unexpected token '"libcuda"'

@maleadt
Copy link
Member

maleadt commented Sep 8, 2020

That's a Julia command. https://docs.julialang.org/en/v1/stdlib/Libdl/#Libdl.find_library
Open a REPL and start with using Libdl

@Flock1
Copy link
Author

Flock1 commented Sep 8, 2020

Hey, apologies. I am so new to Julia that keep using import instead of using.

This is what I got when I ran the command: "".

My LD_LIBRARY_PATH is set to :/usr/lib/i386-linux-gnu/libcuda.so

@maleadt
Copy link
Member

maleadt commented Sep 8, 2020

My LD_LIBRARY_PATH is set to :/usr/lib/i386-linux-gnu/libcuda.so

That's wrong, you should set it do the directory. Furthermore, CUDA is only supported on 64-bit, so you need to use the other directory.

And finally, the LD_LIBRARY_PATH is a temporary solution. /usr/lib/x86_64-linux-gnu should have been added to the library search path persistently with an entry in /etc/ld.so.conf.d

Since neither of these are Julia or CUDA.jl issues, I'll close this issue. If you have more problems with your system, I suggest you hop by Slack (#gpu or #helpdesk channel), or make a post on Discourse 🙂

@maleadt maleadt closed this as completed Sep 8, 2020
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