NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_mpi_distributor.h
Go to the documentation of this file.
1
10#ifndef _BE_MPI_DISTRIBUTOR_H
11#define _BE_MPI_DISTRIBUTOR_H
12
13#include <memory>
14#include <set>
15#include <string>
16
17#include <be_error_exception.h>
18#include <be_io_logsheet.h>
20#include <be_mpi.h>
21#include <be_mpi_resources.h>
22#include <be_mpi_workpackage.h>
23
24namespace BiometricEvaluation {
25 namespace MPI {
52 public:
57 static const std::string CHECKPOINTFILENAME;
58
63 static const std::string CHECKPOINTREASON;
64
69 static const std::string CHECKPOINTPID;
70
81 Distributor(const std::string &propertiesFileName);
82
83 virtual ~Distributor();
84
93 void start();
94
95 protected:
104 virtual void createWorkPackage(
105 MPI::WorkPackage &workPackage) = 0;
106
121 virtual void checkpointSave(
122 const std::string &reason) = 0;
123
134 virtual void checkpointRestore() = 0;
135
142 std::shared_ptr<IO::Logsheet> getLogsheet() const;
143
150 std::shared_ptr<IO::PropertiesFile>
152
153 private:
161 void distributeWork();
162
167 void sendWorkPackage(
168 MPI::WorkPackage &workPackage,
169 int MPITask);
170
178 void shutdown();
179
180 std::unique_ptr<MPI::Resources> _resources;
181
182 /* The list of tasks accepting work */
183 std::set<int> _activeMpiTasks;
184
185 std::shared_ptr<IO::Logsheet> _logsheet;
186 std::shared_ptr<IO::PropertiesFile> _checkpointData;
187 };
188 }
189}
190
191#endif /* _BE_MPI_DISTRIBUTOR_H */
192
A class to represent an MPI task that distributes work to other tasks.
static const std::string CHECKPOINTPID
The process ID of the checkpointing Distributor process, "PID".
virtual void checkpointRestore()=0
Restore from a checkpoint state.
void start()
Start of MPI processing for the distributor.
static const std::string CHECKPOINTFILENAME
The name of the checkpoint properties file, "Distributor.chk".
Distributor(const std::string &propertiesFileName)
Constructor with properties file name.
virtual void checkpointSave(const std::string &reason)=0
Create a checkpoint state.
std::shared_ptr< IO::PropertiesFile > getCheckpointData() const
Get access to the checkpoint data object.
static const std::string CHECKPOINTREASON
The reason string given for the checkpoint to be taken, "Reason".
std::shared_ptr< IO::Logsheet > getLogsheet() const
Get access to the Logsheet object.
virtual void createWorkPackage(MPI::WorkPackage &workPackage)=0
Create a work package for distribution.
A class to represent a piece of work to be acted upon by a processor.
This software was developed at the National Institute of Standards and Technology (NIST) by employees...