Skip to content

Commit

Permalink
work toward runtime vard switch
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Mar 19, 2018
1 parent c8cff06 commit 70f0c64
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/clib/pio_darray_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *
int ierr = PIO_NOERR;
#if USE_VARD_WRITE
PIO_Offset gdim0; /* global size of first dimension if no unlimited dimension and ndims<fndims */
bool use_vard=true;
gdim0 = 0;
#endif
/* Check inputs. */
Expand Down Expand Up @@ -340,7 +341,11 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *

#if USE_VARD_WRITE
if (!ios->async || !ios->ioproc)
ierr = get_gdim0(file, iodesc, varids[0], fndims, &gdim0);
{
if ((ierr = get_gdim0(file, iodesc, varids[0], fndims, &gdim0)))
return pio_err(NULL, file, ierr, __FILE__, __LINE__);

}
#endif

/* If this is an IO task write the data. */
Expand Down Expand Up @@ -424,14 +429,24 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *
#ifdef USE_VARD_WRITE
MPI_Datatype filetype = MPI_DATATYPE_NULL;
#endif
int fvartype;
/* For each variable to be written. */
for (int nv = 0; nv < nvars; nv++)
{

/* Get the var info. */
if ((ierr = get_var_desc(varids[nv], &file->varlist, &vdesc)))
return pio_err(NULL, file, ierr, __FILE__, __LINE__);

#if USE_VARD_WRITE
/* vard does not support type conversion fail over to varn if var is not the same type as defined in file */
if ((ierr = ncmpi_inq_vartype(file->fh, varids[nv], &fvartype)))
return pio_err(NULL, file, ierr, __FILE__, __LINE__);
if (fvartype != vdesc->pio_type){
LOG((0, "ERROR: pnetcdf vard does not support type conversion varid %d filetype %d piotype %d"
,varids[nv],fvartype, vdesc->pio_type));
}

/* If this is the first variable or the frame has changed between variables (this should be rare) */
if(nv==0 || (nv > 0 && frame != NULL && frame[nv] != frame[nv-1])){
int thisframe;
Expand Down
5 changes: 4 additions & 1 deletion src/flib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU")
target_compile_options (piof
PRIVATE -ffree-line-length-none)
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mismatch_all" )
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -mismatch_all " )
# target_compile_options (piof
# PRIVATE -mismatch_all)
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ef")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -debug minimal")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
endif()

# Look for c_sizeof capability
check_macro (Fortran_CSIZEOF
Expand Down
4 changes: 4 additions & 0 deletions tests/general/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
# PRIVATE -mismatch_all)
endif ()

if (CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
endif()

#==============================================================================
# DEFINE THE TARGETS AND TESTS
#==============================================================================
Expand Down

0 comments on commit 70f0c64

Please sign in to comment.