PetaVision  Alpha
CudaUpdateStateFunctions.cpp
1 #include "CudaUpdateStateFunctions.hpp"
2 
3 namespace PVCuda {
4 
5 CudaUpdateHyPerLCALayer::CudaUpdateHyPerLCALayer(CudaDevice *inDevice) : CudaKernel(inDevice) {
6  kernelName = "HyPerLCALayer";
7 }
8 
9 CudaUpdateHyPerLCALayer::~CudaUpdateHyPerLCALayer() {}
10 
11 CudaUpdateMomentumLCALayer::CudaUpdateMomentumLCALayer(CudaDevice *inDevice)
12  : CudaKernel(inDevice) {
13  kernelName = "MomentumLCALayer";
14 }
15 
16 CudaUpdateMomentumLCALayer::~CudaUpdateMomentumLCALayer() {}
17 
18 CudaUpdateISTALayer::CudaUpdateISTALayer(CudaDevice *inDevice) : CudaKernel(inDevice) {
19  kernelName = "ISTALayer";
20 }
21 
22 CudaUpdateISTALayer::~CudaUpdateISTALayer() {}
23 
24 void CudaUpdateHyPerLCALayer::setArgs(
25  const int nbatch,
26  const int numNeurons,
27  const int nx,
28  const int ny,
29  const int nf,
30  const int lt,
31  const int rt,
32  const int dn,
33  const int up,
34  const int numChannels,
35 
36  /* float* */ CudaBuffer *V,
37 
38  const int numVertices,
39  /* float* */ CudaBuffer *verticesV,
40  /* float* */ CudaBuffer *verticesA,
41  /* float* */ CudaBuffer *slopes,
42  const bool selfInteract,
43  /* double* */ CudaBuffer *dtAdapt,
44  const float tau,
45 
46  /* float* */ CudaBuffer *GSynHead,
47  /* float* */ CudaBuffer *activity) {
48  params.nbatch = nbatch;
49  params.numNeurons = numNeurons;
50  params.nx = nx;
51  params.ny = ny;
52  params.nf = nf;
53  params.lt = lt;
54  params.rt = rt;
55  params.dn = dn;
56  params.up = up;
57  params.numChannels = numChannels;
58 
59  params.V = (float *)V->getPointer();
60 
61  params.numVertices = numVertices;
62  params.verticesV = (float *)verticesV->getPointer();
63  params.verticesA = (float *)verticesA->getPointer();
64  params.slopes = (float *)slopes->getPointer();
65  params.selfInteract = selfInteract;
66  params.dtAdapt = (double *)dtAdapt->getPointer();
67  params.tau = tau;
68 
69  params.GSynHead = (float *)GSynHead->getPointer();
70  params.activity = (float *)activity->getPointer();
71 
72  setArgsFlag();
73 }
74 
75 void CudaUpdateMomentumLCALayer::setArgs(
76  const int nbatch,
77  const int numNeurons,
78  const int nx,
79  const int ny,
80  const int nf,
81  const int lt,
82  const int rt,
83  const int dn,
84  const int up,
85  const int numChannels,
86 
87  /* float* */ CudaBuffer *V,
88  /* float* */ CudaBuffer *prevDrive,
89 
90  const int numVertices,
91  /* float* */ CudaBuffer *verticesV,
92  /* float* */ CudaBuffer *verticesA,
93  /* float* */ CudaBuffer *slopes,
94  const bool selfInteract,
95  /* double* */ CudaBuffer *dtAdapt,
96  const float tau,
97  const float LCAMomentumRate,
98 
99  /* float* */ CudaBuffer *GSynHead,
100  /* float* */ CudaBuffer *activity) {
101  params.nbatch = nbatch;
102  params.numNeurons = numNeurons;
103  params.nx = nx;
104  params.ny = ny;
105  params.nf = nf;
106  params.lt = lt;
107  params.rt = rt;
108  params.dn = dn;
109  params.up = up;
110  params.numChannels = numChannels;
111 
112  params.V = (float *)V->getPointer();
113  params.prevDrive = (float *)prevDrive->getPointer();
114 
115  params.numVertices = numVertices;
116  params.verticesV = (float *)verticesV->getPointer();
117  params.verticesA = (float *)verticesA->getPointer();
118  params.slopes = (float *)slopes->getPointer();
119  params.selfInteract = selfInteract;
120  params.dtAdapt = (double *)dtAdapt->getPointer();
121  params.tau = tau;
122  params.LCAMomentumRate = LCAMomentumRate;
123 
124  params.GSynHead = (float *)GSynHead->getPointer();
125  params.activity = (float *)activity->getPointer();
126 
127  setArgsFlag();
128 }
129 
130 void CudaUpdateISTALayer::setArgs(
131  const int nbatch,
132  const int numNeurons,
133  const int nx,
134  const int ny,
135  const int nf,
136  const int lt,
137  const int rt,
138  const int dn,
139  const int up,
140  const int numChannels,
141 
142  /* float* */ CudaBuffer *V,
143 
144  const float Vth,
145  /* double* */ CudaBuffer *dtAdapt,
146  const float tau,
147 
148  /* float* */ CudaBuffer *GSynHead,
149  /* float* */ CudaBuffer *activity) {
150  params.nbatch = nbatch;
151  params.numNeurons = numNeurons;
152  params.nx = nx;
153  params.ny = ny;
154  params.nf = nf;
155  params.lt = lt;
156  params.rt = rt;
157  params.dn = dn;
158  params.up = up;
159  params.numChannels = numChannels;
160 
161  params.V = (float *)V->getPointer();
162 
163  params.Vth = Vth;
164  params.dtAdapt = (double *)dtAdapt->getPointer();
165  params.tau = tau;
166 
167  params.GSynHead = (float *)GSynHead->getPointer();
168  params.activity = (float *)activity->getPointer();
169 
170  setArgsFlag();
171 }
172 
173 } // end namespace PVCuda