qingzhouzhen opened a new issue #7386: How could I define function for GPU only?
URL: https://github.com/apache/incubator-mxnet/issues/7386
 
 
   I need  to define a function in .h file for GPU version only, then implenent 
it in .cu file, 
   declaration in .h:
   ```
    void channelwise_Forward(mshadow::Stream<cpu> *stream,
                             const std::vector<TBlob> &in_data,
                             const std::vector<TBlob> &out_data);
     void channelwise_Backward_input(mshadow::Stream<cpu> *stream,
                             const std::vector<TBlob> &in_data,
                             const std::vector<TBlob> &in_grad,
                             const std::vector<TBlob> &out_grad);  
     void channelwise_Backward_filter(mshadow::Stream<cpu> *stream,
                             const std::vector<TBlob> &in_data,
                             const std::vector<TBlob> &in_grad,
                             const std::vector<TBlob> &out_grad);               
          
   
   #if MXNET_USE_CUDA
     void channelwise_Forward(mshadow::Stream<gpu> *stream,
                             const std::vector<TBlob> &in_data,
                             const std::vector<TBlob> &out_data);
     void channelwise_Backward_input(mshadow::Stream<gpu> *stream,
                             const std::vector<TBlob> &in_data,
                             const std::vector<TBlob> &in_grad,
                             const std::vector<TBlob> &out_grad);  
     void channelwise_Backward_filter(mshadow::Stream<gpu> *stream,
                             const std::vector<TBlob> &in_data,
                             const std::vector<TBlob> &in_grad,
                             const std::vector<TBlob> &out_grad); 
   ```
   implement in .cu file:
   ```
   void ConvolutionOp<xpu, DType>::channelwise_Forward(mshadow::Stream<gpu> 
*stream,
                             const std::vector<TBlob> &in_data,
                             const std::vector<TBlob> &out_data) {
     using namespace mxnet_op;
    .....
   }
   ```
   the problem is I am force to declare the same function for CPU version and 
implement it, or it will compile failed
   I just need the function for GPU, How could I get ride of this problem?
    
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to