Results 1 to 2 of 2

Thread: Searching for non 0 values in a sparse array

  1. #1

    Searching for non 0 values in a sparse array

    Hi all,

    I have a simple question regarding the best way to solve my problem.
    Let's say that I have a 2D array A on the device, and that this array contains (after some computations done by some kernels) mainly values at 0 and few different from 0.
    What I need is to find the index idx in the array (and the corresponding value) so that A[idx]!=0.

    So far, I transfer the array from the device to the host memory, and I process the array with a basic for loop to solve my problem.
    The problem is that with this method, the memory transfer costs a lot and the serial function is not very efficient. I was thinking that maybe I could do the search on GPU and then transfer a small amount of information back since my array is sparse?

    What do you think about it?
    Any suggestions?

    Thanks and happy new year

    Vincent

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Searching for non 0 values in a sparse array

    What you want to do is called a pack operation which can be achieved with a parallel prefix sum. Googling those two terms will give you other sources of information.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. Accessing to bytes in array as to short and int values?
    By o4kareg2 in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 1
    Last Post: 09-11-2012, 06:19 PM
  2. searching through an array
    By amos in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 2
    Last Post: 07-29-2011, 12:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •