Re: [mpich-discuss] MPICH: SHM bandwidth very low on IPC test
Hi all, Thank you for your advice; I really appreciate it. *Try repeat the measurement a few times, you should see higher bandwidth number in the later rounds.* I did this by running the transfer 100 times and only using the last 20 measurements (discarding the first 80), and I saw the same performance. *Obviously if there are multiple rank pairs on the node communicating concurrently, then multiple cores will be active copying concurrently increasing aggregate bandwidth to closer to the many core or threaded throughput, which is what you would get if you compile STREAM with "-fopenmp”. * Good point -- I ran stream.c with -fopenmp, which returned 48 GB/s. So, the discrepancy seems to be when dealing with IPC. Next, I ran these benchmarks, also using MPICH 4.2.1, on a different machine from the same era (Xeon E5-2650 v4). This is a single-socket board with one processor, as opposed to the original Dell Poweredge in question, which has two sockets, each with a E5-2699A. For both machines, I have attached the following in a zip file to avoid clogging the thread: - Hardware topology (from lstopo) - lscpu output - Output from stream.c (single core) - Output from stream_omp.c (openmp) - Output from my host-host communication program (shmem_check.cpp): The main takeaways are that the single- and multi-core memory bandwidth appears to be the same for both machines, although the IPC bandwidth observed using MPI is >*1.5x higher on the single-socket machine* than the original machine that is showing the slow-down. *I would assume, that your MPI bandwidth calculation only accounts for the buffer size (i.e., only read or write).* This is a good point, although I'm not sure why the bandwidth would be 1.5x higher on the other machine that has very similar memory performance. One more piece of information: The single-socket machine (Xeon E5-2650 v4) has four RAM sticks in a quad-channel configuration, all tied to the same socket as you can see in lstopo. On the dual-socket machine (the machine in question), the four RAM sticks are in a dual-channel configuration, with two sticks on each socket. So, I'm not sure if the dual- vs quad-channel configuration is hurting maximum memory bandwidth per socket on the dual-socket machine, despite the total bandwidths showing approximately the same in STREAM. I have tried to make the tests more uniform by binding the processes to the same core. But that still calls into question the total memory bandwidth of the dual-channel vs quad-channel memory configuration. Do you have any thoughts on this? The question I'm trying to answer is: for what reasons would the memory bandwidth be significantly lower on the dual-socket Dell machine? I understand that making comparisons across machines is tricky, but I've tried to provide as much information as possible to isolate the key aspects of the memory configuration. Thanks in advance! Sam On Thu, Aug 14, 2025 at 12:41 PM Boyle, Peter <[email protected]> wrote:
Hi,
1) Obviously if there are multiple rank pairs on the node communicating concurrently, then multiple cores will be active copying concurrently increasing aggregate bandwidth to closer to the many core or threaded throughput, which is what you would get if you compile STREAM with "-fopenmp”.
The Xeon part you quote has a peak of 76GB/s memory bandwidth per socket and multiple cores will be needed to saturate that.
2) It is common for people to use hybrid OpenMP and MPI, to minimize intra-node copy overhead. Often using one rank per NUMA domain. In that context, using MPI_Comm_split(…, MPI_COMM_TYPE_SHARED) will reveal which ranks can use unix shared memory regions (e.g. shmopen ) and then use ALL their threads concurrently to blast data between sockets, and use OpenMP within a socket.
Then we get into the topic of careful NUMA binding of ranks to sockets etc...
Best wishes,
Peter
*From: *Joachim Jenke via discuss <[email protected]> *Date: *Thursday, August 14, 2025 at 12:21 PM *To: *Sam Austin <[email protected]> *Cc: *Joachim Jenke <[email protected]>, [email protected] < [email protected]> *Subject: *Re: [mpich-discuss] MPICH: SHM bandwidth very low on IPC test
Hi Sam,
the 10GB/s stream bandwidth calculation includes the number of read+written bytes (see lines 190/366).
I would assume, that your MPI bandwidth calculation only accounts for the buffer size (i.e., only read or write). In shm communication one process (and therefore one core) streams/memcopies the data from the send to the receive buffer. So, when you see 3.5GB send bandwidth, that actually compares to 7GB of stream Copy bandwidth.
As a side-effect of shm communication, we have actually seen that the placement of the copying process can determine the first-touch allocation of the buffer. Even if the memory is allocated with calloc, the memory is not paged. A bcast/scatter to node-local processes can result in paging all buffers to the same socket (what you typically want to avoid).
Best Joachim
Am 14.08.25 um 07:16 schrieb Sam Austin:
Hi Joachim,
Thanks for this suggestion! I used stream to test the single-core memory bandwidth. I am running on a Xeon E5-2699A v4, which has 55MB last level cache. So, I ran with 30 million elements per the instructions. It appears that I am seeing about 10 GB/s if I'm reading that right? If so, I am still not sure why I am only seeing ~3.5 GB/s on shared memory performance with MPICH.
------------------------------------------------------------- STREAM version $Revision: 5.10 $ ------------------------------------------------------------- This system uses 8 bytes per array element. ------------------------------------------------------------- Array size = 30000000 (elements), Offset = 0 (elements) Memory per array = 228.9 MiB (= 0.2 GiB). Total memory required = 686.6 MiB (= 0.7 GiB). Each kernel will be executed 10 times. The *best* time for each kernel (excluding the first iteration) will be used to compute the reported bandwidth. ------------------------------------------------------------- Your clock granularity/precision appears to be 1 microseconds. Each test below will take on the order of 30276 microseconds. (= 30276 clock ticks) Increase the size of the arrays if this shows that you are not getting at least 20 clock ticks per test. ------------------------------------------------------------- WARNING -- The above is only a rough guideline. For best results, please be sure you know the precision of your system timer. ------------------------------------------------------------- Function Best Rate MB/s Avg time Min time Max time Copy: 10038.1 0.048342 0.047818 0.050004 Scale: 10342.2 0.048738 0.046412 0.056605 Add: 10580.3 0.068542 0.068051 0.069805 Triad: 10703.0 0.067615 0.067271 0.068143 ------------------------------------------------------------- Solution Validates: avg error less than 1.000000e-13 on all three arrays -------------------------------------------------------------
Thanks, Sam
On Wed, Aug 13, 2025 at 5:26 PM Jenke, Joachim <[email protected] <mailto:[email protected] <[email protected]>>> wrote:
Hi Sam,
Can you try out stream to understand the single-core memory bandwidth of the system?
https://urldefense.us/v3/__https://www.cs.virginia.edu/stream/ref.html__;!!G... <https:// https://urldefense.us/v3/__http://www.cs.virginia.edu/stream/ref.html__;!!G_... > <https://urldefense.us/v3/__http://www.cs.virginia.edu/stream/ref.html*3E__;J... >
Copy bandwidth for large junks (exceeding cache sizes) should provide you an upper bound for shm communication bandwidth.
Best Joachim
Am 13.08.2025 22:04 schrieb Sam Austin via discuss <[email protected] <mailto:[email protected] <[email protected]>>>: Hi all, I am working to configure MPICH and run a few examples on my standalone server (single node). Here are the system specs: Server: Dell PowerEdge C4130 CPUs: 2x Xeon E5-2699A v4 GPUs: 4x Tesla V100s connected with NVLink, tied to motherboard ZjQcmQRYFpfptBannerStart This Message Is From an External Sender This message came from outside your organization. ZjQcmQRYFpfptBannerEnd Hi all,
I am working to configure MPICH and run a few examples on my standalone server (single node). Here are the system specs: Server: Dell PowerEdge C4130 CPUs: 2x Xeon E5-2699A v4 GPUs: 4x Tesla V100s connected with NVLink, tied to motherboard with PCIe gen 3 OS: Ubuntu 24.04 LTS I intend to use this system to develop multi-process programs for eventual execution in a large, distributed HPC environment. I ran a few tests with and without CUDA support; here is my mpichversion output:
MPICH Version: 4.3.1 MPICH Release date: Fri Jun 20 09:24:41 AM CDT 2025 MPICH ABI: 17:1:5 MPICH Device: ch4:ofi MPICH configure: --prefix=/opt/mpich/4.2.1-cpu --without-cuda MPICH CC: gcc -O2 MPICH CXX: g++ -O2 MPICH F77: gfortran -O2 MPICH FC: gfortran -O2 MPICH features: threadcomm
The first example that I ran was a bandwidth test for CPU-CPU and GPU-GPU communication. This simple program sends small packets back and forth between processes to test the bandwidth over the various intra-node networks.
The GPU-GPU bandwidth test showed that the GPU interconnect was saturating at ~45 GB/s, which is nominal for the NVLink interconnect topology present on the node (this was run with a CUDA-aware build of MPICH). The problem appears during the CPU-CPU IPC test. In theory, this test is pretty vanilla, as it is communicating between processes using shared memory, and does not involve traversing any of the intra-node networks (PCIe or NVLink). My understanding is that the bandwidth observed on the CPU-CPU IPC test should be quite high, at least higher than 10 GB/s.
However, the intra-node IPC bandwidth appears to be very low, around 3.5 GB/s, when running this test. I tried the following fixes in an attempt to force MPICH to use shared memory, but to no avail: Passing the option to explicitly specify `nemesis` during the build configuration: "--with-device=ch3:nemesis --with-cuda" Passing the option to explicitly specify shared memory with ch4 to the configuration: "--with-ch4-shmmods=posix --with-cuda" Rebuilding MPICH without GPU support: "--without-cuda" Switching to Open MPI and running the same test These results, especially the last one in which I saw the same issues when running with Open MPI, makes me think it might be an issue with my system configuration. The question is: why is the IPC bandwidth so low despite supposedly using the SHM protocol? I'm wondering if anyone has encountered this issue before or might be able to lend some advice here. Any help would be greatly appreciated!
Some interesting observations from the output below: when I run with "mpiexec -np 2 -genv FI_PROVIDER=shm ...", the log file reports "Opened fabric: shm". However, when I run without "-genv FI_PROVIDER=shm", the log file reports "Opened fabric: 10.133.0.0/21 <https://urldefense.us/v3/__http://10.133.0.0/21__;!!G_uCfscf7eWS! ZaUD7Nw- pSrvdcr4vb0JBtm7m5HhtE6d7G1wb5HakwqLQQenlo0WTl1tkzV3CrJnLwCQ7cVvC- kgoP1Dp-C6$>", which I believe means that MPICH is falling back on the TCP socket protocol. In this case, my key point of confusion is that the observed bandwidth is essentially the same between the SHM and TCP protocols. Perhaps my test script isn't set up properly?
Thanks, Sam
The following is attached below: Bandwidth test program Run script for the program Output of the script on my machine
----------------------------------------------------------------------------------------------------------------
In case the attachment doesn't go through, here are the contents of my test program, "shmem_check.cpp":
// shmem_check.cpp // // This is a minimal benchmark to test the raw bandwidth of MPI communication // between two processes on the same node, using only host (CPU)
memory.
// It completely removes CUDA to isolate the performance of the MPI library's // on-node communication mechanism (e.g., shared memory vs. TCP loopback). // // Compile/run: // /opt/mpich/4.2.1-cpu/bin/mpicxx -std=c++17 -I/opt/mpich/4.2.1- cpu/include shmem_check.cpp -o shmem_check // /opt/mpich/4.2.1-cpu/bin/mpiexec -np 2 ./shmem_check
#include <iostream> #include <vector> #include <numeric> #include <mpi.h>
int main(int argc, char* argv[]) { MPI_Init(&argc, &argv);
int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size);
if (size != 2) { if (rank == 0) { std::cerr << "Error: This program must be run with exactly 2 MPI processes." << std::endl; } MPI_Finalize(); return 1; }
const int num_samples = 100; const long long packet_size = 1LL << 28; // 256 MB
// Allocate standard host memory. 'new' is sufficient. char* buffer = new char[packet_size];
if (rank == 0) { std::cout << "--- Starting Host-to-Host MPI Bandwidth Test ---" << std::endl; std::cout << "Packet Size: " << (packet_size / (1024*1024)) << " MB" << std::endl; }
std::vector<double> timings; for (int i = 0; i < num_samples; ++i) { MPI_Barrier(MPI_COMM_WORLD); double start_time = MPI_Wtime();
if (rank == 0) { MPI_Send(buffer, packet_size, MPI_CHAR, 1, 0, MPI_COMM_WORLD); MPI_Recv(buffer, 1, MPI_CHAR, 1, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); // Wait for confirmation } else { // rank == 1 MPI_Recv(buffer, packet_size, MPI_CHAR, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); MPI_Send(buffer, 1, MPI_CHAR, 0, 1, MPI_COMM_WORLD); // Send confirmation }
double end_time = MPI_Wtime(); if (i >= 10) { // Discard warmup runs timings.push_back(end_time - start_time); } }
if (rank == 0) { double total_time = std::accumulate(timings.begin(), timings.end(), 0.0); double avg_time = total_time / timings.size(); double bandwidth = (static_cast<double>(packet_size) / (1024.0 * 1024.0 * 1024.0)) / avg_time;
std::cout << "------------------------------------------------" << std::endl; std::cout << "Average Host-to-Host Bandwidth: " << bandwidth << " GB/s" << std::endl; std::cout << "------------------------------------------------" << std::endl; }
// Clean up host memory delete[] buffer;
MPI_Finalize(); return 0; }
----------------------------------------------------------------------------------------------------------------
Here is the script to run the test with verbose compilation and the `shm` layer forced and unforced:
#!/usr/bin/zsh source ~/.zshrc
# Compile /opt/mpich/4.2.1-cpu/bin/mpicxx -std=c++17 -I/opt/mpich/4.2.1-cpu/ include shmem_check.cpp -o shmem_check
# Run with shm forced /opt/mpich/4.2.1-cpu/bin/mpiexec -np 2 -genv FI_PROVIDER=shm -genv FI_LOG_LEVEL=debug ./shmem_check 2> output_shm.txt
# Run without shm forced /opt/mpich/4.2.1-cpu/bin/mpiexec -np 2 -genv FI_LOG_LEVEL=debug ./ shmem_check 2> output_no_shm.txt
echo "Output of script with SHM forced: " grep -i "opened fabric" output_shm.txt
echo "Output of script with SHM not forced: " grep -i "opened fabric" output_no_shm.txt
----------------------------------------------------------------------------------------------------------------
Here is the output :
--- Starting Host-to-Host MPI Bandwidth Test --- Packet Size: 256 MB ------------------------------------------------ Average Host-to-Host Bandwidth: 3.35709 GB/s ------------------------------------------------ --- Starting Host-to-Host MPI Bandwidth Test --- Packet Size: 256 MB ------------------------------------------------ Average Host-to-Host Bandwidth: 3.54924 GB/s ------------------------------------------------ Output of script with SHM forced: libfabric:3174297:1755114546::core:core:fi_fabric_():1503<info> Opened fabric: shm libfabric:3174298:1755114546::core:core:fi_fabric_():1503<info> Opened fabric: shm Output of script with SHM not forced: libfabric:3174351:1755114554::core:core:fi_fabric_():1503<info> Opened fabric: 10.133.0.0/21 <https://urldefense.us/v3/ __https://urldefense.us/v3/__http://10.133.0.0/21__;!!G_uCfscf7eWS!ZaUD7Nw-__;... pSrvdcr4vb0JBtm7m5HhtE6d7G1wb5HakwqLQQenlo0WTl1tkzV3CrJnLwCQ7cVvC- kgoP1Dp-C6$> libfabric:3174350:1755114554::core:core:fi_fabric_():1503<info> Opened fabric: 10.133.0.0/21 <https://urldefense.us/v3/ __https://urldefense.us/v3/__http://10.133.0.0/21__;!!G_uCfscf7eWS!ZaUD7Nw-__;... pSrvdcr4vb0JBtm7m5HhtE6d7G1wb5HakwqLQQenlo0WTl1tkzV3CrJnLwCQ7cVvC- kgoP1Dp-C6$>
-- Dr. rer. nat. Joachim Jenke Deputy Group Lead
IT Center Group: HPC - Parallelism, Runtime Analysis & Machine Learning Division: Computational Science and Engineering RWTH Aachen University Seffenter Weg 23 D 52074 Aachen (Germany) Tel: +49 241 80- 24765 Fax: +49 241 80-624765 [email protected] https://urldefense.us/v3/__http://www.itc.rwth-aachen.de__;!!G_uCfscf7eWS!aD...
participants (1)
-
Sam Austin