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

  1. Create .wslconfig file with the following content:
[wsl2]
dnsTunneling=true
networkingMode=mirrored
firewall=true
autoProxy=true

[experimental]
autoMemoryReclaim=dropcache
  1. Terminate WSL using wsl.exe --shutdown and start a new WSL instance.

  2. 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;
}
  1. Execute the program using mpirun -np 2 ./mpi and notice that mpirun hangs.

Expected Behavior

screenshot01

Actual Behavior

screenshot02

Diagnostic Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15

Most upvoted comments

Same problem here

Same problem