MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / GPUParams

Method GPUParams

rtpose_wrapper/src/caffe/parallel.cpp:77–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76template<typename Dtype>
77GPUParams<Dtype>::GPUParams(shared_ptr<Solver<Dtype> > root_solver, int device)
78 : Params<Dtype>(root_solver) {
79#ifndef CPU_ONLY
80 int initial_device;
81 CUDA_CHECK(cudaGetDevice(&initial_device));
82
83 // Allocate device buffers
84 CUDA_CHECK(cudaSetDevice(device));
85 CUDA_CHECK(cudaMalloc(&data_, size_ * sizeof(Dtype)));
86
87 // Copy blob values
88 const vector<Blob<Dtype>*>& net =
89 root_solver->net()->learnable_params();
90 apply_buffers(net, data_, size_, copy);
91
92 CUDA_CHECK(cudaMalloc(&diff_, size_ * sizeof(Dtype)));
93 caffe_gpu_set(size_, Dtype(0), diff_);
94
95 CUDA_CHECK(cudaSetDevice(initial_device));
96#else
97 NO_GPU;
98#endif
99}
100
101template<typename Dtype>
102GPUParams<Dtype>::~GPUParams() {

Callers

nothing calls this directly

Calls 2

apply_buffersFunction · 0.85
netMethod · 0.80

Tested by

no test coverage detected