omlins / ParallelStencil.jl

Package for writing high-level code for parallel high-performance stencil computations that can be deployed on both GPUs and CPUs
BSD 3-Clause "New" or "Revised" License
312 stars 31 forks source link

CUDA 3.0.2 triggers error in REPL #26

Closed luraess closed 3 years ago

luraess commented 3 years ago

CUDA v3.0.2 fix of

produces now an error within ParallelStencil when running code on the Base.Threads backend in the REPL when CUDA isn't functional (i.e. no libcuda is available).

This if statement addition in CUDA.jl (src/initialization.jl) seems to be responsible for this.

Note that ParallelStencil has CUDA as dependency but won't use it unless activated in @init_parallel_stencil()

Error stack trace:

ERROR: CUDA.jl did not successfully initialize, and is not usable.
If you did not see any other error message, try again in a new session
with the JULIA_DEBUG environment variable set to 'CUDA'.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] libcuda()
    @ CUDA ~/.julia/packages/CUDA/MpASK/src/initialization.jl:52
  [3] macro expansion
    @ ~/.julia/packages/CUDA/MpASK/lib/cudadrv/libcuda.jl:29 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/CUDA/MpASK/lib/cudadrv/error.jl:94 [inlined]
  [5] cuDeviceGet
    @ ~/.julia/packages/CUDA/MpASK/lib/utils/call.jl:26 [inlined]
  [6] CuDevice
    @ ~/.julia/packages/CUDA/MpASK/lib/cudadrv/devices.jl:25 [inlined]
  [7] CUDA.TaskLocalState()
    @ CUDA ~/.julia/packages/CUDA/MpASK/src/state.jl:50
  [8] task_local_state!()
    @ CUDA ~/.julia/packages/CUDA/MpASK/src/state.jl:73
  [9] stream
    @ ~/.julia/packages/CUDA/MpASK/src/state.jl:419 [inlined]
 [10] synchronize()
    @ CUDA ~/.julia/packages/CUDA/MpASK/lib/cudadrv/stream.jl:117
 [11] top-level scope
    @ ~/.julia/packages/CUDA/MpASK/src/initialization.jl:83
luraess commented 3 years ago

It seems to be a pure CUDA.jl issue as reported in this MVE

Temporary fix is to downgrade to CUDA v3.0.1:

using Pkg
Pkg.add(Pkg.PackageSpec(;name="CUDA", version="3.0.1"))
luraess commented 3 years ago

https://github.com/JuliaGPU/CUDA.jl/pull/840 fixes this CUDA.jl issue, bumping CUDA to v3.0.3.