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

Allow invalid GPU pointers not allowed in unsafe_wrap #1125

Closed
Am386DX-40 opened this issue Sep 2, 2021 · 4 comments · Fixed by #1131
Closed

Allow invalid GPU pointers not allowed in unsafe_wrap #1125

Am386DX-40 opened this issue Sep 2, 2021 · 4 comments · Fixed by #1131
Labels
bug Something isn't working

Comments

@Am386DX-40
Copy link

Describe the bug

The code below used to work up to version 3.3 of CUDA.jl. In version 3.4 it results in this error message: "ERROR: Could not identify the buffer type; are you passing a valid CUDA pointer to unsafe_wrap?"

To reproduce

The Minimal Working Example (MWE) for this bug:

using CUDA

function register(A)
    A_buf = Mem.register(Mem.Host, pointer(A), sizeof(A), Mem.HOSTREGISTER_DEVICEMAP)
    A_gpuptr = convert(CuPtr{Float64}, A_buf)
    return unsafe_wrap(CuArray, A_gpuptr, size(A));
end

nx = 512*512*1024;
A = zeros(nx);
A_d = register(A);

The code was copied from: https://discourse.julialang.org/t/cudanative-register-host-memory-for-pinned-memory-access/23046/20

@Am386DX-40 Am386DX-40 added the bug Something isn't working label Sep 2, 2021
@omlins
Copy link
Contributor

omlins commented Sep 3, 2021

This is also used in ImplicitGlobalGrid.jl:
https://github.com/eth-cscs/ImplicitGlobalGrid.jl/blob/master/src/shared.jl#L110

Could that use case make it to the CUDA.jl unit tests?
Thanks!!

@omlins
Copy link
Contributor

omlins commented Oct 5, 2021

@maleadt , could you soon tag a new release? ImplicitGlobalGrid.jl fails due to this bug with version 3.4...

@maleadt
Copy link
Member

maleadt commented Oct 5, 2021

Yes, I was preparing to create a release this week.

@omlins
Copy link
Contributor

omlins commented Oct 6, 2021

Yes, I was preparing to create a release this week.

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants