ArrayFire Julia: Implementation of gfor?

Hi!

Anyone knows how to implement something equivalent to gfor using the existing ArrayFire wrapper?
I guess gfor is not wrapped…

Regards,

Hey Pedro,

So here’s the thing: the gfor in the arrayfire library is simply syntactic sugar for the vector operations.

For example, something like

@gfor for i = 1:10
a[i] = a[i] + 1
end

is essentially the same as a = a + 1.

Please refer to this page for more details.

Thanks,
Ranjan

1 Like

Dear Ranjan,

Thanks for your reply.
I need the gfor to do more complex things inside the for to save memory.

Julia does not find @gfor !

Regards,

Dear Ranjan,

I had not realized that there are several restrictions over the operations you can do inside the gfor.
Maybe gfor is not what I’m searching for…

Thanks again,

Hey Pedro,

Since gfor is a simple syntax trick (which is why you see those restrictions), it is not going to save you memory. There are a few in place functions that ArrayFire.jl provides: fft!, ifft!, svdfact!, chol!, lufact! amongst others. Please do refer to the README on ArrayFire.jl to get that list.

I hope this helps,
Ranjan