From 8e2a51b8f29daf76b5a24e9af769743e1bf6fdfe Mon Sep 17 00:00:00 2001 From: Evan Shelhamer Date: Sat, 26 Apr 2014 16:08:22 -0700 Subject: [PATCH] default test net device to 0 and log device chosen --- tools/test_net.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/test_net.cpp b/tools/test_net.cpp index 44a3d6c..4b7fe8e 100644 --- a/tools/test_net.cpp +++ b/tools/test_net.cpp @@ -26,12 +26,13 @@ int main(int argc, char** argv) { Caffe::set_phase(Caffe::TEST); if (argc >= 5 && strcmp(argv[4], "GPU") == 0) { - LOG(ERROR) << "Using GPU"; Caffe::set_mode(Caffe::GPU); + int device_id = 0; if (argc == 6) { - int device_id = atoi(argv[5]); - Caffe::SetDevice(device_id); + device_id = atoi(argv[5]); } + Caffe::SetDevice(device_id); + LOG(ERROR) << "Using GPU #" << device_id; } else { LOG(ERROR) << "Using CPU"; Caffe::set_mode(Caffe::CPU); -- 2.7.4