17 #include <cuda_runtime.h> 22 #include "c10/util/Flags.h" 23 #include "caffe2/core/common_gpu.h" 24 #include "caffe2/core/init.h" 25 #include "caffe2/core/logging.h" 29 C10_DECLARE_int(caffe2_log_level);
31 int main(
int argc,
char** argv) {
34 "Inspects the GPUs on the current machine and prints out their details " 38 CUDA_ENFORCE(cudaGetDeviceCount(&gpu_count));
39 for (
int i = 0; i < gpu_count; ++i) {
40 LOG(INFO) <<
"Querying device ID = " << i;
44 vector<vector<bool> > access_pattern;
45 CAFFE_ENFORCE(caffe2::GetCudaPeerAccessPattern(&access_pattern));
47 std::stringstream sstream;
49 for (
int i = 0; i < gpu_count; ++i) {
50 for (
int j = 0; j < gpu_count; ++j) {
51 sstream << (access_pattern[i][j] ?
"+" :
"-") <<
" ";
55 LOG(INFO) <<
"Access pattern: " << std::endl << sstream.str();
C10_API void SetUsageMessage(const std::string &str)
Sets the usage message when a commandline tool is called with "--help".
bool GlobalInit(int *pargc, char ***pargv)
Initialize the global environment of caffe2.
void DeviceQuery(const int device)
Runs a device query function and prints out the results to LOG(INFO).