WSL: `mpirun` hangs when `networkingMode=mirrored`
Windows Version
Microsoft Windows [Version 10.0.22631.3155]
WSL Version
2.1.3.0
Are you using WSL 1 or WSL 2?
- WSL 2
- WSL 1
Kernel Version
5.15.146.1-2
Distro Version
Ubuntu 23.04
Other Software
mpirun (Open MPI) 4.1.4
Repro Steps
- Create
.wslconfigfile with the following content:
[wsl2]
dnsTunneling=true
networkingMode=mirrored
firewall=true
autoProxy=true
[experimental]
autoMemoryReclaim=dropcache
-
Terminate WSL using
wsl.exe --shutdownand start a new WSL instance. -
Compile the following C program using
mpicc mpi.c -o mpi:
#include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
#define ARRAY_SIZE 16
int main(int argc, char *argv[]) {
int rank, size;
int A[ARRAY_SIZE] = {2,5,6,1,6,7,3,9,5,0,6,8,3,5,6,1};
int chunk_size, remainder, local_chunk_size, local_start, local_sum, total_sum;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
chunk_size = ARRAY_SIZE / size;
remainder = ARRAY_SIZE % size;
if (rank < remainder) {
local_chunk_size = chunk_size + 1;
local_start = rank * local_chunk_size;
} else {
local_chunk_size = chunk_size;
local_start = rank * chunk_size + remainder;
}
local_sum = 0;
for (int i = local_start; i < local_start + local_chunk_size; i++) {
local_sum += A[i];
}
MPI_Reduce(&local_sum, &total_sum, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
if (rank == 0) {
printf("Total sum: %d\n", total_sum);
}
MPI_Finalize();
return 0;
}
- Execute the program using
mpirun -np 2 ./mpiand notice thatmpirunhangs.
Expected Behavior
Actual Behavior
Diagnostic Logs
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 15
Same problem here
Same problem