How to vectorize such code?

[Old posts from the commercial version of ArrayFire] Discussion of ArrayFire using CUDA or OpenCL.

Moderator: pavanky

How to vectorize such code?

Postby danielpengzuo » Thu Feb 20, 2014 4:58 pm

I have a nested loop code as follows and I would like to vectorize it to speed it up.
The problem here is I have a "do... while" in the nested loop, and number of times that the "do...while" loop runs are different across different array element.
Is there some clever way to vectorize this nested loops?

Code: Select all
 for (iz=1; iz<nz-1; iz++) {
   gfor(array im, 1, nm-1) {
                do {
                   ;; manipulation to array(iz, im)
                   ;; if (meet some limits) exit loop
                }  while (reach max iter);

Posts: 10
Joined: Mon Jan 27, 2014 10:43 pm

Re: How to vectorize such code?

Postby pavanky » Thu Feb 20, 2014 6:35 pm

Hi Daniel,

Please follow up here:

Pavan Yalamanchili,
~ If it is not broken, you have not tried hard enough ~
User avatar
Site Admin
Posts: 1123
Joined: Mon Mar 15, 2010 7:39 pm
Location: Atlanta, GA

Return to [archive-commercial] Programming & Development with ArrayFire