psmile_spawn_child_appl.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00003 ! All rights reserved. Use is subject to OASIS4 license terms.
00004 !-----------------------------------------------------------------------
00005 !BOP
00006 !
00007 ! !ROUTINE: PSMILe_Spawn_Child_Appl
00008 !
00009 ! !INTERFACE:
00010 
00011       subroutine psmile_spawn_child_appl (intracomm, intercomm, ierror )
00012 !
00013 ! !USES:
00014 !
00015       use PRISM_constants
00016       use PSMILe, dummy_interface => PSMILe_Spawn_Child_Appl
00017       implicit none
00018 !
00019 ! !INPUT PARAMETERS:
00020 !
00021       integer, Intent(In)                 :: intracomm
00022 !
00023 !     Intra communicator used to spawn the processes
00024 !
00025 !
00026 ! !OUTPUT PARAMETERS:
00027 !
00028       integer,Intent(Out)                 :: intercomm
00029 !
00030 !     Resulting Inter communicator
00031 !
00032       integer,Intent(Out)                 :: ierror
00033 !
00034 !     Error status
00035 !
00036 ! !LOCAL VARIABLES
00037 !
00038       integer, parameter :: n_hosts = 1
00039 !
00040 #if ! defined ( PRISM_with_MPI1 )
00041 !
00042 ! ... of dummy arguments of MPI_Comm_spawn_multiple
00043 !
00044       integer            :: npes (n_hosts)
00045       character(len=1)   :: commands (n_hosts)
00046       character(len=1)   :: argv (n_hosts, 1)
00047 #endif
00048 
00049 #ifdef DONT_HAVE_ERRORCODES_IGNORE
00050       integer              :: infos (n_hosts), n
00051       integer, Allocatable :: ierrors (:)
00052       integer              :: ierrp(1)
00053 #endif
00054 !
00055 ! !DESCRIPTION:
00056 !
00057 ! The MPI processes of the applications take part in the spawning
00058 ! of the MPI processes of other applications. This routine
00059 ! takes part in the spawning of the new application processes.
00060 !
00061 !
00062 ! !REVISION HISTORY:
00063 !
00064 !   Date      Programmer   Description
00065 ! ----------  ----------   -----------
00066 ! 02.11.02    H. Ritzdorf  created
00067 !
00068 !EOP
00069 !----------------------------------------------------------------------
00070 !
00071 ! $Id: psmile_spawn_child_appl.F90 2325 2010-04-21 15:00:07Z valcke $
00072 ! $Author: valcke $
00073 !
00074    Character(len=len_cvs_string), save :: mycvs = 
00075        '$Id: psmile_spawn_child_appl.F90 2325 2010-04-21 15:00:07Z valcke $'
00076 !
00077 !----------------------------------------------------------------------
00078 
00079       ierror    = 0
00080       intercomm = MPI_COMM_NULL
00081 
00082 #if ! defined ( PRISM_with_MPI1 )
00083 
00084 !
00085 ! Spawn processes
00086 !
00087 #ifdef DONT_HAVE_ERRORCODES_IGNORE
00088 
00089 !!$  MPI_INFO_NULL and MPI_ERRCODES_IGNORE are
00090 !!$     not supported by all MPI implementations
00091 !!$
00092 ! Info is significant only on the roots;
00093 ! therefore the dummy, not-initialized value should work
00094 !
00095 !     call MPI_Info_create (infos(1), ierror)
00096 !
00097 ! ... Allocate error codes for processes (1 code per process !)
00098 !
00099 !     In principle, the number n must be transferred by MPI_Bcast
00100 !     from the coupler to the processes in the applications
00101 !     (or by another way).
00102 !     Since I don't know whether this will work for the simulated
00103 !     coupler and the real coupler, we set n to a ``large'' number.
00104 !
00105       n = 1024
00106       Allocate (ierrors(1:n), STAT=ierror)
00107       if ( ierror /= 0 ) then
00108          ierrp (1) = n
00109          ierror = PRISM_Error_Alloc
00110          call psmile_error ( ierror, 'ierrors', &
00111               ierrp(1), 1, __FILE__, __LINE__ )
00112          return
00113       endif
00114 
00115       call MPI_Comm_spawn_multiple (n_hosts, commands, argv,        &
00116                                     npes, infos,                    &
00117                                     PRISM_root, intracomm,          &
00118                                     intercomm, ierrors,             &
00119                                     ierror)
00120 
00121       Deallocate (ierrors)
00122 #else
00123       call MPI_Comm_spawn_multiple (n_hosts, commands, argv,        &
00124                                     npes, MPI_INFO_NULL,            &
00125                                     PRISM_root, intracomm,          &
00126                                     intercomm, MPI_ERRCODES_IGNORE, &
00127                                     ierror)
00128 #endif
00129 #endif
00130 
00131       end subroutine PSMILe_Spawn_Child_Appl
00132 
00133 #ifdef DONT_HAVE_STDMPI2
00134       subroutine MPI_Comm_spawn_multiple ( n_hosts, commands, argv, &
00135                                     npes, dummy1, root, intracomm,  &
00136                                     intercomm, dummy2, ierror)
00137 
00138       integer            :: dummy1, dumm2
00139       integer            :: n_hosts, root
00140       integer            :: npes (n_hosts)
00141       character(len=1)   :: commands (n_hosts)
00142       character(len=1)   :: argv (n_hosts, 1)
00143       integer            :: intracomm, intercomm, ierror
00144 
00145       Integer, parameter :: nerrp = 1
00146       Integer            :: ierrp (nerrp)
00147 
00148       call PSMILe_Error ( ierror, 'Spawing not support with this MPI', &
00149                           ierrp, 1, __FILE__, __LINE__ )
00150 
00151       return
00152       end
00153 #endif

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1