Skip to content

MPI nodes all return 0 from pc.id()  #428

Description

@Helveg

When mpi4py is imported before h.nrnmpi_init() is called, all nodes think they are node 0.

This might be because mpi4py calls MPI.Init() and MPI.Init_thread if MPI hasn't been initialized at that point.

Reproducers

nrnmpi_init first (IDs OK)

from neuron import h

h.nrnmpi_init()
pc = h.ParallelContext()

from mpi4py import MPI

print("I am MPI rank", MPI.COMM_WORLD.rank, "but have ParallelContext ID", pc.id())

h.quit()

MPI Init first (IDs not OK)

from neuron import h
from mpi4py import MPI

h.nrnmpi_init()
pc = h.ParallelContext()


print("I am MPI rank", MPI.COMM_WORLD.rank, "but have ParallelContext ID", pc.id())

h.quit()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions