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 8735909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:10:43+00:00 2026-06-13T10:10:43+00:00

Short version : how do I implement an efficient filter operation in CUDA? Long

  • 0

Short version: how do I implement an efficient filter operation in CUDA?

Long version:
I have a CUDA code that follows a queue filtering semantic.
I have ~5 million initial elements in the queue and the code filters them using an “expensive” stage-wise computation.
The end result is expected to retain ~1000 elements, and a each stage the number of removed elements follows an exponential decay curve (i.e. the first stages remove a lot, the last stages remove little).

Since in the GPU each element is processed in parallel (by blocks of threads), simply running “all stages over all elements” is quite waste-full. At a given stage, one element may be retained, all others may be already removed, but computation continues over all remaining stages even for elements already “ready to be removed”.

A more efficient approach would be to run each stage separately, reading an input list and storing results an intermediary output list; and then keep things running in a ping-pong schema.
Doing this however generates significant global memory read-writes, and more importantly puts pressure on an atomicInc that synchronizes the concurrent write on the output list.

How would you suggest to do such stage-wise filtering ?

Thanks for your answers and suggestions.

  • 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-06-13T10:10:45+00:00Added an answer on June 13, 2026 at 10:10 am

    I suggest you to use compact or remove_if. You can use CUDPP library or thrust. You cannot avoid writing to global memory after each stage unless you will compute all stages over all elements.

    This is simple pseudocode:

    1. Init memory etc.
    2. foreach stage do
    3. Run filtering for all elements
    4. Use compact/remove_if for all elements
    5. Rewrite elements or do something else (depends on used library)
    6. If last stage break else goto 4
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The short version is that I have a protocol which has an optional parameter.
Short version: Can I grant access to external databases to a role? Long version:
Short version: I have a similar setup to StackOverflow. Users get Achievements. I have
So the short version, what I don't understand is this line of code: (new
I divided my problem into a short and a long version for the people
is it possible to implement short urls in asp.net 2.0 version. please give me
In short, I have an object called PersonList that has a List of Person
While developing a game I have designed a class that in normal operation has
Short Version Are class variables thread-safe for the duration of a controller action? Long
Short version : I have a working solution using a UISegmentedControl but I don't

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.