Skip to content
Snippets Groups Projects
Commit 11754305 authored by KyleKlenk's avatar KyleKlenk
Browse files

created timingInfo class

parent 5d7c78d4
No related branches found
No related tags found
No related merge requests found
#pragma once
#include <chrono>
#include <optional>
#include <vector>
using chrono_time = std::chrono::time_point<std::chrono::system_clock>;
class TimingInfo {
private:
std::vector<std::optional<chrono_time>> start;
std::vector<std::optional<chrono_time>> end;
std::vector<std::optional<std::string>> name_of_time_point; // the name you want for the time point (ie. reading, writing, duration)
int num_time_points;
public:
TimingInfo();
~TimingInfo();
void addTimePoint(std::string time_point_name);
void updateTimePoint(std::string time_point_name);
};
\ No newline at end of file
......@@ -8,8 +8,16 @@
namespace caf {
struct summa_actor_timing_info {
std::chrono::time_point<std::chrono::system_clock> start;
std::chrono::time_point<std::chrono::system_clock> end;
double summa_actor_duration;
};
struct summa_actor_state {
// Timing Information
// Timing Information For Summa-Actor
std::chrono::time_point<std::chrono::system_clock> start;
std::chrono::time_point<std::chrono::system_clock> end;
double duration;
......
......@@ -249,6 +249,7 @@ SOURCE_DIR = /globalhome/kck540/HPC/SummaProjects/Summa-Actors/build/source/acto
GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
GLOBAL = $(SOURCE_DIR)/global/global.cpp
TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
......@@ -321,7 +322,7 @@ clean_fortran:
################################################ COMPILE SUMMA-C++ ################################################
###################################################################################################################
compile_globals:
$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(GLOBAL_INCLUDES)
$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(GLOBAL_INCLUDES)
compile_hru_actor:
$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
......
#include "timing_info.hpp"
TimingInfo::TimingInfo() {
this->num_time_points = 0;
}
TimingInfo::~TimingInfo(){}
void TimingInfo::addTimePoint(std::string time_point_name) {
this->name_of_time_point.push_back(time_point_name);
this->start.push_back({});
this->end.push_back({});
this->num_time_points++;
}
\ No newline at end of file
......@@ -59,20 +59,11 @@ behavior job_actor(stateful_actor<job_state>* self, int startGRU, int numGRU,
aout(self) << "Job Actor Initalized \n";
return {
// *******************************************************************************************
// *********************************** INTERFACE WITH HRU ************************************
// *******************************************************************************************
/**
*
*/
[=](init_hru) {
initalizeGRU(self);
},
/**
*
*/
[=](done_init_hru) {
if (debug) {
aout(self) << "Done Init\n";
......@@ -88,7 +79,6 @@ behavior job_actor(stateful_actor<job_state>* self, int startGRU, int numGRU,
}
},
[=](done_hru, int indxGRU, double totalDuration, double initDuration,
double forcingDuration, double runPhysicsDuration, double writeOutputDuration) {
aout(self) << "GRU:" << self->state.GRUList[indxGRU - 1]->getRefGRU()
......@@ -115,7 +105,6 @@ behavior job_actor(stateful_actor<job_state>* self, int startGRU, int numGRU,
}
},
[=](run_failure, caf::actor actorRef, int indxGRU, int err) {
aout(self) << "GRU:" << self->state.GRUList[indxGRU - 1]->getRefGRU()
<< "indxGRU = " << indxGRU << "Failed \n"
......@@ -134,23 +123,12 @@ behavior job_actor(stateful_actor<job_state>* self, int startGRU, int numGRU,
}
},
// *******************************************************************************************
// ******************************* END INTERFACE WITH HRU ************************************
// *******************************************************************************************
// *******************************************************************************************
// ****************************** INTERFACE WITH FileAccessActor *****************************
// *******************************************************************************************
/**
*
*/
[=](done_file_access_actor_init) {
// Init GRU Actors and the Output Structure
// self->send(self->state.file_access_actor, initalize_outputStructure_v);
self->send(self, init_hru_v);
},
[=](file_access_actor_done, double readDuration, double writeDuration) {
[=](file_access_actor_done, double read_duration, double write_duration) {
int err = 0;
if (debug) {
aout(self) << "\n********************************\n";
......@@ -178,13 +156,14 @@ behavior job_actor(stateful_actor<job_state>* self, int startGRU, int numGRU,
aout(self) << " " << (self->state.duration / 1000) / 60 << " Minutes\n";
aout(self) << " " << ((self->state.duration / 1000) / 60) / 60 << " Hours\n";
aout(self) << "\nReading Duration:\n";
aout(self) << " " << readDuration << " Seconds\n";
aout(self) << " " << read_duration << " Seconds\n";
aout(self) << "\nWriting Duration:\n";
aout(self) << " " << writeDuration << " Seconds\n\n";
aout(self) << " " << write_duration << " Seconds\n\n";
cleanUpJobActor(&err);
// Tell Parent we are done
self->send(self->state.parent, done_job_v, self->state.numGRUFailed);
self->send(self->state.parent, done_job_v, self->state.numGRUFailed, self->state.duration,
read_duration, write_duration);
self->quit();
},
......
......@@ -35,7 +35,7 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, int startGRU, int
spawnJob(self);
return {
[=](done_job, int numFailed) {
[=](done_job, int numFailed, int job_duration, int read_duration, int write_duration) {
self->state.numFailed += numFailed;
aout(self) << "Job Done\n";
if (self->state.numGRU <= 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment