Changeset 897 for trunk/NEMO
- Timestamp:
- 2008-04-22T17:20:03+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMO/OPA_SRC/lib_mpp.F90
r888 r897 136 136 LOGICAL :: & 137 137 l_isend = .FALSE. ! isend use indicator (T if c_mpi_send='I') 138 138 INTEGER :: & ! size of the buffer in case of mpi_bsend 139 nn_buffer = 0 139 140 140 141 #elif defined key_mpp_shmem … … 296 297 LOGICAL :: mpi_was_called 297 298 INTEGER,OPTIONAL :: localComm 298 NAMELIST/nam_mpp/ c_mpi_send 299 NAMELIST/nam_mpp/ c_mpi_send, nn_buffer 299 300 !!---------------------------------------------------------------------- 300 301 … … 329 330 CASE ( 'B' ) ! Buffer mpi send (blocking) 330 331 WRITE(numout,*) ' Buffer blocking mpi send (bsend)' 331 CALL mpi_init_opa( ierr ) 332 CALL mpi_init_opa( ierr ) 332 333 CASE ( 'I' ) ! Immediate mpi send (non-blocking send) 333 334 WRITE(numout,*) ' Immediate non-blocking send (isend)' … … 5279 5280 END SUBROUTINE mpp_lbc_north_e 5280 5281 5281 5282 !!!!!5283 5284 5285 !!5286 !! This is valid on IBM machine ONLY.5287 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*- Mode: F90 -*- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!5288 !! mpi_init_opa.f90 : Redefinition du point d'entree MPI_INIT de la bibliotheque5289 !! MPI afin de faire, en plus de l'initialisation de5290 !! l'environnement MPI, l'allocation d'une zone tampon5291 !! qui sera ulterieurement utilisee automatiquement lors5292 !! de tous les envois de messages par MPI_BSEND5293 !!5294 !! Auteur : CNRS/IDRIS5295 !! Date : Tue Nov 13 12:02:14 20015296 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!5297 5298 5282 SUBROUTINE mpi_init_opa(code) 5299 IMPLICIT NONE 5300 5301 !$AGRIF_DO_NOT_TREAT 5302 # include <mpif.h> 5303 !$AGRIF_END_DO_NOT_TREAT 5283 !!--------------------------------------------------------------------- 5284 !! *** routine mpp_init.opa *** 5285 !! 5286 !! ** Purpose :: export and attach a MPI buffer for bsend 5287 !! 5288 !! ** Method :: define buffer size in namelist, if 0 no buffer attachment 5289 !! but classical mpi_init 5290 !! 5291 !! History :: 01/11 :: IDRIS initial version for IBM only 5292 !! 08/04 :: R. Benshila, generalisation 5293 !! 5294 !!--------------------------------------------------------------------- 5304 5295 5305 5296 INTEGER :: code,rang,ierr 5306 5297 LOGICAL :: mpi_was_called 5307 5308 ! La valeur suivante doit etre au moins egale a la taille5309 ! du plus grand message qui sera transfere dans le programme5310 ! (de toute facon, il y aura un message d'erreur si cette5311 ! valeur s'avere trop petite)5312 INTEGER :: taille_tampon5313 CHARACTER(len=9) :: taille_tampon_alphanum5314 5298 REAL(kind=8), ALLOCATABLE, DIMENSION(:) :: tampon 5315 5299 5316 ! Le point d'entree dans la bibliotheque MPI elle-meme5300 ! MPI initialization 5317 5301 CALL mpi_initialized(mpi_was_called, code) 5318 5302 IF ( code /= MPI_SUCCESS ) THEN … … 5329 5313 ENDIF 5330 5314 ENDIF 5331 ! La definition de la zone tampon pour les futurs envois 5332 ! par MPI_BSEND (on alloue une fois pour toute cette zone 5333 ! tampon, qui sera automatiquement utilisee lors de chaque 5334 ! appel a MPI_BSEND). 5335 ! La desallocation sera implicite quand on sortira de 5336 ! l'environnement MPI. 5337 5338 ! Recuperation de la valeur de la variable d'environnement 5339 ! BUFFER_LENGTH 5340 ! qui, si elle est definie, doit contenir une valeur superieure 5341 ! a la taille en octets du plus gros message 5342 CALL getenv('BUFFER_LENGTH',taille_tampon_alphanum) 5343 5344 ! Si la variable BUFFER_LENGTH n'est pas positionnee, on lui met par 5345 ! defaut la plus grande valeur de la variable MP_EAGER_LIMIT, soit 5346 ! 65 536 octets 5347 IF (taille_tampon_alphanum == ' ') THEN 5348 taille_tampon = 65536 5349 ELSE 5350 READ(taille_tampon_alphanum,'(i9)') taille_tampon 5351 END IF 5352 5353 ! On est limite en mode d'adressage 32 bits a 1750 Mo pour la zone 5354 ! "data" soit 7 segments, c.-a -d. 1750/8 = 210 Mo 5355 IF (taille_tampon > 210000000) THEN 5356 CALL ctl_stop( ' lib_mpp: Attention la valeur BUFFER_LENGTH doit etre <= 210000000' ) 5357 CALL mpi_abort(MPI_COMM_WORLD,2,code) 5358 END IF 5359 5360 CALL mpi_comm_rank(MPI_COMM_OPA,rang,code) 5361 IF (rang == 0 ) PRINT *,'Taille du buffer alloue : ',taille_tampon 5362 5363 ! Allocation du tampon et attachement 5364 ALLOCATE(tampon(taille_tampon)) 5365 CALL mpi_buffer_attach(tampon,taille_tampon,code) 5315 5316 IF( nn_buffer > 0 ) THEN 5317 IF ( lwp ) WRITE(numout,*) 'mpi_bsend, buffer allocation of : ', nn_buffer 5318 5319 ! Buffer allocation and attachment 5320 ALLOCATE(tampon(nn_buffer)) 5321 CALL mpi_buffer_attach(tampon,nn_buffer,code) 5322 ENDIF 5366 5323 5367 5324 END SUBROUTINE mpi_init_opa
Note: See TracChangeset
for help on using the changeset viewer.