AnsweredAssumed Answered

Difficulty in making a minor code parallel.

Question asked by shreedhar_pawar on Jun 2, 2013

I have an array of 100 elements and I want to put some elements of it in a different array in the kernel code, The problem is that if 'p' is an array with 100 elements and say 'q' with 40 elements, p can be incremented by "get_global_id(0)", but then how do I increment q in the kernel code...? When these elements are above 60000 or so, local atomics won't work, so how do I do this ...?


To make my doubt more clear I'll give an example.....  for convenience p has 10 elements { 44, 64, 58, 93, 21, 32, 9, 4, 26, 47} and I want to insert {44, 93, 9,4,26} in q so I may do ,



if(some condition)

    q[ j ]= p[ i ];

My doubt is how can j be incremented...?

   And also I can't put i in place of j, cause then according to the if condition some elements in q would remain non entered and it wont lead to continuous array , also I don't want any of the part  to be done sequentially(by going back to the host code), since I have to do this a number of times in the actual full code and with more than 1,00,000 elements everytime.....!


Message was edited by: Shreedhar Pawar