mpi-forum / mpi-issues

Tickets for the MPI Forum
http://www.mpi-forum.org/
67 stars 8 forks source link

question about my_user_function bind(C) #660

Open jeffhammond opened 1 year ago

jeffhammond commented 1 year ago

This is a question about the standard, not an issue per se, but depending on the answer here, we may have to fix something.

@VictorEijkhout asked on Slack about the addition of bind(C) to my_user_function in Example 6.21. In particular, Victor notes that "The Intel compiler refuses to compile/run correctly with that clause," so it is not academic.

This change was made in https://github.com/mpi-forum/mpi-standard/commit/8f92e124831554cf3f0b5bb475f698128b3e346c by @tonyskjellum and @puribangalore but the commit message does not describe the reason why my_user_function was changed.

% git show 8f92e1248 | head -n12
commit 8f92e124831554cf3f0b5bb475f698128b3e346c
Author: Tony Skjellum <skjellum@gmail.com>
Date:   Tue Dec 8 15:43:43 2015 -0600

    Integrate Puri Bangalore's update from Last June.  In the case of the
    coll.tex chapter, this was a small change.  However, the topol.tex chapter
    has advanced since last June, so the current input of the persistent topology
    functions was merged into the latest topology chapter, vs. the old one we
    were working with previously.  We still need to do "mpiterm" refactoring
    on the new places in topol.tex, and also look at doing that in coll.tex.
    That seems to be new indexation technology since last year.

% git show 8f92e1248 | grep my_user_function
-  subroutine my_user_function( invec, inoutvec, len, type )
+  subroutine my_user_function( invec, inoutvec, len, type )   bind(c)

@RolfRabenseifner do you know if the correctness of this code depends on bind(C)?

jeffhammond commented 1 year ago

I'll note that the abstract interface definition does not include bind(C).

ABSTRACT INTERFACE
  SUBROUTINE MPI_User_function(invec, inoutvec, len, datatype)
    USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
    TYPE(C_PTR), VALUE :: invec, inoutvec
    INTEGER :: len
    TYPE(MPI_Datatype) :: datatype