NVIDIA / NVIDIA/cuda-samples

p2pBandwidthLatencyTest shows large run-to-run variance with P2P enabled due to low repeat count

Open
#449 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
9.6k
Forks
2.4k
Avg merge
53m
Merged PRs (30d)
1

Description

Description

I observed large run-to-run variance in p2pBandwidthLatencyTest when measuring unidirectional bandwidth with P2P enabled.

In my test environment, I ran the unidirectional P2P-enabled bandwidth test 10 times. For each run, the result is a 2D bandwidth matrix. I then compared the same (src GPU, dst GPU) data point across the 10
runs and calculated:
range / mean

The variance is relatively large for many GPU pairs. Increasing the internal repeat count in outputBandwidthMatrix() from 5 to 500 made the results much more stable in my environment.

The current code uses only 5 repeats:
void outputBandwidthMatrix(int numElems, int numGPUs, bool p2p, P2PDataTransfer p2p_method, bool needsFallback)
{
int repeat = 5;
...
}

With this setting, the unidirectional P2P-enabled results show noticeable run-to-run fluctuation.

Across 10 runs, the unidirectional P2P-enabled results show noticeable variance.
The range / mean is mostly between 5% and 8%, with a maximum of 10.0%.
Increasing repeat from 5 to 500 made the results much more stable in my environment.
Experimented change

Changing the repeat count from 5 to 500 significantly improved result stability in my environment:

diff --git a/cpp/5_Domain_Specific/p2pBandwidthLatencyTest/p2pBandwidthLatencyTest.cu b/cpp/5_Domain_Specific/p2pBandwidthLatencyTest/p2pBandwidthLatencyTest.cu
index 0c642fcd..6c1470d6 100644
--- a/cpp/5_Domain_Specific/p2pBandwidthLatencyTest/p2pBandwidthLatencyTest.cu
+++ b/cpp/5_Domain_Specific/p2pBandwidthLatencyTest/p2pBandwidthLatencyTest.cu
@@ -228,7 +228,7 @@ void performP2PCopy(int *dest,

void outputBandwidthMatrix(int numElems, int numGPUs, bool p2p, P2PDataTransfer p2p_method, bool needsFallback)
{

  • int repeat = 5;
  • int repeat = 500;
    volatile int *flag = NULL;
    vector<int *> buffers(numGPUs);
    vector<int *> buffersD2D(numGPUs); // buffer for D2D, that is, intra-GPU copy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cpp/5_Domain_Specific/p2pBandwidthLatencyTest/p2pBandwidthLatencyTest.cu, focusing on outputBandwidthMatrix() and its repeat count. Reproduce the unidirectional P2P-enabled bandwidth runs and compare the same GPU-pair results across runs. Done means the chosen change reduces the reported run-to-run variance while preserving the bandwidth test behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.