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

Method to_cpu

src/caffe/syncedmem.cpp:39–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39inline void SyncedMemory::to_cpu() {
40 check_device();
41 switch (head_) {
42 case UNINITIALIZED:
43 CaffeMallocHost(&cpu_ptr_, size_, &cpu_malloc_use_cuda_);
44 caffe_memset(size_, 0, cpu_ptr_);
45 head_ = HEAD_AT_CPU;
46 own_cpu_data_ = true;
47 break;
48 case HEAD_AT_GPU:
49#ifndef CPU_ONLY
50 if (cpu_ptr_ == NULL) {
51 CaffeMallocHost(&cpu_ptr_, size_, &cpu_malloc_use_cuda_);
52 own_cpu_data_ = true;
53 }
54 caffe_gpu_memcpy(size_, gpu_ptr_, cpu_ptr_);
55 head_ = SYNCED;
56#else
57 NO_GPU;
58#endif
59 break;
60 case HEAD_AT_CPU:
61 case SYNCED:
62 break;
63 }
64}
65
66inline void SyncedMemory::to_gpu() {
67 check_device();

Callers

nothing calls this directly

Calls 2

CaffeMallocHostFunction · 0.85
caffe_memsetFunction · 0.85

Tested by

no test coverage detected