berathebrain

Stream class limited capability

Discussion created by berathebrain on May 22, 2009
Latest reply on May 24, 2009 by berathebrain

If I have code:

::brook::Stream<float>* divG;

which has some data and I want to make temp variable that has the same data. How can I do this? If I write

::brook::Stream<float> *temp=new ::brook::Stream<float>(*divG);

which I thought is a copy constructor, then I cant use this temp variable in a call like this:

calculate_and_add_divergence_gpu_ati(cols,rows,*Gx,*Gy,*temp,*divG)

where divG is output stream. The runtime reports the error: "Input stream is the same as the output stream."

I get the same error even after the code like this:

temp->assign(divG);

or

*temp=*divG;

If I could just get the dimension of divG I could make a temp variable like

::brook::Stream<float> *temp=new ::brook::Stream<float>(1,&dimension); And then use assign method.

Here is the kernel which I am calling:

kernel void calculate_and_add_divergence_gpu_ati(int cols,int rows,float Gx[],float Gy[],float temp<>, out float divG<>{
    float divGx, divGy;
    int idx=instance().x;
    int ky = idx % cols;
    int kx=idx-ky*cols;
   
    if(kx == 0)
        divGx = Gx[idx];
    else   
        divGx = Gx[idx] - Gx[idx-1];

    if(ky == 0)
        divGy = Gy[idx];
    else   
        divGy = Gy[idx] - Gy[idx - cols];           

    divG = temp + divGx + divGy;
}

Thank you for your help.

Outcomes