From 9e5a68214a5e40bb8e43c5ec2a928dc70e8a6017 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 28 Mar 2020 21:53:43 -0500 Subject: Don't track file offset position when using pread / pwrite. --- src/H5FDcore.c | 42 +++++++++++++++++++++++------------------- src/H5FDlog.c | 29 +++++++++++++++++++++++++---- src/H5FDprivate.h | 2 ++ src/H5FDsec2.c | 39 ++++++++++++++++++++++++++++++--------- 4 files changed, 80 insertions(+), 32 deletions(-) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 552b7ca..91338d7 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -82,7 +82,7 @@ typedef struct H5FD_core_t { DWORD nFileIndexLow; DWORD nFileIndexHigh; DWORD dwVolumeSerialNumber; - + HANDLE hFile; /* Native windows file handle */ #endif /* H5_HAVE_WIN32_API */ hbool_t dirty; /* changes not saved? */ @@ -382,7 +382,9 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) int myerrno = errno; time_t mytime = HDtime(NULL); +#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); +#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ @@ -405,7 +407,7 @@ done: * * Purpose: Initializes any interface-specific data or routines. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -757,9 +759,9 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr if((file_image_info.buffer != NULL) && !(H5F_ACC_CREAT & flags)) { if(HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW) >= 0) HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file already exists") - + /* If backing store is requested, create and stat the file - * Note: We are forcing the O_CREAT flag here, even though this is + * Note: We are forcing the O_CREAT flag here, even though this is * technically an open. */ if(fa->backing_store) { @@ -856,14 +858,14 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Read in existing data, being careful of interrupted system calls, * partial results, and the end of the file. */ - + uint8_t *mem = file->mem; /* memory pointer for writes */ HDoff_t offset = (HDoff_t)0; /* offset for reading */ - + while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - + /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. */ @@ -871,7 +873,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr bytes_in = H5_POSIX_MAX_IO_BYTES; else bytes_in = (h5_posix_io_t)size; - + do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, mem, bytes_in, offset); @@ -881,19 +883,21 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr bytes_read = HDread(file->fd, mem, bytes_in); #endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_read && EINTR == errno); - + if(-1 == bytes_read) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); +#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); +#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ - + HDassert(bytes_read >= 0); HDassert((size_t)bytes_read <= size); - + mem += bytes_read; size -= (size_t)bytes_read; } /* end while */ @@ -1467,24 +1471,24 @@ done: * than the end-of-address. * * Addendum -- 12/2/11 - * For file images opened with the core file driver, it is + * For file images opened with the core file driver, it is * necessary that we avoid reallocating the core file driver's * buffer uneccessarily. * * To this end, I have made the following functional changes - * to this function. + * to this function. * - * If we are closing, and there is no backing store, this + * If we are closing, and there is no backing store, this * function becomes a no-op. * * If we are closing, and there is backing store, we set the - * eof to equal the eoa, and truncate the backing store to + * eof to equal the eoa, and truncate the backing store to * the new eof * - * If we are not closing, we realloc the buffer to size equal - * to the smallest multiple of the allocation increment that - * equals or exceeds the eoa and set the eof accordingly. - * Note that we no longer truncate the backing store to the + * If we are not closing, we realloc the buffer to size equal + * to the smallest multiple of the allocation increment that + * equals or exceeds the eoa and set the eof accordingly. + * Note that we no longer truncate the backing store to the * new eof if applicable. * -- JRM * diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 60255e5..c9aa44d 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -78,8 +78,10 @@ typedef struct H5FD_log_t { int fd; /* the unix file */ haddr_t eoa; /* end of allocated region */ haddr_t eof; /* end of file; current file size */ +#ifndef H5_HAVE_PREADWRITE haddr_t pos; /* current file I/O position */ H5FD_file_op_t op; /* last operation */ +#endif /* H5_HAVE_PREADWRITE */ char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef H5_HAVE_WIN32_API /* On most systems the combination of device and i-node number uniquely @@ -108,7 +110,7 @@ typedef struct H5FD_log_t { DWORD nFileIndexLow; DWORD nFileIndexHigh; DWORD dwVolumeSerialNumber; - + HANDLE hFile; /* Native windows file handle */ #endif /* H5_HAVE_WIN32_API */ @@ -578,8 +580,10 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->fd = fd; H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t); +#ifndef H5_HAVE_PREADWRITE file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(fd); if(INVALID_HANDLE_VALUE == file->hFile) @@ -1255,7 +1259,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ - h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ + h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1279,7 +1283,9 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd int myerrno = errno; time_t mytime = HDtime(NULL); +#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); +#endif /* H5_HAVE_PREADWRITE */ if(file->fa.flags & H5FD_LOG_LOC_READ) HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); @@ -1295,7 +1301,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd HDassert(bytes_read >= 0); HDassert((size_t)bytes_read <= size); - + size -= (size_t)bytes_read; addr += (haddr_t)bytes_read; buf = (char *)buf + bytes_read; @@ -1344,15 +1350,19 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ +#ifndef H5_HAVE_PREADWRITE /* Update current position */ file->pos = addr; file->op = OP_READ; +#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { +#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1472,7 +1482,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to write */ - h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1496,7 +1506,9 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had int myerrno = errno; time_t mytime = HDtime(NULL); +#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); +#endif /* H5_HAVE_PREADWRITE */ if(file->fa.flags & H5FD_LOG_LOC_WRITE) HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); @@ -1555,17 +1567,24 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ +#ifndef H5_HAVE_PREADWRITE /* Update current position and eof */ file->pos = addr; file->op = OP_WRITE; if(file->pos > file->eof) file->eof = file->pos; +#else /* H5_HAVE_PREADWRITE */ + if(addr > file->eof) + file->eof = addr; +#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { +#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1674,9 +1693,11 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U /* Update the eof value */ file->eof = file->eoa; +#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ } /* end if */ done: diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 2e3d3ce..0f014bf 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -59,12 +59,14 @@ typedef struct H5FD_class_mpi_t { /* Library Private Typedefs */ /****************************/ +#ifndef H5_HAVE_PREADWRITE /* File operations */ typedef enum { OP_UNKNOWN = 0, /* Unknown last file operation */ OP_READ = 1, /* Last file I/O operation was a read */ OP_WRITE = 2 /* Last file I/O operation was a write */ } H5FD_file_op_t; +#endif /* H5_HAVE_PREADWRITE */ /* Define structure to hold initial file image and other relevant information */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index a393490..98021ca 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -55,8 +55,10 @@ typedef struct H5FD_sec2_t { int fd; /* the filesystem file descriptor */ haddr_t eoa; /* end of allocated region */ haddr_t eof; /* end of file; current file size */ +#ifndef H5_HAVE_PREADWRITE haddr_t pos; /* current file I/O position */ H5FD_file_op_t op; /* last operation */ +#endif /* H5_HAVE_PREADWRITE */ char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef H5_HAVE_WIN32_API /* On most systems the combination of device and i-node number uniquely @@ -85,7 +87,7 @@ typedef struct H5FD_sec2_t { DWORD nFileIndexLow; DWORD nFileIndexHigh; DWORD dwVolumeSerialNumber; - + HANDLE hFile; /* Native windows file handle */ #endif /* H5_HAVE_WIN32_API */ @@ -355,8 +357,10 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->fd = fd; H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t); +#ifndef H5_HAVE_PREADWRITE file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(fd); if(INVALID_HANDLE_VALUE == file->hFile) @@ -599,7 +603,7 @@ H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * either the filesystem end-of-file or the HDF5 end-of-address * markers. * - * Return: End of file address, the first address past the end of the + * Return: End of file address, the first address past the end of the * "file", either the filesystem file or the HDF5 file. * * Programmer: Robb Matzke @@ -716,39 +720,45 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS bytes_read = HDread(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_read && EINTR == errno); - + if(-1 == bytes_read) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); +#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); +#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ - + if(0 == bytes_read) { /* end of file but not end of format address space */ HDmemset(buf, 0, size); break; } /* end if */ - + HDassert(bytes_read >= 0); HDassert((size_t)bytes_read <= size); - + size -= (size_t)bytes_read; addr += (haddr_t)bytes_read; buf = (char *)buf + bytes_read; } /* end while */ +#ifndef H5_HAVE_PREADWRITE /* Update current position */ file->pos = addr; file->op = OP_READ; +#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { +#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -802,7 +812,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to write */ - h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -821,16 +831,18 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU bytes_wrote = HDwrite(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ } while(-1 == bytes_wrote && EINTR == errno); - + if(-1 == bytes_wrote) { /* error */ int myerrno = errno; time_t mytime = HDtime(NULL); +#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); +#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ - + HDassert(bytes_wrote > 0); HDassert((size_t)bytes_wrote <= size); @@ -839,17 +851,24 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU buf = (const char *)buf + bytes_wrote; } /* end while */ +#ifndef H5_HAVE_PREADWRITE /* Update current position and eof */ file->pos = addr; file->op = OP_WRITE; if(file->pos > file->eof) file->eof = file->pos; +#else /* H5_HAVE_PREADWRITE */ + if(addr > file->eof) + file->eof = addr; +#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { +#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -915,9 +934,11 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ /* Update the eof value */ file->eof = file->eoa; +#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; +#endif /* H5_HAVE_PREADWRITE */ } /* end if */ done: -- cgit v0.12 From fa7f8ad2f3fe509ff69dc574ddad0ae4d329ccca Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 30 Jul 2020 17:21:24 -0500 Subject: Improve code readability: extract common subexpressions into temporary variables. --- src/H5Dvirtual.c | 202 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 106 insertions(+), 96 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e07f538..bf6104d 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -313,6 +313,8 @@ done: herr_t H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) { + H5O_storage_virtual_t *virt = &layout->storage.u.virt; + H5O_storage_virtual_ent_t *ent = &virt->list[idx]; H5S_sel_type sel_type; int rank; hsize_t bounds_start[H5S_MAX_RANK]; @@ -324,10 +326,10 @@ H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) HDassert(layout); HDassert(layout->type == H5D_VIRTUAL); - HDassert(idx < layout->storage.u.virt.list_nalloc); + HDassert(idx < virt->list_nalloc); /* Get type of selection */ - if(H5S_SEL_ERROR == (sel_type = H5S_GET_SELECT_TYPE(layout->storage.u.virt.list[idx].source_dset.virtual_select))) + if(H5S_SEL_ERROR == (sel_type = H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection type") /* Do not update min_dims for "all" or "none" selections */ @@ -335,19 +337,19 @@ H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) HGOTO_DONE(SUCCEED) /* Get rank of vspace */ - if((rank = H5S_GET_EXTENT_NDIMS(layout->storage.u.virt.list[idx].source_dset.virtual_select)) < 0) + if((rank = H5S_GET_EXTENT_NDIMS(ent->source_dset.virtual_select)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions") /* Get selection bounds */ - if(H5S_SELECT_BOUNDS(layout->storage.u.virt.list[idx].source_dset.virtual_select, bounds_start, bounds_end) < 0) + if(H5S_SELECT_BOUNDS(ent->source_dset.virtual_select, bounds_start, bounds_end) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds") /* Update min_dims */ for(i = 0; i < rank; i++) /* Don't check unlimited dimensions in the selection */ - if((i != layout->storage.u.virt.list[idx].unlim_dim_virtual) - && (bounds_end[i] >= layout->storage.u.virt.min_dims[i])) - layout->storage.u.virt.min_dims[i] = bounds_end[i] + (hsize_t)1; + if((i != ent->unlim_dim_virtual) + && (bounds_end[i] >= virt->min_dims[i])) + virt->min_dims[i] = bounds_end[i] + (hsize_t)1; done: FUNC_LEAVE_NOAPI(ret_value) @@ -419,6 +421,7 @@ done: herr_t H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) { + H5O_storage_virtual_t *virt = &layout->storage.u.virt; uint8_t *heap_block = NULL; /* Block to add to heap */ size_t *str_size = NULL; /* Array for VDS entry string lengths */ uint8_t *heap_block_p; /* Pointer into the heap block, while encoding */ @@ -433,16 +436,16 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Sanity checking */ HDassert(f); HDassert(layout); - HDassert(layout->storage.u.virt.serial_list_hobjid.addr == HADDR_UNDEF); + HDassert(virt->serial_list_hobjid.addr == HADDR_UNDEF); /* Create block if # of used entries > 0 */ - if(layout->storage.u.virt.list_nused > 0) { + if(virt->list_nused > 0) { /* Set the low/high bounds according to 'f' for the API context */ H5CX_set_libver_bounds(f); /* Allocate array for caching results of strlen */ - if(NULL == (str_size = (size_t *)H5MM_malloc(2 * layout->storage.u.virt.list_nused * sizeof(size_t)))) + if(NULL == (str_size = (size_t *)H5MM_malloc(2 * virt->list_nused * sizeof(size_t)))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array") /* @@ -453,29 +456,30 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) block_size = (size_t)1 + H5F_SIZEOF_SIZE(f); /* Calculate size of each entry */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; hssize_t select_serial_size; /* Size of serialized selection */ - HDassert(layout->storage.u.virt.list[i].source_file_name); - HDassert(layout->storage.u.virt.list[i].source_dset_name); - HDassert(layout->storage.u.virt.list[i].source_select); - HDassert(layout->storage.u.virt.list[i].source_dset.virtual_select); + HDassert(ent->source_file_name); + HDassert(ent->source_dset_name); + HDassert(ent->source_select); + HDassert(ent->source_dset.virtual_select); /* Source file name */ - str_size[2 * i] = HDstrlen(layout->storage.u.virt.list[i].source_file_name) + (size_t)1; + str_size[2 * i] = HDstrlen(ent->source_file_name) + (size_t)1; block_size += str_size[2 * i]; /* Source dset name */ - str_size[(2 * i) + 1] = HDstrlen(layout->storage.u.virt.list[i].source_dset_name) + (size_t)1; + str_size[(2 * i) + 1] = HDstrlen(ent->source_dset_name) + (size_t)1; block_size += str_size[(2 * i) + 1]; /* Source selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; /* Virtual dataset selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_dset.virtual_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; } /* end for */ @@ -498,25 +502,26 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) *heap_block_p++ = (uint8_t)H5O_LAYOUT_VDS_GH_ENC_VERS; /* Number of entries */ - tmp_nentries = (hsize_t)layout->storage.u.virt.list_nused; + tmp_nentries = (hsize_t)virt->list_nused; H5F_ENCODE_LENGTH(f, heap_block_p, tmp_nentries) /* Encode each entry */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; /* Source file name */ - H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]); + H5MM_memcpy((char *)heap_block_p, ent->source_file_name, str_size[2 * i]); heap_block_p += str_size[2 * i]; /* Source dataset name */ - H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]); + H5MM_memcpy((char *)heap_block_p, ent->source_dset_name, str_size[(2 * i) + 1]); heap_block_p += str_size[(2 * i) + 1]; /* Source selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(ent->source_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection") /* Virtual selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(ent->source_dset.virtual_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection") } /* end for */ @@ -525,7 +530,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) UINT32ENCODE(heap_block_p, chksum) /* Insert block into global heap */ - if(H5HG_insert(f, block_size, heap_block, &(layout->storage.u.virt.serial_list_hobjid)) < 0) /* Casting away const OK --NAF */ + if(H5HG_insert(f, block_size, heap_block, &(virt->serial_list_hobjid)) < 0) /* Casting away const OK --NAF */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block") } /* end if */ @@ -556,6 +561,7 @@ herr_t H5D__virtual_copy_layout(H5O_layout_t *layout) { H5O_storage_virtual_ent_t *orig_list = NULL; + H5O_storage_virtual_t *virt = &layout->storage.u.virt; hid_t orig_source_fapl; hid_t orig_source_dapl; H5P_genplist_t *plist; @@ -569,127 +575,129 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Save original entry list and top-level property lists and reset in layout * so the originals aren't closed on error */ - orig_source_fapl = layout->storage.u.virt.source_fapl; - layout->storage.u.virt.source_fapl = -1; - orig_source_dapl = layout->storage.u.virt.source_dapl; - layout->storage.u.virt.source_dapl = -1; - orig_list = layout->storage.u.virt.list; - layout->storage.u.virt.list = NULL; + orig_source_fapl = virt->source_fapl; + virt->source_fapl = -1; + orig_source_dapl = virt->source_dapl; + virt->source_dapl = -1; + orig_list = virt->list; + virt->list = NULL; /* Copy entry list */ - if(layout->storage.u.virt.list_nused > 0) { + if(virt->list_nused > 0) { HDassert(orig_list); /* Allocate memory for the list */ - if(NULL == (layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc(layout->storage.u.virt.list_nused * sizeof(H5O_storage_virtual_ent_t)))) + if(NULL == (virt->list = H5MM_calloc(virt->list_nused * sizeof(virt->list[0])))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate memory for virtual dataset entry list") - layout->storage.u.virt.list_nalloc = layout->storage.u.virt.list_nused; + virt->list_nalloc = virt->list_nused; /* Copy the list entries, though set source_dset.dset and sub_dset to * NULL */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; + /* Copy virtual selection */ - if(NULL == (layout->storage.u.virt.list[i].source_dset.virtual_select + if(NULL == (ent->source_dset.virtual_select = H5S_copy(orig_list[i].source_dset.virtual_select, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") /* Copy original source names */ - if(NULL == (layout->storage.u.virt.list[i].source_file_name + if(NULL == (ent->source_file_name = H5MM_strdup(orig_list[i].source_file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") - if(NULL == (layout->storage.u.virt.list[i].source_dset_name + if(NULL == (ent->source_dset_name = H5MM_strdup(orig_list[i].source_dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") /* Copy source selection */ - if(NULL == (layout->storage.u.virt.list[i].source_select + if(NULL == (ent->source_select = H5S_copy(orig_list[i].source_select, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection") /* Initialize clipped selections */ if(orig_list[i].unlim_dim_virtual < 0) { - layout->storage.u.virt.list[i].source_dset.clipped_source_select = layout->storage.u.virt.list[i].source_select; - layout->storage.u.virt.list[i].source_dset.clipped_virtual_select = layout->storage.u.virt.list[i].source_dset.virtual_select; + ent->source_dset.clipped_source_select = ent->source_select; + ent->source_dset.clipped_virtual_select = ent->source_dset.virtual_select; } /* end if */ /* Copy parsed names */ - if(H5D__virtual_copy_parsed_name(&layout->storage.u.virt.list[i].parsed_source_file_name, orig_list[i].parsed_source_file_name) < 0) + if(H5D__virtual_copy_parsed_name(&ent->parsed_source_file_name, orig_list[i].parsed_source_file_name) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source file name") - layout->storage.u.virt.list[i].psfn_static_strlen = orig_list[i].psfn_static_strlen; - layout->storage.u.virt.list[i].psfn_nsubs = orig_list[i].psfn_nsubs; - if(H5D__virtual_copy_parsed_name(&layout->storage.u.virt.list[i].parsed_source_dset_name, orig_list[i].parsed_source_dset_name) < 0) + ent->psfn_static_strlen = orig_list[i].psfn_static_strlen; + ent->psfn_nsubs = orig_list[i].psfn_nsubs; + if(H5D__virtual_copy_parsed_name(&ent->parsed_source_dset_name, orig_list[i].parsed_source_dset_name) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source dataset name") - layout->storage.u.virt.list[i].psdn_static_strlen = orig_list[i].psdn_static_strlen; - layout->storage.u.virt.list[i].psdn_nsubs = orig_list[i].psdn_nsubs; + ent->psdn_static_strlen = orig_list[i].psdn_static_strlen; + ent->psdn_nsubs = orig_list[i].psdn_nsubs; /* Copy source names in source dset or add reference as appropriate */ if(orig_list[i].source_dset.file_name) { if(orig_list[i].source_dset.file_name == orig_list[i].source_file_name) - layout->storage.u.virt.list[i].source_dset.file_name = layout->storage.u.virt.list[i].source_file_name; + ent->source_dset.file_name = ent->source_file_name; else if(orig_list[i].parsed_source_file_name && (orig_list[i].source_dset.file_name != orig_list[i].parsed_source_file_name->name_segment)) { - HDassert(layout->storage.u.virt.list[i].parsed_source_file_name); - HDassert(layout->storage.u.virt.list[i].parsed_source_file_name->name_segment); - layout->storage.u.virt.list[i].source_dset.file_name = layout->storage.u.virt.list[i].parsed_source_file_name->name_segment; + HDassert(ent->parsed_source_file_name); + HDassert(ent->parsed_source_file_name->name_segment); + ent->source_dset.file_name = ent->parsed_source_file_name->name_segment; } /* end if */ else - if(NULL == (layout->storage.u.virt.list[i].source_dset.file_name + if(NULL == (ent->source_dset.file_name = H5MM_strdup(orig_list[i].source_dset.file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") } /* end if */ if(orig_list[i].source_dset.dset_name) { if(orig_list[i].source_dset.dset_name == orig_list[i].source_dset_name) - layout->storage.u.virt.list[i].source_dset.dset_name = layout->storage.u.virt.list[i].source_dset_name; + ent->source_dset.dset_name = ent->source_dset_name; else if(orig_list[i].parsed_source_dset_name && (orig_list[i].source_dset.dset_name != orig_list[i].parsed_source_dset_name->name_segment)) { - HDassert(layout->storage.u.virt.list[i].parsed_source_dset_name); - HDassert(layout->storage.u.virt.list[i].parsed_source_dset_name->name_segment); - layout->storage.u.virt.list[i].source_dset.dset_name = layout->storage.u.virt.list[i].parsed_source_dset_name->name_segment; + HDassert(ent->parsed_source_dset_name); + HDassert(ent->parsed_source_dset_name->name_segment); + ent->source_dset.dset_name = ent->parsed_source_dset_name->name_segment; } /* end if */ else - if(NULL == (layout->storage.u.virt.list[i].source_dset.dset_name + if(NULL == (ent->source_dset.dset_name = H5MM_strdup(orig_list[i].source_dset.dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") } /* end if */ /* Copy other fields in entry */ - layout->storage.u.virt.list[i].unlim_dim_source = orig_list[i].unlim_dim_source; - layout->storage.u.virt.list[i].unlim_dim_virtual = orig_list[i].unlim_dim_virtual; - layout->storage.u.virt.list[i].unlim_extent_source = orig_list[i].unlim_extent_source; - layout->storage.u.virt.list[i].unlim_extent_virtual = orig_list[i].unlim_extent_virtual; - layout->storage.u.virt.list[i].clip_size_source = orig_list[i].clip_size_source; - layout->storage.u.virt.list[i].clip_size_virtual = orig_list[i].clip_size_virtual; - layout->storage.u.virt.list[i].source_space_status = orig_list[i].source_space_status; - layout->storage.u.virt.list[i].virtual_space_status = orig_list[i].virtual_space_status; + ent->unlim_dim_source = orig_list[i].unlim_dim_source; + ent->unlim_dim_virtual = orig_list[i].unlim_dim_virtual; + ent->unlim_extent_source = orig_list[i].unlim_extent_source; + ent->unlim_extent_virtual = orig_list[i].unlim_extent_virtual; + ent->clip_size_source = orig_list[i].clip_size_source; + ent->clip_size_virtual = orig_list[i].clip_size_virtual; + ent->source_space_status = orig_list[i].source_space_status; + ent->virtual_space_status = orig_list[i].virtual_space_status; } /* end for */ } /* end if */ else { /* Zero out other fields related to list, just to be sure */ - layout->storage.u.virt.list = NULL; - layout->storage.u.virt.list_nalloc = 0; + virt->list = NULL; + virt->list_nalloc = 0; } /* end else */ /* Copy property lists */ if(orig_source_fapl >= 0) { if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_fapl, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - if((layout->storage.u.virt.source_fapl = H5P_copy_plist(plist, FALSE)) < 0) + if((virt->source_fapl = H5P_copy_plist(plist, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy fapl") } /* end if */ if(orig_source_dapl >= 0) { if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_dapl, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - if((layout->storage.u.virt.source_dapl = H5P_copy_plist(plist, FALSE)) < 0) + if((virt->source_dapl = H5P_copy_plist(plist, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl") } /* end if */ /* New layout is not fully initialized */ - layout->storage.u.virt.init = FALSE; + virt->init = FALSE; done: /* Release allocated resources on failure */ @@ -721,6 +729,7 @@ herr_t H5D__virtual_reset_layout(H5O_layout_t *layout) { size_t i, j; + H5O_storage_virtual_t *virt = &layout->storage.u.virt; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE @@ -731,53 +740,54 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) /* Free the list entries. Note we always attempt to free everything even in * the case of a failure. Because of this, and because we free the list * afterwards, we do not need to zero out the memory in the list. */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; /* Free source_dset */ - if(H5D__virtual_reset_source_dset(&layout->storage.u.virt.list[i], &layout->storage.u.virt.list[i].source_dset) < 0) + if(H5D__virtual_reset_source_dset(ent, &ent->source_dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset") /* Free original source names */ - (void)H5MM_xfree(layout->storage.u.virt.list[i].source_file_name); - (void)H5MM_xfree(layout->storage.u.virt.list[i].source_dset_name); + (void)H5MM_xfree(ent->source_file_name); + (void)H5MM_xfree(ent->source_dset_name); /* Free sub_dset */ - for(j = 0; j < layout->storage.u.virt.list[i].sub_dset_nalloc; j++) - if(H5D__virtual_reset_source_dset(&layout->storage.u.virt.list[i], &layout->storage.u.virt.list[i].sub_dset[j]) < 0) + for(j = 0; j < ent->sub_dset_nalloc; j++) + if(H5D__virtual_reset_source_dset(ent, &ent->sub_dset[j]) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset") - layout->storage.u.virt.list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_xfree(layout->storage.u.virt.list[i].sub_dset); + ent->sub_dset = H5MM_xfree(ent->sub_dset); /* Free source_select */ - if(layout->storage.u.virt.list[i].source_select) - if(H5S_close(layout->storage.u.virt.list[i].source_select) < 0) + if(ent->source_select) + if(H5S_close(ent->source_select) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") /* Free parsed_source_file_name */ - H5D_virtual_free_parsed_name(layout->storage.u.virt.list[i].parsed_source_file_name); + H5D_virtual_free_parsed_name(ent->parsed_source_file_name); /* Free parsed_source_dset_name */ - H5D_virtual_free_parsed_name(layout->storage.u.virt.list[i].parsed_source_dset_name); - } /* end for */ + H5D_virtual_free_parsed_name(ent->parsed_source_dset_name); + } /* Free the list */ - layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_xfree(layout->storage.u.virt.list); - layout->storage.u.virt.list_nalloc = (size_t)0; - layout->storage.u.virt.list_nused = (size_t)0; - (void)HDmemset(layout->storage.u.virt.min_dims, 0, sizeof(layout->storage.u.virt.min_dims)); + virt->list = H5MM_xfree(virt->list); + virt->list_nalloc = (size_t)0; + virt->list_nused = (size_t)0; + (void)HDmemset(virt->min_dims, 0, sizeof(virt->min_dims)); /* Close access property lists */ - if(layout->storage.u.virt.source_fapl >= 0) { - if(H5I_dec_ref(layout->storage.u.virt.source_fapl) < 0) + if(virt->source_fapl >= 0) { + if(H5I_dec_ref(virt->source_fapl) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source fapl") - layout->storage.u.virt.source_fapl = -1; - } /* end if */ - if(layout->storage.u.virt.source_dapl >= 0) { - if(H5I_dec_ref(layout->storage.u.virt.source_dapl) < 0) + virt->source_fapl = -1; + } + if(virt->source_dapl >= 0) { + if(H5I_dec_ref(virt->source_dapl) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source dapl") - layout->storage.u.virt.source_dapl = -1; - } /* end if */ + virt->source_dapl = -1; + } /* The list is no longer initialized */ - layout->storage.u.virt.init = FALSE; + virt->init = FALSE; /* Note the lack of a done: label. This is because there are no HGOTO_ERROR * calls. If one is added, a done: label must also be added */ -- cgit v0.12 From 7b48e3409a8c3ba1e83c929656e84196a6dc2e6d Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 7 Jul 2020 12:52:00 -0500 Subject: Fix a bug in H5D__virtual_write_one to stop an assertion from failing deep in H5Dwrite---project the *clipped* virtual selection instead of the virtual selection: assertion "((src_space)->select.num_elem) == ((dst_space)->select.num_elem)" failed: file "../../../vchoi_fork/src/H5Sselect.c", line 2617, function "H5S_select_project_intersection" with this backtrace: at /home/dyoung/plain-nbsd/src/lib/libc/gen/raise.c:48 at /home/dyoung/plain-nbsd/src/lib/libc/stdlib/abort.c:74 file=0xae9e3e80 "../../../vchoi_fork/src/H5Sselect.c", line=2617, function=0xae9e4ca0 <__func__.15686> "H5S_select_project_intersection", failedexpr=0xae9e0e54 "((src_space)->select.num_elem) == ((dst_space)->select.num_elem)") at /home/dyoung/plain-nbsd/src/lib/libc/gen/assert.c:72 dst_space=0xae26f0dc, src_intersect_space=0xae0b577c, new_space_ptr=0xbfb85fac, share_selection=true) at ../../../vchoi_fork/src/H5Sselect.c:2749 type_info=type_info@entry=0xbfb86084, file_space=file_space@entry=0xae0b577c, source_dset=0xae24741c, io_info=) at ../../../vchoi_fork/src/H5Dvirtual.c:2784 type_info=0xbfb86084, nelmts=256, file_space=0xae0b577c, mem_space=0xae26ec8c, fm=0xadf0401c) at ../../../vchoi_fork/src/H5Dvirtual.c:2873 mem_type_id=216172782113783837, mem_space=0xae26ec8c, file_space=0xae0b577c, buf=0xae203808) at ../../../vchoi_fork/src/H5Dio.c:780 mem_type_id=216172782113783837, mem_space_id=288230376151711754, file_space_id=288230376151711755, dxpl_id=792633534417207304, buf=0xae203808, req=0x0) at ../../../vchoi_fork/src/H5VLnative_dataset.c:206 mem_type_id=216172782113783837, mem_space_id=288230376151711754, file_space_id=288230376151711755, dxpl_id=792633534417207304, buf=0xae203808, req=0x0, cls=) at ../../../vchoi_fork/src/H5VLcallback.c:2152 mem_type_id=216172782113783837, mem_space_id=288230376151711754, file_space_id=288230376151711755, dxpl_id=792633534417207304, buf=0xae203808, req=0x0) at ../../../vchoi_fork/src/H5VLcallback.c:2186 mem_type_id=216172782113783837, mem_space_id=288230376151711754, file_space_id=288230376151711755, dxpl_id=792633534417207304, buf=0xae203808) at ../../../vchoi_fork/src/H5Dio.c:313 --- src/H5Dvirtual.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e07f538..8519ec8 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2781,7 +2781,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, * extent in the unlimited dimension. -NAF */ /* Project intersection of file space and mapping virtual space onto * mapping source space */ - if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0) + if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space") /* Perform write on source dataset */ -- cgit v0.12 From 32a1188bbd648e981615a388a8ca011df76fa1e0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 17 Aug 2020 10:54:07 -0700 Subject: Adds fix for H5Fstart_swmr_write lock issue --- src/H5Fint.c | 19 +++++++++++++++---- src/H5Fpkg.h | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 46508fe..a29d20b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1872,6 +1872,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) set_flag = TRUE; } /* end else */ + /* Set the file locking flag */ + file->use_file_locking = use_file_locking; + /* Check to see if both SWMR and cache image are requested. Fail if so */ if(H5C_cache_image_status(file, &ci_load, &ci_write) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status") @@ -3571,6 +3574,7 @@ H5F__start_swmr_write(H5F_t *f) size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ H5VL_t *vol_connector = NULL; /* VOL connector for the file */ + hbool_t use_file_locking = TRUE;/* Using file locks? */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3695,6 +3699,12 @@ H5F__start_swmr_write(H5F_t *f) setup = TRUE; + /* Place an advisory lock on the file */ + if(f->use_file_locking) + if(H5FD_lock(f->shared->lf, TRUE) < 0) { + HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file") + } + /* Mark superblock as dirty */ if(H5F_super_dirty(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") @@ -3712,10 +3722,6 @@ H5F__start_swmr_write(H5F_t *f) if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") - /* Unlock the file */ - if(H5FD_unlock(f->shared->lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to unlock the file") - done: if(ret_value < 0 && setup) { @@ -3744,6 +3750,11 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock") } /* end if */ + /* Unlock the file */ + if(f->use_file_locking) + if(H5FD_unlock(f->shared->lf) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file") + /* Free memory */ if(obj_ids) H5MM_xfree(obj_ids); diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index ff44536..294687c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -382,6 +382,7 @@ struct H5F_t { hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ + hbool_t use_file_locking; /* Whether or not to use file locking */ }; -- cgit v0.12 From f02ced7e7443563581930a6c2d58d1628608bbdd Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 17 Aug 2020 14:25:04 -0700 Subject: Moves lock flag to H5F_shared_t and adds test. --- src/H5Fint.c | 17 +++++++---- src/H5Fpkg.h | 2 +- src/H5Fprivate.h | 3 ++ src/H5Fquery.c | 21 +++++++++++++ test/swmr.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 5 files changed, 118 insertions(+), 15 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index a29d20b..7e3876f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1872,9 +1872,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) set_flag = TRUE; } /* end else */ - /* Set the file locking flag */ - file->use_file_locking = use_file_locking; - /* Check to see if both SWMR and cache image are requested. Fail if so */ if(H5C_cache_image_status(file, &ci_load, &ci_write) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status") @@ -1888,6 +1885,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) shared = file->shared; lf = shared->lf; + /* Set the file locking flag. If the file is already open, the file + * requested file locking flag must match that of the open file. + */ + if(shared->nrefs == 1) + file->shared->use_file_locking = use_file_locking; + else if(shared->nrefs > 1) + if(file->shared->use_file_locking != use_file_locking) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match") + /* Check if page buffering is enabled */ if(H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get page buffer size") @@ -3574,7 +3580,6 @@ H5F__start_swmr_write(H5F_t *f) size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ H5VL_t *vol_connector = NULL; /* VOL connector for the file */ - hbool_t use_file_locking = TRUE;/* Using file locks? */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3700,7 +3705,7 @@ H5F__start_swmr_write(H5F_t *f) setup = TRUE; /* Place an advisory lock on the file */ - if(f->use_file_locking) + if(H5F_USE_FILE_LOCKING(f)) if(H5FD_lock(f->shared->lf, TRUE) < 0) { HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file") } @@ -3751,7 +3756,7 @@ done: } /* end if */ /* Unlock the file */ - if(f->use_file_locking) + if(H5F_USE_FILE_LOCKING(f)) if(H5FD_unlock(f->shared->lf) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file") diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 294687c..30306d8 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -306,6 +306,7 @@ struct H5F_shared_t { struct H5G_t *root_grp; /* Open root group */ H5FO_t *open_objs; /* Open objects in file */ H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + hbool_t use_file_locking; /* Whether or not to use file locking */ hbool_t closing; /* File is in the process of being closed */ /* Cached VOL connector ID & info */ @@ -382,7 +383,6 @@ struct H5F_t { hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ - hbool_t use_file_locking; /* Whether or not to use file locking */ }; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 384a781..552855b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -338,6 +338,7 @@ typedef struct H5F_t H5F_t; #define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V)) #define H5F_VOL_CLS(F) ((F)->shared->vol_cls) #define H5F_VOL_OBJ(F) ((F)->vol_obj) +#define H5F_USE_FILE_LOCKING(F) ((F)->shared->use_file_locking) #else /* H5F_MODULE */ #define H5F_LOW_BOUND(F) (H5F_get_low_bound(F)) #define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F)) @@ -400,6 +401,7 @@ typedef struct H5F_t H5F_t; #define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V))) #define H5F_VOL_CLS(F) (H5F_get_vol_cls(F)) #define H5F_VOL_OBJ(F) (H5F_get_vol_obj(F)) +#define H5F_USE_FILE_LOCKING(F) (H5F_get_use_file_locking(F)) #endif /* H5F_MODULE */ @@ -765,6 +767,7 @@ H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f); H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize); H5_DLL const H5VL_class_t *H5F_get_vol_cls(const H5F_t *f); H5_DLL H5VL_object_t *H5F_get_vol_obj(const H5F_t *f); +H5_DLL hbool_t H5F_get_file_locking(const H5F_t *f); /* Functions than retrieve values set/cached from the superblock/FCPL */ H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 565f492..51f2194 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1363,3 +1363,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_cont_info */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_locking + * + * Purpose: Get the file locking flag for the file + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_get_file_locking(const H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->use_file_locking) +} /* end H5F_get_file_locking */ + diff --git a/test/swmr.c b/test/swmr.c index a839a74..67fb41b 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6057,16 +6057,13 @@ error: } /* end test_file_lock_swmr_concur() */ - - #endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */ /**************************************************************** ** -** test_file_lock_swmr_concur(): low-level file test routine. -** With the implementation of file locking, this test checks file -** open with different combinations of flags + SWMR flags. -** This is for concurrent access. +** test_file_locking(): +** Tests various combinations of file locking flags and +** and environment variables. ** *****************************************************************/ static int @@ -6244,6 +6241,79 @@ error: } /* end test_file_locking() */ +/**************************************************************** +** +** test_different_lock_flags(): +** Tests opening a file multiple times with different lock +** flags. +** +*****************************************************************/ +static int +test_different_lock_flags(hid_t in_fapl) +{ + hid_t fid1 = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid3 = H5I_INVALID_HID; /* File ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ + char filename[NAME_BUF_SIZE]; /* File name */ + + TESTING("Using different lock flags") + + /* Copy the incoming fapl */ + if((fapl_id = H5Pcopy(in_fapl)) < 0) + TEST_ERROR + + /* Set locking in the fapl */ + if(H5Pset_file_locking(fapl_id, TRUE, TRUE) < 0) + TEST_ERROR + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)); + + /* Create the test file */ + if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR + + /* Open the test file with the same flags (should pass) */ + if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR + + /* Unset locking in the fapl */ + if(H5Pset_file_locking(fapl_id, FALSE, FALSE) < 0) + TEST_ERROR + + /* Open the test file with different flags (should FAIL) */ + H5E_BEGIN_TRY { + fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + } H5E_END_TRY; + if(H5I_INVALID_HID != fid3) + FAIL_PUTS_ERROR("Should not have been able to open a file with different locking flags") + + /* Close the files */ + if(H5Fclose(fid1) < 0) + TEST_ERROR + if(H5Fclose(fid2) < 0) + TEST_ERROR + + /* Close the copied property list */ + if(H5Pclose(fapl_id) < 0) + TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + H5Fclose(fid1); + H5Fclose(fid2); + H5Fclose(fid3); + } H5E_END_TRY; + + return -1; +} /* end test_different_lock_flags() */ + static int test_swmr_vfd_flag(void) { @@ -7181,8 +7251,12 @@ main(void) if(NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2")) nerrors += test_swmr_vfd_flag(); - /* This test changes the HDF5_USE_FILE_LOCKING environment variable - * so it should be run last. + /* Test multiple opens via different locking flags */ + if (use_file_locking && file_locking_enabled) + nerrors += test_different_lock_flags(fapl); + + /* These tests change the HDF5_USE_FILE_LOCKING environment variable + * so they should be run last. */ if (use_file_locking && file_locking_enabled) { nerrors += test_file_locking(fapl, TRUE, TRUE); -- cgit v0.12 From 5bb893a2c2bcba6e8bebc99ee1a506599111b716 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 17 Aug 2020 17:51:15 -0500 Subject: Fix HDFFV-11101 Description Added initialization to local structs in the src function H5MF_settle_raw_data_fsm() and the test function test_bt2_hdr_fd() to prevent the following error in two different occurrences: MemorySanitizer: use-of-uninitialized-value Platforms tested: Linux/64 (jelly) Linux/64 (platypus) --- src/H5MF.c | 4 ++++ test/dsets.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/H5MF.c b/src/H5MF.c index aa65db2..5e61751 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -2645,6 +2645,10 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) HDassert(f->shared); HDassert(fsm_settled); + /* Initialize structs */ + HDmemset(&fsinfo, 0, sizeof(fsinfo)); + HDmemset(&fs_stat, 0, sizeof(fs_stat)); + /* * Only need to settle things if we are persisting free space and * the private property in f->shared->null_fsm_addr is not enabled. diff --git a/test/dsets.c b/test/dsets.c index d5c11be..ae917cc 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -11334,6 +11334,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly"); + /* Initialize struct */ + HDmemset(&info, 0, sizeof(info)); + /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ -- cgit v0.12 From ad9a2ceabe2dd9045111f8b57774948a124607b9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 17 Aug 2020 18:29:55 -0500 Subject: Only initialize the contiguous or compact I/O info struct when needed. --- src/H5Dchunk.c | 54 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 8962348..bdfa3f3 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2651,6 +2651,8 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ H5D_io_info_t cpt_io_info; /* Compact I/O info object */ H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */ + hbool_t ctg_init = FALSE; /* Whether the contiguous I/O info is initialized */ + hbool_t cpt_init = FALSE; /* Whether the compact I/O info is initialized */ hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */ uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2663,27 +2665,11 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert(type_info); HDassert(fm); - /* Set up contiguous I/O info object */ - H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); - ctg_io_info.store = &ctg_store; - ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; - - /* Initialize temporary contiguous storage info */ - H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t); - - /* Set up compact I/O info object */ - H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); - cpt_io_info.store = &cpt_store; - cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; - - /* Initialize temporary compact storage info */ - cpt_store.compact.dirty = &cpt_dirty; - /* Iterate through nodes in chunk skip list */ chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); while(chunk_node) { H5D_chunk_info_t *chunk_info; /* Chunk information */ - H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ void *chunk; /* Pointer to locked chunk buffer */ H5D_chunk_ud_t udata; /* Index pass-through */ @@ -2701,8 +2687,8 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); - /* Set chunk's [scaled] coordinates */ - io_info->store->chunk.scaled = chunk_info->scaled; + /* Set chunk's [scaled] coordinates */ + io_info->store->chunk.scaled = chunk_info->scaled; /* Determine if we should use the chunk cache */ if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0) @@ -2719,7 +2705,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Determine if we will access all the data in the chunk */ if(dst_accessed_bytes != ctg_store.contig.dset_size || (chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size || - fm->fsel_type == H5S_SEL_POINTS) + fm->fsel_type == H5S_SEL_POINTS) entire_chunk = FALSE; /* Lock the chunk into the cache */ @@ -2729,6 +2715,20 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Set up the storage buffer information for this chunk */ cpt_store.compact.buf = chunk; + /* Initialize the compact I/O info, if it isn't already */ + if(!cpt_init) { + /* Set up compact I/O info object */ + H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); + cpt_io_info.store = &cpt_store; + cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; + + /* Initialize temporary compact storage info */ + cpt_store.compact.dirty = &cpt_dirty; + + /* Indicate compact I/O info ready */ + cpt_init = TRUE; + } /* end if */ + /* Point I/O info at main I/O info for this chunk */ chk_io_info = &cpt_io_info; } /* end if */ @@ -2762,6 +2762,20 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* No chunk cached */ chunk = NULL; + /* Initialize the contigous I/O info, if it isn't already */ + if(!ctg_init) { + /* Set up contiguous I/O info object */ + H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); + ctg_io_info.store = &ctg_store; + ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; + + /* Initialize temporary contiguous storage info */ + H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t); + + /* Indicate contigous I/O info ready */ + ctg_init = TRUE; + } /* end if */ + /* Point I/O info at temporary I/O info for this chunk */ chk_io_info = &ctg_io_info; } /* end else */ -- cgit v0.12 From 5352b1dbc92313d91d3502dd8352352abe8749a7 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 17 Aug 2020 22:37:26 -0500 Subject: Fixed typo --- examples/h5_cmprss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index 5feadd3..97f6567 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -98,7 +98,7 @@ int main () { for (i=0; i Date: Tue, 18 Aug 2020 06:18:23 -0700 Subject: Fixes CMake issue with file locking variable --- config/cmake/H5pubconf.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index fdf4c7d..600b046 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -733,7 +733,7 @@ #cmakedefine H5_USE_114_API_DEFAULT @H5_USE_114_API_DEFAULT@ /* Define if the library will use file locking */ -#cmakedefine H5_FILE_LOCKING @H5_USE_FILE_LOCKING@ +#cmakedefine H5_USE_FILE_LOCKING @H5_USE_FILE_LOCKING@ /* Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the -- cgit v0.12 From 98754591b8dcf2be70957d67ec7172c53cbaa827 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 18 Aug 2020 12:51:13 -0500 Subject: Revert "Merge pull request #2477 in HDFFV/hdf5 from pio_update to develop" This reverts commit ba80bcaff24113f438da0f40cb5b5479d4a21cc6, reversing changes made to 522ef0dd5ca1daa2b26c3fe4459ddbb1eaf6ec20. --- src/H5FDcore.c | 4 ---- src/H5FDlog.c | 21 --------------------- src/H5FDprivate.h | 2 -- src/H5FDsec2.c | 21 --------------------- 4 files changed, 48 deletions(-) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 66c08ad..97437de 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -386,9 +386,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) int myerrno = errno; time_t mytime = HDtime(NULL); -#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); -#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ @@ -912,9 +910,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr int myerrno = errno; time_t mytime = HDtime(NULL); -#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); -#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index cbd475f..5d1b536 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -81,10 +81,8 @@ typedef struct H5FD_log_t { int fd; /* the unix file */ haddr_t eoa; /* end of allocated region */ haddr_t eof; /* end of file; current file size */ -#ifndef H5_HAVE_PREADWRITE haddr_t pos; /* current file I/O position */ H5FD_file_op_t op; /* last operation */ -#endif /* H5_HAVE_PREADWRITE */ hbool_t ignore_disabled_file_locks; char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef H5_HAVE_WIN32_API @@ -573,10 +571,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->fd = fd; H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t); -#ifndef H5_HAVE_PREADWRITE file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(fd); if(INVALID_HANDLE_VALUE == file->hFile) @@ -1284,9 +1280,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had int myerrno = errno; time_t mytime = HDtime(NULL); -#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); -#endif /* H5_HAVE_PREADWRITE */ if(file->fa.flags & H5FD_LOG_LOC_READ) HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); @@ -1343,19 +1337,15 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDfprintf(file->logfp, "\n"); } /* end if */ -#ifndef H5_HAVE_PREADWRITE /* Update current position */ file->pos = addr; file->op = OP_READ; -#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { -#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1499,9 +1489,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha int myerrno = errno; time_t mytime = HDtime(NULL); -#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); -#endif /* H5_HAVE_PREADWRITE */ if(file->fa.flags & H5FD_LOG_LOC_WRITE) HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); @@ -1553,24 +1541,17 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha HDfprintf(file->logfp, "\n"); } /* end if */ -#ifndef H5_HAVE_PREADWRITE /* Update current position and eof */ file->pos = addr; file->op = OP_WRITE; if(file->pos > file->eof) file->eof = file->pos; -#else /* H5_HAVE_PREADWRITE */ - if(addr > file->eof) - file->eof = addr; -#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { -#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1675,11 +1656,9 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ /* Update the eof value */ file->eof = file->eoa; -#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ } /* end if */ done: diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 7ac63b7..7d5b66d 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -59,14 +59,12 @@ typedef struct H5FD_class_mpi_t { /* Library Private Typedefs */ /****************************/ -#ifndef H5_HAVE_PREADWRITE /* File operations */ typedef enum { OP_UNKNOWN = 0, /* Unknown last file operation */ OP_READ = 1, /* Last file I/O operation was a read */ OP_WRITE = 2 /* Last file I/O operation was a write */ } H5FD_file_op_t; -#endif /* H5_HAVE_PREADWRITE */ /* Define structure to hold initial file image and other relevant information */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 6a16838..147d08f 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -58,10 +58,8 @@ typedef struct H5FD_sec2_t { int fd; /* the filesystem file descriptor */ haddr_t eoa; /* end of allocated region */ haddr_t eof; /* end of file; current file size */ -#ifndef H5_HAVE_PREADWRITE haddr_t pos; /* current file I/O position */ H5FD_file_op_t op; /* last operation */ -#endif /* H5_HAVE_PREADWRITE */ hbool_t ignore_disabled_file_locks; char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef H5_HAVE_WIN32_API @@ -371,10 +369,8 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr file->fd = fd; H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t); -#ifndef H5_HAVE_PREADWRITE file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(fd); if(INVALID_HANDLE_VALUE == file->hFile) @@ -752,9 +748,7 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU int myerrno = errno; time_t mytime = HDtime(NULL); -#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); -#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ @@ -773,19 +767,15 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU buf = (char *)buf + bytes_read; } /* end while */ -#ifndef H5_HAVE_PREADWRITE /* Update current position */ file->pos = addr; file->op = OP_READ; -#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { -#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -861,9 +851,7 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN int myerrno = errno; time_t mytime = HDtime(NULL); -#ifndef H5_HAVE_PREADWRITE offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); -#endif /* H5_HAVE_PREADWRITE */ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ @@ -876,24 +864,17 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN buf = (const char *)buf + bytes_wrote; } /* end while */ -#ifndef H5_HAVE_PREADWRITE /* Update current position and eof */ file->pos = addr; file->op = OP_WRITE; if(file->pos > file->eof) file->eof = file->pos; -#else /* H5_HAVE_PREADWRITE */ - if(addr > file->eof) - file->eof = addr; -#endif /* H5_HAVE_PREADWRITE */ done: if(ret_value < 0) { -#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -959,11 +940,9 @@ H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR /* Update the eof value */ file->eof = file->eoa; -#ifndef H5_HAVE_PREADWRITE /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#endif /* H5_HAVE_PREADWRITE */ } /* end if */ done: -- cgit v0.12 From 76d93a78fe583b99efa295cd44359092310172a3 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 20 Aug 2020 10:57:29 -0500 Subject: Revert "Merge pull request #2796 in HDFFV/hdf5 from small_chunk_io_opt to develop" This reverts commit a7a8e6451a37d1bd072c7281b432f1436795daef, reversing changes made to 30422a6b55a135ec406d484a6c66f995057e0a50. --- src/H5Dchunk.c | 54 ++++++++++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index bdfa3f3..8962348 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2651,8 +2651,6 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ H5D_io_info_t cpt_io_info; /* Compact I/O info object */ H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */ - hbool_t ctg_init = FALSE; /* Whether the contiguous I/O info is initialized */ - hbool_t cpt_init = FALSE; /* Whether the compact I/O info is initialized */ hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */ uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2665,11 +2663,27 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert(type_info); HDassert(fm); + /* Set up contiguous I/O info object */ + H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); + ctg_io_info.store = &ctg_store; + ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; + + /* Initialize temporary contiguous storage info */ + H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t); + + /* Set up compact I/O info object */ + H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); + cpt_io_info.store = &cpt_store; + cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; + + /* Initialize temporary compact storage info */ + cpt_store.compact.dirty = &cpt_dirty; + /* Iterate through nodes in chunk skip list */ chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); while(chunk_node) { H5D_chunk_info_t *chunk_info; /* Chunk information */ - H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ void *chunk; /* Pointer to locked chunk buffer */ H5D_chunk_ud_t udata; /* Index pass-through */ @@ -2687,8 +2701,8 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); - /* Set chunk's [scaled] coordinates */ - io_info->store->chunk.scaled = chunk_info->scaled; + /* Set chunk's [scaled] coordinates */ + io_info->store->chunk.scaled = chunk_info->scaled; /* Determine if we should use the chunk cache */ if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0) @@ -2705,7 +2719,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Determine if we will access all the data in the chunk */ if(dst_accessed_bytes != ctg_store.contig.dset_size || (chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size || - fm->fsel_type == H5S_SEL_POINTS) + fm->fsel_type == H5S_SEL_POINTS) entire_chunk = FALSE; /* Lock the chunk into the cache */ @@ -2715,20 +2729,6 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Set up the storage buffer information for this chunk */ cpt_store.compact.buf = chunk; - /* Initialize the compact I/O info, if it isn't already */ - if(!cpt_init) { - /* Set up compact I/O info object */ - H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); - cpt_io_info.store = &cpt_store; - cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; - - /* Initialize temporary compact storage info */ - cpt_store.compact.dirty = &cpt_dirty; - - /* Indicate compact I/O info ready */ - cpt_init = TRUE; - } /* end if */ - /* Point I/O info at main I/O info for this chunk */ chk_io_info = &cpt_io_info; } /* end if */ @@ -2762,20 +2762,6 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* No chunk cached */ chunk = NULL; - /* Initialize the contigous I/O info, if it isn't already */ - if(!ctg_init) { - /* Set up contiguous I/O info object */ - H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); - ctg_io_info.store = &ctg_store; - ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; - - /* Initialize temporary contiguous storage info */ - H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t); - - /* Indicate contigous I/O info ready */ - ctg_init = TRUE; - } /* end if */ - /* Point I/O info at temporary I/O info for this chunk */ chk_io_info = &ctg_io_info; } /* end else */ -- cgit v0.12 From 91bd6f9a63352a700075aea1ed80b72aeaa91d09 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 20 Aug 2020 14:31:35 -0500 Subject: Avoid creating MPI datatypes on ranks with 0 chunks to write' --- src/H5Dchunk.c | 121 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 53 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 8962348..92cdfda 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4958,6 +4958,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */ hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */ hbool_t need_addr_sort = FALSE; + hbool_t created_mpi_datatypes = FALSE; /* Whether MPI datatypes were created */ int i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4980,9 +4981,9 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero") num_blocks = (size_t)(chunk_info->num_io / (size_t)mpi_size); /* value should be the same on all procs */ - /* after evenly distributing the blocks between processes, are - there any leftover blocks for each individual process - (round-robin) */ + /* After evenly distributing the blocks between processes, are there any + * leftover blocks for each individual process (round-robin)? + */ leftover_blocks = (size_t)(chunk_info->num_io % (size_t)mpi_size); /* Cast values to types needed by MPI */ @@ -4990,58 +4991,70 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, H5_CHECKED_ASSIGN(leftover, int, leftover_blocks, size_t); H5_CHECKED_ASSIGN(block_len, int, chunk_size, size_t); - /* Allocate buffers */ - /* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */ - if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer") - if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer") + /* Check if we have any chunks to write on this rank */ + if(num_blocks > 0 || (leftover && leftover > mpi_rank)) { + /* Allocate buffers */ + /* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */ + if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer") + if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer") - for(i = 0 ; i < blocks ; i++) { - /* store the chunk address as an MPI_Aint */ - chunk_disp_array[i] = (MPI_Aint)(chunk_info->addr[i + mpi_rank*blocks]); + for(i = 0 ; i < blocks ; i++) { + /* store the chunk address as an MPI_Aint */ + chunk_disp_array[i] = (MPI_Aint)(chunk_info->addr[i + (mpi_rank * blocks)]); - /* MSC - should not need this if MPI_type_create_hindexed_block is working */ - block_lens[i] = block_len; + /* MSC - should not need this if MPI_type_create_hindexed_block is working */ + block_lens[i] = block_len; - /* make sure that the addresses in the datatype are - monotonically non decreasing */ - if(i && (chunk_disp_array[i] < chunk_disp_array[i - 1])) - need_addr_sort = TRUE; - } /* end for */ + /* Make sure that the addresses in the datatype are + * monotonically non-decreasing + */ + if(i && (chunk_disp_array[i] < chunk_disp_array[i - 1])) + need_addr_sort = TRUE; + } /* end for */ - /* calculate if there are any leftover blocks after evenly - distributing. If there are, then round robin the distribution - to processes 0 -> leftover. */ - if(leftover && leftover > mpi_rank) { - chunk_disp_array[blocks] = (MPI_Aint)chunk_info->addr[blocks*mpi_size + mpi_rank]; - if(blocks && (chunk_disp_array[blocks] < chunk_disp_array[blocks - 1])) - need_addr_sort = TRUE; - block_lens[blocks] = block_len; - blocks++; - } + /* Calculate if there are any leftover blocks after evenly + * distributing. If there are, then round-robin the distribution + * to processes 0 -> leftover. + */ + if(leftover && leftover > mpi_rank) { + chunk_disp_array[blocks] = (MPI_Aint)chunk_info->addr[(blocks * mpi_size) + mpi_rank]; + if(blocks && (chunk_disp_array[blocks] < chunk_disp_array[blocks - 1])) + need_addr_sort = TRUE; + block_lens[blocks] = block_len; + blocks++; + } - /* - * Ensure that the blocks are sorted in monotonically non-decreasing - * order of offset in the file. - */ - if(need_addr_sort) - HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr); + /* Ensure that the blocks are sorted in monotonically non-decreasing + * order of offset in the file. + */ + if(need_addr_sort) + HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr); - /* MSC - should use this if MPI_type_create_hindexed block is working: - * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); - */ - mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); - if(mpi_code != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - - mpi_code = MPI_Type_create_hvector(blocks, block_len, 0, MPI_BYTE, &mem_type); - if(mpi_code != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) - if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + /* MSC - should use this if MPI_type_create_hindexed block is working: + * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); + */ + mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); + if(mpi_code != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + + mpi_code = MPI_Type_create_hvector(blocks, block_len, 0, MPI_BYTE, &mem_type); + if(mpi_code != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + + /* Indicate that the MPI types were created */ + created_mpi_datatypes = TRUE; + } /* end if */ + else { + /* Set up file & memory MPI types, to participate in collective write */ + file_type = MPI_BYTE; + mem_type = MPI_BYTE; + } /* end else */ /* Set MPI-IO VFD properties */ @@ -5073,10 +5086,12 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* free things */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(created_mpi_datatypes) { + if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + } /* end if */ H5MM_xfree(chunk_disp_array); H5MM_xfree(block_lens); -- cgit v0.12 From d67de87ecd15b531718b4e5642b264a5f9b6bbc4 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 20 Aug 2020 17:08:24 -0500 Subject: Simplify code to avoid using a boolean to free MPI types --- src/H5Dchunk.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 92cdfda..52a921f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4954,11 +4954,10 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, int blocks, leftover, block_len; /* converted to int for MPI */ MPI_Aint *chunk_disp_array = NULL; int *block_lens = NULL; - MPI_Datatype mem_type, file_type; + MPI_Datatype mem_type = MPI_DATATYPE_NULL, file_type = MPI_DATATYPE_NULL; H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */ hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */ hbool_t need_addr_sort = FALSE; - hbool_t created_mpi_datatypes = FALSE; /* Whether MPI datatypes were created */ int i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5046,9 +5045,6 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - - /* Indicate that the MPI types were created */ - created_mpi_datatypes = TRUE; } /* end if */ else { /* Set up file & memory MPI types, to participate in collective write */ @@ -5086,12 +5082,12 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* free things */ - if(created_mpi_datatypes) { + if(MPI_DATATYPE_NULL != file_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(MPI_DATATYPE_NULL != mem_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - } /* end if */ H5MM_xfree(chunk_disp_array); H5MM_xfree(block_lens); -- cgit v0.12 From fa0d395370daa7337ed2676d30198937145ad6e9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 20 Aug 2020 18:22:39 -0500 Subject: Don't free builtin MPI_BYTE MPI type --- src/H5Dchunk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 52a921f..b57a608 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -5082,10 +5082,10 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* free things */ - if(MPI_DATATYPE_NULL != file_type) + if(MPI_DATATYPE_NULL != file_type && MPI_BYTE != file_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if(MPI_DATATYPE_NULL != mem_type) + if(MPI_DATATYPE_NULL != mem_type && MPI_BYTE != mem_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) H5MM_xfree(chunk_disp_array); -- cgit v0.12 From 4c43ff0b8b015ccfc1f4aeab18f189d629a5beb9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 20 Aug 2020 18:24:07 -0500 Subject: Simplify default use of MPI_BYTE --- src/H5Dchunk.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index b57a608..b2a9eb6 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4954,7 +4954,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, int blocks, leftover, block_len; /* converted to int for MPI */ MPI_Aint *chunk_disp_array = NULL; int *block_lens = NULL; - MPI_Datatype mem_type = MPI_DATATYPE_NULL, file_type = MPI_DATATYPE_NULL; + MPI_Datatype mem_type = MPI_BYTE, file_type = MPI_BYTE; H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */ hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */ hbool_t need_addr_sort = FALSE; @@ -5046,11 +5046,6 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) } /* end if */ - else { - /* Set up file & memory MPI types, to participate in collective write */ - file_type = MPI_BYTE; - mem_type = MPI_BYTE; - } /* end else */ /* Set MPI-IO VFD properties */ @@ -5082,10 +5077,10 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* free things */ - if(MPI_DATATYPE_NULL != file_type && MPI_BYTE != file_type) + if(MPI_BYTE != file_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if(MPI_DATATYPE_NULL != mem_type && MPI_BYTE != mem_type) + if(MPI_BYTE != mem_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) H5MM_xfree(chunk_disp_array); -- cgit v0.12 From 2ac49e2fec3a5cc39a2037b80d49ceb3a1e4df5e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 23 Aug 2020 14:05:19 -0500 Subject: Fix S3/HDFS test --- tools/libtest/h5tools_test_utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 12360a7..244fd43 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -1003,6 +1003,7 @@ test_set_configured_fapl(void) hid_t fapl_id = H5I_INVALID_HID; other_fa_t wrong_fa = {0x432, 0xf82, 0x9093}; +#ifdef H5_HAVE_ROS3_VFD H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""}; H5FD_ros3_fapl_t ros3_auth_fa = { 1, /* fapl version */ @@ -1011,6 +1012,8 @@ test_set_configured_fapl(void) "12345677890abcdef", /* simulate access key ID */ "oiwnerwe9u0234nJw0-aoj+dsf", /* simulate secret key */ }; +#endif /* H5_HAVE_ROS3_VFD */ +#ifdef H5_HAVE_LIBHDFS H5FD_hdfs_fapl_t hdfs_fa = { 1, /* fapl version */ "", /* namenode name */ @@ -1019,6 +1022,7 @@ test_set_configured_fapl(void) "", /* user name */ 2048, /* stream buffer size */ }; +#endif /* H5_HAVE_LIBHDFS */ unsigned n_cases = 7; /* number of common testcases */ testcase cases[] = { { "(common) should fail: no fapl id", -- cgit v0.12 From 4d5354afcddf4e8858dfb496a5b1c113ee960cb6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 23 Aug 2020 14:58:09 -0500 Subject: Add hypen to subrelease regex --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac291fa..6c52c50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,7 +236,7 @@ string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$" "\\1" H5_VERS_MINOR ${_h5public_h_contents}) string (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$" "\\1" H5_VERS_RELEASE ${_h5public_h_contents}) -string (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._]*)\".*$" +string (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._\-]*)\".*$" "\\1" H5_VERS_SUBRELEASE ${_h5public_h_contents}) #message (STATUS "VERSION: ${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}-${H5_VERS_SUBRELEASE}") -- cgit v0.12 From 9b63dcb5c88442311fef59299c207638268b4738 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 24 Aug 2020 00:32:48 -0500 Subject: Condition if (H5_VERS_SUBRELEASE) is incorrectly false when H5_VERS_SUBRELEASE is 0, a valid value for H5_VERS_SUBRELEASE. Updated to if (${H5_VERS_SUBRELEASE} STREQUAL "") with corresponding reversal of action statements to avoid NOT. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c52c50..13b96e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,10 +338,10 @@ set (HDF5_PACKAGE_NAME "HDF5") set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}") set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") -if (H5_VERS_SUBRELEASE) - set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") -else () +if (${H5_VERS_SUBRELEASE} STREQUAL "") set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") +else () + set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") endif () set (HDF5_LIB_PACKAGE_SOVERSION "${H5_LIB_SOVERS_MAJOR}.${H5_LIB_SOVERS_RELEASE}.${H5_LIB_SOVERS_MINOR}") set (HDF5_LIB_PACKAGE_SOVERSION_MAJOR "${H5_LIB_SOVERS_MAJOR}") -- cgit v0.12 From 9765b7ff3020ecd0981e84cdb2bcfe1e6d3b9803 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Aug 2020 06:55:00 -0500 Subject: Add special case when H5_VERS_SUBRELEASE is 0 --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13b96e9..bc94f73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,10 +338,14 @@ set (HDF5_PACKAGE_NAME "HDF5") set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}") set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") -if (${H5_VERS_SUBRELEASE} STREQUAL "") - set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") -else () +if (H5_VERS_SUBRELEASE) set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") +else () + if (${H5_VERS_SUBRELEASE} STREQUAL "") + set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") + else () + set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") + endif () endif () set (HDF5_LIB_PACKAGE_SOVERSION "${H5_LIB_SOVERS_MAJOR}.${H5_LIB_SOVERS_RELEASE}.${H5_LIB_SOVERS_MINOR}") set (HDF5_LIB_PACKAGE_SOVERSION_MAJOR "${H5_LIB_SOVERS_MAJOR}") -- cgit v0.12 From ec1c324a0d184d2778e9155140367a7d3a307fa1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Aug 2020 08:01:01 -0500 Subject: Revert H5_VERS_SUBRELEASE check --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc94f73..6c52c50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -341,11 +341,7 @@ set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") if (H5_VERS_SUBRELEASE) set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") else () - if (${H5_VERS_SUBRELEASE} STREQUAL "") - set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") - else () - set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") - endif () + set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") endif () set (HDF5_LIB_PACKAGE_SOVERSION "${H5_LIB_SOVERS_MAJOR}.${H5_LIB_SOVERS_RELEASE}.${H5_LIB_SOVERS_MINOR}") set (HDF5_LIB_PACKAGE_SOVERSION_MAJOR "${H5_LIB_SOVERS_MAJOR}") -- cgit v0.12 From 336b30024216b142eb096bf85986786ecf65e993 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 25 Aug 2020 11:19:12 -0500 Subject: Add back function for VERIFY_EXTERNAL_CONSOLIDATION --- tools/test/h5repack/h5repack.sh.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 02f515c..18e6d86 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -678,6 +678,26 @@ VERIFY_INVALIDBOUNDS() } # end of VERIFY_INVALIDBOUNDS # ----------------------------------------------------------------------------- +# Expect h5diff to fail +# Use only by VERIFY_EXTERNAL_CONSOLIDATION +# ----------------------------------------------------------------------------- +DIFFFAIL() +{ + VERIFY h5diff unequal $@ + ( + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN -q "$@" + ) + RET=$? + if [ $RET == 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi +} + +# ----------------------------------------------------------------------------- # Catchall test for repacking with external files # Loops over all (internally-listed) cases and applies the given arguments # to h5repack. -- cgit v0.12 From 3f65adefd90bbefc446c42801fe5a502ef70d43a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 26 Aug 2020 09:03:43 -0500 Subject: The version string has a second use for packaging --- CMakeLists.txt | 4 +++- tools/test/misc/testfiles/h5mkgrp_version.txt.in | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c52c50..e4b87a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -339,9 +339,11 @@ set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}" set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") if (H5_VERS_SUBRELEASE) - set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") + set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}.${H5_VERS_SUBRELEASE}") + set (HDF5_RELEASE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") else () set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") + set (HDF5_RELEASE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") endif () set (HDF5_LIB_PACKAGE_SOVERSION "${H5_LIB_SOVERS_MAJOR}.${H5_LIB_SOVERS_RELEASE}.${H5_LIB_SOVERS_MINOR}") set (HDF5_LIB_PACKAGE_SOVERSION_MAJOR "${H5_LIB_SOVERS_MAJOR}") diff --git a/tools/test/misc/testfiles/h5mkgrp_version.txt.in b/tools/test/misc/testfiles/h5mkgrp_version.txt.in index 75c13a5..37dbabd 100644 --- a/tools/test/misc/testfiles/h5mkgrp_version.txt.in +++ b/tools/test/misc/testfiles/h5mkgrp_version.txt.in @@ -1 +1 @@ -h5mkgrp: Version @HDF5_PACKAGE_VERSION_STRING@ +h5mkgrp: Version @HDF5_RELEASE_VERSION_STRING@ -- cgit v0.12 From 0932c46e3d5b09d32cbe29335e8054302ab122c5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 26 Aug 2020 10:17:21 -0500 Subject: MinGW uses "MinGW Makefiles" --- config/cmake/scripts/HDF5config.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 7b7560f..3a8d5b7 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -21,6 +21,7 @@ cmake_minimum_required (VERSION 3.12) # ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log # where valid options for OPTION are: # BUILD_GENERATOR - The cmake build generator: +# MinGW * MinGW Makefiles # Unix * Unix Makefiles # VS2019 * Visual Studio 16 2019 # VS201964 * Visual Studio 16 2019 @@ -167,7 +168,11 @@ if (NOT DEFINED HPC) ## Set the following to unique id your computer ## set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") else () - set (CTEST_CMAKE_GENERATOR "Unix Makefiles") + if (MINGW) + set (CTEST_CMAKE_GENERATOR "MinGW Makefiles") + else () + set (CTEST_CMAKE_GENERATOR "Unix Makefiles") + endif () ## Set the following to unique id your computer ## if (APPLE) set (CTEST_SITE "MAC.XXXX") -- cgit v0.12