-
Notifications
You must be signed in to change notification settings - Fork 20
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
Size constraint for cudaMallocHost #54
Comments
I think the linked forum question mainly refers to Beyond that, I'm generally aware of the difficulties related to "memory sizes" and the different sizes of But there still are some caveats in the interoperation with Java. And what you just mentioned is such a caveat. The first options (add documentation, and do a sanity check) are things that I'll certainly consider. What you suggested as option 3 could be broken down into two steps:
Now, one reason for me to have used the It is true that this limits the size of the host allocation, due to the limitation of I might consider to expose the "address" from If you strongly need that 'raw address', I could probably add such a function in the next release. But for now, the workaround of breaking the allocation into chunks probably makes more sense. |
Yep I was mainly referring to your brief aside at the bottom of the reply that I linked, where you mentioned the fact that Java arrays etc are indexed with integers. But yes I agree with what you're saying, I can see some merit in being able to access the address directly and using Happy to stick with the workaround for now, just thought I would point out the issue in case I was missing some easy way to fix it. Thanks again for your time! |
Websearches indicate that there are some attempts to provide a In any case, the point about checking the limit in |
Yeah it looks like there were some For my current use case I am in fact just iterating over the buffer with a But yes for now the documentation/limit checking would be great thanks :) |
Not sure if this has been brought up before, but I ran into an issue while trying to allocate host memory with size larger than MAX_INT. E.g. running:
gives:
After digging around this seems to be caused by the fact that although
cudaMallocHost
takes a long size argument (which corresponds to the native cudasize_t
), Java Buffers only have integer capacity. When it tries to create a JavaDirectByteBuffer
with the JNINewDirectByteBuffer
call the size is cast back to an int. The capacity then ends up overflowing to a negative value, causing the error.Currently the workaround for me seems to be splitting the allocation into multiple chunks, so as to keep each one below the limit. Some options I can think of to deal with this issue in JCuda are (in increasing order of difficulty):
Please let me know if I've just made a silly mistake somewhere. Thanks for your time, I appreciate all the work that goes into this :)
Edit: just found this reply to a forum post, indicating that you might be aware of the issue
The text was updated successfully, but these errors were encountered: