[Dart-dev] [4381] DART/trunk/mpi_utilities/mpi_utilities_mod.f90: The xlf compiler has strict ideas about scope and won't let a non-module
nancy at ucar.edu
nancy at ucar.edu
Wed Jun 2 08:16:18 MDT 2010
Revision: 4381
Author: nancy
Date: 2010-06-02 08:16:17 -0600 (Wed, 02 Jun 2010)
Log Message:
-----------
The xlf compiler has strict ideas about scope and won't let a non-module
subroutine access a module global (which is irritatingly correct). Add an
accessor routine that the non-module exit routine can call to find out
whether mpi has been initialized or not before trying to use the private
communicator in the abort call.
Modified Paths:
--------------
DART/trunk/mpi_utilities/mpi_utilities_mod.f90
-------------- next part --------------
Modified: DART/trunk/mpi_utilities/mpi_utilities_mod.f90
===================================================================
--- DART/trunk/mpi_utilities/mpi_utilities_mod.f90 2010-06-01 20:13:55 UTC (rev 4380)
+++ DART/trunk/mpi_utilities/mpi_utilities_mod.f90 2010-06-02 14:16:17 UTC (rev 4381)
@@ -213,7 +213,7 @@
task_count, my_task_id, block_task, restart_task, &
task_sync, array_broadcast, send_to, receive_from, iam_task0, &
broadcast_send, broadcast_recv, shell_execute, sleep_seconds, &
- sum_across_tasks
+ sum_across_tasks, mpi_was_init
! version controlled file description for error handling, do not edit
character(len=128), parameter :: &
@@ -1469,7 +1469,16 @@
end subroutine sleep_seconds
!-----------------------------------------------------------------------------
+function mpi_was_init()
+ logical :: mpi_was_init
+
+! return the init status for the non-module subroutine below.
+ mpi_was_init = module_initialized
+
+end function mpi_was_init
+
!-----------------------------------------------------------------------------
+!-----------------------------------------------------------------------------
end module mpi_utilities_mod
@@ -1481,6 +1490,8 @@
!-----------------------------------------------------------------------------
subroutine exit_all(exit_code)
+ use mpi_utilities_mod, only : mpi_was_init
+
integer, intent(in) :: exit_code
! In case of error, call this instead of the fortran intrinsic exit().
@@ -1491,7 +1502,7 @@
! if we seem to have gone through the init code, call abort on our
! private communicator. otherwise call abort on the world comm.
-if (module_initialized) then
+if ( mpi_was_init() ) then
call MPI_Abort(my_local_comm, exit_code, ierror)
else
call MPI_Abort(MPI_COMM_WORLD, exit_code, ierror)
More information about the Dart-dev
mailing list