             if (i == j) {
                 gb *= 2;    //must count both the read and the write here
             }
-            bandwidthMatrix[i * numGPUs + j] = gb / duration.count();
+            bandwidthMatrix(i, j) = gb / duration.count();
             if (test_p2p and p2p_access_possible) {
                 cuda::device::peer_to_peer::disable_access(device, peer);
                 cuda::device::peer_to_peer::disable_access(peer, device);


    std::cout << "Unidirectional P2P=" << (test_p2p ? "Enabled": "Disabled") << " Bandwidth " << (p2p_method == P2P_READ ? "(P2P Reads) " : "") << "Matrix (GB/s)\n";

    std::cout << "   D\\D ";

    for (auto device : cuda::devices()) {
        std::cout << std::setw(bandwidth::field_width) << device.id() << ' ';
    }

    std::cout << "\n";

    for (auto device : cuda::devices()) {
        std::cout << std::setw(bandwidth::field_width) << device.id() << ' ';

        for (auto peer : cuda::devices()) {
            std::cout << std::fixed << std::setprecision(bandwidth::precision) << std::setw(bandwidth::field_width) << bandwidthMatrix[device.id() * numGPUs + peer.id()] << ' ';
        }

        std::cout << "\n";
    }
}

void outputBidirectionalBandwidthMatrix(P2PEngine p2p_mechanism, int numGPUs, bool test_p2p)
{
    int numElems = 10000000;
    int repeat = 5;

            if (i == j) {
                gb *= 2;    //must count both the read and the write here
            }
            bandwidthMatrix(i, j) = gb / duration.count();
            if (test_p2p && p2p_access_possible) {
                cuda::device::peer_to_peer::disable_access(device, peer);
                cuda::device::peer_to_peer::disable_access(peer, device);
