MCPcopy Create free account
hub / github.com/apache/singa / GetGPUMemSize

Method GetGPUMemSize

src/core/device/platform.cc:58–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58const std::pair<size_t, size_t> Platform::GetGPUMemSize(const int device) {
59 std::pair<size_t, size_t> ret{0, 0};
60 if (Platform::CheckDevice(device)) {
61 CUDA_CHECK(cudaSetDevice(device));
62 size_t free = 0, total = 0;
63 CUDA_CHECK(cudaMemGetInfo(&free, &total));
64 ret = std::make_pair(free, total);
65 } else {
66 LOG(ERROR) << "The device (ID = " << device << ") is not available";
67 }
68 return ret;
69}
70
71const vector<std::pair<size_t, size_t>> Platform::GetGPUMemSize() {
72 vector<std::pair<size_t, size_t>> mem;

Callers 1

get_gpu_mem_sizeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected