mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
[svn-r27264] some cleanups.
This commit is contained in:
parent
cf07aa6803
commit
f56008e0fe
@ -617,7 +617,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
/* destroying the cache, so clear all collective entries */
|
||||
if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0)
|
||||
if(H5C_clear_coll_entries(f->shared->cache, 0) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
|
||||
|
||||
aux_ptr = (struct H5AC_aux_t *)(f->shared->cache->aux_ptr);
|
||||
@ -759,7 +759,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id)
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
/* flushing the cache, so clear all collective entries */
|
||||
if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0)
|
||||
if(H5C_clear_coll_entries(f->shared->cache, 0) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
|
||||
|
||||
/* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */
|
||||
@ -4341,7 +4341,7 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu
|
||||
evicted later. All ranks are guranteed to mark the same entires
|
||||
since we don't modify the order of the collectively accessed
|
||||
entries except through collective access. */
|
||||
if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, TRUE) < 0)
|
||||
if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
|
||||
|
||||
switch(aux_ptr->metadata_write_strategy) {
|
||||
|
48
src/H5C.c
48
src/H5C.c
@ -698,7 +698,6 @@ H5C_apply_candidate_list(H5F_t * f,
|
||||
ranks. */
|
||||
if(TRUE == entry_ptr->coll_access) {
|
||||
entry_ptr->coll_access = FALSE;
|
||||
cache_ptr->num_coll_entries --;
|
||||
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
|
||||
}
|
||||
} /* end else */
|
||||
@ -1460,7 +1459,6 @@ H5C_create(size_t max_cache_size,
|
||||
cache_ptr->coll_list_size = (size_t)0;
|
||||
cache_ptr->coll_head_ptr = NULL;
|
||||
cache_ptr->coll_tail_ptr = NULL;
|
||||
cache_ptr->num_coll_entries = 0;
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
cache_ptr->cLRU_list_len = 0;
|
||||
@ -3277,19 +3275,18 @@ H5C_insert_entry(H5F_t * f,
|
||||
entry_ptr->coll_access = coll_access;
|
||||
if(coll_access) {
|
||||
//fprintf(stderr, "NEW (%llu, %s)\n", addr, entry_ptr->type->name);
|
||||
cache_ptr->num_coll_entries ++;
|
||||
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL)
|
||||
|
||||
/* Make sure the size of the collective entries in the cache remain in check */
|
||||
if(H5P_USER_TRUE == f->coll_md_read) {
|
||||
if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) {
|
||||
if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0)
|
||||
if(H5C_clear_coll_entries(cache_ptr, 1) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) {
|
||||
if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0)
|
||||
if(H5C_clear_coll_entries(cache_ptr, 1) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
|
||||
}
|
||||
}
|
||||
@ -3479,7 +3476,6 @@ H5C_mark_entries_as_clean(H5F_t * f,
|
||||
*/
|
||||
if(TRUE == entry_ptr->coll_access) {
|
||||
entry_ptr->coll_access = FALSE;
|
||||
cache_ptr->num_coll_entries --;
|
||||
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
|
||||
}
|
||||
|
||||
@ -4338,7 +4334,6 @@ H5C_protect(H5F_t * f,
|
||||
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
|
||||
|
||||
entry_ptr->coll_access = TRUE;
|
||||
cache_ptr->num_coll_entries ++;
|
||||
|
||||
//fprintf(stderr, "ONLY INSERT (%llu, %s)\n", addr, entry_ptr->type->name);
|
||||
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
|
||||
@ -4395,7 +4390,6 @@ H5C_protect(H5F_t * f,
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
|
||||
if(entry_ptr->coll_access) {
|
||||
cache_ptr->num_coll_entries ++;
|
||||
//fprintf(stderr, "LOAD and INSERT (%llu, %s)\n", addr, entry_ptr->type->name);
|
||||
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
|
||||
}
|
||||
@ -4693,14 +4687,14 @@ H5C_protect(H5F_t * f,
|
||||
//fprintf(stderr, "COLL entries size = %zu, MAX = %zu\n", cache_ptr->coll_list_size, cache_ptr->max_cache_size);
|
||||
if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) {
|
||||
//fprintf(stderr, "COLL entries at 80.. CLEARING\n");
|
||||
if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0)
|
||||
if(H5C_clear_coll_entries(cache_ptr, 1) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.")
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) {
|
||||
//fprintf(stderr, "COLL entries at 40.. CLEARING\n");
|
||||
if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0)
|
||||
if(H5C_clear_coll_entries(cache_ptr, 1) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.")
|
||||
}
|
||||
}
|
||||
@ -10569,7 +10563,6 @@ H5C_make_space_in_cache(H5F_t * f,
|
||||
|
||||
if(TRUE == entry_ptr->coll_access) {
|
||||
entry_ptr->coll_access = FALSE;
|
||||
cache_ptr->num_coll_entries --;
|
||||
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
|
||||
}
|
||||
|
||||
@ -10596,7 +10589,6 @@ H5C_make_space_in_cache(H5F_t * f,
|
||||
|
||||
if(TRUE == entry_ptr->coll_access) {
|
||||
entry_ptr->coll_access = FALSE;
|
||||
cache_ptr->num_coll_entries --;
|
||||
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
|
||||
}
|
||||
|
||||
@ -11671,7 +11663,8 @@ done:
|
||||
*
|
||||
* Function: H5C_clear_coll_entries
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose: Clear half or the entire list of collective entries and
|
||||
* mark them as independent.
|
||||
*
|
||||
* Return: FAIL if error is detected, SUCCEED otherwise.
|
||||
*
|
||||
@ -11681,45 +11674,30 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5C_clear_coll_entries(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5C_t * cache_ptr,
|
||||
hbool_t partial)
|
||||
H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial)
|
||||
{
|
||||
int32_t list_len, coll_entries_cleared = 0, coll_dirty_entries=0;
|
||||
int32_t list_len, coll_entries_cleared = 0;
|
||||
H5C_cache_entry_t * entry_ptr = NULL;
|
||||
H5C_cache_entry_t * prev_ptr;
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
//fprintf(stderr, "List len = %d, NUM coll entries = %d\n", cache_ptr->coll_list_len, cache_ptr->num_coll_entries);
|
||||
entry_ptr = cache_ptr->coll_tail_ptr;
|
||||
list_len = cache_ptr->coll_list_len;
|
||||
|
||||
while(entry_ptr && (coll_entries_cleared < (partial ? list_len/2 : list_len))) {
|
||||
prev_ptr = entry_ptr->coll_prev;
|
||||
|
||||
HDassert(entry_ptr->coll_access);
|
||||
|
||||
if(entry_ptr->is_dirty && partial && 0) {
|
||||
coll_dirty_entries ++;
|
||||
//fprintf(stderr, "%d: %llu Coll entry is Dirty\n", mpi_rank, entry_ptr->addr);
|
||||
}
|
||||
else {
|
||||
entry_ptr->coll_access = FALSE;
|
||||
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
|
||||
coll_entries_cleared ++;
|
||||
//fprintf(stderr, "Cleared %llu Coll entries Cleaned = %d\n", entry_ptr->addr, coll_entries_cleared);
|
||||
}
|
||||
entry_ptr->coll_access = FALSE;
|
||||
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
|
||||
coll_entries_cleared ++;
|
||||
|
||||
entry_ptr = prev_ptr;
|
||||
}
|
||||
|
||||
//fprintf(stderr, "NUM COLL entries = %d, CLEARED %d, Dirty %d\n",
|
||||
//cache_ptr->num_coll_entries, coll_entries_cleared, coll_dirty_entries);
|
||||
|
||||
cache_ptr->num_coll_entries -= coll_entries_cleared;
|
||||
//fprintf(stderr, "NUM COLL entries = %d, NUM COLL dirty entries = %d\n", cache_ptr->num_coll_entries, coll_dirty_entries);
|
||||
HDassert(cache_ptr->coll_list_len == cache_ptr->num_coll_entries);
|
||||
//HDassert(0 == coll_dirty_entries - cache_ptr->num_coll_entries);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5C_clear_coll_entries */
|
||||
|
@ -2833,9 +2833,7 @@ if ( ( (entry_ptr) == NULL ) || \
|
||||
{ \
|
||||
(head_ptr) = (entry_ptr)->coll_next; \
|
||||
if ( (head_ptr) != NULL ) \
|
||||
{ \
|
||||
(head_ptr)->coll_prev = NULL; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
@ -2845,14 +2843,10 @@ if ( ( (entry_ptr) == NULL ) || \
|
||||
{ \
|
||||
(tail_ptr) = (entry_ptr)->coll_prev; \
|
||||
if ( (tail_ptr) != NULL ) \
|
||||
{ \
|
||||
(tail_ptr)->coll_next = NULL; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \
|
||||
} \
|
||||
entry_ptr->coll_next = NULL; \
|
||||
entry_ptr->coll_prev = NULL; \
|
||||
(len)--; \
|
||||
@ -3918,7 +3912,6 @@ struct H5C_t {
|
||||
size_t coll_list_size;
|
||||
H5C_cache_entry_t * coll_head_ptr;
|
||||
H5C_cache_entry_t * coll_tail_ptr;
|
||||
int32_t num_coll_entries; /* MSC - used only for debugging - should remove usage*/
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
/* Fields for automatic cache size adjustment */
|
||||
|
@ -1922,8 +1922,7 @@ H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id,
|
||||
int mpi_rank, int mpi_size);
|
||||
H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr);
|
||||
H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr);
|
||||
H5_DLL herr_t H5C_clear_coll_entries(H5F_t * f, hid_t dxpl_id,
|
||||
H5C_t * cache_ptr, hbool_t partial);
|
||||
H5_DLL herr_t H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial);
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
#ifndef NDEBUG /* debugging functions */
|
||||
|
@ -501,6 +501,7 @@ static hbool_t smoke_check_2(int metadata_write_strategy);
|
||||
static hbool_t smoke_check_3(int metadata_write_strategy);
|
||||
static hbool_t smoke_check_4(int metadata_write_strategy);
|
||||
static hbool_t smoke_check_5(int metadata_write_strategy);
|
||||
static hbool_t smoke_check_6(int metadata_write_strategy);
|
||||
static hbool_t trace_file_check(int metadata_write_strategy);
|
||||
|
||||
|
||||
@ -7149,12 +7150,6 @@ trace_file_check(int metadata_write_strategy)
|
||||
*
|
||||
* Purpose: Sixth smoke check for the parallel cache.
|
||||
*
|
||||
* Use random reads to vary the loads on the diffferent
|
||||
* processors. Also force different cache size adjustments.
|
||||
*
|
||||
* In this test, load process 0 heavily, and the other
|
||||
* processes lightly.
|
||||
*
|
||||
* Return: Success: TRUE
|
||||
*
|
||||
* Failure: FALSE
|
||||
|
Loading…
Reference in New Issue
Block a user