DiffEqFlux throws a CUDA error on installation

Hello,

I am trying to get into the SciML ecosystem and as such I installed DiffEqFlux. During installation, I get this error

Blockquote
DiffEqFlux [aae7a2af-3d4f-5e19-a356-7da93b79d9d0]
│ ┌ Error: Failed to initialize CUDA
│ │ exception =
│ │ CUDA error (code 100, CUDA_ERROR_NO_DEVICE)
│ │ Stacktrace:
│ │ [1] throw_api_error(res::CUDA.cudaError_enum)
│ │ @ CUDA ~/.julia/packages/CUDA/p5OVK/lib/cudadrv/libcuda.jl:27
│ │ [2] macro expansion
│ │ @ ~/.julia/packages/CUDA/p5OVK/lib/cudadrv/libcuda.jl:35 [inlined]
│ │ [3] cuInit
│ │ @ ~/.julia/packages/CUDA/p5OVK/lib/utils/call.jl:26 [inlined]
│ │ [4] init()
│ │ @ CUDA ~/.julia/packages/CUDA/p5OVK/src/initialization.jl:125
│ │ [5] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
│ │ @ Base ./loading.jl:1074
│ │ [6] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
│ │ @ Base ./loading.jl:1020
│ │ [7] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})
│ │ @ Base ./loading.jl:1356
│ │ [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
│ │ @ Base ./loading.jl:1459
│ │ [9] _require(pkg::Base.PkgId, env::String)
│ │ @ Base ./loading.jl:1748
│ │ [10] _require_prelocked(uuidkey::Base.PkgId, env::String)
│ │ @ Base ./loading.jl:1625
│ │ [11] macro expansion
│ │ @ ./loading.jl:1613 [inlined]
│ │ [12] macro expansion
│ │ @ ./lock.jl:267 [inlined]
│ │ [13] require(into::Module, mod::Symbol)
│ │ @ Base ./loading.jl:1576
│ │ [14] include
│ │ @ ./Base.jl:457 [inlined]
│ │ [15] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
│ │ @ Base ./loading.jl:2010
│ │ [16] top-level scope
│ │ @ stdin:2
│ │ [17] eval
│ │ @ ./boot.jl:370 [inlined]
│ │ [18] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
│ │ @ Base ./loading.jl:1864
│ │ [19] include_string
│ │ @ ./loading.jl:1874 [inlined]
│ │ [20] exec_options(opts::Base.JLOptions)
│ │ @ Base ./client.jl:305
│ │ [21] _start()
│ │ @ Base ./client.jl:522
│ └ @ CUDA ~/.julia/packages/CUDA/p5OVK/src/initialization.jl:127

I googled this issue and it seems to appear when something is wrong with your CUDA installation. Now here is the thing. I have a laptop with an AMD GPU that is not compatible with CUDA. I do not have the CUDA driver installed (as it wouldn’t work with my GPU anyways), and I am assuming that this might be the cause of the error.

I would like to assume that it is possible to use tools like DiffEqFlux without a CUDA compatible GPU, because being locked to a specific GPU vendor to use this tooling doesn’t sound like a sensible decision. But, being fairly new to Julia, I have no clue how to fix this, so I really need your help.

Thanks in advance!
Vidianos

You do have the CUDA driver installed, otherwise CUDA.jl wouldn’t be able to call cuInit and throw a CUDA_ERROR_NO_DEVICE error.

If I have it, then Julia tried to install it on its own for this package (which it honestly shouldn’t do by default because not everyone has a compatible GPU). If I try to install it from my package manager for example, it says its not installed, I did check that to make sure it wasn’t installed.

That’s not possible, as the CUDA driver is installed system-wide (requires admin privileges and a kernel driver).

That’s what I would assume myself. However, sudo pacman -S cuda shows that the package is most definitely not installed. And anyways, the point isn’t if its installed or not. Its that it wouldn’t work regardless and I am asking if it’s possible to use DiffEqFlux without CUDA because it will not work.

You’re looking for the wrong package, libcuda is packaged by nvidia-* packages.

It very much is. Packages are generally not expected to function if their requirements aren’t fullfilled. In the case of CUDA.jl, we generally ignore errors if you haven’t installed CUDA, because conditional dependencies weren’t available pre-1.9. However, if you do have the CUDA driver installed, we assume that you want CUDA.jl to work, so we inform you if the package isn’t functional. That’s reasonable, no?

In addition, these errors are non-fatal. They only @error and otherwise let module initialization. So DiffEqFlux should be fully functional already.

You’re looking for the wrong package, libcuda is packaged by nvidia-* packages.

Oh, I see, its bizarre that there exists a CUDA package but its not the one we are looking for. And equally bizarre the fact I have it installed. I will troubleshoot why and see if I can find it.

However, if you do have the CUDA driver installed, we assume that you want CUDA.jl to work, so we inform you if the package isn’t functional. That’s reasonable, no?

Yeah, I didn’t think of it like that, it makes sense.

So DiffEqFlux should be fully functional already.

It actually is, I feel silly for not trying it first and thinking it was broken.

Thanks for your help and patience with me!!