Skip to content

Commit

Permalink
commented out all prints
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathanlyj committed Dec 1, 2024
1 parent 3c7705a commit edb95b1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/drivers/common/mem_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void NCI_Free_fn(void *ptr,
#ifdef PNC_MALLOC_TRACE
ncmpii_del_mem_entry(ptr);
#endif
free_counter++;
// free_counter++;
free(ptr);
}

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
(xtype == NC_UBYTE && itype == MPI_UNSIGNED_CHAR)) ? 0 : 1
#endif

extern int free_counter;
// extern int free_counter;

extern void *
NCI_Malloc_fn(size_t size, const int lineno, const char *func,
Expand Down
30 changes: 15 additions & 15 deletions src/drivers/ncmpio/ncmpio_close.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "ncmpio_subfile.h"
#endif

int free_counter = 0;
// int free_counter = 0;

/*----< ncmpio_free_NC() >----------------------------------------------------*/
void
Expand All @@ -47,18 +47,18 @@ ncmpio_free_NC(NC *ncp)
ncmpio_free_NC_dimarray(&ncp->dims);
// if (rank == 0)
// printf("ncmpio_free_NC free() count after ncmpio_free_NC_dimarray: %d\n", free_counter);
double dim_free_time = MPI_Wtime() - start_time;
// double dim_free_time = MPI_Wtime() - start_time;
ncmpio_free_NC_attrarray(&ncp->attrs);
// if (rank == 0)
// printf("ncmpio_free_NC free() count after ncmpio_free_NC_attarray: %d\n", free_counter);
start_time = MPI_Wtime();
// start_time = MPI_Wtime();
ncmpio_free_NC_vararray(&ncp->vars);

// if (rank == 0)
// printf("ncmpio_free_NC free() count after ncmpio_free_NC_vararray: %d\n", free_counter);
double var_free_time = MPI_Wtime() - start_time;
if (rank == 0)
printf("dim_free_time: %f, var_free_time: %f\n", dim_free_time, var_free_time);
// double var_free_time = MPI_Wtime() - start_time;
// if (rank == 0)
// printf("dim_free_time: %f, var_free_time: %f\n", dim_free_time, var_free_time);
/* The only case that ncp->mpiinfo is MPI_INFO_NULL is when exiting endef
* from a redef. All other cases reaching here are from ncmpi_close, in
* which case ncp->mpiinfo is never MPI_INFO_NULL.
Expand Down Expand Up @@ -231,16 +231,16 @@ ncmpio_close(void *ncdp)
}

/* free up space occupied by the header metadata */
double free_time_start = MPI_Wtime();
free_counter = 0;
// double free_time_start = MPI_Wtime();
// free_counter = 0;
ncmpio_free_NC(ncp);
double free_time = MPI_Wtime() - free_time_start;
int rank;
MPI_Comm_rank(ncp->comm, &rank);
if (rank == 0){
printf("ncmpio_free_NC time: %f\n", free_time);
printf("ncmpio_free_NC free() count: %d\n", free_counter);
}
// double free_time = MPI_Wtime() - free_time_start;
// int rank;
// MPI_Comm_rank(ncp->comm, &rank);
// // if (rank == 0){
// printf("ncmpio_free_NC time: %f\n", free_time);
// printf("ncmpio_free_NC free() count: %d\n", free_counter);
// }

return status;
}
Expand Down
22 changes: 11 additions & 11 deletions src/drivers/ncmpio/ncmpio_dim.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ ncmpio_free_NC_dimarray(NC_dimarray *ncap)
int i;

