File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ int main(int argc, char** argv) {
3434 cudaGetDevice (&device);
3535 cout << " Current device id: " << device << endl;
3636 cudaGetDeviceProperties (&CAFFE_TEST_CUDA_PROP, device);
37+ cout << " Current device name: " << CAFFE_TEST_CUDA_PROP.name << endl;
3738#endif
3839 // invoke the test.
3940 return RUN_ALL_TESTS ();
Original file line number Diff line number Diff line change @@ -183,7 +183,13 @@ int train() {
183183 s << (i ? " , " : " " ) << gpus[i];
184184 }
185185 LOG (INFO) << " Using GPUs " << s.str ();
186-
186+ #ifndef CPU_ONLY
187+ cudaDeviceProp device_prop;
188+ for (int i = 0 ; i < gpus.size (); ++i) {
189+ cudaGetDeviceProperties (&device_prop, gpus[i]);
190+ LOG (INFO) << " GPU " << gpus[i] << " : " << device_prop.name ;
191+ }
192+ #endif
187193 solver_param.set_device_id (gpus[0 ]);
188194 Caffe::SetDevice (gpus[0 ]);
189195 Caffe::set_mode (Caffe::GPU);
@@ -229,6 +235,11 @@ int test() {
229235 get_gpus (&gpus);
230236 if (gpus.size () != 0 ) {
231237 LOG (INFO) << " Use GPU with device ID " << gpus[0 ];
238+ #ifndef CPU_ONLY
239+ cudaDeviceProp device_prop;
240+ cudaGetDeviceProperties (&device_prop, gpus[0 ]);
241+ LOG (INFO) << " GPU device name: " << device_prop.name ;
242+ #endif
232243 Caffe::SetDevice (gpus[0 ]);
233244 Caffe::set_mode (Caffe::GPU);
234245 } else {
You can’t perform that action at this time.
0 commit comments