Skip to content

Commit

Permalink
Parallel updates and fixes for VFD SWMR (#705)
Browse files Browse the repository at this point in the history
* Brings CMake updates from develop

* Brings reduction in pedantic casts from develop

* Purges UFAIL from the library (#637)

* Committing clang-format changes

* Purges UFAIL from the library

* H5HL_insert change requested in PR

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Removes gratuitous (double)x.yF casts (#632)

* Committing clang-format changes

* Removes gratuitous (double)x.yF casts

* Committing clang-format changes

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Committing clang-format changes

* Cleans up a const warning left over from previous constification (#633)

* Committing clang-format changes

* Adds consts to a few global variables

* Cleans up a const warning left over from previous constification

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Formatted source

* Bring over some VOL registration changes

* VOL cleanup

* H5VL_request_status_t substitutions

* H5F.c cleanup

* Minor API tweaks from develop

* Moves H5G package init/teardown to H5Gint.c

* H5G cleanup

* H5M cleanup

* H5SM cleanup

* H5T cleanup

* H5R cleanup

* H5Lpublic.h cleanup

* H5L cleanup

* H5O cleanup

* H5A, H5CS, and H5AC cleanup

* Moved H5A init/teardown code to H5Aint.c

* Moves H5D I/O functions to H5D.c

* H5D cleanup

* Misc minor cleanup

* H5P close cleanup

* H5Tpublic.h cleanup

* Fixes err_compat test

* H5PLpublic.h cleanup

* Updates H5Ppublic.h

* H5Fpublic.h updates

* H5A.c cleanup

* Brings over H5Aexists and related changes

* Brings CMake shell testing changes from develop

* Close callback changes

* H5R and H5Tcommit normalization

* err_compat test works now

* H5O tweaks

* Updates VOL registration code

* Brings over H5VL_create_object

* H5Tconv.c reformatting

* H5T.c tweaks

* Brings datatype and reference updates from develop

* Brings VOL plugin loading changes from develop

* Brings event sets from develop

* Brings async functions over

* Tools changes

* Brings over many tools changes from develop

* Brings VOL flags from develop

* Fixes h5dump double/float tests

* Updates h5repack tests

* Brings h5diff test changes from develop

* Last h5dump changes

* Brings test changes from develop

* Committing clang-format changes

* Tidied h5_testing()

* Brings chunk iteration code + misc from develop

* Updates vds test

* Enables external link parallel test

* Brings updated property lists from develop

* H5G changes from develop

* H5MF cleanup

* Brings vfd_swmr test back into CMake

* Updates threadsafe test

* Updates plist test

* Brings recent changes from develop

* Require a C++11 compiler to build the C++ wrappers (#693)

* Committing clang-format changes

* Requires a C++11 compiler to build the C++ wrappers

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Fix H5FD_mpio_Debug="rw" can report MPI_count instead of bytes (#699)

* Removes pre-C99 build and header cruft (#700)

* Assumes ANSI C headers exist
* Assumes stdbool.h, stdint.h, and inttypes.h are present
* Assumes the C++ compiler can handle stdint.h
* Removes all work-arounds for missing functionality, especially stdbool.h

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Updates release documents

* Brings parallel changes from develop

* Adds a VFD/parallel check program for the VFD SWMR shell test

* Updates MANIFEST

* Disable building VFD SWMR acceptance tests on CMake

* Removes err.h from genall5.c

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
derobins and github-actions[bot] authored May 28, 2021
1 parent f86004d commit 62868da
Show file tree
Hide file tree
Showing 11 changed files with 226 additions and 92 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -1402,8 +1402,10 @@
./test/vfd_swmr_addrem_writer.c
./test/vfd_swmr_attrdset_writer.c
./test/vfd_swmr_bigset_writer.c
./test/vfd_swmr_check_compat.c
./test/vfd_swmr_common.c
./test/vfd_swmr_common.h
./test/vfd_swmr_dsetops_writer.c
./test/vfd_swmr_generator.c
./test/vfd_swmr_group_writer.c
./test/vfd_swmr_reader.c
Expand Down
4 changes: 2 additions & 2 deletions src/H5ACmpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr)
else {
aux_ptr->dirty_bytes += entry_ptr->size;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
aux_ptr->unprotect_dirty_bytes += entry_size;
aux_ptr->unprotect_dirty_bytes += entry_ptr->size;
aux_ptr->unprotect_dirty_bytes_updates += 1;
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
} /* end else */
Expand Down Expand Up @@ -970,7 +970,7 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr)
aux_ptr->dirty_bytes += entry_ptr->size;

#if H5AC_DEBUG_DIRTY_BYTES_CREATION
aux_ptr->insert_dirty_bytes += size;
aux_ptr->insert_dirty_bytes += entry_ptr->size;
aux_ptr->insert_dirty_bytes_updates += 1;
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */

Expand Down
57 changes: 30 additions & 27 deletions src/H5Cimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,33 +423,33 @@ H5C__generate_cache_image(H5F_t *f, H5C_t *cache_ptr)
* Function: H5C__deserialize_prefetched_entry()
*
* Purpose: Deserialize the supplied prefetched entry entry, and return
* a pointer to the deserialized entry in *entry_ptr_ptr.
* If successful, remove the prefetched entry from the cache,
* and free it. Insert the deserialized entry into the cache.
*
* Note that the on disk image of the entry is not freed --
* a pointer to it is stored in the deserialized entries'
* image_ptr field, and its image_up_to_date field is set to
* TRUE unless the entry is dirtied by the deserialize call.
*
* If the prefetched entry is a flush dependency child,
* destroy that flush dependency prior to calling the
* deserialize callback. If appropriate, the flush dependency
* relationship will be recreated by the cache client.
*
* If the prefetched entry is a flush dependency parent,
* destroy the flush dependency relationship with all its
* children. As all these children must be prefetched entries,
* recreate these flush dependency relationships with
* deserialized entry after it is inserted in the cache.
*
* Since deserializing a prefetched entry is semantically
* equivalent to a load, issue an entry loaded nofification
* if the notify callback is defined.
* a pointer to the deserialized entry in *entry_ptr_ptr.
* If successful, remove the prefetched entry from the cache,
* and free it. Insert the deserialized entry into the cache.
*
* Note that the on disk image of the entry is not freed --
* a pointer to it is stored in the deserialized entries'
* image_ptr field, and its image_up_to_date field is set to
* TRUE unless the entry is dirtied by the deserialize call.
*
* If the prefetched entry is a flush dependency child,
* destroy that flush dependency prior to calling the
* deserialize callback. If appropriate, the flush dependency
* relationship will be recreated by the cache client.
*
* If the prefetched entry is a flush dependency parent,
* destroy the flush dependency relationship with all its
* children. As all these children must be prefetched entries,
* recreate these flush dependency relationships with
* deserialized entry after it is inserted in the cache.
*
* Since deserializing a prefetched entry is semantically
* equivalent to a load, issue an entry loaded nofification
* if the notify callback is defined.
*
* Return: SUCCEED on success, and FAIL on failure.
*
* Note that *entry_ptr_ptr is undefined on failure.
* Note that *entry_ptr_ptr is undefined on failure.
*
* Programmer: John Mainzer, 8/10/15
*
Expand Down Expand Up @@ -685,15 +685,17 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t
*
* 1) Set pf_entry_ptr->image_ptr to NULL. Since we have already
* transferred the buffer containing the image to *ds_entry_ptr,
* this is not a memory leak.
* this is not a memory leak.
*
* 2) Call H5C__flush_single_entry() with the H5C__FLUSH_INVALIDATE_FLAG
* and H5C__FLUSH_CLEAR_ONLY_FLAG flags set.
*/
pf_entry_ptr->image_ptr = NULL;

if (pf_entry_ptr->is_dirty) {
HDassert(pf_entry_ptr->in_slist);
flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG;

} /* end if */

if (H5C__flush_single_entry(f, pf_entry_ptr, flush_flags) < 0)
Expand Down Expand Up @@ -1211,7 +1213,8 @@ H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);

/* Set information needed to load cache image */
cache_ptr->image_addr = addr, cache_ptr->image_len = len;
cache_ptr->image_addr = addr;
cache_ptr->image_len = len;
cache_ptr->load_image = TRUE;
cache_ptr->delete_image = rw;

Expand Down Expand Up @@ -1825,7 +1828,7 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t *
p = *buf;

/* Check signature */
if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN))
if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature")
p += H5C__MDCI_BLOCK_SIGNATURE_LEN;

Expand Down
92 changes: 61 additions & 31 deletions src/H5Cmpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ herr_t
H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr,
int mpi_rank, int mpi_size)
{
int i;
int m;
unsigned n;
unsigned first_entry_to_flush;
unsigned last_entry_to_flush;
unsigned total_entries_to_clear = 0;
Expand All @@ -177,7 +174,8 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
char tbl_buf[1024];
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
unsigned m, n;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */

Expand Down Expand Up @@ -219,9 +217,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
} /* end if */

n = num_candidates / (unsigned)mpi_size;
if (num_candidates % (unsigned)mpi_size > INT_MAX)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "m overflow")
m = (int)(num_candidates % (unsigned)mpi_size);
m = num_candidates % (unsigned)mpi_size;

if (NULL ==
(candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1))))
Expand All @@ -232,31 +228,31 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
candidate_assignment_table[mpi_size] = num_candidates;

if (m == 0) { /* mpi_size is an even divisor of num_candidates */
for (i = 1; i < mpi_size; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
for (u = 1; u < (unsigned)mpi_size; u++)
candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n;
} /* end if */
else {
for (i = 1; i <= m; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1;
for (u = 1; u <= m; u++)
candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n + 1;

if (num_candidates < (unsigned)mpi_size) {
for (i = m + 1; i < mpi_size; i++)
candidate_assignment_table[i] = num_candidates;
for (u = m + 1; u < (unsigned)mpi_size; u++)
candidate_assignment_table[u] = num_candidates;
} /* end if */
else {
for (i = m + 1; i < mpi_size; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
for (u = m + 1; u < (unsigned)mpi_size; u++)
candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n;
} /* end else */
} /* end else */
HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates);

#if H5C_DO_SANITY_CHECKS
/* Verify that the candidate assignment table has the expected form */
for (i = 1; i < mpi_size - 1; i++) {
for (u = 1; u < (unsigned)(mpi_size - 1); u++) {
unsigned a, b;

a = candidate_assignment_table[i] - candidate_assignment_table[i - 1];
b = candidate_assignment_table[i + 1] - candidate_assignment_table[i];
a = candidate_assignment_table[u] - candidate_assignment_table[u - 1];
b = candidate_assignment_table[u + 1] - candidate_assignment_table[u];

HDassert(n + 1 >= a);
HDassert(a >= b);
Expand All @@ -268,11 +264,11 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1;

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
for (i = 0; i < 1024; i++)
tbl_buf[i] = '\0';
for (u = 0; u < 1024; u++)
tbl_buf[u] = '\0';
HDsprintf(&(tbl_buf[0]), "candidate assignment table = ");
for (i = 0; i <= mpi_size; i++)
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[i]);
for (u = 0; u <= (unsigned)mpi_size; u++)
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]);
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);

