prismdrv_def_mpi_comm.F90
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine prismdrv_def_mpi_comm (id_err)
00012
00013
00014
00015
00016 USE PRISMDrv, dummy_interface => PRISMDrv_Def_MPI_Comm
00017
00018 IMPLICIT NONE
00019
00020
00021
00022
00023
00024
00025
00026 INTEGER, INTENT (Out) :: id_err
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 CHARACTER(LEN=len_cvs_string), SAVE :: mycvs =
00046 '$Id: prismdrv_def_mpi_comm.F90 2325 2010-04-21 15:00:07Z valcke $'
00047
00048 INTEGER :: index
00049 INTEGER :: key
00050 INTEGER :: color
00051 INTEGER :: comm
00052
00053 INTEGER, PARAMETER :: nerrp = 1
00054 INTEGER :: ierrp (nerrp)
00055
00056
00057
00058 #ifdef VERBOSE
00059 PRINT *, '| | Enter PRISMDrv_Def_mpi_comm'
00060 call psmile_flushstd
00061 #endif
00062
00063
00064
00065
00066
00067
00068 key = 0
00069 color = 0
00070
00071 CALL MPI_Comm_Split ( comm_drv_global, color, key, comm_drv_local, id_err )
00072
00073 IF ( id_err /= MPI_SUCCESS ) THEN
00074 ierrp (1) = id_err
00075 id_err = PRISM_Error_MPI
00076
00077 call psmile_error_common ( id_err, 'MPI_Comm_Split', &
00078 ierrp, 1, __FILE__, __LINE__ )
00079 RETURN
00080 ENDIF
00081
00082
00083
00084
00085 DO INDEX = 1, ig_nb_appl
00086
00087
00088
00089 key = 0
00090 color = INDEX
00091
00092
00093
00094 CALL MPI_Comm_Split ( comm_drv_global, color, key, comm, id_err )
00095
00096 IF ( id_err /= MPI_SUCCESS ) THEN
00097 ierrp (1) = id_err
00098 id_err = PRISM_Error_MPI
00099
00100 call psmile_error_common ( id_err, 'MPI_Comm_Split', &
00101 ierrp, 1, __FILE__, __LINE__ )
00102 RETURN
00103 ENDIF
00104
00105
00106
00107 comm_coupling(index) = comm
00108
00109 CALL MPI_Comm_Rank ( comm_coupling(index), driver_rank, id_err )
00110
00111 IF ( id_err /= MPI_SUCCESS ) THEN
00112 ierrp (1) = id_err
00113 id_err = PRISM_Error_MPI
00114
00115 call psmile_error_common ( id_err, 'MPI_Comm_Rank', &
00116 ierrp, 1, __FILE__, __LINE__ )
00117 RETURN
00118 ENDIF
00119
00120 END DO
00121
00122
00123
00124
00125
00126
00127 key = 0
00128 color = MPI_UNDEFINED
00129
00130 CALL MPI_Comm_Split ( comm_drv_global, color, key, &
00131 comm_psmile, id_err )
00132
00133 IF ( id_err /= MPI_SUCCESS ) THEN
00134 ierrp (1) = id_err
00135 id_err = PRISM_Error_MPI
00136
00137 call psmile_error_common ( id_err, 'MPI_Comm_Split', &
00138 ierrp, 1, __FILE__, __LINE__ )
00139 RETURN
00140 ENDIF
00141
00142
00143
00144 #ifdef VERBOSE
00145 PRINT *, '| | Quit PRISMDrv_Def_MPI_Comm'
00146 call psmile_flushstd
00147 #endif
00148 END SUBROUTINE PRISMDrv_Def_MPI_Comm
00149
00150