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 ...@@ -26,7 +26,7 @@ void
modelRun(struct model_config setup, MPI_Comm comm); modelRun(struct model_config setup, MPI_Comm comm);
static const struct model_config default_setup 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, .filetype = FILETYPE_GRB, .datatype = DATATYPE_PACK24,
.compute_checksum = 1, .compute_checksum = 1,
.suffix = "grb", .suffix = "grb",
...@@ -111,7 +111,7 @@ int main (int argc, char *argv[]) ...@@ -111,7 +111,7 @@ int main (int argc, char *argv[])
{ {
int opt; 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 #ifdef USE_MPI
"p:w:" "p:w:"
#endif #endif
...@@ -160,6 +160,21 @@ int main (int argc, char *argv[]) ...@@ -160,6 +160,21 @@ int main (int argc, char *argv[])
case 'n': case 'n':
setup.nlat = parse_intarg("error parsing number of latitudes"); setup.nlat = parse_intarg("error parsing number of latitudes");
break; 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': case 'z':
setup.max_nlev = parse_intarg("error parsing number of levels"); setup.max_nlev = parse_intarg("error parsing number of levels");
if (setup.max_nlev < 1) if (setup.max_nlev < 1)
...@@ -177,7 +192,7 @@ int main (int argc, char *argv[]) ...@@ -177,7 +192,7 @@ int main (int argc, char *argv[])
break; break;
default: /* '?' */ default: /* '?' */
fprintf(stderr, "Usage: %s " 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 #ifdef USE_MPI
" [-p PIO_MODE] [-w NIOSERVERS] [-c]" " [-p PIO_MODE] [-w NIOSERVERS] [-c]"
#endif #endif
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
struct model_config struct model_config
{ {
int nlon, nlat, nts, max_nlev; int nlon, nlat, nts, max_nlev, nvars;
int filetype, datatype; int filetype, datatype;
bool compute_checksum; bool compute_checksum;
const char *suffix; const char *suffix;
......
...@@ -21,7 +21,6 @@ typedef int MPI_Comm; ...@@ -21,7 +21,6 @@ typedef int MPI_Comm;
enum { enum {
ntfiles = 2, ntfiles = 2,
nVars = 5,
}; };
static void static void
...@@ -92,6 +91,7 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -92,6 +91,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
int rank = 0; int rank = 0;
char filename[1024]; char filename[1024];
int nlon = setup.nlon, nlat = setup.nlat; int nlon = setup.nlon, nlat = setup.nlat;
int nVars = setup.nvars;
size_t varslice_size = 0; size_t varslice_size = 0;
#if USE_MPI #if USE_MPI
int *chunks = NULL, *displs = NULL, comm_size = 1; int *chunks = NULL, *displs = NULL, comm_size = 1;
......
Supports Markdown
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