Question about CUDPP

Hi all.

After some initial work with CUDA and CUBLAS I am now implementing a medical imaging reconstruction algorithm. Somewhere along the way i am going to have 3 vectors each containing x,y or z coordinates. I will have to check those 3 vectors and eliminate some unwanted points(ex: if x1<0, eliminate x1,y1 and z1) and after doing that, I am going to sort the vectors according to the x or z coordinate.

I have seen an hello world of sorts for CUDPP and my question is: can I input 3 vectors with CUDPP and stream compact them at the same time like the example I showed before? Likewise, I would like to know if I can do something similar with sorting(having 3 different vectors, sort them according to the coordinates of only one of them).

I am almost certain CUDPP does not allow me to do that, so I will probably have to write the algorithms myself, or go serial with them.

Thanks in advance ;)

You should investigate the thrust library. There are stream compaction routines which accept a binary predicate (which is a simple functor you need to write yourself), and a zip operator, which can combine separate arrays into an array of tuples. Those two things combined should solve your problem, if I am understanding it correctly.

I was aware of thrust but i was avoiding because it is based on C++. Do you have to be an C++ expert? I never worked with C++ before

You don’t have to be an “expert” in C++ any more than you need to be an “expert” in C to use CUDA. It would seem to me that you have two choices - either teach yourself enough parallel algorithm theory and CUDA programming to write your own stream compaction routine, or teach yourself enough C++ to be able to use the algorithms which already exist in thrust. Only you know what might be easier/faster/more beneficial in getting to the end goal of whatever it is you are trying to do.

Thanks once again avidday ;)

Sorry to dig up this thread, but I wanted to know if I can use CUDPPCompact with a matrix. Briefly I have a matrix I want to go through each line, and if a single element of that line does not meet the criteria, the line is deleted.

Thanks in advance ;)