Commit 054de60c authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Add configurable number of variables to test.

parent 0c564d98
......@@ -26,7 +26,7 @@ void
modelRun(struct model_config setup, MPI_Comm comm);
static const struct model_config default_setup
= { .nlon = 12, .nts = 3, .nlat = 6,
= { .nlon = 12, .nts = 3, .nlat = 6, .nvars = 5,
.filetype = FILETYPE_GRB, .datatype = DATATYPE_PACK24,
.compute_checksum = 1,
.suffix = "grb",
......@@ -111,7 +111,7 @@ int main (int argc, char *argv[])
{
int opt;
while ((opt = getopt(argc, argv, "f:m:n:z:t:c"
while ((opt = getopt(argc, argv, "f:m:n:z:t:y:c"
#ifdef USE_MPI
"p:w:"
#endif
......@@ -160,6 +160,21 @@ int main (int argc, char *argv[])
case 'n':
setup.nlat = parse_intarg("error parsing number of latitudes");
break;
case 'y':
setup.nvars = parse_intarg("error parsing number of variables");
if (setup.nvars < 1)
{
fputs("number of levels must be greater than zero!\n",
stderr);
exit(EXIT_FAILURE);
}
if (setup.nvars > 127)
{
fputs("number of variables must not exceed 127!\n",
stderr);
exit(EXIT_FAILURE);
}
break;
case 'z':
setup.max_nlev = parse_intarg("error parsing number of levels");
if (setup.max_nlev < 1)
......@@ -177,7 +192,7 @@ int main (int argc, char *argv[])
break;
default: /* '?' */
fprintf(stderr, "Usage: %s "
"[-m nlon] [-n nlat] [-z nlev] [-t nts]"
"[-m nlon] [-n nlat] [-z nlev] [-t nts] [-y num_vars]"
#ifdef USE_MPI
" [-p PIO_MODE] [-w NIOSERVERS] [-c]"
#endif
......
......@@ -9,7 +9,7 @@
struct model_config
{
int nlon, nlat, nts, max_nlev;
int nlon, nlat, nts, max_nlev, nvars;
int filetype, datatype;
bool compute_checksum;
const char *suffix;
......
......@@ -21,7 +21,6 @@ typedef int MPI_Comm;
enum {
ntfiles = 2,
nVars = 5,
};
static void
......@@ -92,6 +91,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
int rank = 0;
char filename[1024];
int nlon = setup.nlon, nlat = setup.nlat;
int nVars = setup.nvars;
size_t varslice_size = 0;
#if USE_MPI
int *chunks = NULL, *displs = NULL, comm_size = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment