17 #include <cuda_runtime.h> 22 #include "caffe2/core/common_gpu.h" 23 #include "caffe2/core/init.h" 24 #include "caffe2/core/logging.h" 28 CAFFE2_DECLARE_int(caffe2_log_level);
30 int main(
int argc,
char** argv) {
33 "Inspects the GPUs on the current machine and prints out their details " 37 CUDA_ENFORCE(cudaGetDeviceCount(&gpu_count));
38 for (
int i = 0; i < gpu_count; ++i) {
39 LOG(INFO) <<
"Querying device ID = " << i;
43 vector<vector<bool> > access_pattern;
46 std::stringstream sstream;
48 for (
int i = 0; i < gpu_count; ++i) {
49 for (
int j = 0; j < gpu_count; ++j) {
50 sstream << (access_pattern[i][j] ?
"+" :
"-") <<
" ";
54 LOG(INFO) <<
"Access pattern: " << std::endl << sstream.str();
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).
bool GetCudaPeerAccessPattern(vector< vector< bool > > *pattern)
Return a peer access pattern by returning a matrix (in the format of a nested vector) of boolean valu...
void SetUsageMessage(const string &str)
Sets the usage message when a commandline tool is called with "--help".