assert(ncap != NULL);
double start_time;
double free_dim_array_time;
double free_dim_extra_time;
double free_dim_hash_time;
// double start_time;
// double free_dim_array_time;
// double free_dim_extra_time;
// double free_dim_hash_time;
if (ncap->value != NULL) {
/* when error is detected reading NC_DIMENSION tag, ncap->ndefined can
* be > 0 and ncap->value is still NULL
*/
start_time = MPI_Wtime();
// start_time = MPI_Wtime();
for (i=0; i<ncap->ndefined; i++) {
/* when error is detected reading dimension i, ncap->value[i] can
* still be NULL
Expand All @@ -139,19 +139,19 @@ ncmpio_free_NC_dimarray(NC_dimarray *ncap)
}

NCI_Free(ncap->value);
free_dim_array_time = MPI_Wtime() - start_time;
start_time = MPI_Wtime();
// free_dim_array_time = MPI_Wtime() - start_time;
// start_time = MPI_Wtime();
NCI_Free(ncap->localids);
NCI_Free(ncap->indexes);
ncap->value = NULL;
ncap->localids = NULL;
ncap->indexes = NULL;
free_dim_extra_time = MPI_Wtime() - start_time;
// free_dim_extra_time = MPI_Wtime() - start_time;

}
ncap->ndefined = 0;
ncap->nread = 0;
start_time = MPI_Wtime();
// start_time = MPI_Wtime();
// printf("dimarray ncap->hash_size: %d\n", ncap->hash_size);
#ifndef SEARCH_NAME_LINEARLY
/* free space allocated for dim name lookup table */
Expand All @@ -162,8 +162,8 @@ ncmpio_free_NC_dimarray(NC_dimarray *ncap)
ncap->hash_size = 0;
}
#endif
free_dim_hash_time = MPI_Wtime() - start_time;
printf("free_dim_array_time: %f, free_dim_extra_time: %f, free_dim_hash_time: %f\n", free_dim_array_time, free_dim_extra_time, free_dim_hash_time);
// free_dim_hash_time = MPI_Wtime() - start_time;
// printf("free_dim_array_time: %f, free_dim_extra_time: %f, free_dim_hash_time: %f\n", free_dim_array_time, free_dim_extra_time, free_dim_hash_time);
}

/*----< ncmpio_dup_NC_dimarray() >-------------------------------------------*/
Expand Down
20 changes: 10 additions & 10 deletions src/drivers/ncmpio/ncmpio_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void
ncmpio_free_NC_var(NC_var *varp)
{
if (varp == NULL) return;
int old_free_counter = free_counter;
// int old_free_counter = free_counter;

ncmpio_free_NC_attrarray(&varp->attrs);
// if (first_var)
Expand Down Expand Up @@ -141,10 +141,10 @@ ncmpio_free_NC_vararray(NC_vararray *ncap)

assert(ncap != NULL);
// printf("var ncap->ndefined: %d\n", ncap->ndefined);
int old_free_counter = free_counter;
// int old_free_counter = free_counter;
// first_var = 1;
double start_time, free_var_array_time, free_var_extra_time, free_var_hash_time;
start_time = MPI_Wtime();
// double start_time, free_var_array_time, free_var_extra_time, free_var_hash_time;
// start_time = MPI_Wtime();
if (ncap->value != NULL) {
/* when error is detected reading NC_VARIABLE tag, ncap->ndefined can
* be > 0 and ncap->value is still NULL
Expand All @@ -159,20 +159,20 @@ ncmpio_free_NC_vararray(NC_vararray *ncap)
}

NCI_Free(ncap->value);
free_var_array_time = MPI_Wtime() - start_time;
start_time = MPI_Wtime();
// free_var_array_time = MPI_Wtime() - start_time;
// start_time = MPI_Wtime();
NCI_Free(ncap->localids);
NCI_Free(ncap->indexes);
ncap->localids = NULL;
ncap->indexes = NULL;
ncap->value = NULL;
free_var_extra_time = MPI_Wtime() - start_time;
// free_var_extra_time = MPI_Wtime() - start_time;
// printf("free_var_array_time: %f, free_var_extra_time: %f\n", free_var_array_time, free_var_extra_time);
}
ncap->ndefined = 0;
ncap->nread = 0;
// printf("free_counter after free var array: %d\n", free_counter);
start_time = MPI_Wtime();
// start_time = MPI_Wtime();
// printf("vararray ncap->hash_size: %d\n", ncap->hash_size);
#ifndef SEARCH_NAME_LINEARLY
/* free space allocated for var name lookup table */
Expand All @@ -183,8 +183,8 @@ ncmpio_free_NC_vararray(NC_vararray *ncap)
ncap->hash_size = 0;
}
#endif
free_var_hash_time = MPI_Wtime() - start_time;
printf("free_var_array_time: %f, free_var_extra_time: %f, free_var_hash_time: %f\n", free_var_array_time, free_var_extra_time, free_var_hash_time);
// free_var_hash_time = MPI_Wtime() - start_time;
// printf("free_var_array_time: %f, free_var_extra_time: %f, free_var_hash_time: %f\n", free_var_array_time, free_var_extra_time, free_var_hash_time);
}

/*----< ncmpio_dup_NC_vararray() >-------------------------------------------*/
Expand Down

0 comments on commit edb95b1

Please sign in to comment.