11 #include "checkpointing/Checkpointer.hpp" 12 #include "components/PatchGeometry.hpp" 13 #include "include/PVLayerLoc.h" 14 #include "include/pv_types.h" 20 #include "arch/cuda/CudaDevice.hpp" 53 Weights(std::string
const &name);
60 std::string
const &name,
78 std::shared_ptr<PatchGeometry> geometry,
110 void checkpointWeightPvp(
112 char const *objectName,
113 char const *bufferName,
132 int calcDataIndexFromPatchIndex(
int patchIndex)
const;
139 #endif // PV_USE_CUDA 145 std::string
const &
getName()
const {
return mName; }
148 std::shared_ptr<PatchGeometry>
getGeometry()
const {
return mGeometry; }
200 float *
getData(
int arbor,
double timestamp);
250 bool getWeightsArePlastic()
const {
return mWeightsArePlastic; }
252 void setWeightsArePlastic() { mWeightsArePlastic =
true; }
263 bool isUsingGPU() {
return mUsingGPUFlag; }
264 void useGPU() { mUsingGPUFlag =
true; }
266 void setCudaDevice(PVCuda::CudaDevice *device) { mCudaDevice = device; }
268 PVCuda::CudaBuffer *getDevicePatchToDataLookup()
const {
return mDevicePatchToDataLookup; }
269 PVCuda::CudaBuffer *getDeviceData()
const {
return mDeviceData; }
271 PVCuda::CudaBuffer *getCUDNNData()
const {
return mCUDNNData; }
272 #endif // PV_USE_CUDNN 273 #endif // PV_USE_CUDA 282 void setName(std::string
const &name) { mName = name; }
284 void setNumDataPatches(
int numDataPatchesX,
int numDataPatchesY,
int numDataPatchesF);
287 void allocateCudaBuffers();
288 #endif // PV_USE_CUDA 291 virtual void initNumDataPatches();
295 std::shared_ptr<PatchGeometry> mGeometry =
nullptr;
299 int mNumDataPatchesX;
300 int mNumDataPatchesY;
301 int mNumDataPatchesF;
303 std::vector<std::vector<float>> mData;
304 std::vector<int> dataIndexLookupTable;
306 bool mWeightsArePlastic =
false;
309 bool mUsingGPUFlag =
false;
310 PVCuda::CudaDevice *mCudaDevice =
nullptr;
311 PVCuda::CudaBuffer *mDevicePatchToDataLookup =
nullptr;
312 PVCuda::CudaBuffer *mDeviceData =
nullptr;
314 PVCuda::CudaBuffer *mCUDNNData =
nullptr;
315 #endif // PV_USE_CUDNN 316 double mTimestampGPU;
317 #endif // PV_USE_CUDA 322 #endif // WEIGHTS_HPP_ bool getSharedFlag() const
void setMargins(PVHalo const &preHalo, PVHalo const &postHalo)
float * getData(int arbor)
int getPatchStrideF() const
int getPatchSizeX() const
std::string const & getName() const
int getNumDataPatchesX() const
int getNumDataPatchesY() const
void initialize(std::shared_ptr< PatchGeometry > geometry, int numArbors, bool sharedWeights, double timestamp)
int getPatchSizeOverall() const
int getNumDataPatches() const
int getNumDataPatchesF() const
Patch const & getPatch(int patchIndex) const
float * getDataFromDataIndex(int arbor, int dataIndex)
int getPatchSizeY() const
std::shared_ptr< PatchGeometry > getGeometry() const
int getPatchStrideY() const
float * getDataFromPatchIndex(int arbor, int patchIndex)
double getTimestamp() const
int getPatchStrideX() const
void allocateDataStructures()
void setTimestamp(double timestamp)
int getPatchSizeF() const
float const * getDataReadOnly(int arbor) const