Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:12:26+00:00 2026-05-26T15:12:26+00:00

For a project, I had to dive into OpenCL: things are going fairly well

  • 0

For a project, I had to dive into OpenCL: things are going fairly well except now that I need atomic operations.
I’m executing the OpenCL code on top of an Nvidia GPU, with the last drivers. clGetDeviceInfo() querying CL_DEVICE_VERSION returns me:
OpenCL 1.0 CUDA, hence I guess I have to refer to the OpenCL 1.0 specs.

I started using an atom_add operation in my kernel on a __global int* vnumber buffer:
atom_add(&vnumber[0], 1);. This gave me clearly wrong results. Thus, as an additional check, I have moved the add instruction at the beginning of the kernel, so that it is executed for each thread. When the kernel is launched with 512 x 512 threads, the content of vnumber[0] is: 524288, which is exactly 2 x 512 x 512, two times the value that I should get. The funny thing is that by changing the add operation to atom_add(&vnumber[0], 2);, the returned value is 65536, again two times what I should get.

Did someone already experienced something similar? Am I missing something very basic? I have checked the correctness of data types but it seems ok (I’m using *int buffer, and allocating it with sizeof(cl_int)).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:12:27+00:00Added an answer on May 26, 2026 at 3:12 pm

    You are using atom_add, which is an OpenCL 1.0 extension for local memory. Yet you are passing it global memory. Instead, try OpenCL 1.1’s atomic_add, which works with global memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Until now, my project had only .cpp files that were compiled into different binaries
There is a project which had an svn server that is down now, but
I was working on project that had problem when encoding UFT-8 text into JSON
We had a test project that started out as MbUnit v3 / Gallio but
I worked on a project that had the following requirement: TableA is the parent
I imported an EAR project I had written on another system into eclipse so
I am adding source control to a project that had none. The problem is
I have a web project that had UrlRewriter.NET installed and working fine on .NET
I accidently merged a project with another project that had nothing to do with
After my last project I had the problem that the client was expecting an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.