00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 subroutine prismdrv_spawn_child ( exec, args, n_args, application_number, &
00013 n_hosts, hostnames, npes, intracomm, intercomm, ierror )
00014
00015
00016 USE PRISMDrv, dummy_interface => prismdrv_spawn_child
00017
00018 IMPLICIT NONE
00019
00020
00021
00022 character(len=*),Intent(In) :: exec
00023
00024
00025
00026 integer,Intent(In) :: n_args
00027
00028
00029
00030 character(len=*),Intent(In) :: args (n_args)
00031
00032
00033
00034 integer,Intent(In) :: application_number
00035
00036
00037
00038 integer,Intent(In) :: n_hosts
00039
00040
00041
00042 character(len=*),Intent(In) :: hostnames (n_hosts)
00043
00044
00045
00046 integer,Intent(In) :: npes (n_hosts)
00047
00048
00049
00050 integer, Intent(In) :: intracomm
00051
00052
00053
00054 integer,Intent(Out) :: intercomm
00055
00056
00057
00058 integer,Intent(Out) :: ierror
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #if ! defined ( PRISM_with_MPI1 )
00079
00080
00081
00082 character(len=64) :: commands (n_hosts)
00083 character(len=64) :: argv (n_hosts, n_args+1)
00084 character(len=8) :: appl_group
00085 integer :: info (n_hosts)
00086 integer :: n
00087 integer :: i
00088
00089 #ifdef DONT_HAVE_ERRORCODES_IGNORE
00090 integer, allocatable :: ierrors (:)
00091 #endif
00092
00093
00094
00095 PRINT *, '| | Enter PRISMDrv_spawn_child'
00096 call psmile_flushstd
00097
00098
00099
00100 intercomm = MPI_COMM_NULL
00101 ierror = 0
00102
00103
00104
00105 n = 0
00106 do i = 1, n_hosts
00107 n = n + max (0, npes(i))
00108 enddo
00109
00110
00111
00112 commands (1:n_hosts) = exec
00113
00114 do i = 1, n_hosts
00115 argv (i, 1:n_args) = args (1:n_args)
00116 enddo
00117
00118 argv (1:n_hosts, n_args+1) = ' '
00119
00120
00121
00122 write (appl_group, "(i8)") application_number
00123
00124
00125
00126 # if ! defined ( PRISM_LAM )
00127 do i = 1, n_hosts
00128 call MPI_Info_create (info(i), ierror)
00129
00130
00131
00132 call MPI_Info_set (info(i), "host", hostnames(i), ierror)
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 call MPI_Info_set (info(i), "appl_group", appl_group, ierror)
00144
00145 enddo
00146
00147
00148
00149 #else
00150 info = MPI_INFO_NULL
00151 #endif
00152
00153 #ifdef DONT_HAVE_ERRORCODES_IGNORE
00154
00155
00156
00157 Allocate (ierrors(1:n))
00158
00159 call MPI_Comm_spawn_multiple ( n_hosts, commands, argv, npes, &
00160 info, PRISM_root, intracomm, intercomm, ierrors, ierror )
00161 #else
00162 call MPI_Comm_spawn_multiple (n_hosts, commands, argv, npes, info, &
00163 PRISM_root, intracomm, intercomm, MPI_ERRCODES_IGNORE, ierror )
00164 #endif
00165
00166
00167
00168 # if ! defined ( PRISM_LAM )
00169 do i = 1, n_hosts
00170 call MPI_Info_free ( info(i), ierror )
00171 end do
00172 #endif
00173
00174
00175
00176 #ifdef DONT_HAVE_ERRORCODES_IGNORE
00177 Deallocate (ierrors)
00178 #endif
00179
00180
00181
00182 1000 format (1x, '| | | Spawning ', a, ' on', i4, ' processe(s) and', i3, &
00183 ' host(s).' )
00184
00185 PRINT *, '| | Quit PRISMDrv_spawn_child'
00186 PRINT *, '| |'
00187 call psmile_flushstd
00188
00189 #else
00190 intercomm = MPI_COMM_NULL
00191 ierror = 0
00192 #endif
00193
00194 END SUBROUTINE PRISMDrv_spawn_child
00195
00196 #ifdef DONT_HAVE_STDMPI2
00197 subroutine MPI_Comm_spawn_multiple ( n_hosts, commands, argv, &
00198 npes, dummy1, root, intracomm, &
00199 intercomm, dummy2, ierror)
00200
00201 integer :: dummy1, dummy2
00202 integer :: n_hosts
00203 integer :: root
00204 integer :: npes (n_hosts)
00205 character(len=1) :: commands (n_hosts)
00206 character(len=1) :: argv (n_hosts, 1)
00207 integer :: intracomm, intercomm, ierror
00208
00209 Integer, parameter :: nerrp = 1
00210 Integer :: ierrp (nerrp)
00211
00212 call psmile_error_common ( -1, 'Spawing not support with this MPI', &
00213 ierrp, 1, __FILE__, __LINE__ )
00214
00215 return
00216 end
00217 #endif