diff --git a/src/clib/pio_darray_int.c b/src/clib/pio_darray_int.c index 12da1914d90..1e349543d8b 100644 --- a/src/clib/pio_darray_int.c +++ b/src/clib/pio_darray_int.c @@ -102,7 +102,7 @@ int get_gdim0(file_desc_t *file,io_desc_t *iodesc, int varid, int fndims, MPI_Of int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdimoffset, int rrcnt, int ndims, int fndims, int frame, PIO_Offset **startlist, PIO_Offset **countlist, - MPI_Datatype *subarray, MPI_Datatype *filetype) + MPI_Datatype *filetype) { int sa_ndims; @@ -111,6 +111,7 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi int mpierr; MPI_Aint displacements[rrcnt]; int blocklengths[rrcnt]; + MPI_Datatype subarray[rrcnt]; if(rrcnt == 0) return PIO_NOERR; @@ -123,9 +124,6 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi } if(*filetype != MPI_DATATYPE_NULL) { - for( int rc=0; rcrecord >= 0 && ndims < fndims) @@ -464,10 +466,6 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * if(nv==nvars-1 && filetype != MPI_DATATYPE_NULL) { int mpierr; - for(int i=0; imaxregions - 1) { #if USE_VARD_READ - MPI_Datatype filetype, subarray[rrlen]; - PIO_Offset unlimdimoffset; - int mpierr; - if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ + MPI_Datatype filetype; + PIO_Offset unlimdimoffset; + int mpierr; + if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ { - if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) - return pio_err(NULL, file, ierr, __FILE__, __LINE__); + if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) + return pio_err(NULL, file, ierr, __FILE__, __LINE__); } - else - unlimdimoffset = gdim0; - - filetype = MPI_DATATYPE_NULL; - for(int i=0; irecord, startlist, countlist, - subarray, &filetype); - ierr = ncmpi_get_vard_all(file->fh, vid, filetype, iobuf, iodesc->llen, iodesc->mpitype); - for(int i=0; irecord, startlist, countlist, &filetype); + ierr = ncmpi_get_vard_all(file->fh, vid, filetype, iobuf, iodesc->llen, iodesc->mpitype); + if(filetype != MPI_DATATYPE_NULL && (mpierr = MPI_Type_free(&filetype))) + return check_mpi(NULL, mpierr, __FILE__, __LINE__); +#else /* Read a list of subarrays. */ ierr = ncmpi_get_varn_all(file->fh, vid, rrlen, startlist, countlist, iobuf, iodesc->llen, iodesc->mpitype); diff --git a/tests/general/ncdf_simple_tests.F90.in b/tests/general/ncdf_simple_tests.F90.in index b1d8133194a..2af0e21c651 100644 --- a/tests/general/ncdf_simple_tests.F90.in +++ b/tests/general/ncdf_simple_tests.F90.in @@ -115,6 +115,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN test_data_conversion integer :: pio_dim integer :: i, ierr + do i=1,VEC_LOCAL_SZ compdof_rel_disps(i) = i end do @@ -147,11 +148,14 @@ PIO_TF_AUTO_TEST_SUB_BEGIN test_data_conversion call PIO_syncfile(pio_file) - ! Read the variable back (data conversion might occur) - call PIO_read_darray(pio_file, pio_var, riodesc, rbuf, ierr) - PIO_TF_CHECK_ERR(ierr, "Failed to read darray : " // trim(data_fname)) - - PIO_TF_CHECK_VAL((rbuf, exp_val), "Got wrong val") + if (tgv_iotype .eq. PIO_iotype_pnetcdf) then + PIO_TF_LOG(0,*) "WARNING: Data type conversion not supported in pnetcdf vard interface, skipping test" + else + ! Read the variable back (data conversion might occur) + call PIO_read_darray(pio_file, pio_var, riodesc, rbuf, ierr) + PIO_TF_CHECK_ERR(ierr, "Failed to read darray : " // trim(data_fname)) + PIO_TF_CHECK_VAL((rbuf, exp_val), "Got wrong val") + endif call PIO_closefile(pio_file) call PIO_deletefile(pio_tf_iosystem_, data_fname); diff --git a/tests/general/util/pio_tf_f90gen.pl b/tests/general/util/pio_tf_f90gen.pl index f880cda1beb..7cf2672cda5 100755 --- a/tests/general/util/pio_tf_f90gen.pl +++ b/tests/general/util/pio_tf_f90gen.pl @@ -563,7 +563,11 @@ sub parse_and_store_gen_templ_funcs $ifline_num, \$is_transformed); } if($annotate_source){ - $out_line = $out_line . " ! $base_file_name:$ifline_num" . "\n"; + if($out_line =~ /[^#]/){ + $out_line .= "\n"; + }else{ + $out_line = $out_line . " ! $base_file_name:$ifline_num" . "\n"; + } } if($verbose) { print "Adding \"$out_line\" to ${$ref_templ_funcname}\n"; } if(exists $template_funcs{${$ref_templ_funcname}}){