Skip to content

Commit c28c60e

Browse files
author
Christos Konstantinos Matzoros
committed
Adding Growlocal_SSP_Perm_Proc with BSP kernel Execution
1 parent 9ec9842 commit c28c60e

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

apps/maxbsp_ssp_sptrsv.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ enum class Algorithm {
5454
GrowLocalSsp,
5555
GrowLocalSspPermSteps,
5656
GrowLocalSspPermProcs,
57+
GrowLocalSspPermProcsBspExec,
5758
GrowLocal,
5859
GrowLocalPermSteps,
5960
Serial
@@ -178,6 +179,8 @@ bool ParseArgs(int argc, char *argv[], Args &args) {
178179
args.algorithms.insert(Algorithm::GrowLocalSspPermSteps);
179180
} else if (flag == "--growlocal-ssp-perm-proc") {
180181
args.algorithms.insert(Algorithm::GrowLocalSspPermProcs);
182+
} else if (flag == "--growlocal-ssp-perm-proc-bsp-exec") {
183+
args.algorithms.insert(Algorithm::GrowLocalSspPermProcsBspExec);
181184
} else if (flag == "--growlocal") {
182185
args.algorithms.insert(Algorithm::GrowLocal);
183186
} else if (flag == "--growlocal-perm-step") {
@@ -188,6 +191,7 @@ bool ParseArgs(int argc, char *argv[], Args &args) {
188191
args.algorithms = {Algorithm::VarianceSsp,
189192
Algorithm::GrowLocalSsp,
190193
Algorithm::GrowLocalSspPermProcs,
194+
Algorithm::GrowLocalSspPermProcsBspExec,
191195
Algorithm::GrowLocalSspPermSteps,
192196
Algorithm::GrowLocal,
193197
Algorithm::GrowLocalPermSteps,
@@ -589,6 +593,57 @@ int main(int argc, char *argv[]) {
589593
}
590594
}
591595

596+
if (args.algorithms.count(Algorithm::GrowLocalSspPermProcsBspExec) > 0U) {
597+
GrowLocalSSP<SparseMatrixImp<int32_t>, kDefaultStaleness> scheduler;
598+
MaxBspSchedule<SparseMatrixImp<int32_t>> schedule(instance);
599+
600+
const auto t0 = std::chrono::high_resolution_clock::now();
601+
scheduler.ComputeSchedule(schedule);
602+
const auto t1 = std::chrono::high_resolution_clock::now();
603+
const double scheduleTime = std::chrono::duration<double>(t1 - t0).count();
604+
605+
std::vector<SparseMatrixImp<int32_t>::VertexIdx> perm;
606+
sptrsv.SetupCsrWithPermutationProcessorsFirst(schedule, perm);
607+
const unsigned supersteps = schedule.NumberOfSupersteps();
608+
const int syncCosts = ComputeSyncCosts(instance);
609+
610+
bool correct = false;
611+
std::vector<double> x(n, 1.0);
612+
sptrsv.x_ = x.data();
613+
for (int iter = 0; iter < args.iterations + preMeasureIterations; ++iter) {
614+
resetOnes(x);
615+
616+
const auto s = std::chrono::high_resolution_clock::now();
617+
sptrsv.LsolveWithProcFirstPermutationInPlace();
618+
const auto e = std::chrono::high_resolution_clock::now();
619+
const double runtime = std::chrono::duration<double>(e - s).count();
620+
621+
if (iter == 0) {
622+
sptrsv.PermuteXVector(perm);
623+
const double diff = LInftyNormalisedDiff(x, serialRefX);
624+
correct = (diff < EPSILON);
625+
std::cout << " Growlocal_SSP_Perm_Proc_BSP_Exec first-run max relative diff vs serial: " << diff << std::endl;
626+
}
627+
628+
if (iter >= preMeasureIterations) {
629+
bufferedRows.emplace_back(CsvRow{graphName,
630+
"Growlocal_SSP_Perm_Proc_BSP_Exec",
631+
args.processors,
632+
scheduleTime,
633+
supersteps,
634+
syncCosts,
635+
kDefaultStaleness,
636+
runtime,
637+
correct});
638+
}
639+
}
640+
641+
for (auto it = std::next(bufferedRows.cbegin(), writtenEntries); it != bufferedRows.cend(); ++it) {
642+
WriteCsvRow(csv, *it);
643+
++writtenEntries;
644+
}
645+
}
646+
592647
if (args.algorithms.count(Algorithm::GrowLocal) > 0U) {
593648
OldGrowLocalAutoCoresParallel<SparseMatrixImp<int32_t>> scheduler;
594649
BspSchedule<SparseMatrixImp<int32_t>> schedule(instance);

0 commit comments

Comments
 (0)