Skip to content

Commit dd6e803

Browse files
committed
print configuration of the benchmark
1 parent bb9833d commit dd6e803

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

benchmarks/C/indep_data_obj_create.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,16 @@ int main(int argc, char *argv[]) {
12771277
if (argv[optind] == NULL) strcpy(filename, OUTPUT_NAME);
12781278
else snprintf(filename, 256, "%s", argv[optind]);
12791279

1280+
if (verbose && rank == 0) {
1281+
printf("-------------------------------------------------------------------\n");
1282+
printf("Output NetCDF file name: %s\n", "testfile.nc");
1283+
printf("Number of MPI processes: %d\n", nproc);
1284+
printf("Total number of variables: %d\n", num_vars);
1285+
printf("Number of dimensions per variable: %d\n", num_dims_per_var);
1286+
printf("Number of attributes per variable: %d\n", num_attrs_per_var);
1287+
printf("Hash table size for var and dim: %d\n", hash_size);
1288+
}
1289+
12801290
generate_metadata(rank, nproc, &local_hdr, num_vars, num_dims_per_var, num_attrs_per_var, dim_size, attr_size);
12811291

12821292
MPI_Barrier(MPI_COMM_WORLD);
@@ -1331,10 +1341,7 @@ int main(int argc, char *argv[]) {
13311341
snprintf(hash_size_str, sizeof(hash_size_str), "%d", hash_size);
13321342
MPI_Info_set(info, "nc_hash_size_dim", hash_size_str);
13331343
MPI_Info_set(info, "nc_hash_size_var", hash_size_str);
1334-
if (rank == 0 && verbose){
1335-
printf("Hash table size for dim: %d\n", hash_size);
1336-
printf("Hash table size for var: %d\n", hash_size);
1337-
}
1344+
13381345
if (mem_track){
13391346
app_check_crt_mem(MPI_COMM_WORLD, 0);
13401347
}
@@ -1383,6 +1390,11 @@ int main(int argc, char *argv[]) {
13831390
app_check_crt_mem(MPI_COMM_WORLD, 4);
13841391
pnetcdf_check_crt_mem(MPI_COMM_WORLD, 4);
13851392
}
1393+
MPI_Offset header_size;
1394+
MPI_Offset header_extent;
1395+
err = ncmpi_inq_header_size(ncid, &header_size); ERR
1396+
err = ncmpi_inq_header_extent(ncid, &header_extent); ERR
1397+
13861398
err = ncmpi_close(ncid); ERR
13871399
end_time = MPI_Wtime();
13881400
close_time = end_time - end_time3;
@@ -1391,17 +1403,24 @@ int main(int argc, char *argv[]) {
13911403

13921404

13931405
double times[6] = {end_to_end_time, mpi_time, io_time, enddef_time, total_def_time, close_time};
1394-
char *names[6] = {"end-end", "mpi-phase", "write", "enddef", "def_dim/var", "close"};
1406+
char *names[6] = {"end to end ", "metadata synchronization", "write ", "enddef ", "data object create", "file close "};
13951407
double max_times[6], min_times[6];
13961408

13971409

13981410
MPI_Reduce(&times[0], &max_times[0], 6, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
13991411
MPI_Reduce(&times[0], &min_times[0], 6, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
1400-
for (int i = 0; i < 6; i++) {
1401-
if (rank == 0 && verbose) {
1402-
printf("Min %s time: %f seconds\n", names[i], min_times[i]);
1403-
printf("Max %s time: %f seconds\n", names[i], max_times[i]);
1412+
if (rank == 0 && verbose) {
1413+
printf("Output NetCDF file header size: %lld B\n", header_size);
1414+
printf("Output NetCDF file header extent: %lld B\n", header_extent);
1415+
printf("-------------------------------------------------------------------\n");
1416+
double mib = total_recv_size / (1024.0);
1417+
double gib = total_recv_size / (1024.0 * 1024.0);
1418+
printf("Total metadata amount = %10d B = %10.2f MiB = %8.2f GiB\n", total_recv_size, mib, gib);
1419+
for (int i = 0; i < 6; i++) {
1420+
// printf("Min %s time: %f seconds\n", names[i], min_times[i]);
1421+
printf("Max %-25s time = %.4f sec\n", names[i], max_times[i]);
14041422
}
1423+
printf("-------------------------------------------------------------------\n");
14051424
}
14061425
if (mem_track){
14071426
app_check_crt_mem(MPI_COMM_WORLD, 5);

0 commit comments

Comments
 (0)