[1762] | 1 | MODULE pmc_server |
---|
| 2 | |
---|
| 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
| 17 | ! Copyright 1997-2015 Leibniz Universitaet Hannover |
---|
| 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
| 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
[1797] | 22 | ! introduction of different datatransfer modes |
---|
[1762] | 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: pmc_server.f90 1797 2016-03-21 16:50:28Z raasch $ |
---|
| 27 | ! |
---|
[1792] | 28 | ! 1791 2016-03-11 10:41:25Z raasch |
---|
| 29 | ! Debug write-statements commented out |
---|
| 30 | ! |
---|
[1787] | 31 | ! 1786 2016-03-08 05:49:27Z raasch |
---|
| 32 | ! change in client-server data transfer: server now gets data from client |
---|
| 33 | ! instead that client put's it to the server |
---|
| 34 | ! |
---|
[1780] | 35 | ! 1779 2016-03-03 08:01:28Z raasch |
---|
| 36 | ! kind=dp replaced by wp, |
---|
| 37 | ! error messages removed or changed to PALM style, dim_order removed |
---|
| 38 | ! array management changed from linked list to sequential loop |
---|
| 39 | ! |
---|
[1767] | 40 | ! 1766 2016-02-29 08:37:15Z raasch |
---|
| 41 | ! modifications to allow for using PALM's pointer version |
---|
| 42 | ! +new routine pmc_s_set_active_data_array |
---|
| 43 | ! |
---|
[1765] | 44 | ! 1764 2016-02-28 12:45:19Z raasch |
---|
| 45 | ! cpp-statement added (nesting can only be used in parallel mode) |
---|
| 46 | ! |
---|
[1763] | 47 | ! 1762 2016-02-25 12:31:13Z hellstea |
---|
| 48 | ! Initial revision by K. Ketelsen |
---|
[1762] | 49 | ! |
---|
| 50 | ! Description: |
---|
| 51 | ! ------------ |
---|
| 52 | ! |
---|
| 53 | ! Server part of Palm Model Coupler |
---|
| 54 | !------------------------------------------------------------------------------! |
---|
| 55 | |
---|
[1764] | 56 | #if defined( __parallel ) |
---|
[1762] | 57 | use, intrinsic :: iso_c_binding |
---|
| 58 | |
---|
[1764] | 59 | #if defined( __lc ) |
---|
| 60 | USE MPI |
---|
| 61 | #else |
---|
| 62 | INCLUDE "mpif.h" |
---|
| 63 | #endif |
---|
| 64 | USE kinds |
---|
[1762] | 65 | USE PMC_general, ONLY: ClientDef, PMC_MAX_MODELL,PMC_sort, DA_NameDef, DA_Desclen, DA_Namelen, & |
---|
[1779] | 66 | PMC_G_SetName, PeDef, ArrayDef, PMC_MAX_ARRAY |
---|
[1762] | 67 | USE PMC_handle_communicator, ONLY: m_model_comm,m_model_rank,m_model_npes, m_to_client_comm, & |
---|
| 68 | PMC_Server_for_Client, m_world_rank |
---|
| 69 | USE PMC_MPI_wrapper, ONLY: PMC_Send_to_Client, PMC_Recv_from_Client, PMC_Bcast, PMC_Inter_Bcast, & |
---|
| 70 | PMC_Alloc_mem, PMC_Time |
---|
| 71 | |
---|
| 72 | IMPLICIT none |
---|
| 73 | PRIVATE |
---|
| 74 | SAVE |
---|
| 75 | |
---|
| 76 | TYPE ClientIndexDef |
---|
| 77 | INTEGER :: NrPoints |
---|
| 78 | INTEGER,DIMENSION(:,:),allocatable :: index_list_2d |
---|
| 79 | END TYPE ClientIndexDef |
---|
| 80 | |
---|
| 81 | TYPE(ClientDef),DIMENSION(PMC_MAX_MODELL) :: Clients |
---|
| 82 | TYPE(ClientIndexDef),DIMENSION(PMC_MAX_MODELL) :: indClients |
---|
| 83 | |
---|
[1779] | 84 | INTEGER :: next_array_in_list = 0 |
---|
| 85 | |
---|
[1762] | 86 | PUBLIC PMC_Server_for_Client |
---|
| 87 | |
---|
| 88 | INTERFACE PMC_ServerInit |
---|
| 89 | MODULE procedure PMC_ServerInit |
---|
| 90 | END INTERFACE PMC_ServerInit |
---|
| 91 | |
---|
| 92 | INTERFACE PMC_S_Set_2D_index_list |
---|
| 93 | MODULE procedure PMC_S_Set_2D_index_list |
---|
| 94 | END INTERFACE PMC_S_Set_2D_index_list |
---|
| 95 | |
---|
[1779] | 96 | INTERFACE PMC_S_clear_next_array_list |
---|
| 97 | MODULE procedure PMC_S_clear_next_array_list |
---|
| 98 | END INTERFACE PMC_S_clear_next_array_list |
---|
| 99 | |
---|
[1762] | 100 | INTERFACE PMC_S_GetNextArray |
---|
| 101 | MODULE procedure PMC_S_GetNextArray |
---|
| 102 | END INTERFACE PMC_S_GetNextArray |
---|
| 103 | |
---|
| 104 | INTERFACE PMC_S_Set_DataArray |
---|
| 105 | MODULE procedure PMC_S_Set_DataArray_2d |
---|
| 106 | MODULE procedure PMC_S_Set_DataArray_3d |
---|
| 107 | END INTERFACE PMC_S_Set_DataArray |
---|
| 108 | |
---|
| 109 | INTERFACE PMC_S_setInd_and_AllocMem |
---|
| 110 | MODULE procedure PMC_S_setInd_and_AllocMem |
---|
| 111 | END INTERFACE PMC_S_setInd_and_AllocMem |
---|
| 112 | |
---|
| 113 | INTERFACE PMC_S_FillBuffer |
---|
| 114 | MODULE procedure PMC_S_FillBuffer |
---|
| 115 | END INTERFACE PMC_S_FillBuffer |
---|
| 116 | |
---|
| 117 | INTERFACE PMC_S_GetData_from_Buffer |
---|
| 118 | MODULE procedure PMC_S_GetData_from_Buffer |
---|
| 119 | END INTERFACE PMC_S_GetData_from_Buffer |
---|
| 120 | |
---|
[1766] | 121 | INTERFACE PMC_S_Set_Active_data_array |
---|
| 122 | MODULE procedure PMC_S_Set_Active_data_array |
---|
| 123 | END INTERFACE PMC_S_Set_Active_data_array |
---|
| 124 | |
---|
[1762] | 125 | ! PUBLIC section |
---|
| 126 | |
---|
| 127 | PUBLIC PMC_ServerInit, PMC_S_Set_2D_index_list, PMC_S_GetNextArray, PMC_S_Set_DataArray |
---|
[1766] | 128 | PUBLIC PMC_S_setInd_and_AllocMem, PMC_S_FillBuffer, PMC_S_GetData_from_Buffer, PMC_S_Set_Active_data_array |
---|
[1779] | 129 | PUBLIC PMC_S_clear_next_array_list |
---|
[1762] | 130 | |
---|
| 131 | CONTAINS |
---|
| 132 | |
---|
| 133 | SUBROUTINE PMC_ServerInit |
---|
| 134 | IMPLICIT none |
---|
| 135 | INTEGER :: i |
---|
| 136 | INTEGER :: j |
---|
| 137 | INTEGER :: ClientId |
---|
| 138 | INTEGER :: istat |
---|
| 139 | |
---|
| 140 | do i=1,size(PMC_Server_for_Client)-1 |
---|
[1791] | 141 | ! if(m_model_comm == 0) write(0,*) 'PMC_Server: Initialize client Id',PMC_Server_for_Client(i) |
---|
[1762] | 142 | |
---|
| 143 | ClientId = PMC_Server_for_Client(i) |
---|
| 144 | |
---|
| 145 | Clients(ClientId)%model_comm = m_model_comm |
---|
| 146 | Clients(ClientId)%inter_comm = m_to_client_comm(ClientId) |
---|
| 147 | |
---|
| 148 | ! Get rank and size |
---|
| 149 | CALL MPI_Comm_rank (Clients(ClientId)%model_comm, Clients(ClientId)%model_rank, istat); |
---|
| 150 | CALL MPI_Comm_size (Clients(ClientId)%model_comm, Clients(ClientId)%model_npes, istat); |
---|
| 151 | CALL MPI_Comm_remote_size (Clients(ClientId)%inter_comm, Clients(ClientId)%inter_npes, istat); |
---|
| 152 | |
---|
| 153 | ! Intra communicater is used for MPI_Get |
---|
| 154 | CALL MPI_Intercomm_merge (Clients(ClientId)%inter_comm, .false., Clients(ClientId)%intra_comm, istat); |
---|
| 155 | CALL MPI_Comm_rank (Clients(ClientId)%intra_comm, Clients(ClientId)%intra_rank, istat); |
---|
| 156 | |
---|
[1791] | 157 | ! write(9,*) 'ClientId ',i,ClientId,m_world_rank, Clients(ClientId)%inter_npes |
---|
[1762] | 158 | |
---|
| 159 | ALLOCATE (Clients(ClientId)%PEs(Clients(ClientId)%inter_npes)) |
---|
[1779] | 160 | ! |
---|
| 161 | !-- Allocate for all client PEs an array of TYPE ArrayDef to store information of transfer array |
---|
| 162 | do j=1,Clients(ClientId)%inter_npes |
---|
| 163 | Allocate(Clients(ClientId)%PEs(j)%array_list(PMC_MAX_ARRAY)) |
---|
[1762] | 164 | end do |
---|
| 165 | |
---|
| 166 | CALL Get_DA_names_from_client (ClientId) |
---|
| 167 | end do |
---|
| 168 | |
---|
| 169 | return |
---|
| 170 | END SUBROUTINE PMC_ServerInit |
---|
| 171 | |
---|
| 172 | SUBROUTINE PMC_S_Set_2D_index_list (ClientId, index_list) |
---|
| 173 | IMPLICIT none |
---|
| 174 | INTEGER,INTENT(IN) :: ClientId |
---|
| 175 | INTEGER,DIMENSION(:,:),INTENT(INOUT) :: index_list !Index list will be modified in sort, therefore INOUT |
---|
| 176 | |
---|
| 177 | !-- Local variables |
---|
| 178 | INTEGER :: ip,is,ie,ian,ic,n |
---|
| 179 | INTEGER :: istat |
---|
| 180 | |
---|
| 181 | if(m_model_rank == 0) then |
---|
| 182 | CALL PMC_sort (index_list, 6) ! Sort to ascending Server PE |
---|
| 183 | is = 1 |
---|
| 184 | |
---|
| 185 | do ip=0,m_model_npes-1 |
---|
| 186 | |
---|
| 187 | ! Split into Server PEs |
---|
| 188 | ie = is-1 !there may be no entry for this PE |
---|
| 189 | if(is <= size(index_list,2) .and. ie >= 0) then |
---|
| 190 | do while ( index_list(6,ie+1) == ip) |
---|
| 191 | ie = ie+1 |
---|
| 192 | if( ie == size(index_list,2)) EXIT |
---|
| 193 | end do |
---|
| 194 | |
---|
| 195 | ian = ie-is+1 |
---|
| 196 | else |
---|
| 197 | is = -1 |
---|
| 198 | ie = -2 |
---|
| 199 | ian = 0 |
---|
| 200 | end if |
---|
| 201 | |
---|
| 202 | ! Send data to other server PEs |
---|
| 203 | |
---|
| 204 | if(ip == 0) then |
---|
| 205 | indClients(ClientId)%NrPoints = ian |
---|
| 206 | if(ian > 0) then |
---|
| 207 | ALLOCATE (indClients(ClientId)%index_list_2d(6,ian)) |
---|
| 208 | indClients(ClientId)%index_list_2d(:,1:ian) = index_list(:,is:ie) |
---|
| 209 | end if |
---|
| 210 | else |
---|
| 211 | CALL MPI_Send (ian, 1, MPI_INTEGER, ip, 1000, m_model_comm, istat) |
---|
| 212 | if(ian > 0) then |
---|
| 213 | CALL MPI_Send (index_list(1,is), 6*ian, MPI_INTEGER, ip, 1001, & |
---|
| 214 | m_model_comm, istat) |
---|
| 215 | end if |
---|
| 216 | end if |
---|
| 217 | is = ie+1 |
---|
| 218 | end do |
---|
| 219 | else |
---|
| 220 | CALL MPI_Recv (indClients(ClientId)%NrPoints, 1, MPI_INTEGER, 0, 1000, m_model_comm, & |
---|
| 221 | MPI_STATUS_IGNORE, istat) |
---|
| 222 | ian = indClients(ClientId)%NrPoints |
---|
| 223 | if(ian > 0) then |
---|
| 224 | ALLOCATE(indClients(ClientId)%index_list_2d(6,ian)) |
---|
| 225 | CALL MPI_RECV (indClients(ClientId)%index_list_2d, 6*ian, MPI_INTEGER, 0, 1001, & |
---|
| 226 | m_model_comm, MPI_STATUS_IGNORE, istat) |
---|
| 227 | end if |
---|
| 228 | end if |
---|
| 229 | |
---|
| 230 | CALL Set_PE_index_list (ClientId,Clients(ClientId),indClients(ClientId)%index_list_2d,indClients(ClientId)%NrPoints) |
---|
| 231 | |
---|
| 232 | return |
---|
| 233 | END SUBROUTINE PMC_S_Set_2D_index_list |
---|
| 234 | |
---|
[1779] | 235 | SUBROUTINE PMC_S_clear_next_array_list |
---|
| 236 | IMPLICIT none |
---|
[1762] | 237 | |
---|
[1779] | 238 | next_array_in_list = 0 |
---|
[1762] | 239 | |
---|
[1779] | 240 | return |
---|
| 241 | END SUBROUTINE PMC_S_clear_next_array_list |
---|
[1762] | 242 | |
---|
[1779] | 243 | ! List handling is still required to get minimal interaction with pmc_interface |
---|
| 244 | logical function PMC_S_GetNextArray (ClientId, myName) |
---|
| 245 | INTEGER(iwp),INTENT(IN) :: ClientId |
---|
| 246 | CHARACTER(len=*),INTENT(OUT) :: myName |
---|
[1762] | 247 | |
---|
[1779] | 248 | !-- local variables |
---|
| 249 | TYPE(PeDef),POINTER :: aPE |
---|
| 250 | TYPE(ArrayDef),POINTER :: ar |
---|
[1762] | 251 | |
---|
[1779] | 252 | next_array_in_list = next_array_in_list+1 |
---|
[1762] | 253 | |
---|
[1779] | 254 | !-- Array Names are the same on all client PE, so take first PE to get the name |
---|
| 255 | aPE => Clients(ClientId)%PEs(1) |
---|
| 256 | |
---|
| 257 | if(next_array_in_list > aPE%Nr_arrays) then |
---|
| 258 | PMC_S_GetNextArray = .false. ! all arrays done |
---|
| 259 | return |
---|
| 260 | end if |
---|
| 261 | |
---|
| 262 | ar => aPE%array_list(next_array_in_list) |
---|
| 263 | myName = ar%name |
---|
| 264 | |
---|
| 265 | PMC_S_GetNextArray = .true. ! Return true if legal array |
---|
| 266 | return |
---|
[1762] | 267 | END function PMC_S_GetNextArray |
---|
| 268 | |
---|
[1766] | 269 | SUBROUTINE PMC_S_Set_DataArray_2d (ClientId, array, array_2 ) |
---|
[1779] | 270 | |
---|
[1762] | 271 | IMPLICIT none |
---|
[1779] | 272 | |
---|
[1762] | 273 | INTEGER,INTENT(IN) :: ClientId |
---|
[1779] | 274 | REAL(wp), INTENT(IN), DIMENSION(:,:) :: array |
---|
| 275 | REAL(wp), INTENT(IN), DIMENSION(:,:), OPTIONAL :: array_2 |
---|
| 276 | |
---|
[1762] | 277 | INTEGER :: NrDims |
---|
| 278 | INTEGER,DIMENSION (4) :: dims |
---|
| 279 | TYPE(c_ptr) :: array_adr |
---|
[1766] | 280 | TYPE(c_ptr) :: second_adr |
---|
[1762] | 281 | |
---|
| 282 | dims = 1 |
---|
| 283 | |
---|
| 284 | NrDims = 2 |
---|
| 285 | dims(1) = size(array,1) |
---|
| 286 | dims(2) = size(array,2) |
---|
| 287 | array_adr = c_loc(array) |
---|
| 288 | |
---|
[1766] | 289 | IF ( PRESENT( array_2 ) ) THEN |
---|
| 290 | second_adr = c_loc(array_2) |
---|
[1779] | 291 | CALL PMC_S_SetArray (ClientId, NrDims, dims, array_adr, second_adr = second_adr) |
---|
[1766] | 292 | ELSE |
---|
[1779] | 293 | CALL PMC_S_SetArray (ClientId, NrDims, dims, array_adr) |
---|
[1766] | 294 | ENDIF |
---|
[1762] | 295 | |
---|
| 296 | return |
---|
| 297 | END SUBROUTINE PMC_S_Set_DataArray_2d |
---|
| 298 | |
---|
[1766] | 299 | SUBROUTINE PMC_S_Set_DataArray_3d (ClientId, array, nz_cl, nz, array_2 ) |
---|
[1779] | 300 | |
---|
[1762] | 301 | IMPLICIT none |
---|
[1779] | 302 | |
---|
[1762] | 303 | INTEGER,INTENT(IN) :: ClientId |
---|
[1779] | 304 | REAL(wp), INTENT(IN), DIMENSION(:,:,:) :: array |
---|
| 305 | REAL(wp), INTENT(IN), DIMENSION(:,:,:), OPTIONAL :: array_2 |
---|
[1762] | 306 | INTEGER,INTENT(IN) :: nz_cl |
---|
| 307 | INTEGER,INTENT(IN) :: nz |
---|
[1779] | 308 | |
---|
[1762] | 309 | INTEGER :: NrDims |
---|
| 310 | INTEGER,DIMENSION (4) :: dims |
---|
| 311 | TYPE(c_ptr) :: array_adr |
---|
[1766] | 312 | TYPE(c_ptr) :: second_adr |
---|
[1762] | 313 | |
---|
| 314 | dims = 1 |
---|
| 315 | |
---|
| 316 | dims = 0 |
---|
| 317 | NrDims = 3 |
---|
| 318 | dims(1) = size(array,1) |
---|
| 319 | dims(2) = size(array,2) |
---|
| 320 | dims(3) = size(array,3) |
---|
| 321 | dims(4) = nz_cl+dims(1)-nz ! works for first dimension 1:nz and 0:nz+1 |
---|
| 322 | |
---|
| 323 | array_adr = c_loc(array) |
---|
| 324 | |
---|
[1766] | 325 | ! |
---|
| 326 | !-- In PALM's pointer version, two indices have to be stored internally. |
---|
| 327 | !-- The active address of the data array is set in swap_timelevel |
---|
| 328 | IF ( PRESENT( array_2 ) ) THEN |
---|
| 329 | second_adr = c_loc(array_2) |
---|
[1779] | 330 | CALL PMC_S_SetArray (ClientId, NrDims, dims, array_adr, second_adr = second_adr) |
---|
[1766] | 331 | ELSE |
---|
[1779] | 332 | CALL PMC_S_SetArray (ClientId, NrDims, dims, array_adr) |
---|
[1766] | 333 | ENDIF |
---|
[1762] | 334 | |
---|
| 335 | return |
---|
| 336 | END SUBROUTINE PMC_S_Set_DataArray_3d |
---|
| 337 | |
---|
| 338 | SUBROUTINE PMC_S_setInd_and_AllocMem (ClientId) |
---|
[1779] | 339 | |
---|
| 340 | USE control_parameters, & |
---|
| 341 | ONLY: message_string |
---|
| 342 | |
---|
[1762] | 343 | IMPLICIT none |
---|
[1779] | 344 | |
---|
[1786] | 345 | ! |
---|
| 346 | !-- Naming convention for appendices: _sc -> server to client transfer |
---|
| 347 | !-- _cs -> client to server transfer |
---|
| 348 | !-- Send -> Server to client transfer |
---|
| 349 | !-- Recv -> client to server transfer |
---|
[1762] | 350 | INTEGER,INTENT(IN) :: ClientId |
---|
| 351 | |
---|
[1779] | 352 | INTEGER :: i, istat, ierr, j |
---|
[1762] | 353 | INTEGER :: arlen, myIndex, tag |
---|
| 354 | INTEGER :: rCount ! count MPI requests |
---|
[1764] | 355 | INTEGER(idp) :: bufsize ! Size of MPI data Window |
---|
[1762] | 356 | TYPE(PeDef),POINTER :: aPE |
---|
| 357 | TYPE(ArrayDef),POINTER :: ar |
---|
| 358 | CHARACTER(len=DA_Namelen) :: myName |
---|
| 359 | INTEGER,DIMENSION(1024) :: req |
---|
| 360 | Type(c_ptr) :: base_ptr |
---|
[1786] | 361 | REAL(wp),DIMENSION(:),POINTER,SAVE :: base_array_sc !Base array for server to client transfer |
---|
| 362 | REAL(wp),DIMENSION(:),POINTER,SAVE :: base_array_cs !Base array for client to server transfer |
---|
[1762] | 363 | INTEGER(KIND=MPI_ADDRESS_KIND) :: WinSize |
---|
| 364 | |
---|
[1786] | 365 | ! |
---|
| 366 | !-- Server to client direction |
---|
[1762] | 367 | myIndex = 1 |
---|
| 368 | rCount = 0 |
---|
| 369 | bufsize = 8 |
---|
| 370 | |
---|
[1786] | 371 | ! |
---|
| 372 | !-- First stride: Compute size and set index |
---|
[1762] | 373 | do i=1,Clients(ClientId)%inter_npes |
---|
| 374 | aPE => Clients(ClientId)%PEs(i) |
---|
| 375 | tag = 200 |
---|
[1779] | 376 | do j=1,aPE%Nr_arrays |
---|
| 377 | ar => aPE%array_list(j) |
---|
| 378 | if(ar%NrDims == 2) then |
---|
[1786] | 379 | arlen = aPE%NrEle ! 2D |
---|
[1779] | 380 | else if(ar%NrDims == 3) then |
---|
[1786] | 381 | arlen = aPE%NrEle * ar%A_dim(4); ! 3D |
---|
[1762] | 382 | else |
---|
| 383 | arlen = -1 |
---|
| 384 | end if |
---|
[1786] | 385 | ar%SendIndex = myIndex |
---|
[1762] | 386 | |
---|
| 387 | tag = tag+1 |
---|
| 388 | rCount = rCount+1 |
---|
| 389 | CALL MPI_Isend (myIndex, 1, MPI_INTEGER, i-1, tag, Clients(ClientId)%inter_comm, req(rCount),ierr) |
---|
| 390 | |
---|
| 391 | if(rCount == 1024) then ! Maximum of 1024 outstanding requests |
---|
| 392 | CALL MPI_Waitall (rCount, req, MPI_STATUSES_IGNORE, ierr) |
---|
| 393 | rCount = 0; |
---|
| 394 | end if |
---|
| 395 | |
---|
| 396 | myIndex = myIndex+arlen |
---|
| 397 | bufsize = bufsize+arlen |
---|
[1786] | 398 | ar%SendSize = arlen |
---|
[1762] | 399 | |
---|
| 400 | end do |
---|
[1786] | 401 | if(rCount > 0) then ! Wait for all send completed |
---|
[1762] | 402 | CALL MPI_Waitall (rCount, req, MPI_STATUSES_IGNORE, ierr) |
---|
| 403 | end if |
---|
| 404 | end do |
---|
| 405 | |
---|
[1786] | 406 | ! |
---|
| 407 | !-- Create RMA (One Sided Communication) window for data buffer server to |
---|
| 408 | !-- client transfer. |
---|
| 409 | !-- The buffer of MPI_Get (counter part of transfer) can be PE-local, i.e. |
---|
| 410 | !-- it can but must not be part of the MPI RMA window. |
---|
| 411 | !-- Only one RMA window is required to prepare the data |
---|
| 412 | !-- for server -> client transfer on the server side and |
---|
| 413 | !-- for client -> server transfer on the client side |
---|
| 414 | CALL PMC_Alloc_mem (base_array_sc, bufsize) |
---|
| 415 | Clients(ClientId)%TotalBufferSize = bufsize*wp !Total buffer size in Byte |
---|
[1762] | 416 | |
---|
[1786] | 417 | WinSize = bufsize*wp |
---|
| 418 | CALL MPI_Win_create (base_array_sc, WinSize, wp, MPI_INFO_NULL, & |
---|
| 419 | Clients(ClientId)%intra_comm, Clients(ClientId)%win_server_client, ierr) |
---|
| 420 | CALL MPI_Win_fence (0, Clients(ClientId)%win_server_client, ierr); ! Open Window to set data |
---|
| 421 | ! |
---|
| 422 | !-- Second stride: Set Buffer pointer |
---|
| 423 | do i=1,Clients(ClientId)%inter_npes |
---|
| 424 | aPE => Clients(ClientId)%PEs(i) |
---|
| 425 | do j=1,aPE%Nr_arrays |
---|
| 426 | ar => aPE%array_list(j) |
---|
| 427 | ar%SendBuf = c_loc(base_array_sc(ar%SendIndex)) |
---|
| 428 | if(ar%SendIndex+ar%SendSize > bufsize) then |
---|
| 429 | write(0,'(a,i4,4i7,1x,a)') 'Server Buffer too small ',i,ar%SendIndex,ar%SendSize,ar%SendIndex+ar%SendSize,bufsize,trim(ar%name) |
---|
| 430 | CALL MPI_Abort (MPI_COMM_WORLD, istat, ierr) |
---|
| 431 | end if |
---|
| 432 | end do |
---|
| 433 | end do |
---|
| 434 | |
---|
| 435 | !-- Client to server direction |
---|
| 436 | |
---|
| 437 | bufsize = 8 |
---|
| 438 | |
---|
| 439 | !-- First stride, Compute size and set index |
---|
| 440 | |
---|
| 441 | do i=1,Clients(ClientId)%inter_npes |
---|
| 442 | aPE => Clients(ClientId)%PEs(i) |
---|
| 443 | tag = 300 |
---|
| 444 | |
---|
| 445 | do j=1,aPE%Nr_arrays |
---|
| 446 | ar => aPE%array_list(j) |
---|
| 447 | |
---|
| 448 | ! Receive Index from client |
---|
| 449 | tag = tag+1 |
---|
| 450 | CALL MPI_Recv (myIndex, 1, MPI_INTEGER, i-1, tag, Clients(ClientId)%inter_comm, MPI_STATUS_IGNORE, ierr) |
---|
| 451 | |
---|
| 452 | if(ar%NrDims == 3) then |
---|
| 453 | bufsize = max(bufsize,aPE%NrEle * ar%A_dim(4)) ! 3D |
---|
| 454 | else |
---|
| 455 | bufsize = max(bufsize,aPE%NrEle) ! 2D |
---|
| 456 | end if |
---|
| 457 | ar%RecvIndex = myIndex |
---|
| 458 | end do |
---|
| 459 | |
---|
| 460 | end do |
---|
| 461 | |
---|
| 462 | !-- Create RMA (One Sided Communication) data buffer |
---|
| 463 | !-- The buffer for MPI_Get can be PE local, i.e. it can but must not be part of the MPI RMA window |
---|
| 464 | |
---|
| 465 | CALL PMC_Alloc_mem (base_array_cs, bufsize, base_ptr) |
---|
[1762] | 466 | Clients(ClientId)%TotalBufferSize = bufsize*wp !Total buffer size in Byte |
---|
| 467 | |
---|
| 468 | CALL MPI_Barrier(Clients(ClientId)%intra_comm, ierr) |
---|
| 469 | |
---|
[1786] | 470 | !-- Second stride, Set Buffer pointer |
---|
[1762] | 471 | |
---|
| 472 | do i=1,Clients(ClientId)%inter_npes |
---|
| 473 | aPE => Clients(ClientId)%PEs(i) |
---|
[1786] | 474 | |
---|
[1779] | 475 | do j=1,aPE%Nr_arrays |
---|
| 476 | ar => aPE%array_list(j) |
---|
[1786] | 477 | ar%RecvBuf = base_ptr |
---|
[1762] | 478 | end do |
---|
| 479 | end do |
---|
| 480 | |
---|
| 481 | return |
---|
| 482 | END SUBROUTINE PMC_S_setInd_and_AllocMem |
---|
| 483 | |
---|
| 484 | SUBROUTINE PMC_S_FillBuffer (ClientId, WaitTime) |
---|
| 485 | IMPLICIT none |
---|
[1779] | 486 | INTEGER,INTENT(IN) :: ClientId |
---|
| 487 | REAL(wp), INTENT(OUT), OPTIONAL :: WaitTime |
---|
[1762] | 488 | |
---|
[1779] | 489 | INTEGER :: ip,ij,istat,ierr,j |
---|
| 490 | INTEGER :: myIndex |
---|
| 491 | REAL(wp) :: t1,t2 |
---|
| 492 | TYPE(PeDef),POINTER :: aPE |
---|
| 493 | TYPE(ArrayDef),POINTER :: ar |
---|
| 494 | CHARACTER(len=DA_Namelen) :: myName |
---|
| 495 | INTEGER,DIMENSION(1) :: buf_shape |
---|
| 496 | REAL(wp), POINTER, DIMENSION(:) :: buf |
---|
| 497 | REAL(wp), POINTER, DIMENSION(:,:) :: data_2d |
---|
| 498 | REAL(wp), POINTER, DIMENSION(:,:,:) :: data_3d |
---|
[1762] | 499 | |
---|
[1797] | 500 | !-- Synchronization of the model is done in pmci_client_synchronize and pmci_server_synchronize |
---|
| 501 | !-- Therefor the RMA window cann be filled without sychronization at this point and the barrier |
---|
| 502 | !-- is not necessary |
---|
| 503 | !-- Please note that WaitTime has to be set in PMC_S_FillBuffer AND PMC_C_GetBuffer |
---|
[1762] | 504 | |
---|
[1797] | 505 | if(present(WaitTime)) then |
---|
| 506 | t1 = PMC_Time() |
---|
| 507 | CALL MPI_Barrier(Clients(ClientId)%intra_comm, ierr) |
---|
| 508 | t2 = PMC_Time() |
---|
| 509 | WaitTime = t2-t1 |
---|
| 510 | end if |
---|
| 511 | |
---|
[1762] | 512 | do ip=1,Clients(ClientId)%inter_npes |
---|
| 513 | aPE => Clients(ClientId)%PEs(ip) |
---|
[1779] | 514 | do j=1,aPE%Nr_arrays |
---|
| 515 | ar => aPE%array_list(j) |
---|
[1762] | 516 | myIndex=1 |
---|
[1779] | 517 | if(ar%NrDims == 2) then |
---|
[1762] | 518 | buf_shape(1) = aPE%NrEle |
---|
| 519 | CALL c_f_pointer(ar%SendBuf, buf, buf_shape) |
---|
| 520 | CALL c_f_pointer(ar%data, data_2d, ar%A_dim(1:2)) |
---|
| 521 | do ij=1,aPE%NrEle |
---|
| 522 | buf(myIndex) = data_2d(aPE%locInd(ij)%j,aPE%locInd(ij)%i) |
---|
| 523 | myIndex = myIndex+1 |
---|
| 524 | end do |
---|
[1779] | 525 | else if(ar%NrDims == 3) then |
---|
[1762] | 526 | buf_shape(1) = aPE%NrEle*ar%A_dim(4) |
---|
| 527 | CALL c_f_pointer(ar%SendBuf, buf, buf_shape) |
---|
| 528 | CALL c_f_pointer(ar%data, data_3d, ar%A_dim(1:3)) |
---|
| 529 | do ij=1,aPE%NrEle |
---|
| 530 | buf(myIndex:myIndex+ar%A_dim(4)-1) = data_3d(1:ar%A_dim(4),aPE%locInd(ij)%j,aPE%locInd(ij)%i) |
---|
| 531 | myIndex = myIndex+ar%A_dim(4) |
---|
| 532 | end do |
---|
| 533 | end if |
---|
| 534 | end do |
---|
| 535 | end do |
---|
| 536 | |
---|
[1786] | 537 | CALL MPI_Barrier(Clients(ClientId)%intra_comm, ierr) ! buffer is filled |
---|
[1762] | 538 | |
---|
| 539 | return |
---|
| 540 | END SUBROUTINE PMC_S_FillBuffer |
---|
| 541 | |
---|
| 542 | SUBROUTINE PMC_S_GetData_from_Buffer (ClientId, WaitTime) |
---|
[1779] | 543 | |
---|
[1762] | 544 | IMPLICIT none |
---|
| 545 | |
---|
[1779] | 546 | INTEGER,INTENT(IN) :: ClientId |
---|
| 547 | REAL(wp), INTENT(OUT), OPTIONAL :: WaitTime |
---|
| 548 | |
---|
[1762] | 549 | !-- local variables |
---|
[1779] | 550 | INTEGER :: ip,ij,istat,ierr,j |
---|
| 551 | INTEGER :: myIndex |
---|
[1786] | 552 | INTEGER :: nr |
---|
[1779] | 553 | REAL(wp) :: t1,t2 |
---|
| 554 | TYPE(PeDef),POINTER :: aPE |
---|
| 555 | TYPE(ArrayDef),POINTER :: ar |
---|
| 556 | CHARACTER(len=DA_Namelen) :: myName |
---|
| 557 | INTEGER,DIMENSION(1) :: buf_shape |
---|
| 558 | REAL(wp), POINTER, DIMENSION(:) :: buf |
---|
| 559 | REAL(wp), POINTER, DIMENSION(:,:) :: data_2d |
---|
| 560 | REAL(wp), POINTER, DIMENSION(:,:,:) :: data_3d |
---|
[1786] | 561 | INTEGER :: target_pe |
---|
| 562 | INTEGER(kind=MPI_ADDRESS_KIND) :: target_disp |
---|
[1762] | 563 | |
---|
| 564 | t1 = PMC_Time() |
---|
[1786] | 565 | CALL MPI_Barrier(Clients(ClientId)%intra_comm, ierr) ! Wait for client to fill buffer |
---|
| 566 | t2 = PMC_Time()-t1 |
---|
| 567 | if(present(WaitTime)) WaitTime = t2 |
---|
[1762] | 568 | |
---|
[1786] | 569 | ! CALL MPI_Win_fence (0, Clients(ClientId)%win_server_client, ierr) ! Fence might do it, test later |
---|
| 570 | CALL MPI_Barrier(Clients(ClientId)%intra_comm, ierr) ! Wait for buffer is filled |
---|
| 571 | |
---|
[1762] | 572 | do ip=1,Clients(ClientId)%inter_npes |
---|
| 573 | aPE => Clients(ClientId)%PEs(ip) |
---|
[1779] | 574 | do j=1,aPE%Nr_arrays |
---|
| 575 | ar => aPE%array_list(j) |
---|
[1786] | 576 | |
---|
| 577 | if(ar%RecvIndex < 0) CYCLE |
---|
| 578 | |
---|
| 579 | if(ar%NrDims == 2) then |
---|
| 580 | nr = aPE%NrEle |
---|
| 581 | else if(ar%NrDims == 3) then |
---|
| 582 | nr = aPE%NrEle*ar%A_dim(4) |
---|
| 583 | end if |
---|
| 584 | |
---|
| 585 | buf_shape(1) = nr |
---|
| 586 | CALL c_f_pointer(ar%RecvBuf, buf, buf_shape) |
---|
| 587 | ! |
---|
| 588 | !-- MPI passive target RMA |
---|
| 589 | |
---|
| 590 | if(nr > 0) then |
---|
| 591 | target_disp = ar%RecvIndex-1 |
---|
| 592 | target_pe = ip-1+m_model_npes ! client PEs are located behind server PEs |
---|
| 593 | CALL MPI_Win_lock (MPI_LOCK_SHARED , target_pe, 0, Clients(ClientId)%win_server_client, ierr) |
---|
| 594 | CALL MPI_Get (buf, nr, MPI_REAL, target_pe, target_disp, nr, MPI_REAL, Clients(ClientId)%win_server_client, ierr) |
---|
| 595 | CALL MPI_Win_unlock (target_pe, Clients(ClientId)%win_server_client, ierr) |
---|
| 596 | end if |
---|
| 597 | |
---|
[1762] | 598 | myIndex=1 |
---|
[1779] | 599 | if(ar%NrDims == 2) then |
---|
[1762] | 600 | CALL c_f_pointer(ar%data, data_2d, ar%A_dim(1:2)) |
---|
| 601 | do ij=1,aPE%NrEle |
---|
| 602 | data_2d(aPE%locInd(ij)%j,aPE%locInd(ij)%i) = buf(myIndex) |
---|
| 603 | myIndex = myIndex+1 |
---|
| 604 | end do |
---|
[1779] | 605 | else if(ar%NrDims == 3) then |
---|
[1762] | 606 | CALL c_f_pointer(ar%data, data_3d, ar%A_dim(1:3)) |
---|
| 607 | do ij=1,aPE%NrEle |
---|
| 608 | data_3d(1:ar%A_dim(4),aPE%locInd(ij)%j,aPE%locInd(ij)%i) = buf(myIndex:myIndex+ar%A_dim(4)-1) |
---|
| 609 | myIndex = myIndex+ar%A_dim(4) |
---|
| 610 | end do |
---|
| 611 | end if |
---|
| 612 | end do |
---|
| 613 | end do |
---|
| 614 | |
---|
| 615 | END SUBROUTINE PMC_S_GetData_from_Buffer |
---|
| 616 | |
---|
| 617 | ! Private SUBROUTINEs |
---|
| 618 | |
---|
| 619 | SUBROUTINE Get_DA_names_from_client (ClientId) |
---|
| 620 | IMPLICIT none |
---|
| 621 | INTEGER,INTENT(IN) :: ClientId |
---|
| 622 | !-- local variables |
---|
| 623 | type(DA_NameDef) :: myName |
---|
| 624 | |
---|
| 625 | ! Get Data Array Description and Name from Client |
---|
| 626 | |
---|
| 627 | do |
---|
| 628 | CALL PMC_Bcast ( myName%couple_index, 0, comm=m_to_client_comm(ClientId)) |
---|
| 629 | if(myName%couple_index == -1) EXIT |
---|
| 630 | CALL PMC_Bcast ( myName%ServerDesc, 0, comm=m_to_client_comm(ClientId)) |
---|
| 631 | CALL PMC_Bcast ( myName%NameOnServer, 0, comm=m_to_client_comm(ClientId)) |
---|
| 632 | CALL PMC_Bcast ( myName%ClientDesc, 0, comm=m_to_client_comm(ClientId)) |
---|
| 633 | CALL PMC_Bcast ( myName%NameOnClient, 0, comm=m_to_client_comm(ClientId)) |
---|
| 634 | |
---|
| 635 | CALL PMC_G_SetName (clients(ClientID), myName%couple_index, myName%NameOnServer ) |
---|
| 636 | end do |
---|
| 637 | |
---|
| 638 | return |
---|
| 639 | END SUBROUTINE Get_DA_names_from_client |
---|
| 640 | |
---|
[1779] | 641 | SUBROUTINE PMC_S_SetArray (ClientId, NrDims, dims, array_adr, second_adr) |
---|
[1762] | 642 | IMPLICIT none |
---|
| 643 | |
---|
| 644 | INTEGER,INTENT(IN) :: ClientId |
---|
| 645 | INTEGER,INTENT(IN) :: NrDims |
---|
| 646 | INTEGER,INTENT(IN),DIMENSION(:) :: dims |
---|
| 647 | TYPE(c_ptr),INTENT(IN) :: array_adr |
---|
[1766] | 648 | TYPE(c_ptr),INTENT(IN),OPTIONAL :: second_adr |
---|
[1762] | 649 | |
---|
| 650 | INTEGER :: i |
---|
| 651 | TYPE(PeDef),POINTER :: aPE |
---|
| 652 | TYPE(ArrayDef),POINTER :: ar |
---|
| 653 | CHARACTER(len=DA_Namelen) :: myName |
---|
| 654 | |
---|
| 655 | ! Set Array for Client interPE 0 |
---|
| 656 | |
---|
| 657 | do i=1,Clients(ClientId)%inter_npes |
---|
| 658 | aPE => Clients(ClientId)%PEs(i) |
---|
[1779] | 659 | ar => aPE%array_list(next_array_in_list) |
---|
[1762] | 660 | ar%NrDims = NrDims |
---|
| 661 | ar%A_dim = dims |
---|
| 662 | ar%data = array_adr |
---|
[1766] | 663 | if(present(second_adr)) then |
---|
| 664 | ar%po_data(1) = array_adr |
---|
| 665 | ar%po_data(2) = second_adr |
---|
| 666 | else |
---|
| 667 | ar%po_data(1) = C_NULL_PTR |
---|
| 668 | ar%po_data(2) = C_NULL_PTR |
---|
| 669 | end if |
---|
[1762] | 670 | end do |
---|
| 671 | |
---|
| 672 | return |
---|
| 673 | END SUBROUTINE PMC_S_SetArray |
---|
| 674 | |
---|
| 675 | |
---|
[1766] | 676 | SUBROUTINE PMC_S_Set_Active_data_array (ClientId,iactive) |
---|
| 677 | IMPLICIT none |
---|
| 678 | |
---|
| 679 | INTEGER,INTENT(IN) :: ClientId |
---|
| 680 | INTEGER,INTENT(IN) :: iactive |
---|
| 681 | |
---|
| 682 | !-- local variables |
---|
[1779] | 683 | INTEGER :: i, ip, j |
---|
[1766] | 684 | TYPE(PeDef),POINTER :: aPE |
---|
| 685 | TYPE(ArrayDef),POINTER :: ar |
---|
| 686 | CHARACTER(len=DA_Namelen) :: myName |
---|
| 687 | |
---|
| 688 | do ip=1,Clients(ClientId)%inter_npes |
---|
| 689 | aPE => Clients(ClientId)%PEs(ip) |
---|
[1779] | 690 | do j=1,aPE%Nr_arrays |
---|
| 691 | ar => aPE%array_list(j) |
---|
[1766] | 692 | if(iactive == 1 .OR. iactive == 2) then |
---|
| 693 | ar%data = ar%po_data(iactive) |
---|
| 694 | end if |
---|
| 695 | end do |
---|
| 696 | end do |
---|
| 697 | |
---|
| 698 | return |
---|
| 699 | END SUBROUTINE PMC_S_Set_Active_data_array |
---|
| 700 | |
---|
| 701 | |
---|
[1762] | 702 | SUBROUTINE Set_PE_index_list (ClientId, myClient,index_list,NrP) |
---|
| 703 | IMPLICIT none |
---|
| 704 | |
---|
| 705 | INTEGER,INTENT(IN) :: ClientId |
---|
| 706 | TYPE(ClientDef),INTENT(INOUT) :: myClient |
---|
| 707 | INTEGER,INTENT(IN),DIMENSION(:,:) :: index_list |
---|
| 708 | INTEGER,INTENT(IN) :: NrP |
---|
| 709 | |
---|
| 710 | !-- local variables |
---|
| 711 | INTEGER :: i,j,ind,ierr,i2 |
---|
| 712 | TYPE(PeDef),POINTER :: aPE |
---|
| 713 | INTEGER :: RemPE |
---|
| 714 | INTEGER,DIMENSION(myClient%inter_npes) :: RemInd |
---|
| 715 | INTEGER,DIMENSION(:),POINTER :: RemIndw |
---|
| 716 | INTEGER,DIMENSION(:),POINTER :: RLdef |
---|
| 717 | INTEGER(KIND=MPI_ADDRESS_KIND) :: WinSize |
---|
| 718 | INTEGER :: indWin,indWin2 |
---|
| 719 | |
---|
| 720 | ! First, count entries for every remote client PE |
---|
| 721 | |
---|
| 722 | do i=1,myClient%inter_npes |
---|
| 723 | aPE => myClient%PEs(i) |
---|
| 724 | aPE%NrEle = 0 |
---|
| 725 | end do |
---|
| 726 | |
---|
| 727 | do j=1,NrP ! loop over number of cells coarse grid |
---|
| 728 | RemPE = index_list(5,j)+1 ! Pe number remote PE |
---|
| 729 | aPE => myClient%PEs(RemPE) |
---|
| 730 | aPE% NrEle = aPE% NrEle+1 ! Increment Number of elements for this client Pe |
---|
| 731 | end do |
---|
| 732 | |
---|
| 733 | do i=1,myClient%inter_npes |
---|
| 734 | aPE => myClient%PEs(i) |
---|
| 735 | ALLOCATE(aPE%locInd(aPE%NrEle)) |
---|
| 736 | end do |
---|
| 737 | |
---|
| 738 | RemInd = 0 |
---|
| 739 | |
---|
| 740 | ! Second, Create lists |
---|
| 741 | |
---|
| 742 | do j=1,NrP ! loop over number of cells coarse grid |
---|
| 743 | RemPE = index_list(5,j)+1 ! Pe number remote PE |
---|
| 744 | aPE => myClient%PEs(RemPE) |
---|
| 745 | RemInd(RemPE) = RemInd(RemPE)+1 |
---|
| 746 | ind = RemInd(RemPE) |
---|
| 747 | aPE%locInd(ind)%i = index_list(1,j) |
---|
| 748 | aPE%locInd(ind)%j = index_list(2,j) |
---|
| 749 | end do |
---|
| 750 | |
---|
| 751 | ! Prepare Number of Elements for Client PEs |
---|
| 752 | CALL PMC_Alloc_mem (RLdef, myClient%inter_npes*2) |
---|
| 753 | WinSize = myClient%inter_npes*c_sizeof(i)*2 ! Number of Client PEs * size of INTEGER (i just arbitrary INTEGER) |
---|
| 754 | |
---|
| 755 | CALL MPI_Win_create (RLdef, WinSize, iwp, MPI_INFO_NULL, myClient%intra_comm, indWin, ierr); |
---|
| 756 | CALL MPI_Win_fence (0, indWin, ierr); ! Open Window to set data |
---|
| 757 | |
---|
| 758 | RLdef(1) = 0 ! Index on Remote PE 0 |
---|
| 759 | RLdef(2) = RemInd(1) ! Number of Elements on Rem PE 0 |
---|
| 760 | |
---|
| 761 | do i=2,myClient%inter_npes ! Reserve Buffer for index array |
---|
| 762 | i2 = (i-1)*2+1 |
---|
| 763 | RLdef(i2) = RLdef(i2-2) + RLdef(i2-1)*2 ! Index on Remote PE |
---|
| 764 | RLdef(i2+1) = RemInd(i) ! Number of Elements on Remote PE |
---|
| 765 | end do |
---|
| 766 | |
---|
| 767 | CALL MPI_Win_fence (0, indWin, ierr); ! Close Window to allow client to access data |
---|
| 768 | CALL MPI_Win_fence (0, indWin, ierr); ! Client has retrieved data |
---|
| 769 | |
---|
| 770 | i2 = 2*myClient%inter_npes-1 |
---|
| 771 | WinSize = (RLdef(i2)+RLdef(i2+1))*2 |
---|
| 772 | WinSize = max(WinSize,1) ! Make sure, MPI_Alloc_mem works |
---|
| 773 | |
---|
| 774 | CALL PMC_Alloc_mem (RemIndw, int(WinSize)) |
---|
| 775 | |
---|
| 776 | CALL MPI_Barrier (m_model_comm, ierr) |
---|
| 777 | CALL MPI_Win_create (RemIndw, WinSize*c_sizeof(i), iwp, MPI_INFO_NULL, myClient%intra_comm, indWin2, ierr); |
---|
| 778 | |
---|
| 779 | CALL MPI_Win_fence (0, indWin2, ierr); ! Open Window to set data |
---|
| 780 | do j=1,NrP ! this loop creates the 2D index list |
---|
| 781 | RemPE = index_list(5,j)+1 ! Pe number remote PE |
---|
| 782 | aPE => myClient%PEs(RemPE) |
---|
| 783 | i2 = RemPE*2-1 |
---|
| 784 | ind = RLdef(i2)+1 |
---|
| 785 | RemIndw(ind) = index_list(3,j) |
---|
| 786 | RemIndw(ind+1) = index_list(4,j) |
---|
| 787 | RLdef(i2) = RLdef(i2)+2 |
---|
| 788 | end do |
---|
| 789 | CALL MPI_Win_fence (0, indWin2, ierr); !all data set |
---|
| 790 | |
---|
| 791 | CALL MPI_Barrier(myClient%intra_comm, ierr) ! Dont know why, but this barrier is necessary before we can free the windows |
---|
| 792 | |
---|
| 793 | CALL MPI_Win_free(indWin, ierr) |
---|
| 794 | CALL MPI_Win_free(indWin2, ierr) |
---|
| 795 | |
---|
| 796 | ! Sollte funktionieren, Problem mit MPI implementation |
---|
| 797 | ! https://www.lrz.de/services/software/parallel/mpi/onesided |
---|
| 798 | ! CALL MPI_Free_mem (RemIndw, ierr) |
---|
| 799 | |
---|
| 800 | return |
---|
| 801 | END SUBROUTINE Set_PE_index_list |
---|
| 802 | |
---|
[1764] | 803 | #endif |
---|
[1762] | 804 | END MODULE pmc_server |
---|