374. Comparison with C

PreviousUpNext
Up: Fortran Support Next: Language Interoperability Previous: Permanent Data Movement

In C, subroutines which modify variables that are not in the argument list will not cause register optimization problems. This is because taking pointers to storage objects by using the & operator and later referencing the objects by indirection on the pointer is an integral part of the language. A C compiler understands the implications, so that the problem should not occur, in general. However, some compilers do offer optional aggressive optimization levels which may not be safe. Problems due to temporary memory modifications can also occur in C. As above, the best advice is to avoid the problem: use different variables for buffers in nonblocking MPI operations and computation that is executed while a nonblocking operation is pending.


Example Protecting GPU optimizations with the ASYNCHRONOUS attribute.

USE mpi_f08  
REAL :: buf(100,100) 
CALL separated_sections(buf(1:1,1:100), buf(2:100,1:100)) 
END 
 
SUBROUTINE separated_sections(buf_halo, buf_inner) 
REAL, ASYNCHRONOUS :: buf_halo(1:1,1:100) 
REAL :: buf_inner(2:100,1:100) 
REAL :: local_buf(2:100,100)  
 
CALL MPI_Irecv(buf_halo(1,1:100),...req,...) 
local_buf = buf_inner  
DO j=1,100 
  DO i=2,100 
    local_buf(i,j)=.... 
  END DO 
END DO 
buf_inner = local_buf ! buf_halo is not touched!!! 
 
CALL MPI_Wait(req,...) 


PreviousUpNext
Up: Fortran Support Next: Language Interoperability Previous: Permanent Data Movement


Return to MPI-3.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-3.1 of June 4, 2015
HTML Generated on June 4, 2015