Changeset 1329 for XIOS


Ignore:
Timestamp:
11/15/17 12:51:25 (6 years ago)
Author:
yushan
Message:

dev_omp

Location:
XIOS/dev/branch_openmp
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/bld.cfg

    r1328 r1329  
    4242bld::target test_remap.exe  
    4343bld::target test_remap_ref.exe  
     44bld::target test_remap_omp.exe  
    4445#bld::target test_unstruct_omp.exe 
    4546#bld::target test_netcdf_omp.exe 
  • XIOS/dev/branch_openmp/src/test/test_remap_omp.f90

    r1220 r1329  
    33  USE xios 
    44  USE mod_wait 
    5   use omp_lib 
     5  USE omp_lib 
    66  USE netcdf 
    77 
     
    3737  INTEGER :: varid 
    3838  INTEGER :: ts 
    39   INTEGER :: i,j, provided 
     39  INTEGER :: i,j 
    4040  INTEGER,PARAMETER :: llm=5, interpolatedLlm = 4, llm2 = 6 
    4141  DOUBLE PRECISION, PARAMETER :: missing_value = 100000 
    42  
    43     CALL MPI_INIT_THREAD(3, provided, ierr) 
     42  INTEGER :: provided 
     43 
     44  CALL MPI_INIT_THREAD(3, provided, ierr) 
    4445    if(provided .NE. 3) then 
    4546      print*, "provided thread level = ", provided 
     
    4748    endif 
    4849  CALL init_wait 
    49    
     50 
    5051  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    5152  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
    5253  if(rank < size-2) then 
    53  
    54   !$omp parallel default(firstprivate) firstprivate(dtime) 
     54  
     55  !$omp parallel default(firstprivate)  
    5556 
    5657!!! XIOS Initialization (get the local communicator) 
     
    6364  size = size*omp_get_num_threads() 
    6465 
    65    
     66  print*, "rank = ", rank, " size = ", size 
     67 
    6668  !$omp critical (open_file) 
    6769  ierr=NF90_OPEN(src_file, NF90_NOWRITE, ncid) 
    68   !$omp end critical (open_file) 
    69  
    70   ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid) 
    71   ierr=NF90_INQUIRE_VARIABLE(ncid, varid, dimids=dimids) 
     70  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid) 
     71  ierr=NF90_INQUIRE_VARIABLE(ncid, varid,dimids=dimids) 
    7272  ierr=NF90_INQUIRE_DIMENSION(ncid, dimids(1), len=src_nvertex) 
    7373  ierr=NF90_INQUIRE_DIMENSION(ncid, dimids(2), len=src_ni_glo) 
     
    8282    src_ibegin= remain * (div+1) + (rank-remain) * div ; 
    8383  ENDIF 
    84  
    85   if(src_ni .LE. 0) CALL MPI_ABORT() 
    86  
    8784 
    8885  ALLOCATE(src_lon(src_ni), src_lon_tmp(src_ni)) 
     
    9895  ALLOCATE(lval1(interpolatedLlm)) 
    9996  ALLOCATE(lval2(llm2)) 
    100   lval2 = 0 
    101   lval=0 
    102   lval1=0 
    10397 
    10498  ierr=NF90_INQ_VARID(ncid,"lon",varid) 
     
    147141  ENDDO 
    148142 
    149   !$omp critical (open_file) 
     143  print*, "ID = ", rank, "src_ni = ", "src_nvertex = ", src_nvertex, "src_ni_glo = ", src_ni_glo 
     144 
    150145  ierr=NF90_OPEN(dst_file, NF90_NOWRITE, ncid) 
    151   !$omp end critical (open_file) 
    152  
    153    
    154146  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid) 
    155147  ierr=NF90_INQUIRE_VARIABLE(ncid, varid,dimids=dimids) 
     
    167159  ENDIF 
    168160 
    169   if(dst_ni .LE. 0) CALL MPI_ABORT() 
    170  
    171161  ALLOCATE(dst_lon(dst_ni)) 
    172162  ALLOCATE(dst_lat(dst_ni)) 
     
    182172  ierr=NF90_INQ_VARID(ncid,"bounds_lat",varid) 
    183173  ierr=NF90_GET_VAR(ncid,varid, dst_boundslat, start=(/1,dst_ibegin+1/),count=(/dst_nvertex,dst_ni/)) 
    184  
    185    !$omp barrier 
     174   
     175  !$omp end critical (open_file) 
     176   
     177  !$omp barrier 
    186178 
    187179  !$omp master  
     
    191183  !$omp barrier 
    192184 
    193    
    194185  CALL xios_context_initialize("test",comm) 
    195186  CALL xios_get_handle("test",ctx_hdl) 
    196187  CALL xios_set_current_context(ctx_hdl) 
    197    
     188 
    198189  CALL xios_set_domain_attr("src_domain", ni_glo=src_ni_glo, ibegin=src_ibegin, ni=src_ni, type="unstructured") 
    199190  CALL xios_set_domain_attr("src_domain", lonvalue_1D=src_lon, latvalue_1D=src_lat, & 
     
    216207                            bounds_lon_1D=src_boundslon, bounds_lat_1D=src_boundslat, nvertex=src_nvertex) 
    217208 
     209 
    218210  dtime%second = 3600 
    219    
    220211  CALL xios_set_timestep(dtime) 
    221212 
    222213  CALL xios_close_context_definition() 
    223  
     214  print *, "xios_close_context_definition OK " 
     215   
    224216  CALL xios_get_domain_attr("src_domain_regular_read", ni=src_tmp_ni, nj=src_tmp_nj) 
    225217  ALLOCATE(tmp_field_0(src_tmp_ni*src_tmp_nj)) 
     
    257249    CALL wait_us(5000) ; 
    258250   ENDDO 
    259    
     251 
    260252  CALL xios_context_finalize() 
    261253 
     
    263255  DEALLOCATE(dst_lon, dst_lat, dst_boundslon,dst_boundslat) 
    264256  DEALLOCATE(tmp_field_0, tmp_field_1, tmp_field_2) 
    265    
     257 
    266258  CALL xios_finalize() 
    267259   
     
    277269 
    278270  !$omp end parallel 
    279  
    280  
    281     else 
     271  else 
    282272 
    283273    CALL xios_init_server 
    284     print *, "Server : xios_finalize " 
    285    
    286     endif 
     274    print *, "Server : xios_finalize ", rank 
     275   
     276  endif 
     277 
     278   
    287279 
    288280  CALL MPI_FINALIZE(ierr) 
     
    293285 
    294286 
     287 
Note: See TracChangeset for help on using the changeset viewer.