Closed hppritcha closed 11 months ago
Looks like we need to properly initialize the user supplied pset_name
if it is greater in size than the length of the process set name. similar to what's done with, for example, MPI_Open_port
.
related to https://github.com/mathomp4/MPITests/pull/1
closed via #12105 and
email direct to me that I had to edit owing to my employer's email URL mangling thing
This is my attempt to add a hello world example using MPI Sessions. I was inspired by the Open MPI BoF at SC23. Note that this is shamelessly based on sessions_ex3.f90 from https://github.com/open-mpi/ompi-tests-public/tree/master/sessions When run you get:
Compiler Version: GCC version 12.3.0 MPI Version: 3.1 MPI Library Version: Open MPI v5.0.0, package: Open MPI mathomp4@gs6101-Dagobah.ndc.nasa.gov Distribution, ident: 5.0.0, repo rev: v5.0.0, Oct 26, 2023 Pset 0 name: mpi://WORLD Pset 1 name: mpi://SELF Pset 2 name: mpix://SHARED Process 0 of 4 is on gs6101-Dagobah.ndc.nasa.gov Process 1 of 4 is on gs6101-Dagobah.ndc.nasa.gov Process 3 of 4 is on gs6101-Dagobah.ndc.nasa.gov Process 2 of 4 is on gs6101-Dagobah.ndc.nasa.gov Note, a couple oddities. First, in the code I have:
character(len=MPI_MAX_PSET_NAME_LEN), allocatable :: pset_names(:), dummy ... allocate(pset_names(0:n_psets-1)) do i = 0, n_psets-1 pset_names(i) = "" call MPI_Session_get_nth_pset(shandle, MPI_INFO_NULL, i, pset_len(i), pset_names(i)) end do ... if (myid == 0) then ! Now let's print out the array of pset names just because I'm not sure what they are... do i = 0, n_psets-1 write(,) "Pset ", i, " name: ", trim(pset_names(i)) end do end if which gets the good output above.
My first attempt I didn't have:
to initialize the array to "", and that output garbage despite the trim in the write:
Compiler Version: GCC version 12.3.0 MPI Version: 3.1 MPI Library Version: Open MPI v5.0.0, package: Open MPI mathomp4@gs6101-Dagobah.ndc.nasa.gov Distribution, ident: 5.0.0, repo rev: v5.0.0, Oct 26, 2023 Pset 0 name: mpi://WORLD � ZTUM����������������ZTUMZTUM�lp��`�pkd<���������:;p�ZTUM� ZTUM��������O�������ZTUMZTUMDNOC Pset 1 name: mpi://SELF (�X��G�o�������ox� Pset 2 name: mpix://SHARED �g<�g<
Now, this might be a feature/bug/🤷🏼 of the how Fortran gets the name via C? Not sure, but it seems to indicate that it's not whitespace in the buffer, but uninitialized.
Next, I tried to be clever and tried:
allocate(pset_names(0:n_psets-1), source="") but that didn't seem to work either:
Compiler Version: GCC version 12.3.0 MPI Version: 3.1 MPI Library Version: Open MPI v5.0.0, package: Open MPI mathomp4@gs6101-Dagobah.ndc.nasa.gov Distribution, ident: 5.0.0, repo rev: v5.0.0, Oct 26, 2023 ��F�(� 0 name: mpi://WORLD �F�(� Pset 1 name: mpi://SELF Pset 2 name: mpix://SHARED Process 0 of 4 is on Process 1 of 4 is on Process 3 of 4 is on Process 2 of 4 is on I might need to impose on @tclune to educate me on that. I sort of assumed:
allocate(pset_names(0:n_psets-1), source="") would be equivalent to:
allocate(pset_names(0:n_psets-1)) do i = 0, n_psets-1 pset_names(i) = "" end do but it doesn't seem like it?