Skip to content

Commit

Permalink
Declare mpi_rank unconditionally to simplify other logic
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilMiller committed Jan 8, 2024
1 parent 8c22886 commit bf268b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/NGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ std::string nexusDataFile = "";
std::string REALIZATION_CONFIG_PATH = "";
bool is_subdivided_hydrofabric_wanted = false;

// Define in the non-MPI case so that we don't need to conditionally compile `if (mpi_rank == 0)`
int mpi_rank = 0;

#ifdef NGEN_MPI_ACTIVE

#ifndef MPI_HF_SUB_CLI_FLAG
Expand All @@ -50,10 +53,7 @@ bool is_subdivided_hydrofabric_wanted = false;
#include <HY_Features_MPI.hpp>

std::string PARTITION_PATH = "";
int mpi_rank;
int mpi_num_procs;
#else // NGEN_MPI_ACTIVE
int mpi_rank = 0;
#endif // NGEN_MPI_ACTIVE

#include <Layer.hpp>
Expand Down

0 comments on commit bf268b8

Please sign in to comment.