Oceananigans.jl: `versioninfo_with_gpu` util fails on machine with CUDA but running CPU models

Created on 7 Aug 2020  路  6Comments  路  Source: CliMA/Oceananigans.jl

We should only add GPU data is there's a current CUDA context, i.e.

if !isnothing(CUDA.CuCurrentContext())
    gpu_name = CUDA.CuCurrentContext() |> CUDA.device |> CUDA.name
    s = s * "  GPU: $gpu_name\n"
end
GPU 馃懢 bug 馃悶

Most helpful comment

I don't understand the issue; when does has_cuda return true while CUDA doesn't work? Also, you generally shouldn't use the low-level CuCurrentContext, because that'll return nothing if you just haven't done anything CUDA-related yet. Calling context() should always return a context (i.e., it'll create one if the system hasn't been initialized yet). There's also has_cuda_gpu that checks if CUDA works and there's at least one GPU; added by @simonbyrne IIRC.

All 6 comments

A related issue but really outside our scope is that someone that has CUDA but doesn't have things configured correctly can have difficulty running Oceananigans --- even if they only ever planned on running CPU models. This issue was avoided when has_cuda() was based on whether using CuArrays failed or not.

Yeah... Might be worth opening an issue on CUDA.jl or @maleadt might have some tips.

I guess has_cuda() as it functions now is more accurate than what we did. We want something more like has_working_cuda()... ?

I don't understand the issue; when does has_cuda return true while CUDA doesn't work? Also, you generally shouldn't use the low-level CuCurrentContext, because that'll return nothing if you just haven't done anything CUDA-related yet. Calling context() should always return a context (i.e., it'll create one if the system hasn't been initialized yet). There's also has_cuda_gpu that checks if CUDA works and there's at least one GPU; added by @simonbyrne IIRC.

Ah thanks @maleadt, sounds like we should be using context() instead.

@maleadt perhaps I am misremembering. @raphaelouillon may be able to provide more information --- I seem to remember that he was unable to use Oceananigans.jl due to some CUDA issue, despite having no interest in running code on his laptop's GPU.

Was this page helpful?
0 / 5 - 0 ratings