Skip to content

COMM_WORLD.Get_size() returns 1 reguardless of num threads launched on Github Runner #13

Closed
@jpmorgan98

Description

@jpmorgan98

mpi4py in a Github runner seems to have stopped being able to allocate multiple threads. We have tests that need exactly 4 threads to pass and mpi4py from setup-mpi seems to have stopped allocating anything other then 1, even tho it will still execute a given script n times. For an example I am attaching a runner script, a sample mpi4py test, the incorrect, and the expected outputs.

For some more background see our issue tracking this problem

Thanks in advance!

mpi_error.yml

name: MPI CI Error

on: [push, pull_request]

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
        fail-fast: false
        matrix:
            os: ["ubuntu-latest"]
    steps:
    - uses: actions/checkout@v3
    - name: Set up python 3.11
      uses: actions/setup-python@v3
      with:
        python-version: "3.11"
    - name: debug
      run: |
        pwd
        ls
    - uses: mpi4py/setup-mpi@v1
    - name: Install dependencies
      run: |
        pip install mpi4py
    - name: Run MPI
      run : |
        lscpu
        mpiexec -n 4 python -m mpi4py.bench helloworld
        mpiexec -n 4 python test_mpi.py

test_mpi.py

from mpi4py import MPI
print(MPI.COMM_WORLD.Get_size())

output when github runner CI is used

Hello, World! I am process 0 of 1 on fv-az1308-741.
Hello, World! I am process 0 of 1 on fv-az1308-741.
Hello, World! I am process 0 of 1 on fv-az1308-741.
Hello, World! I am process 0 of 1 on fv-az1308-741.

1
1
1
1

The expected output (commands run on a local machine configured with mpi4py)

Hello, World! I am process 0 of 4 on 
Hello, World! I am process 1 of 4 on 
Hello, World! I am process 2 of 4 on 
Hello, World! I am process 3 of 4 on 

4
4
4
4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions