diff options
author | Jeff Donahue <jeff.donahue@gmail.com> | 2016-02-02 22:05:07 -0800 |
---|---|---|
committer | Jeff Donahue <jeff.donahue@gmail.com> | 2016-02-02 22:05:07 -0800 |
commit | b590f1d27eb5cbd9bc7b9157d447706407c68682 (patch) | |
tree | 0b6b83bc4ad981265012d6a598117204e3202408 | |
parent | 2ef584785c8ade90260eb117f189146364494183 (diff) | |
parent | dd2099786f11033ded6e9f46bc772ef9b2166399 (diff) | |
download | caffeonacl-b590f1d27eb5cbd9bc7b9157d447706407c68682.tar.gz caffeonacl-b590f1d27eb5cbd9bc7b9157d447706407c68682.tar.bz2 caffeonacl-b590f1d27eb5cbd9bc7b9157d447706407c68682.zip |
Merge pull request #3624 from drnikolaev/bvlc-print-gpu-names
Nicely prints gpu names
-rw-r--r-- | src/caffe/test/test_caffe_main.cpp | 1 | ||||
-rw-r--r-- | tools/caffe.cpp | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/caffe/test/test_caffe_main.cpp b/src/caffe/test/test_caffe_main.cpp index c8caf5ac..fccf6f16 100644 --- a/src/caffe/test/test_caffe_main.cpp +++ b/src/caffe/test/test_caffe_main.cpp @@ -34,6 +34,7 @@ int main(int argc, char** argv) { cudaGetDevice(&device); cout << "Current device id: " << device << endl; cudaGetDeviceProperties(&CAFFE_TEST_CUDA_PROP, device); + cout << "Current device name: " << CAFFE_TEST_CUDA_PROP.name << endl; #endif // invoke the test. return RUN_ALL_TESTS(); diff --git a/tools/caffe.cpp b/tools/caffe.cpp index 470165ad..ebe95d61 100644 --- a/tools/caffe.cpp +++ b/tools/caffe.cpp @@ -183,7 +183,13 @@ int train() { s << (i ? ", " : "") << gpus[i]; } LOG(INFO) << "Using GPUs " << s.str(); - +#ifndef CPU_ONLY + cudaDeviceProp device_prop; + for (int i = 0; i < gpus.size(); ++i) { + cudaGetDeviceProperties(&device_prop, gpus[i]); + LOG(INFO) << "GPU " << gpus[i] << ": " << device_prop.name; + } +#endif solver_param.set_device_id(gpus[0]); Caffe::SetDevice(gpus[0]); Caffe::set_mode(Caffe::GPU); @@ -229,6 +235,11 @@ int test() { get_gpus(&gpus); if (gpus.size() != 0) { LOG(INFO) << "Use GPU with device ID " << gpus[0]; +#ifndef CPU_ONLY + cudaDeviceProp device_prop; + cudaGetDeviceProperties(&device_prop, gpus[0]); + LOG(INFO) << "GPU device name: " << device_prop.name; +#endif Caffe::SetDevice(gpus[0]); Caffe::set_mode(Caffe::GPU); } else { |