Parse GPU ids or use all available devices
| 87 | |
| 88 | // Parse GPU ids or use all available devices |
| 89 | static void get_gpus(vector<int>* gpus) { |
| 90 | if (FLAGS_gpu == "all") { |
| 91 | int count = 0; |
| 92 | #ifndef CPU_ONLY |
| 93 | CUDA_CHECK(cudaGetDeviceCount(&count)); |
| 94 | #else |
| 95 | NO_GPU; |
| 96 | #endif |
| 97 | for (int i = 0; i < count; ++i) { |
| 98 | gpus->push_back(i); |
| 99 | } |
| 100 | } else if (FLAGS_gpu.size()) { |
| 101 | vector<string> strings; |
| 102 | boost::split(strings, FLAGS_gpu, boost::is_any_of(",")); |
| 103 | for (int i = 0; i < strings.size(); ++i) { |
| 104 | gpus->push_back(boost::lexical_cast<int>(strings[i])); |
| 105 | } |
| 106 | } else { |
| 107 | CHECK_EQ(gpus->size(), 0); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // Parse phase from flags |
| 112 | caffe::Phase get_phase_from_flags(caffe::Phase default_value) { |
no test coverage detected