Comments (4)
As proposed in https://forum.byte-welt.net/t/pointer-buffer-should-have-byteorder-little-endian/19508/3 , the implementation could be thread-safe and safe regarding the offsets by implementing it as
ByteBuffer byteBuffer = ((ByteBuffer)buffer).slice();
byteBuffer.limit(Math.toIntExact(byteOffset + byteSize));
byteBuffer.position(Math.toIntExact(byteOffset));
from jcuda.
It is probably worth considering that Nvidia (and AMD) GPUs are LITTLE_ENDIAN, so IMHO native should be the default.
from jcuda.
Using the nativeOrder()
certainly makes sense. In fact, I occasionally stumbled over the (nowadays somewhat unusual) BIG_ENDIAN
being the default, and wondered why they did this...
(This was an attempt to blame the Sun/Oracle people ;-) )
It would have made even more sense to do this right in the beginning, when the method was implemented. As mentioned above (and in the forum thread ), changing this now might be incompatible.
But although I'm always hesitant do do changes like this, here, it may be justified: Most users probably already did set the byte order manually. And they did this (or should have done this) because until now, the byte order of the returned buffer was not specified.
The advantage of specifying it now to be the nativeOrder()
seems to outweigh the slight possibility of an incompatibiliy, especially when it's pointed out in the change log.
from jcuda.
BIG_ENDIAN
is the default probably because it is the "network" byte order used by many protocols such as TCP/IP.
File I/O defaults to whatever is the system's code page, while NIO standardizes on BIG_ENDIAN. The JDK guys made the wrong choice both times :)
from jcuda.
Related Issues (20)
- CUDA_ERROR_ILLEGAL_ADDRESS HOT 3
- jar missing HOT 4
- implement binding CUDA 10 HOT 1
- Coding errors in JCudaMemcpy3DTest.java HOT 1
- Thread safety of nio ByteBuffer HOT 9
- JCuda Pointer vs CudaMallocHost HOT 3
- JCuda maven build fails due to Maven javadoc plugin HOT 4
- Feature request: Buffer API from Jcuda Pointer HOT 14
- Maven install libraries issue - pom file is never instaled HOT 10
- Bug: CUdevprop referenced in JCudaDriver doesn't exist HOT 9
- Cuda Data types definition - there is no unsigned integer in Java! HOT 2
- String representations for flags are not always created properly
- JCuda JNvrtc-11.2.0-windows-x86_64.dll dependencies HOT 22
- Can we rename the development branch to main? HOT 5
- Where is Jcudpp? HOT 3
- on JDK17, performance slowdown significantly after a few days HOT 3
- how to downlaod the libraries of CUDA 11.2 HOT 1
- Cuda 11.4 Jetson Orin Nano failures HOT 9
- Cuda 12 HOT 1
- JCuda 12.0.0 not working? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jcuda.