Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.

mpiifort MPI_IN_PLACE vs mpiicc

David_Race
Beginner
1,879 Views
I am working on some profiler code, but many of the collective routines allow passing a constant MPI_IN_PLACE instead of an address. The MPI_IN_PLACE for fortran is in a common block vs the (void *) -1 for C. Is there a standard way within the intel mpi runtime environment to see if the address passed to the c profiling routine is the fortran MPI_IN_PLACE?
Thanks
David Race
0 Kudos
2 Replies
James_T_Intel
Moderator
1,879 Views
Hi David,

I do not have a definitive answer at this time, but I will ask around to see if I can get some better ideas. However, here are a few hints that might help.

First, consider the argument types. In Fortran,many MPI arguments use an integer value, whereas in C/C++, some of these arguments have a specific type defined. For instance, communicators in Fortran are of type integer (used as a handle to the actual communicator), and in C, a communicator is an object of type MPI_Comm.

Second, look at the length of the call. Almost all MPI calls in Fortran (and all that are relevant to this question) have an extra argument at the end for returning the error code, whereas this argument is missing in C (it is the function return value instead).

While neither of these is a direct method, you can try to utilize them to determine which MPI_IN_PLACE is being used. Also, try looking at the address in the pointer. If it is not -1, youknow that it must be the Fortran version.

As I said, I will see if I can get some more definitive information. Hopefully this can give you some useful information in the meantime.

Sincerely,
James Tullos
Technical Consulting Engineer
Intel Cluster Tools
0 Kudos
James_T_Intel
Moderator
1,879 Views
Hi David,

Here's a better solution for what you're trying to do. Use a Fortran function that takes an integer argument and compares the address of that argument to the address of MPI_IN_PLACE.

[fortran]      integer function is_in_place( i )
      include 'mpif.h'
      integer i
      is_in_place = 0
      if( %loc(i) .eq. %loc(mpi_in_place) ) is_in_place = 1
      return
      end
[/fortran]

The return value of this function can be used to determine if the MPI_IN_PLACE passed to it came from Fortran (return 1) or not (return 0).

Sincerely,
James Tullos
Technical Consulting Engineer
Intel Cluster Tools
0 Kudos
Reply