CUDA Unknown Error (30) after GFOR

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

Moderator: pavanky

CUDA Unknown Error (30) after GFOR

Postby neuralPanther » Mon Mar 03, 2014 10:59 pm

Hi Again,

My program constantly re-sizes it's arrays (they start large (~10 million points) and then get smaller (~ 100 thousand points))

Data comes in and I reset everything to the proper initial size:
Code: Select all
   af_signal_1 = af::constant(0.0,signalSize,af::c32);
   af_signal_2 = af::constant(0.0,signalSize,af::c32);
   af_signal_3 = af::constant(0.0,signalSize,af::c32);


I do some stuff to the data and then I reduce the data size like so (by a factor of 4):
Code: Select all
       af_signal_1= af::constant(0.0,signalSize/4,af::c32); // prep the array to be reduced
       index = af::constant(0.0,signalSize,af::s32);
       gfor(index,0,4,signalSize)
       {
           af_signal_1(index/4) = af_signal_2 (index)/constant; // fill the prepped array
       }


After that I may repeat this process and reduce the size by another factor (say 2):
Code: Select all
       signalSize = signalSize/4;
       af_signal_1= af::constant(0.0,signalSize/2,af::c32); // prep the array to be reduced again
       index = af::constant(0.0,signalSize,af::s32);
       gfor(index,0,2,signalSize)
       {
           af_signal_1(index/2) = af_signal_2 (index)/constant;
       }


This works just fine for about 1000 cycles, and then I get

"src/cuda/set.cu:30: CUDA runtime error: unknown error <30>

The crash always occurs after one of the GFORs

From what I can tell this error is because of the reduction and the memory allocation but, my problem requires me to reduce the data sets, I'm memory limited and can't just add another array every time I need to do this reduction -

The fact that it works for a while and then crashes is also extremely bothersome -

I've hit a wall, any ideas would be greatly appreciated

~ NP
neuralPanther
 
Posts: 25
Joined: Fri Feb 14, 2014 8:03 pm

Re: CUDA Unknown Error (30) after GFOR

Postby shehzan » Tue Mar 04, 2014 4:05 am

Hi

Instead of using gfor, you can use sequencing (seq) as I show below.

For reduction by 'n', (mimicking your sample code):
Code: Select all
af_signal_1 = af_signal2(seq(0, n, af::end))/constant;


Here is the output of a similar piece of code i tested quickly. You can check it to see if it is working as you desire.
Code: Select all
x [20 1] =
        0.7402
        0.9210
        0.0390
        0.9690
        0.9251
        0.4464
        0.6673
        0.1099
        0.4702
        0.5132
        0.7762
        0.2948
        0.7140
        0.3585
        0.6814
        0.2920
        0.3194
        0.8109
        0.1541
        0.4452

x(seq(0, 4, af::end)) [5 1] =
        0.7402
        0.9251
        0.4702
        0.7140
        0.3194


This is also a more optimal way to do it. Let me know if this has fixed the issue.
----
Shehzan
Developer
AccelerEyes
User avatar
shehzan
 
Posts: 121
Joined: Tue Feb 12, 2013 7:20 pm

Re: CUDA Unknown Error (30) after GFOR

Postby neuralPanther » Tue Mar 04, 2014 1:46 pm

Thank you so much!
That looks like it solves the problem!

On another note - if I'm making custom sequences like so:
Code: Select all
      index = af::constant(0.0,signalSize,af::s32);
      gfor ( index, 0,signalSize)
      {
         t(index) = (t_delta*index)+(const1-(const2/2.0));
      }


Could I do this instead with:
Code: Select all
t = af::seq((-const2/2.0, const2/SignalSize, SignalSize));


I'm assuming this would be equivalent to MATLAB's:
Code: Select all
t = -const/2:const/signalSize: const/2;


Thank you again,

~ NP
neuralPanther
 
Posts: 25
Joined: Fri Feb 14, 2014 8:03 pm

Re: CUDA Unknown Error (30) after GFOR

Postby shehzan » Tue Mar 04, 2014 1:57 pm

Hi

You can take a look at all the subscript indexing functions here: http://www.accelereyes.com/arrayfire/c/ ... dexing.htm

The 3 parameter seq function is seq(start, increment, end) -> more info on the link above.
So your code does look fairly accurate.
----
Shehzan
Developer
AccelerEyes
User avatar
shehzan
 
Posts: 121
Joined: Tue Feb 12, 2013 7:20 pm


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

cron