Coder Social home page Coder Social logo

Comments (3)

karlrupp avatar karlrupp commented on September 18, 2024

the direct use of std::size_t instead of vcl_size_t is only a lack of unification after the vcl_size_t typedef was introduced. I consider this to be the necessary task associated with this issue.

The use of unsigned int, however, is intentional when dealing with sparse matrices for now. The reason is that size_t may differ on the host and on the GPU, hence one cannot use size_t for both and has to fall back to integer types.

from viennacl-dev.

albertz avatar albertz commented on September 18, 2024

And unsigned int is the same on both? How can that be? Isn't sizeof(int) quite dependent on the compiler and the target arch (32bit or 64bit)? And wouldn't it maybe sth different on the GPU, like always 32bit or so? (Just curious because I never did GPU programming.)

from viennacl-dev.

karlrupp avatar karlrupp commented on September 18, 2024

OpenCL defines the type 'cl_uint', which is guaranteed to be the same on both the host and the device. For all operations on OpenCL buffers, there is actually a lot of extra logic in place to make sure things get converted to the correct types.

However, 'cl_uint' is not necessarily available on the OpenMP backend, because OpenCL might be switched off. For this reason, 'unsigned int' is consistently used for indices for buffers in CPU RAM. Similarly, 'unsigned int' is controlled by the CUDA compiler to be the same on the host and on the device, hence we considered this to be the most consistent way of dealing with stuff.

On a related note: We make the index type a global typedef just like vcl_size_t so that user codes dealing with signed integer indices can better interface without the need for (potentially costly) conversions...

from viennacl-dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.