Can Jacket data types be global? Yes

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

Moderator: pavanky

Can Jacket data types be global? Yes

Postby melonakos » Sat Aug 07, 2010 1:31 pm

We received the following question from a Jacket programmer:

Is there any possibility to declare variables in the GPU having a persistent or global scope as in the CPU?


I have never attempted this, so I was unsure. But then I tried running the following code:

1) saved as an M-file, I did the following:

Code: Select all
function test_global_state()

global gpu_var;

gpu_var = gpu_var + 1

end


2) Then from the MATLAB command line, I tried:

Code: Select all
>> global gpu_var
>> gpu_var = gzeros(1)
 
gpu_var =
 
     0

>> test_global_state
 
gpu_var =
 
     1

>> test_global_state
 
gpu_var =
 
     2

>> test_global_state
 
gpu_var =
 
     3

>>


So it looks like it works to me. Anyone else have info on this?

-John
John Melonakos (john@arrayfire.com)
User avatar
melonakos
 
Posts: 503
Joined: Tue Jun 10, 2008 9:49 am

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

cron