Error gfor

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

Moderator: pavanky

Error gfor

Postby vitigcastro » Wed Feb 26, 2014 12:32 pm

Hi,

I am trying to use gfor in a test function: it compiles fine, but when I try to execute it I receive the following exception:
src/gena/image.cpp:509: error: GFOR not supported

The code is the following:

Code: Select all
array function_Test_GFOR(const array &refImg, const array &mTol) {
   
    array imgRet = constant(255, refImg.dims(0), refImg.dims(1));
   
    //Getting list of unique values in refImg
    array greyLevUn = setunique(refImg);
    int n = greyLevUn.elements();

    gfor(array i, n) {
        array greyLev = greyLevUn(i);
       
        try {
            array bInf = greyLev - mTol;
            array bSup = greyLev + mTol;
           
            array thresh = (refImgGF>=bInf)&(refImgGF<=bSup);
           
            array binImgLab = regions(thresh, 8);
           
        } catch (af::exception& e) {
            fprintf(stderr, "%s\n", e.what());
            throw;
        }
    }
       
    return(imgRet);
   
}


Does anyone know what can be the issue here? I have tried setting n to 2, to assess if it was a problem of memory, but I get the same error.

Thank you very much in advance. BEst regards,

V.
vitigcastro
 
Posts: 2
Joined: Wed Feb 26, 2014 11:34 am

Re: Error gfor

Postby pavanky » Wed Feb 26, 2014 4:24 pm

Hi,

Regions is not supported for GFOR yet. The error should have been more clearer. There is no easy way to support regions inside gfor other than making a for loop internally..
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

Re: Error gfor

Postby vitigcastro » Mon Mar 03, 2014 9:24 am

Thank you very much for your help.

Best regards,

Victor
vitigcastro
 
Posts: 2
Joined: Wed Feb 26, 2014 11:34 am


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

cron