How to return results from kernel?

Discussion created by niravshah00 on May 24, 2010
Latest reply on Jun 23, 2010 by niravshah00

I have kerne running with and want to return a set of six integers back to the host code.

Well i dont know how many set i would be getting in advance . It is possible that i might not get any.

Any thoughts on how can i do this i am attaching the kernel code here

kernel void threadABC(int startRange,out int a<> )
    int X,Y,Z;
    int A,B,C;
    int gcdAB,gcdAC,gcdBC;
    float N = 4093.0f;   
    //using the index of the output stream as the values for A,B,C
    A = instance().x+startRange;
    B = instance().y+startRange;
    C = instance().z+startRange;
    // intialising a to 0 so that when we filter the reuslts we can know that 0 means that
    //location does not have a reuslt.

     gcdAB = findGcd(A,B);
     gcdAC = findGcd(A,C);
     gcdBC = findGcd(B,C);
    if(gcdAB==1 && gcdAC==1 && gcdBC==1){
        for( X = 3; X < 10; X++)
            for( Y = 3; Y < 10; Y++)
                for( Z = 3; Z < 10; Z++)
                    float sum =  modulusPower((float)A,X)+modulusPower((float)B, Y);
                    float cpowerZ = modulusPower((float)C,Z);
                    sum = fmod(sum,N);
                    if(cpowerZ == sum){
                        // here the possible solution should be stored and returned to host code
                        //have to figure out the way to return the values of A,B,C,X,Y,Z to host