Assignment operator using subscript indexing in GFOR

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

Moderator: pavanky

Assignment operator using subscript indexing in GFOR

Postby hogenes » Thu Oct 30, 2014 5:39 am


I have written a program which does essentially this
Code: Select all
uint N,Nx,Nt;
array x = constant(0, N, Nx, Nt);
array z = constant(0, N, Nx);

for (t = 0:Nt) {
   gfor( array i, Nx ) {
      x(span, i, t) = z(span, i) + ...//some matrix multiplication and addition
      z(span, i) = x(span, i, t);

The point of z is to store a value for the next iteration of the outer for-loop.
I think that I have done everything according to the GFOR-rules, because the values of x at the end are correct (well, at least non-zero).

The problem is that z will always have the value of zeros if i dont force a deep copy using ".copy()" or do something stupid as "+0".

My interpretation of this note (from the assignment operator) "The array operator may not do a deep copy. A deep copy happens only if a subscript indexing is used.", this implies that a deep copy should happen in my case. So why is it not? Is this a limitation of GFOR, or is it a bug?

Posts: 1
Joined: Thu Oct 30, 2014 5:25 am

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