<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 2, 2014 at 7:05 AM, Bill Long <span dir="ltr"><<a href="mailto:longb@cray.com" target="_blank">longb@cray.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class=""><br>
On Jul 2, 2014, at 2:11 AM, Rolf Rabenseifner <<a href="mailto:rabenseifner@hlrs.de">rabenseifner@hlrs.de</a>> wrote:<br>
<br>
> Bill,<br>
><br>
> The reason for removal of BIND(C) was simple:<br>
> Four callbacks contain LOGICAL arguments<br>
> and we learnt that LOGICAL and BIND(C) does not work together.<br>
> Therefore the errata is correct.<br>
<br>
</div>Agreed.<br>
<div class=""><br>
><br>
> I hope you find a solution for storing the callback pointer<br>
> in a C structure and to bring it back to Fortran.<br>
> I expect that calling the Fortran callbacks<br>
> in a portable way may require Fortran code<br>
> that calls the callback.<br>
<br>
</div>For compilers that support the TS, there should be no problem. As noted by Junchao, Cray and Gfortran did not have a problem.  The IBM compiler appears to have overlooked the TS  change. A bug report to IBM should resolve the issue.  The fix is trivial - just disabling an error message<br>
</blockquote><div><br></div><div>Have sent two bug reports regarding F08 to IBM. One is the BIND(C). The other is that XLF-15.1 does not support storage_size().</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Cheers,<br>
Bill<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
><br>
> Best regards<br>
> Rolf<br>
><br>
><br>
> ----- Original Message -----<br>
>> From: "Bill Long" <<a href="mailto:longb@cray.com">longb@cray.com</a>><br>
>> To: "MPI-WG Fortran working group" <<a href="mailto:mpiwg-fortran@lists.mpi-forum.org">mpiwg-fortran@lists.mpi-forum.org</a>><br>
>> Sent: Tuesday, July 1, 2014 9:06:05 PM<br>
>> Subject: Re: [MPIWG Fortran] BIND(C) attribute of MPI callback functions<br>
>><br>
>><br>
>> On Jul 1, 2014, at 2:00 PM, Junchao Zhang <<a href="mailto:jczhang@mcs.anl.gov">jczhang@mcs.anl.gov</a>><br>
>> wrote:<br>
>><br>
>>> Hello,<br>
>>>  Errata for MPI-3.0 removed the BIND(C) attribute of MPI callback<br>
>>>  functions. But in an implementation, to pass the Fortran<br>
>>>  procedure to the backend C, I need to get its C function pointer<br>
>>>  with c_funloc, as the following code shows. When I compile it<br>
>>>  with IBM XLF 15.1, it complains with such an error "1516-203 (S)<br>
>>>  The argument to the intrinsic procedure C_FUNLOC must be a<br>
>>>  procedure with the BIND(C) attribute." In my experiments, gcc<br>
>>>  and Cray ftn are fine with it.  Looking at<br>
>>>  <a href="https://gcc.gnu.org/onlinedocs/gfortran/C_005fFUNLOC.html" target="_blank">https://gcc.gnu.org/onlinedocs/gfortran/C_005fFUNLOC.html</a>, I<br>
>>>  find c_funloc indeed requires an interoperable function<br>
>>>  argument. Any comments?<br>
>><br>
>> This requirement on the argument of C_FUNLOC was removed by TS 29113,<br>
>> subclause 8.1 “Removed restrictions on ISO_C_BINDING module<br>
>> procedures”.<br>
>><br>
>> Cheers,<br>
>> Bill<br>
>><br>
>><br>
>><br>
>>><br>
>>> subroutine MPI_Comm_create_errhandler_f08(comm_errhandler_fn,<br>
>>> errhandler, ierror)<br>
>>>    use, intrinsic :: iso_c_binding, only : c_funloc, c_int,<br>
>>>    c_funptr<br>
>>>    use :: mpi_f08, only : MPI_Errhandler,<br>
>>>    MPI_Comm_errhandler_function<br>
>>>    use :: mpi_c_interface, only : c_Errhandler,<br>
>>>    MPIR_Comm_create_errhandler_c<br>
>>><br>
>>>    implicit none<br>
>>><br>
>>>    procedure(MPI_Comm_errhandler_function) :: comm_errhandler_fn<br>
>>>    type(MPI_Errhandler), intent(out) :: errhandler<br>
>>>    integer, optional, intent(out) :: ierror<br>
>>><br>
>>>    type(c_funptr) :: comm_errhandler_fn_c<br>
>>><br>
>>>    comm_errhandler_fn_c = c_funloc(comm_errhandler_fn) !! xlf<br>
>>>    issues an error<br>
>>>    ierror_c = MPIR_Comm_create_errhandler_c(comm_errhandler_fn_c,<br>
>>>    errhandler%MPI_VAL)<br>
>>>    ...<br>
>>> end subroutine MPI_Comm_create_errhandler_f08<br>
>>><br>
>>> --Junchao Zhang<br>
>>> _______________________________________________<br>
>>> mpiwg-fortran mailing list<br>
>>> <a href="mailto:mpiwg-fortran@lists.mpi-forum.org">mpiwg-fortran@lists.mpi-forum.org</a><br>
>>> <a href="http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran" target="_blank">http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran</a><br>
>><br>
>> Bill Long<br>
>>                                                                      <a href="mailto:longb@cray.com">longb@cray.com</a><br>
>> Fortran Technical Suport  &                                  voice:<br>
>> <a href="tel:651-605-9024" value="+16516059024">651-605-9024</a><br>
>> Bioinformatics Software Development                     fax:<br>
>> <a href="tel:651-605-9142" value="+16516059142">651-605-9142</a><br>
>> Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101<br>
>><br>
>><br>
>> _______________________________________________<br>
>> mpiwg-fortran mailing list<br>
>> <a href="mailto:mpiwg-fortran@lists.mpi-forum.org">mpiwg-fortran@lists.mpi-forum.org</a><br>
>> <a href="http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran" target="_blank">http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran</a><br>
>><br>
><br>
> --<br>
> Dr. Rolf Rabenseifner . . . . . . . . . .. email <a href="mailto:rabenseifner@hlrs.de">rabenseifner@hlrs.de</a><br>
> High Performance Computing Center (HLRS) . phone <a href="tel:%2B%2B49%280%29711%2F685-65530" value="+4971168565530">++49(0)711/685-65530</a><br>
> University of Stuttgart . . . . . . . . .. fax <a href="tel:%2B%2B49%280%29711%20%2F%20685-65832" value="+4971168565832">++49(0)711 / 685-65832</a><br>
> Head of Dpmt Parallel Computing . . . <a href="http://www.hlrs.de/people/rabenseifner" target="_blank">www.hlrs.de/people/rabenseifner</a><br>
> Nobelstr. 19, D-70550 Stuttgart, Germany . . . . (Office: Room 1.307)<br>
> _______________________________________________<br>
> mpiwg-fortran mailing list<br>
> <a href="mailto:mpiwg-fortran@lists.mpi-forum.org">mpiwg-fortran@lists.mpi-forum.org</a><br>
> <a href="http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran" target="_blank">http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran</a><br>
<br>
Bill Long                                                                       <a href="mailto:longb@cray.com">longb@cray.com</a><br>
Fortran Technical Suport  &                                  voice:  <a href="tel:651-605-9024" value="+16516059024">651-605-9024</a><br>
Bioinformatics Software Development                     fax:  <a href="tel:651-605-9142" value="+16516059142">651-605-9142</a><br>
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101<br>
<br>
<br>
_______________________________________________<br>
mpiwg-fortran mailing list<br>
<a href="mailto:mpiwg-fortran@lists.mpi-forum.org">mpiwg-fortran@lists.mpi-forum.org</a><br>
<a href="http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran" target="_blank">http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran</a><br>
</div></div></blockquote></div><br></div></div>