Changeset 10131
- Timestamp:
- 2018-09-14T15:58:40+02:00 (6 years ago)
- Location:
- NEMO/branches/UKMO/dev_rebuild_nemo_compression/REBUILD_NEMO
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/UKMO/dev_rebuild_nemo_compression/REBUILD_NEMO/rebuild_nemo
r9048 r10131 10 10 echo " ************" 11 11 echo 12 echo " usage: ${0##*/} [-l - t -c -m -n] filebase ndomain [rebuild dimensions]"12 echo " usage: ${0##*/} [-l -p -s -m -n -r -d -x -y -z -t -s] filebase ndomain [rebuild dimensions]" 13 13 echo 14 14 echo " flags: -l submit to compute node" 15 echo " - tnum use num threads"16 echo " - c num split 4D vars into time chuncksof size num"15 echo " -p num use num threads" 16 echo " -s num split 4D vars into time slice of size num" 17 17 echo " -m force masking of global arrays (zero if no mdi)" 18 echo " -d deflate_level deflate level for output files (key_netcdf4 only)"19 18 echo " -n namelist full path to namelist file to be created (otherwise default nam_rebuild+_process_id is used)" 20 19 echo " -r memory Memory to request on compute node including units (Default = 10Gb)" 20 echo "" 21 echo " key_netcdf4 only " 22 echo " -d deflate_level deflate level for output files" 23 echo " -x chunsize along x " 24 echo " -y chunsize along y " 25 echo " -z chunsize along z " 26 echo " -t chunsize along t " 27 echo " -s chunsize " 21 28 echo 22 29 exit 1 23 30 } 24 31 25 while getopts c:n:t:d:r:lmopt32 while getopts l:p:s:m:n:r:d:x:y:z:t:s opt 26 33 do 27 34 case ${opt} in … … 32 39 echo "Submitting job to compute node" 33 40 ;; 34 t)41 p) 35 42 OMP_NUM_THREADS=${OPTARG} 36 43 ;; 37 c)38 N CHUNKSIZE=${OPTARG}44 s) 45 NSLICESIZE=${OPTARG} 39 46 ;; 40 47 m) … … 50 57 r) 51 58 MEMORY=${OPTARG} 59 ;; 60 x) 61 NXCHUNK=${OPTARG} 62 ;; 63 y) 64 NYCHUNK=${OPTARG} 65 ;; 66 z) 67 NZCHUNK=${OPTARG} 68 ;; 69 t) 70 NTCHUNK=${OPTARG} 71 ;; 72 s) 73 CHUNKSIZE=${OPTARG} 52 74 ;; 53 75 esac … … 90 112 echo ${dims} >> $nam_rebuild 91 113 fi 92 if [[ -n ${NC HUNKSIZE} ]] ; then93 echo " n chunksize=${NCHUNKSIZE}" >> $nam_rebuild114 if [[ -n ${NCSLICESIZE} ]] ; then 115 echo " nslicesize=${NCSLICESIZE}" >> $nam_rebuild 94 116 fi 95 117 if [[ -n ${NMASK} ]] ; then … … 99 121 echo " deflate_level=${DEFLATE}" >> $nam_rebuild 100 122 fi 123 if [[ -n ${NXCHUNK} ]] ; then 124 echo " nc4_xchunk=${NXCHUNK}" >> $nam_rebuild 125 fi 126 if [[ -n ${NYCHUNK} ]] ; then 127 echo " nc4_ychunk=${NYCHUNK}" >> $nam_rebuild 128 fi 129 if [[ -n ${NZCHUNK} ]] ; then 130 echo " nc4_zchunk=${NZCHUNK}" >> $nam_rebuild 131 fi 132 if [[ -n ${NTCHUNK} ]] ; then 133 echo " nc4_tchunk=${NTCHUNK}" >> $nam_rebuild 134 fi 135 if [[ -n ${CHUNKSIZE} ]] ; then 136 echo " fchunksize=${CHUNKSIZE}" >> $nam_rebuild 137 fi 138 139 101 140 102 141 echo "/" >> $nam_rebuild -
NEMO/branches/UKMO/dev_rebuild_nemo_compression/REBUILD_NEMO/src/rebuild_nemo.F90
r9048 r10131 1 1 PROGRAM rebuild_nemo 2 2 #define key_netcdf4 3 3 !!========================================================================= 4 4 !! *** rebuild_nemo *** … … 14 14 !! * works for 1,2,3 and 4d arrays or types for all valid NetCDF types 15 15 !! * utilises OMP shared memory parallelisation where applicable 16 !! * time ' chunking' for lower memory use16 !! * time 'slicing' for lower memory use 17 17 !! (only for 4D vars with unlimited dimension) 18 18 !! 19 19 !! Ed Blockley - August 2011 20 20 !! (based on original code by Matt Martin) 21 !! Julien Palmieri and Andrew Coward - September 2018 (add compression and chunking) 21 22 !! 22 23 !!------------------------------------------------------------------------- … … 38 39 !! and errors are written to numerr (default 0 - stderr). 39 40 !! 40 !! If time chunking is specified the code will use less memory but take a little longer.41 !! If time slicing is specified the code will use less memory but take a little longer. 41 42 !! It does this by breaking down the 4D input variables over their 4th dimension 42 43 !! (generally time) by way of a while loop. … … 66 67 CHARACTER(LEN=nf90_max_name), ALLOCATABLE :: filenames(:), indimnames(:) 67 68 CHARACTER(LEN=nf90_max_name), DIMENSION(2) :: dims 68 69 INTEGER :: ndomain, ifile, ndomain_file, nchunksize, deflate_level 69 CHARACTER(LEN=256) :: cnampath 70 CHARACTER(LEN=50) :: clibnc ! netcdf library version 71 72 INTEGER :: ndomain, ifile, ndomain_file, nslicesize, deflate_level 70 73 INTEGER :: ncid, outid, idim, istop 71 74 INTEGER :: natts, attid, xtype, varid, rbdims 72 75 INTEGER :: jv, ndims, nvars, dimlen, dimids(4) 73 76 INTEGER :: dimid, unlimitedDimId, di, dj, dr 74 INTEGER :: nmax_unlimited, nt, ntchunk 75 INTEGER :: chunksize = 3200000 77 INTEGER :: nmax_unlimited, nt, ntslice 78 INTEGER :: fchunksize = 32000000 ! NetCDF global file chunk cache size 79 INTEGER :: patchchunk ! NetCDF processor-domain file chunk cache size 76 80 INTEGER :: nthreads = 1 81 INTEGER :: chunkalg = 0 ! NetCDF4 variable chunking algorithm 82 ! Default variable chunksizes (typical ORCA025 83 ! recommendations which can be adjusted via namelist 84 ! or will be bounded if too large for domain.) 85 INTEGER :: nc4_xchunk = 206 ! Default x (longitude) variable chunk size 86 INTEGER :: nc4_ychunk = 135 ! Default y (latitude) variable chunk size 87 INTEGER :: nc4_zchunk = 1 ! Default z (depth) variable chunk size (almost always 1) 88 INTEGER :: nc4_tchunk = 1 ! Default t (time) variable chunk size (almost always 1) 77 89 INTEGER, ALLOCATABLE :: outdimids(:), outdimlens(:), indimlens(:), inncids(:) 90 INTEGER, ALLOCATABLE :: chunksizes(:) 78 91 INTEGER, ALLOCATABLE :: global_sizes(:), rebuild_dims(:) 79 92 INTEGER, DIMENSION(2) :: halo_start, halo_end, local_sizes 80 93 INTEGER, DIMENSION(2) :: idomain, jdomain, rdomain, start_pos 81 94 INTEGER :: ji, jj, jk, jl, jr 95 INTEGER :: nargs ! number of arguments 96 INTEGER, EXTERNAL :: iargc 82 97 83 98 REAL(sp) :: ValMin, ValMax, InMin, InMax, rmdi … … 154 169 LOGICAL :: l_maskout = .false. 155 170 156 NAMELIST/nam_rebuild/ filebase, ndomain, dims, nchunksize, l_maskout, deflate_level 171 NAMELIST/nam_rebuild/ filebase, ndomain, dims, nslicesize, l_maskout, deflate_level, & 172 & nc4_xchunk, nc4_ychunk, nc4_zchunk, nc4_tchunk, fchunksize 157 173 158 174 external :: getarg 159 integer, external :: iargc160 integer :: found_num_args = 0161 character(256) :: namelist_path162 175 163 176 !End of definitions … … 174 187 175 188 !-------------------------------------------------------------------------------- 189 !1.0 Check netcdf version for warning 190 clibnc = TRIM(nf90_inq_libvers()) 191 IF (ICHAR(clibnc(1:1)) <= 3) THEN 192 PRINT *, '==========================================================' 193 PRINT *, 'You are using old netcdf library (',TRIM(clibnc),').' 194 PRINT *, 'REBUILD_NEMO support of old netcdf library will end soon' 195 PRINT *, 'please consider moving to netcdf 4 or higher' 196 PRINT *, '==========================================================' 197 END IF 198 176 199 !1.1 Get the namelist path 177 !Determine the number of arguments on the command line178 found_num_args=iargc()179 !Check that the required argument is present, if it is not then set it to the default value: nam_rebuild180 IF (found_num_args <= 0) THEN181 WRITE(numout,*) 'Namelist path not supplied as command line argument. Using default, nam_rebuild.'182 namelist_path='nam_rebuild'183 ELSE IF (found_num_args == 1) THEN184 CALL getarg(1, namelist_path)185 ELSE186 WRITE(numerr,*) 'ERROR! : Incorrect number of command line arguments. Please supply only'187 WRITE(numerr,*) ' the path to the namelist file, or no arguments to use default value'188 STOP 1189 END IF200 !Determine the number of arguments on the command line 201 nargs=iargc() 202 !Check that the required argument is present, if it is not then set it to the default value: nam_rebuild 203 IF (nargs == 0) THEN 204 WRITE(numout,*) 'Namelist path not supplied as command line argument. Using default, nam_rebuild.' 205 cnampath='nam_rebuild' 206 ELSE IF (nargs == 1) THEN 207 CALL getarg(1, cnampath) 208 ELSE 209 WRITE(numerr,*) 'ERROR! : Incorrect number of command line arguments. Please supply only' 210 WRITE(numerr,*) ' the path to the namelist file, or no arguments to use default value' 211 STOP 1 212 END IF 190 213 191 214 !1.2 Read in the namelist 192 215 193 216 dims(:) = "" 194 n chunksize = 0217 nslicesize = 0 195 218 deflate_level = 0 196 OPEN( UNIT=numnam, FILE=TRIM( namelist_path), FORM='FORMATTED', STATUS='OLD' )219 OPEN( UNIT=numnam, FILE=TRIM(cnampath), FORM='FORMATTED', STATUS='OLD' ) 197 220 READ( numnam, nam_rebuild ) 198 221 CLOSE( numnam ) 199 222 IF( .NOT. ALL(dims(:) == "") ) l_findDims = .false. 200 201 !1. 1Set up the filenames and fileids223 224 !1.3 Set up the filenames and fileids 202 225 203 226 ALLOCATE(filenames(ndomain)) … … 227 250 228 251 !2.1 Set up the output file 229 !#if defined key_netcdf4230 CALL check_nf90( nf90_create( TRIM(filebase)//'.nc', nf90_netcdf4, outid, chunksize= chunksize ) )231 !#else232 ! CALL check_nf90( nf90_create( TRIM(filebase)//'.nc', nf90_64bit_offset, outid, chunksize=chunksize ) )233 !#endif252 #if defined key_netcdf4 253 CALL check_nf90( nf90_create( TRIM(filebase)//'.nc', nf90_netcdf4, outid, chunksize=fchunksize ) ) 254 #else 255 CALL check_nf90( nf90_create( TRIM(filebase)//'.nc', nf90_64bit_offset, outid, chunksize=fchunksize ) ) 256 #endif 234 257 235 258 !2.2 Set up dimensions in output file … … 291 314 outdimlens(idim) = dimlen 292 315 END DO 293 ! nmax_unlimited is only used for time- chunking so we set it to be at least 1 to316 ! nmax_unlimited is only used for time-slicing so we set it to be at least 1 to 294 317 ! account for files with no record dimension or zero length record dimension(!) 295 318 nmax_unlimited = max(nmax_unlimited,1) … … 340 363 CALL check_nf90( nf90_inquire_variable( ncid, jv, varname, xtype, ndims, dimids, natts ) ) 341 364 ALLOCATE(outdimids(ndims)) 342 DO idim = 1, ndims 343 outdimids(idim) = dimids(idim) 344 END DO 365 ALLOCATE(chunksizes(ndims)) 366 IF( ndims > 0 ) then 367 DO idim = 1, ndims 368 outdimids(idim) = dimids(idim) 369 chunksizes(idim) = outdimlens(dimids(idim)) 370 if( TRIM(indimnames(dimids(idim))) == 'x' ) & 371 & chunksizes(idim) = min(outdimlens(dimids(idim)), max(nc4_xchunk,1)) 372 if( TRIM(indimnames(dimids(idim))) == 'y' ) & 373 & chunksizes(idim) = min(outdimlens(dimids(idim)), max(nc4_ychunk,1)) 374 ! trick to find var in a list of suggestion (var0 and var1 : INDEX(|var0|var1|,|var|) 375 if( INDEX('|depth|z|nav_lev|','|'//TRIM(indimnames(dimids(idim)))//'|') > 0 ) & 376 & chunksizes(idim) = min(outdimlens(dimids(idim)), max(nc4_zchunk,1)) 377 if( INDEX('|time|time_counter|','|'//TRIM(indimnames(dimids(idim)))//'|') > 0 ) & 378 & chunksizes(idim) = min(outdimlens(dimids(idim)), max(nc4_tchunk,1)) 379 END DO 345 380 #if defined key_netcdf4 346 CALL check_nf90( nf90_def_var( outid, varname, xtype, outdimids, varid, & 347 deflate_level=deflate_level ) ) 381 CALL check_nf90( nf90_def_var( outid, varname, xtype, outdimids, varid, & 382 deflate_level=deflate_level ) ) 383 IF (l_verbose) WRITE(numout,*) 'Dims : ',ndims, outdimids(1:ndims) 384 IF (l_verbose) WRITE(numout,*) 'names : ',(TRIM(indimnames(dimids(idim)))//' ',idim=1,ndims) 385 IF (l_verbose) WRITE(numout,*) 'lens : ',(outdimlens(dimids(idim)),idim=1,ndims) 386 IF (l_verbose) WRITE(numout,*) 'Chunking: ',chunkalg, chunksizes 387 CALL check_nf90( nf90_def_var_chunking( outid, varid, chunkalg, & 388 & chunksizes ) ) 389 ELSE 390 CALL check_nf90( nf90_def_var( outid, varname, xtype, outdimids, varid ) ) 348 391 #else 349 392 CALL check_nf90( nf90_def_var( outid, varname, xtype, outdimids, varid ) ) 350 393 #endif 394 ENDIF 351 395 DEALLOCATE(outdimids) 396 DEALLOCATE(chunksizes) 352 397 IF (l_verbose) WRITE(numout,*) 'Defining variable '//TRIM(varname)//'...' 353 398 IF( natts > 0 ) THEN … … 375 420 376 421 IF (l_verbose) WRITE(numout,*) 'Opening input files...' 422 423 ! Set a file chunk cache size for the processor-domain files that scales with the number of processors 424 patchchunk = max(8192, fchunksize/ndomain) 425 426 ! open files 377 427 DO ifile = 2, ndomain 378 CALL check_nf90( nf90_open( TRIM(filenames(ifile)), nf90_share, ncid, chunksize= chunksize) )428 CALL check_nf90( nf90_open( TRIM(filenames(ifile)), nf90_share, ncid, chunksize=patchchunk ) ) 379 429 inncids(ifile) = ncid 380 430 END DO … … 388 438 istop = nf90_noerr 389 439 nt = 1 390 nt chunk= nmax_unlimited391 IF( n chunksize == 0 ) nchunksize = nmax_unlimited440 ntslice = nmax_unlimited 441 IF( nslicesize == 0 ) nslicesize = nmax_unlimited 392 442 393 443 !3.2 Inquire variable to find out name and how many dimensions it has … … 403 453 ENDIF 404 454 405 !3.2.0 start while loop for time chunking455 !3.2.0 start while loop for time slicing 406 456 407 457 DO WHILE( nt <= nmax_unlimited ) 408 458 409 459 IF( ndims > 3 ) THEN 410 nt chunk = MIN( nchunksize, nmax_unlimited + 1 - nt )460 ntslice = MIN( nslicesize, nmax_unlimited + 1 - nt ) 411 461 ENDIF 412 462 413 463 IF (l_noRebuild) THEN 414 464 415 IF( n chunksize == nmax_unlimited .OR. ndims <= 3 ) THEN465 IF( nslicesize == nmax_unlimited .OR. ndims <= 3 ) THEN 416 466 IF (l_verbose) WRITE(numout,*) 'Copying data from variable '//TRIM(varname)//'...' 417 467 ELSE 418 468 IF (l_verbose) WRITE(numout,'(A,I3,A,I3,A)') ' Copying data from variable ' & 419 & //TRIM(varname)//' for chunks ',nt,' to ',nt+ntchunk-1,' ...'469 & //TRIM(varname)//' for slices ',nt,' to ',nt+ntslice-1,' ...' 420 470 ENDIF 421 471 … … 519 569 CASE( NF90_BYTE ) 520 570 ALLOCATE(globaldata_4d_i1(indimlens(dimids(1)),indimlens(dimids(2)), & 521 & indimlens(dimids(3)),nt chunk))571 & indimlens(dimids(3)),ntslice)) 522 572 CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_i1, start=(/1,1,1,nt/) ) ) 523 573 CASE( NF90_SHORT ) 524 574 ALLOCATE(globaldata_4d_i2(indimlens(dimids(1)),indimlens(dimids(2)), & 525 & indimlens(dimids(3)),nt chunk))575 & indimlens(dimids(3)),ntslice)) 526 576 CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_i2, start=(/1,1,1,nt/) ) ) 527 577 CASE( NF90_INT ) 528 578 ALLOCATE(globaldata_4d_i4(indimlens(dimids(1)),indimlens(dimids(2)), & 529 & indimlens(dimids(3)),nt chunk))579 & indimlens(dimids(3)),ntslice)) 530 580 CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_i4, start=(/1,1,1,nt/) ) ) 531 581 CASE( NF90_FLOAT ) 532 582 ALLOCATE(globaldata_4d_sp(indimlens(dimids(1)),indimlens(dimids(2)), & 533 & indimlens(dimids(3)),nt chunk))583 & indimlens(dimids(3)),ntslice)) 534 584 CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_sp, start=(/1,1,1,nt/) ) ) 535 585 CASE( NF90_DOUBLE ) 536 586 ALLOCATE(globaldata_4d_dp(indimlens(dimids(1)),indimlens(dimids(2)), & 537 & indimlens(dimids(3)),nt chunk))587 & indimlens(dimids(3)),ntslice)) 538 588 CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_dp, start=(/1,1,1,nt/) ) ) 539 589 CASE DEFAULT … … 548 598 !3.2.2 For variables that require rebuilding we need to read in from all ndomain files 549 599 ! Here we allocate global variables ahead of looping over files 550 IF( n chunksize == nmax_unlimited .OR. ndims <= 3 ) THEN600 IF( nslicesize == nmax_unlimited .OR. ndims <= 3 ) THEN 551 601 IF (l_verbose) WRITE(numout,*) 'Rebuilding data from variable '//TRIM(varname)//'...' 552 602 ELSE 553 603 IF (l_verbose) WRITE(numout,'(A,I3,A,I3,A)') ' Rebuilding data from variable ' & 554 & //TRIM(varname)//' for chunks ',nt,' to ',nt+ntchunk-1,' ...'604 & //TRIM(varname)//' for slices ',nt,' to ',nt+ntslice-1,' ...' 555 605 ENDIF 556 606 IF( ndims == 1 ) THEN … … 633 683 CASE( NF90_BYTE ) 634 684 ALLOCATE(globaldata_4d_i1(outdimlens(dimids(1)),outdimlens(dimids(2)), & 635 & outdimlens(dimids(3)),nt chunk))685 & outdimlens(dimids(3)),ntslice)) 636 686 IF (l_maskout) globaldata_4d_i1(:,:,:,:)=mdiVals(jv) 637 687 CASE( NF90_SHORT ) 638 688 ALLOCATE(globaldata_4d_i2(outdimlens(dimids(1)),outdimlens(dimids(2)), & 639 & outdimlens(dimids(3)),nt chunk))689 & outdimlens(dimids(3)),ntslice)) 640 690 IF (l_maskout) globaldata_4d_i2(:,:,:,:)=mdiVals(jv) 641 691 CASE( NF90_INT ) 642 692 ALLOCATE(globaldata_4d_i4(outdimlens(dimids(1)),outdimlens(dimids(2)), & 643 & outdimlens(dimids(3)),nt chunk))693 & outdimlens(dimids(3)),ntslice)) 644 694 IF (l_maskout) globaldata_4d_i4(:,:,:,:)=mdiVals(jv) 645 695 CASE( NF90_FLOAT ) 646 696 ALLOCATE(globaldata_4d_sp(outdimlens(dimids(1)),outdimlens(dimids(2)), & 647 & outdimlens(dimids(3)),nt chunk))697 & outdimlens(dimids(3)),ntslice)) 648 698 IF (l_maskout) globaldata_4d_sp(:,:,:,:)=mdiVals(jv) 649 699 CASE( NF90_DOUBLE ) 650 700 ALLOCATE(globaldata_4d_dp(outdimlens(dimids(1)),outdimlens(dimids(2)), & 651 & outdimlens(dimids(3)),nt chunk))701 & outdimlens(dimids(3)),ntslice)) 652 702 IF (l_maskout) globaldata_4d_dp(:,:,:,:)=mdiVals(jv) 653 703 CASE DEFAULT … … 670 720 !$OMP& localdata_1d_i1,localdata_2d_i1,localdata_3d_i1,localdata_4d_i1) & 671 721 !$OMP& SHARED(jv,nvars,varname,filenames,ValMin,ValMax,indimlens,outdimlens,rbdims, & 672 !$OMP& ndomain,outid, chunksize,istop,l_valid,nthreads,inncids,rebuild_dims,&722 !$OMP& ndomain,outid,fchunksize,istop,l_valid,nthreads,inncids,rebuild_dims, & 673 723 !$OMP& globaldata_1d_i2,globaldata_1d_i4,globaldata_1d_sp,globaldata_1d_dp, & 674 724 !$OMP& globaldata_2d_i2,globaldata_2d_i4,globaldata_2d_sp,globaldata_2d_dp, & … … 676 726 !$OMP& globaldata_4d_i2,globaldata_4d_i4,globaldata_4d_sp,globaldata_4d_dp, & 677 727 !$OMP& globaldata_1d_i1,globaldata_2d_i1,globaldata_3d_i1,globaldata_4d_i1, & 678 !$OMP& nt chunk,nt,nmax_unlimited,indimnames,dims)728 !$OMP& ntslice,nt,nmax_unlimited,indimnames,dims,patchchunk) 679 729 680 730 DO ifile = 1, ndomain … … 932 982 CASE( NF90_BYTE ) 933 983 ALLOCATE(localdata_4d_i1(local_sizes(di),local_sizes(dj), & 934 & indimlens(dimids(3)),nt chunk))984 & indimlens(dimids(3)),ntslice)) 935 985 CALL check_nf90( nf90_get_var( ncid, jv, localdata_4d_i1, start=(/1,1,1,nt/) ), istop ) 936 986 !$OMP PARALLEL DEFAULT(NONE) PRIVATE(ji,jj,jk,jl) & 937 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_i1,localdata_4d_i1,di,dj,nt,nt chunk)938 DO jl = 1, nt chunk987 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_i1,localdata_4d_i1,di,dj,nt,ntslice) 988 DO jl = 1, ntslice 939 989 !$OMP DO 940 990 DO jk = 1, indimlens(dimids(3)) … … 951 1001 CASE( NF90_SHORT ) 952 1002 ALLOCATE(localdata_4d_i2(local_sizes(di),local_sizes(dj), & 953 & indimlens(dimids(3)),nt chunk))1003 & indimlens(dimids(3)),ntslice)) 954 1004 CALL check_nf90( nf90_get_var( ncid, jv, localdata_4d_i2, start=(/1,1,1,nt/) ), istop ) 955 1005 !$OMP PARALLEL DEFAULT(NONE) PRIVATE(ji,jj,jk,jl) & 956 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_i2,localdata_4d_i2,di,dj,nt,nt chunk)957 DO jl = 1, nt chunk1006 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_i2,localdata_4d_i2,di,dj,nt,ntslice) 1007 DO jl = 1, ntslice 958 1008 !$OMP DO 959 1009 DO jk = 1, indimlens(dimids(3)) … … 970 1020 CASE( NF90_INT ) 971 1021 ALLOCATE(localdata_4d_i4(local_sizes(di),local_sizes(dj), & 972 & indimlens(dimids(3)),nt chunk))1022 & indimlens(dimids(3)),ntslice)) 973 1023 CALL check_nf90( nf90_get_var( ncid, jv, localdata_4d_i4, start=(/1,1,1,nt/) ), istop ) 974 1024 !$OMP PARALLEL DEFAULT(NONE) PRIVATE(ji,jj,jk,jl) & 975 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_i4,localdata_4d_i4,di,dj,nt,nt chunk)976 DO jl = 1, nt chunk1025 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_i4,localdata_4d_i4,di,dj,nt,ntslice) 1026 DO jl = 1, ntslice 977 1027 !$OMP DO 978 1028 DO jk = 1, indimlens(dimids(3)) … … 989 1039 CASE( NF90_FLOAT ) 990 1040 ALLOCATE(localdata_4d_sp(local_sizes(di),local_sizes(dj), & 991 & indimlens(dimids(3)),nt chunk))1041 & indimlens(dimids(3)),ntslice)) 992 1042 CALL check_nf90( nf90_get_var( ncid, jv, localdata_4d_sp, start=(/1,1,1,nt/) ), istop ) 993 1043 !$OMP PARALLEL DEFAULT(NONE) PRIVATE(ji,jj,jk,jl) & 994 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_sp,localdata_4d_sp,di,dj,nt,nt chunk)995 DO jl = 1, nt chunk1044 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_sp,localdata_4d_sp,di,dj,nt,ntslice) 1045 DO jl = 1, ntslice 996 1046 !$OMP DO 997 1047 DO jk = 1, indimlens(dimids(3)) … … 1008 1058 CASE( NF90_DOUBLE ) 1009 1059 ALLOCATE(localdata_4d_dp(local_sizes(di),local_sizes(dj), & 1010 & indimlens(dimids(3)),nt chunk))1060 & indimlens(dimids(3)),ntslice)) 1011 1061 CALL check_nf90( nf90_get_var( ncid, jv, localdata_4d_dp, start=(/1,1,1,nt/) ), istop ) 1012 1062 !$OMP PARALLEL DEFAULT(NONE) PRIVATE(ji,jj,jk,jl) & 1013 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_dp,localdata_4d_dp,di,dj,nt,nt chunk)1014 DO jl = 1, nt chunk1063 !$OMP& SHARED(idomain,jdomain,indimlens,dimids,start_pos,globaldata_4d_dp,localdata_4d_dp,di,dj,nt,ntslice) 1064 DO jl = 1, ntslice 1015 1065 !$OMP DO 1016 1066 DO jk = 1, indimlens(dimids(3)) … … 1099 1149 CASE( NF90_DOUBLE ) 1100 1150 CALL check_nf90( nf90_put_var( outid, jv, globaldata_0d_dp ) ) 1151 CASE DEFAULT 1152 WRITE(numerr,*) '0d Unknown nf90 type: ', xtype 1153 STOP 4 1101 1154 END SELECT 1102 1155 … … 1119 1172 CALL check_nf90( nf90_put_var( outid, jv, globaldata_1d_dp ) ) 1120 1173 DEALLOCATE(globaldata_1d_dp) 1174 CASE DEFAULT 1175 WRITE(numerr,*) '1d Unknown nf90 type: ', xtype 1176 STOP 4 1121 1177 END SELECT 1122 1178 … … 1140 1196 DEALLOCATE(globaldata_2d_dp) 1141 1197 CASE DEFAULT 1142 WRITE(numerr,*) ' Unknown nf90 type: ', xtype1198 WRITE(numerr,*) '2d Unknown nf90 type: ', xtype 1143 1199 STOP 4 1144 1200 END SELECT … … 1163 1219 DEALLOCATE(globaldata_3d_dp) 1164 1220 CASE DEFAULT 1165 WRITE(numerr,*) ' Unknown nf90 type: ', xtype1221 WRITE(numerr,*) '3d Unknown nf90 type: ', xtype 1166 1222 STOP 4 1167 1223 END SELECT … … 1186 1242 DEALLOCATE(globaldata_4d_dp) 1187 1243 CASE DEFAULT 1188 WRITE(numerr,*) ' Unknown nf90 type: ', xtype1244 WRITE(numerr,*) '4d Unknown nf90 type: ', xtype 1189 1245 STOP 4 1190 1246 END SELECT 1247 ! why only for big data set, test the cost. 1248 CALL check_nf90( nf90_sync( outid ) ) ! flush buffers to disk after writing big 4D datasets 1191 1249 1192 1250 ENDIF 1193 1251 1194 nt = nt + nt chunk1252 nt = nt + ntslice 1195 1253 1196 1254 END DO ! WHILE loop … … 1237 1295 WRITE(numerr,*) "*** NEMO rebuild failed ***" 1238 1296 WRITE(numerr,*) 1239 STOP 41297 STOP 5 1240 1298 ENDIF 1241 1299 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.