ompi icon indicating copy to clipboard operation
ompi copied to clipboard

MPI-4.0: Mandatory "mpi_size" info key from Session processors sets.

Open dalcinl opened this issue 2 years ago • 2 comments

Please review MPI-4.0, pp 503, lines 43-44, quoted below:

A process set caches key/value tuples that are accessible to the application via an MPI_Info object. The "mpi_size" key is mandatory for all process sets.

Next take a look at this two test cases from mpi4py test suite.

These two test cases are currently failing the following way:

FAIL: testSessionSELF (test_session.TestSession)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dalcinl/Devel/mpi4py/test/test_session.py", line 54, in testSessionSELF
    self.assertEqual(info.Get("mpi_size"), "1")
AssertionError: None != '1'
FAIL: testSessionWORLD (test_session.TestSession)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dalcinl/Devel/mpi4py/test/test_session.py", line 68, in testSessionWORLD
    self.assertEqual(info.Get("mpi_size"), str(size))
AssertionError: None != '1'

Looks like the Info object returned by MPI_Session_get_pset_info() does not have the mandatory "mpi_size" key/value pair set.

Clarification: In mpi4py, info.Get(key) returns None if the key/value pair is not set in the Info object.

dalcinl avatar Jul 18 '22 12:07 dalcinl

@hppritcha You may want to look at this one.

dalcinl avatar Jul 18 '22 12:07 dalcinl

we forgot to update the key string when this was changed in the sessions proposal.

hppritcha avatar Jul 18 '22 16:07 hppritcha

closed via #10637 and #10650

hppritcha avatar Aug 16 '22 19:08 hppritcha

@hppritcha Unfortunately, It is not working as expected:

Reproducer

from mpi4py import MPI

session = MPI.Session.Init()

info = session.Get_pset_info("mpi://SELF")
print(info.Get("mpi_size"))
info.Free()

info = session.Get_pset_info("mpi://WORLD")
print(info.Get("mpi_size"))
info.Free()

session.Finalize()

Output

$ mpiexec -n 1 python test.py 
self size:   0
world size:  0

dalcinl avatar Aug 17 '22 06:08 dalcinl

try with mpi://world

hppritcha avatar Aug 17 '22 15:08 hppritcha

i fixed the process set name parsing in a subsequent PR #10672

hppritcha avatar Aug 17 '22 15:08 hppritcha