-
Notifications
You must be signed in to change notification settings - Fork 195
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
Non-standard function throws an error when used in a KernelFunctionOperation
on the GPU
#3438
Comments
I suggest starting a thread on |
Also you will never get an error of the form "X function is not implemented by CUDA". The way GPU compilation works, functions with known CUDA analogues are converted appropriately at compile time. The rest are attempted to compile directly. The error you're getting probably means that |
You might be hitting this warning which I don't think is valid to include in a GPU kernel: |
Probably the easiest thing to do is to fork |
Do you get a warning during CPU execution ? |
Nope. Everything seems to run pretty smoothly: julia> using Oceananigans
julia> using Oceananigans.Grids: xnode, ynode
julia> using CUDA: has_cuda_gpu
julia> using LambertW: lambertw
julia> arch = has_cuda_gpu() ? GPU() : CPU()
CPU()
julia> grid = RectilinearGrid(arch, size = (4, 4, 4), extent = (1,1,1))
4×4×4 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── Periodic x ∈ [0.0, 1.0) regularly spaced with Δx=0.25
├── Periodic y ∈ [0.0, 1.0) regularly spaced with Δy=0.25
└── Bounded z ∈ [-1.0, 0.0] regularly spaced with Δz=0.25
julia> @inline W(x, y) = lambertw((y/x)^2)
W (generic function with 1 method)
julia> @inline W(i, j, k, grid) = W(xnode(i, grid, Center()), ynode(j, grid, Center()))
W (generic function with 2 methods)
julia> op = KernelFunctionOperation{Center, Center, Center}(W, grid)
KernelFunctionOperation at (Center, Center, Center)
├── grid: 4×4×4 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── kernel_function: W (generic function with 2 methods)
└── arguments: ()
julia> compute!(Field(op))
4×4×4 Field{Center, Center, Center} on RectilinearGrid on CPU
├── grid: 4×4×4 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── boundary conditions: FieldBoundaryConditions
│ └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: ZeroFlux
├── operand: KernelFunctionOperation at (Center, Center, Center)
├── status: time=0.0
└── data: 10×10×10 OffsetArray(::Array{Float64, 3}, -2:7, -2:7, -2:7) with eltype Float64 with indices -2:7×-2:7×-2:7
└── max=2.84593, min=0.020004, mean=0.833143 |
EDIT: This has nothing to do with Oceananigans.jl per se. Better pursued on LambertW.jl I agree with #3438 (comment) . This part of the stack trace suggests that it is the Better would be to remove the I don't know anything about running on GPUs. Does EDIT: I missed this above:
So it seems that execution does not have to hit the EDIT: so the following comment may be relevant, but perhaps not It would be nice if there were a way to redirect io or send it to dev null or otherwise disable everywhere when running on a GPU.
|
I tested it and can confirm if the line with |
Thanks @glwagner. Sorry I didn't test before but I assumed that since we never reached that warning it couldn't cause problems. I'll close this issue since it's clearly out of the scope for Oceananigans |
Precisely.
Perhaps a positional argument to
It is interesting to consider auto-sanitization of GPU code... |
I'd like to use the Lambert W function in a
KernelFunctionOperation
but it doesn't seem to work on the GPU. Here's a MWE that works on the CPU:When running on a GPU this throws a huge error message, that you can check in full here, but here are the first few lines:
I imagine
lambertw
isn't implemented by CUDA, but that doesn't seem to be what the error says, so I wonder if there's something else going on here. I also saw that ClimaAtmos seems to be one of the packages that useLambertW.jl
, so maybe the Clima people have encountered (and hopefully solved) this before?The text was updated successfully, but these errors were encountered: