Skip to content

Commit

Permalink
no mpi
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Apr 23, 2024
1 parent c54bf6d commit e38edab
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions utils/soca/gdassoca_obsstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,18 @@ namespace gdasapp {
std::vector<eckit::LocalConfiguration> obsSpaces;
fullConfig.get("obs spaces", obsSpaces);

// check if the number of workers is correct. Only the serial and 1 diag file
// per pe works for now
ASSERT(getComm().size() <= 1 || getComm().size() >= obsSpaces.size());

// initialize pe's color and communicator's name
int color(0);
std::string commNameStr = "comm_idle";
if (this->getComm().rank() < obsSpaces.size()) {
color = 1;
std::string commNameStr = "comm_work";
}

// Create the new communicator ()
char const *commName = commNameStr.c_str();
eckit::mpi::Comm & commObsSpace = this->getComm().split(color, commName);
// only the serial case works for now.
ASSERT(getComm().size() == 1);

// spread out the work over pes
if (color > 0) {
for (int i = 0; i < obsSpaces.size(); i++) {
// get the obs space configuration
auto obsSpace = obsSpaces[commObsSpace.rank()];
auto obsSpace = obsSpaces[i];
eckit::LocalConfiguration obsConfig(obsSpace, "obs space");

// get the obs diag file
std::string obsFile;
obsConfig.get("obsdatain.engine.obsfile", obsFile);
oops::Log::info() << "========= Processing" << obsFile
oops::Log::info() << "========= Processing " << obsFile
<< " date: " << extractDateFromFilename(obsFile)
<< std::endl;

Expand All @@ -86,8 +72,7 @@ namespace gdasapp {
obsSpace.get("variable", variable);

// read the obs space
ioda::ObsSpace ospace(obsConfig, commObsSpace, timeWindow,
oops::mpi::myself());
ioda::ObsSpace ospace(obsConfig, getComm(), timeWindow, getComm());
const size_t nlocs = ospace.nlocs();
oops::Log::info() << "nlocs =" << nlocs << std::endl;
std::vector<float> var(nlocs);
Expand Down Expand Up @@ -125,7 +110,6 @@ namespace gdasapp {
// Close the file
outputFile.close();
}
getComm().barrier();
return EXIT_SUCCESS;
}

Expand Down

0 comments on commit e38edab

Please sign in to comment.