 
 int main(int argc, char **argv)
 {
-    const auto numGPUs = cuda::device::count();
-
     command_line_options opts = handle_command_line(argc, argv);
     std::cout << "[P2P (Peer-to-Peer) GPU Bandwidth Latency Test]\n";
 
-    list_devices(numGPUs);
-
-    checkP2Paccess(numGPUs);
-
-    print_connectivity_matrix(numGPUs);
+    list_devices();
+    checkP2Paccess();
+
+    print_connectivity_matrix();
 
     enum : bool {
         do_measure_p2p = true,
         dont_measure_p2p = false
     };
 
-    outputBandwidthMatrix(opts.mechanism, numGPUs, dont_measure_p2p, P2P_WRITE);
-    outputBandwidthMatrix(opts.mechanism, numGPUs, do_measure_p2p, P2P_WRITE);
+    outputBandwidthMatrix(opts.mechanism, dont_measure_p2p, P2P_WRITE);
+    outputBandwidthMatrix(opts.mechanism, do_measure_p2p, P2P_WRITE);
     if (opts.test_p2p_read)
     {
-        outputBandwidthMatrix(opts.mechanism, numGPUs, do_measure_p2p, P2P_READ);
-    }
-    outputBidirectionalBandwidthMatrix(opts.mechanism, numGPUs, dont_measure_p2p);
-    outputBidirectionalBandwidthMatrix(opts.mechanism, numGPUs, do_measure_p2p);
-
-    outputLatencyMatrix(opts.mechanism, numGPUs, dont_measure_p2p, P2P_WRITE);
-    outputLatencyMatrix(opts.mechanism, numGPUs, do_measure_p2p, P2P_WRITE);
+        outputBandwidthMatrix(opts.mechanism, do_measure_p2p, P2P_READ);
+    }
+    outputBidirectionalBandwidthMatrix(opts.mechanism, dont_measure_p2p);
+    outputBidirectionalBandwidthMatrix(opts.mechanism, do_measure_p2p);
+
+    outputLatencyMatrix(opts.mechanism, dont_measure_p2p, P2P_WRITE);
+    outputLatencyMatrix(opts.mechanism, do_measure_p2p, P2P_WRITE);
     if (opts.test_p2p_read)
     {
-        outputLatencyMatrix(opts.mechanism, numGPUs, do_measure_p2p, P2P_READ);
+        outputLatencyMatrix(opts.mechanism, do_measure_p2p, P2P_READ);
     }
     std::cout << "\nNOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.\n";
 }

        << "--sm_copy\t\tUse SM initiated p2p transfers instead of Copy Engine\n";
}

void checkP2Paccess(int numGPUs)
{
    for (auto device : cuda::devices()) {
    	static_assert(std::is_same<decltype(device), cuda::device_t>::value, "Unexpected type");

    }
}

void outputBandwidthMatrix(P2PEngine mechanism, bool test_p2p, P2PDataTransfer p2p_method)
{
    int numElems = 10000000;
    int repeat = 5;
