c++ - Friends & Pointers -
i have following code:
(*writeoutputtobuffer)(cl::enqueueargs(*queue, cl::nullrange, cl::ndrange(netspec[lastlayerindex]), cl::nullrange), writeoutputtobufferbuf[0], writeoutputtobufferbuf[1], lastlayerindex);   where writeoutputtobufferbuf[0] contains cl::buffer,
writeoutputtobufferbuf[1] contains cl::buffer
and lastlayerindex contains int.
writeoutputtobufferbuf vector of cl::buffer
using above code in own class works fine. call successful this:
(cl::make_kernel< cl::buffer, cl::buffer, int >) (cl::enqueueargs, cl::buffer&, cl::buffer&, int&)
the kernel initialized as:
 std::shared_ptr<cl::make_kernel<cl::buffer, cl::buffer, int>> writeoutputtobuffer;   but when use them in friend class follows:
(fullyconnectedportion->writeoutputtobuffer)(cl::enqueueargs(*queue, cl::nullrange,                         cl::ndrange(outputsize), cl::nullrange),  (fullyconnectedportion->writeoutputtobufferbuf[0]),                             (fullyconnectedportion->writeoutputtobufferbuf[1]), (fullyconnectedportion->lastlayerindex));   it returns error:
no match call ‘(std::shared_ptr < cl::make_kernel< cl::buffer, cl::buffer, int > >) (cl::enqueueargs, cl::buffer&, cl::buffer&, int&)’
how fix issue?
i tried make more detailed example below, hope helps. actual lines of codes long post here , needs opencl compile. think supposed issue use of pointers though.
class fcn{ public:      std::vector<cl::buffer> writeoutputtobufferbuf;     friend class neuralnetwork;      void initialize();  private:     std::shared_ptr<cl::make_kernel<cl::buffer, cl::buffer, int>> writeoutputtobuffer; }  class nn{ public:     fcn* fcnn;      void calc(); }  void fcn::initialize(){ //puts data writeoutputtobufferbuf }  void nn::calc(){   (fullyconnectedportion->writeoutputtobuffer)(cl::enqueueargs(*queue, cl::nullrange,                         cl::ndrange(outputsize), cl::nullrange),  (fullyconnectedportion->writeoutputtobufferbuf[0]),                             (fullyconnectedportion->writeoutputtobufferbuf[1]), (fullyconnectedportion->lastlayerindex));  }  int main(){   nn *nnnet = new nn;  fcn *fcnet = new fcn;   (*fcn).initialize();  (*nn).calc(); }       
 
  
Comments
Post a Comment