MCPcopy Create free account
hub / github.com/BVLC/caffe / GPUParams

Method GPUParams

src/caffe/parallel.cpp:76–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

apply_buffersFunction · 0.85
netMethod · 0.80

Tested by

no test coverage detected