Expand Down Expand Up @@ -347,9 +343,9 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
#if H5C_DO_SANITY_CHECKS
m = 0;
n = 0;
for (i = 0; i < H5C_RING_NTYPES; i++) {
m += (int)entries_to_flush[i];
n += entries_to_clear[i];
for (u = 0; u < H5C_RING_NTYPES; u++) {
m += entries_to_flush[u];
n += entries_to_clear[u];
} /* end if */

HDassert((unsigned)m == total_entries_to_flush);
Expand Down Expand Up @@ -439,6 +435,7 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr)
HDassert(cache_ptr->slist_len <= (cache_ptr->dLRU_list_len + cache_ptr->pel_len));

if (space_needed > 0) { /* we have work to do */

H5C_cache_entry_t *entry_ptr;
unsigned nominated_entries_count = 0;
size_t nominated_entries_size = 0;
Expand All @@ -450,54 +447,70 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr)
* entries to free up the necessary space.
*/
entry_ptr = cache_ptr->dLRU_tail_ptr;

while ((nominated_entries_size < space_needed) && (nominated_entries_count < cache_ptr->slist_len) &&
(entry_ptr != NULL)) {

HDassert(!(entry_ptr->is_protected));
HDassert(!(entry_ptr->is_read_only));
HDassert(entry_ptr->ro_ref_count == 0);
HDassert(entry_ptr->is_dirty);
HDassert(entry_ptr->in_slist);

nominated_addr = entry_ptr->addr;

if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)

HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed")

nominated_entries_size += entry_ptr->size;
nominated_entries_count++;
entry_ptr = entry_ptr->aux_prev;

} /* end while */

HDassert(entry_ptr == NULL);

/* it is possible that there are some dirty entries on the
* protected entry list as well -- scan it too if necessary
*/
entry_ptr = cache_ptr->pel_head_ptr;

while ((nominated_entries_size < space_needed) && (nominated_entries_count < cache_ptr->slist_len) &&
(entry_ptr != NULL)) {

if (entry_ptr->is_dirty) {

HDassert(!(entry_ptr->is_protected));
HDassert(!(entry_ptr->is_read_only));
HDassert(entry_ptr->ro_ref_count == 0);
HDassert(entry_ptr->is_dirty);
HDassert(entry_ptr->in_slist);

nominated_addr = entry_ptr->addr;

if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)

HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed")

nominated_entries_size += entry_ptr->size;
nominated_entries_count++;

} /* end if */

entry_ptr = entry_ptr->next;

} /* end while */

HDassert(nominated_entries_count == cache_ptr->slist_len);
HDassert(nominated_entries_size == space_needed);

} /* end if */

done:

FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_construct_candidate_list__clean_cache() */

/*-------------------------------------------------------------------------
Expand Down Expand Up @@ -533,21 +546,32 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr)
* cache back within its min clean constraints.
*/
if (cache_ptr->max_cache_size > cache_ptr->index_size) {

if (((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size) >=
cache_ptr->min_clean_size)
cache_ptr->min_clean_size) {

space_needed = 0;
else
}
else {

space_needed = cache_ptr->min_clean_size -
((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size);
}
} /* end if */
else {
if (cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size)

if (cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size) {

space_needed = 0;
else
}
else {

space_needed = cache_ptr->min_clean_size - cache_ptr->cLRU_list_size;
}
} /* end else */

if (space_needed > 0) { /* we have work to do */

H5C_cache_entry_t *entry_ptr;
unsigned nominated_entries_count = 0;
size_t nominated_entries_size = 0;
Expand All @@ -558,8 +582,10 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr)
* entries to free up the necessary space.
*/
entry_ptr = cache_ptr->dLRU_tail_ptr;

while ((nominated_entries_size < space_needed) && (nominated_entries_count < cache_ptr->slist_len) &&
(entry_ptr != NULL) && (!entry_ptr->flush_me_last)) {

haddr_t nominated_addr;

HDassert(!(entry_ptr->is_protected));
Expand All @@ -569,12 +595,15 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr)
HDassert(entry_ptr->in_slist);

nominated_addr = entry_ptr->addr;

if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)

HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed")

nominated_entries_size += entry_ptr->size;
nominated_entries_count++;
entry_ptr = entry_ptr->aux_prev;

} /* end while */
HDassert(nominated_entries_count <= cache_ptr->slist_len);
HDassert(nominated_entries_size >= space_needed);
Expand Down Expand Up @@ -679,13 +708,14 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr

if (entry_ptr == NULL) {
#if H5C_DO_SANITY_CHECKS
HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %a not in cache.\n", u, addr);
HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR " not in cache.\n", u,
addr);
#endif /* H5C_DO_SANITY_CHECKS */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?")
} /* end if */
else if (!entry_ptr->is_dirty) {
#if H5C_DO_SANITY_CHECKS
HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %a is not dirty!?!\n", addr);
HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %" PRIuHADDR " is not dirty!?!\n", addr);
#endif /* H5C_DO_SANITY_CHECKS */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?")
} /* end else-if */
Expand Down
Loading

0 comments on commit 62868da

Please sign in to comment.