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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:36:47+00:00 2026-06-03T08:36:47+00:00

The application is to intersect two sorted list of integers (set intersection), say list1

  • 0

The application is to intersect two sorted list of integers (set intersection), say list1 and list2.

Each element of list1 will be assigned a GPU thread, and do binary search to check whether it appears in the list2. It is easy to see that there will be huge amount thread divergences in this application. I wonder if there is any good approach to reduce thread divergences. I am using CUDA to implement this application.

I know there is an approach called P-ary search, but my task is to reduce the thread divergence of binary search. Also I know there is library called thrust, but it seems there is no attempt on reducing the divergences.

  • 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-03T08:36:49+00:00Added an answer on June 3, 2026 at 8:36 am

    If both lists are sorted, binary search is not the best algorithm you can do. Binary search will give O(n lg n), but just doing a merge-like algorithm, only taking intersections, is O(n).

    This is a silly algorithm to use a GPU for. The only case I see is that you’ve just generated the data in the GPU. In which case, you want to break the problem up into a bunch of smaller intersections and assign a thread to each.

    To do that, pick k equally-spaced elements of list1 and find them in list2 using binary search. Similarly, pick k equally-spaced elements of list2 and find them in list1. You now have 2k ranges in each list, where each range has at most N/k elements. Now intersect those ranges in parallel. (Set k to be half the number of threads you want.)

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

Sidebar

Related Questions

I'm writing an application which will have two Activities, when the user presses the
Here's a strange question for you guys, I have a nice sorted list that
I want to interact between two android enabled handset with same application installed, but
We have two challenges deploying our application for Ubuntu/Debian: 1. Offline installation Many (let's
I have a windows forms application that is deployed to two different locations. Intranet
I've got an older intranet application that needs to show two frames (a fixed
In my sample application, I have basically two threads. The main thread contains a
I am currently working on an Android tablet application which has two fragments, a
I'm writing an iPhone application that needs to send small bits of information (two
I Have a scenario of chat application. A server and two client. Since I'm

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.