Indexing GFOR tiles

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

Moderator: pavanky

Indexing GFOR tiles

Postby DThoris » Thu Mar 06, 2014 2:49 pm

Hi,

Below is a simple example:

Code: Select all
array a(seq(25),5,5);
float hA[] = {0, 1, 1,2};
array A(2,2, hA);   
           
array b =constant(0,2,2);
gfor(array k, 5){ 
       b=(a(A,k));
}
     
print(b);

b [4 1] = 
(tile 1 of 5)
        0.0000 
        1.0000 
        1.0000 
        2.0000 

(tile 2 of 5)
        5.0000 
        6.0000 
        6.0000 
        7.0000 

(tile 3 of 5)
       10.0000 
       11.0000 
       11.0000 
       12.0000 

(tile 4 of 5)
       15.0000 
       16.0000 
       16.0000 
       17.0000 

(tile 5 of 5)
       20.0000 
       21.0000 
       21.0000 
       22.0000 



I would like to know if it's possible to index the tiles of array b.
I'm trying to sum all tiles, i.e. b_tile1 + b_tile2 + b_tile3+...

I am using very large arrays, so I am also trying to avoid doing:

array b =constant(0,2,2,5);
gfor(array k, 5){ 
       b(span,span,k)=(a(A,k));
}

The size of a 3D array seems to be limited to the gpu block size, is this correct?

Thanks for your help.
DThoris
 
Posts: 6
Joined: Thu Feb 20, 2014 7:42 am

Re: Indexing GFOR tiles

Postby pavanky » Thu Mar 06, 2014 2:53 pm

Hi,

GFOR does need to replicate the data if you want to add all the tiles together. There is no way around it.
Pavan Yalamanchili,
ArrayFire
--
~ If it is not broken, you have not tried hard enough ~
User avatar
pavanky
Site Admin
 
Posts: 1123
Joined: Mon Mar 15, 2010 7:39 pm
Location: Atlanta, GA


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

cron