PetaVision  Alpha
PresynapticPerspectiveGPUDelivery.hpp
1 /*
2  * PresynapticPerspectiveGPUDelivery.hpp
3  *
4  * Created on: Jan 10, 2018
5  * Author: Pete Schultz
6  */
7 
8 #ifndef PRESYNAPTICPERSPECTIVEGPUDELIVERY_HPP_
9 #define PRESYNAPTICPERSPECTIVEGPUDELIVERY_HPP_
10 
11 #include "HyPerDelivery.hpp"
12 #include "arch/cuda/CudaBuffer.hpp"
13 #include "cudakernels/CudaRecvPre.hpp"
14 
15 namespace PV {
16 
22  protected:
34  virtual void ioParam_receiveGpu(enum ParamsIOFlag ioFlag) override; // End of list of BaseDelivery parameters.
36 
37  public:
38  PresynapticPerspectiveGPUDelivery(char const *name, HyPerCol *hc);
39 
41 
48  virtual void deliver() override;
49 
50  virtual void deliverUnitInput(float *recvBuffer) override;
51 
52  protected:
54 
55  int initialize(char const *name, HyPerCol *hc);
56 
57  virtual void setObjectType() override;
58 
59  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
60 
61  virtual Response::Status
62  communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) override;
63 
64  virtual Response::Status
65  setCudaDevice(std::shared_ptr<SetCudaDeviceMessage const> message) override;
66 
67  virtual Response::Status allocateDataStructures() override;
68 
69  void initializeRecvKernelArgs();
70 
71  void allocateThreadGSyn();
72 
73  // Data members
74  protected:
75  std::vector<std::vector<float>> mThreadGSyn; // needed since deliverUnitInput is not on the GPU
76  PVCuda::CudaRecvPre *mRecvKernel = nullptr;
77  PVCuda::CudaBuffer *mDevicePatches = nullptr;
78  PVCuda::CudaBuffer *mDeviceGSynPatchStart = nullptr;
79 
80 }; // end class PresynapticPerspectiveGPUDelivery
81 
82 } // end namespace PV
83 
84 #endif // PRESYNAPTICPERSPECTIVEGPUDELIVERY_HPP_
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual void ioParam_receiveGpu(enum ParamsIOFlag ioFlag) override
receiveGpu: PresynapticPerspectiveGPUDelivery always sets receiveGpu to true. The receiveGpu=false ca...