4 Replies Latest reply on May 24, 2009 8:56 AM by berathebrain

    Stream class limited capability


      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:


      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:




      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];
              divGx = Gx[idx] - Gx[idx-1];

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

          divG = temp + divGx + divGy;

      Thank you for your help.