|
NEP 4.3.0
NetCDF Expansion Pack
|
Benchmark four-rank collective nxCDF write and read throughput with disk-bound timing. More...
#include <mpi.h>#include <netcdf.h>#include <netcdf_par.h>#include <nep.h>#include "nxcdf/nxcdf.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include "perf_disk.h"Data Structures | |
| struct | row_t |
| One benchmark row for one field/type/storage configuration. More... | |
Macros | |
| #define | ROWS 512 |
| #define | NX 1536 |
| #define | NREPS 10 |
| #define | TMP_FILE "parallel_perf_tmp.nc" |
| #define | ERRCODE 2 |
| #define | ERR(e) |
| #define | NCONFIGS 2 |
Functions | |
| static int | run_config (MPI_Comm comm, int rank, int size, int deflate, const float *data, float *rbuf, row_t *row) |
| Write and read the slab in one configuration NREPS times. | |
| int | main (int argc, char **argv) |
| Main entry point. | |
Benchmark four-rank collective nxCDF write and read throughput with disk-bound timing.
Each rank owns one contiguous slab of a two-dimensional NC_FLOAT variable and transfers it with nc_put_vara_float()/nc_get_vara_float() under the default (collective for filtered variables, independent otherwise) parallel access. Two storage configurations are timed: contiguous and chunked+shuffle+deflate level 1 (the deflate rows force NC_COLLECTIVE). Every read is checked bit-for-bit against the data written.
Write time covers nc_create_par() through nc_close() plus a rank-0 fsync() of the file (nep_perf_sync_file()), so data has reached the storage device; before each read rank 0 drops the file from the page cache (nep_perf_drop_cache(), untimed) and read time covers nc_open_par() through nc_close(). Each phase ends with an MPI_Allreduce so the reported number is the slowest rank's wall time (MPI_Wtime). NREPS (10) repetitions run per configuration and the minimum times are kept.
Output: CSV written to the path given on the command line, with columns:
Each row is also printed to stdout on rank 0.
Typical workflow:
| #define ERR | ( | e | ) |
| #define ERRCODE 2 |
| #define NCONFIGS 2 |
Number of storage configurations: contiguous, deflate1.
| #define NREPS 10 |
Repetitions per configuration; the minimum time is kept.
| #define NX 1536 |
Columns in the variable.
| #define ROWS 512 |
Slab rows written by each rank.
| #define TMP_FILE "parallel_perf_tmp.nc" |
Temporary NetCDF file created for each measurement.
| int main | ( | int | argc, |
| char ** | argv ) |
Main entry point.
Fills each rank's slab with a rank-identifying pattern, runs the contiguous and deflate1 configurations and writes one CSV row per configuration on rank 0.
| argc | Argument count; must be 2. |
| argv | argv[1] is the output CSV path. |
|
static |
Write and read the slab in one configuration NREPS times.
For each repetition all ranks create TMP_FILE with nc_create_par(NC_NXCDF | NC_NETCDF4 | NC_CLOBBER) — NC_NETCDF4 is required because upstream nc_create_par() gates on it — define dims row = mpi_size*ROWS and col = NX and one NC_FLOAT variable, collectively write each rank's slab, close and fsync (timed), then drop the page cache (untimed) and collectively read the slab back (timed). The deflate1 configuration is chunked ROWSxNX with shuffle+deflate level 1, which forces collective access.
| comm | MPI communicator. |
| rank | This rank. |
| size | Number of ranks. |
| deflate | Non-zero for shuffle+deflate level 1. |
| data | This rank's slab (ROWS*NX floats). |
| rbuf | Read-back slab (ROWS*NX floats). |
| row | Result row to fill in. |