Skip to content

Commit 7a069b3

Browse files
committed
Fix an issue with periodic data flush, minor changes to benchmark code
1 parent 9a3ba68 commit 7a069b3

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

src/server/pdc_server_region/pdc_server_region_cache.c

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,9 @@ PDC_region_cache_clock_cycle(void *ptr)
864864
pdc_obj_cache *obj_cache, *obj_cache_iter;
865865
struct timeval current_time;
866866
struct timeval finish_time;
867-
int nflush = 0;
868-
double flush_frequency_s = PDC_CACHE_FLUSH_TIME_INT, elapsed_time = 0.0;
869-
int server_rank = 0;
867+
int nflush = 0;
868+
int flush_frequency_s = PDC_CACHE_FLUSH_TIME_INT, elapsed_time = 0.0;
869+
int server_rank = 0;
870870

871871
char *p = getenv("PDC_SERVER_CACHE_FLUSH_FREQUENCY_S");
872872
if (p != NULL)
@@ -876,30 +876,15 @@ PDC_region_cache_clock_cycle(void *ptr)
876876
obj_cache_iter = NULL;
877877
}
878878
while (1) {
879-
nflush = 0;
880-
usleep(1000);
881879
pthread_mutex_lock(&pdc_cache_mutex);
882880
if (!pdc_recycle_close_flag) {
883881
pthread_mutex_lock(&pdc_obj_cache_list_mutex);
884882
gettimeofday(&current_time, NULL);
885883
obj_cache_iter = obj_cache_list;
886-
nflush = 0;
884+
nflush = 0;
887885
while (obj_cache_iter != NULL) {
888886
obj_cache = obj_cache_iter;
889-
// flush every *flush_frequency_s seconds
890-
if (obj_cache->timestamp.tv_sec > 0)
891-
elapsed_time = current_time.tv_sec - obj_cache_list->timestamp.tv_sec;
892-
if (elapsed_time >= flush_frequency_s) {
893-
/* char tmbuf[64]; */
894-
/* strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S",
895-
* localtime(&obj_cache->timestamp.tv_sec)); */
896-
/* fprintf(stderr, "Previous %s\n", tmbuf); */
897-
/* strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S", localtime(&current_time.tv_sec)); */
898-
/* fprintf(stderr, "Current %s\n", tmbuf); */
899-
nflush += PDC_region_cache_flush_by_pointer(obj_cache->obj_id, obj_cache);
900-
// Update latest flush time
901-
gettimeofday(&obj_cache_list->timestamp, NULL);
902-
}
887+
nflush += PDC_region_cache_flush_by_pointer(obj_cache->obj_id, obj_cache);
903888
obj_cache_iter = obj_cache_iter->next;
904889
}
905890
if (nflush > 0) {
@@ -913,13 +898,18 @@ PDC_region_cache_clock_cycle(void *ptr)
913898
"==PDC_SERVER[%d]: %s, flushed %d regions to storage (full/every %.0fs), took %.4fs\n",
914899
server_rank, __func__, nflush, flush_frequency_s, elapsed_time);
915900
}
901+
else
902+
fprintf(stderr, "==PDC_SERVER[%d]: %s, no cached data flushed\n", server_rank, __func__);
903+
916904
pthread_mutex_unlock(&pdc_obj_cache_list_mutex);
917905
}
918906
else {
919907
pthread_mutex_unlock(&pdc_cache_mutex);
920908
break;
921909
}
910+
922911
pthread_mutex_unlock(&pdc_cache_mutex);
912+
sleep(flush_frequency_s);
923913
}
924914
return 0;
925915
}

src/tools/hdf5_access_eqsim.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ main(int argc, char **argv)
5353
H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
5454

5555
dapl = H5Pcreate(H5P_DATASET_ACCESS);
56+
if (use_chunk_cache > 0)
57+
H5Pset_chunk_cache(dapl, 1228800, 4294967295, 1);
5658

5759
file = H5Fopen(fname, H5F_ACC_RDONLY, fapl);
5860
if (file < 0)
@@ -70,7 +72,7 @@ main(int argc, char **argv)
7072

7173
//=============Metadata Query=========
7274
// Each rank read 4 values, simulating a lat lon range access
73-
meta_dset = H5Dopen(file, "z coordinates", H5P_DEFAULT);
75+
meta_dset = H5Dopen(file, "z coordinates", dapl);
7476
meta_dspace = H5Dget_space(meta_dset);
7577

7678
offset[0] = start_x[rank / devide_factor] * 2;
@@ -368,6 +370,7 @@ main(int argc, char **argv)
368370

369371
H5Sclose(dspace);
370372

373+
H5Pclose(dapl);
371374
H5Pclose(fapl);
372375
H5Pclose(dxpl);
373376
H5Dclose(dset);

src/tools/pdc_query_eqsim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ main(int argc, char **argv)
189189
#endif
190190

191191
// Construct query constraints
192-
double query_val = 0.5;
192+
double query_val = 0.9;
193193
pdc_query_t *q = PDCquery_create(obj, PDC_GT, PDC_INT, &query_val);
194194

195195
#ifdef ENABLE_MPI

0 commit comments

Comments
 (0)