added json for SPF_CreateParallelVariant pass

This commit is contained in:
ALEXks
2025-05-20 16:20:27 +03:00
parent 4bcf83f551
commit b1eeac0b10
3 changed files with 30 additions and 60 deletions

View File

@@ -2,6 +2,7 @@
#include <vector>
#include "dvm.h"
#include "../GraphCall/graph_calls.h"
#include "../Utils/json.hpp"
class ParallelStats
{
@@ -11,10 +12,10 @@ public:
RemoteCount = ShadowCount = ReductionCount = AcrossCount = 0;
}
int RemoteCount;
int ShadowCount;
int ReductionCount;
int AcrossCount;
int RemoteCount = 0;
int ShadowCount = 0;
int ReductionCount = 0;
int AcrossCount = 0;
};
class PredictorStats
@@ -27,28 +28,32 @@ public:
}
ParallelStats ParallelStat;
int ParallelCount;
int RemoteCount;
int RedistributeCount;
int IntervalCount;
int TotalScoreComm;
int TotalScorePar;
int TotalScoreDist;
int ParallelCount = 0;
int RemoteCount = 0;
int RedistributeCount = 0;
int IntervalCount = 0;
int TotalScoreComm = 0;
int TotalScorePar = 0;
int TotalScoreDist = 0;
std::string to_string()
nlohmann::json toJson()
{
std::string res = "";
res += std::to_string(ParallelCount) + "|";
res += std::to_string(RemoteCount) + "|";
res += std::to_string(RedistributeCount) + "|";
res += std::to_string(IntervalCount) + "|";
nlohmann::json stat;
res += std::to_string(ParallelStat.RemoteCount) + "|";
res += std::to_string(ParallelStat.ShadowCount) + "|";
res += std::to_string(ParallelStat.ReductionCount) + "|";
res += std::to_string(ParallelStat.AcrossCount);
stat["ParallelCount"] = ParallelCount;
stat["RemoteCount"] = RemoteCount;
stat["RedistributeCount"] = RedistributeCount;
stat["IntervalCount"] = IntervalCount;
return res;
stat["PS_RemoteCount"] = ParallelStat.RemoteCount;
stat["PS_ShadowCount"] = ParallelStat.ShadowCount;
stat["PS_ReductionCount"] = ParallelStat.ReductionCount;
stat["PS_AcrossCount"] = ParallelStat.AcrossCount;
//TODO: need to improve
// (summed.TotalScoreComm != 0 ? 1.0 / summed.TotalScoreComm : 0.0) + (double)summed.TotalScorePar * 1000 + (countOfDist == 0 ? -5000 : countOfDist);
stat["TotalScore"] = -1 * (ParallelStat.RemoteCount + ParallelStat.ShadowCount + ParallelStat.ReductionCount + ParallelStat.AcrossCount);
return stat;
}
};