FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

updated workstealing · walker2010cs/cpp-taskflow@9c28cce · GitHub

Commit 9c28cce

Browse files
updated workstealing
1 parent 8795339 commit 9c28cce

4 files changed

Lines changed: 203 additions & 75 deletions

File tree

‎benchmark/mnist/main.cpp‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@ int main(int argc, char *argv[]){
6464

6565
CLI11_PARSE(app, argc, argv);
6666

67-
std::cout << "model=" << model << ' '
68-
<< "num_threads=" << num_threads << ' '
69-
<< "num_rounds=" << num_rounds << ' '
70-
<< "num_epochs=" << num_epochs << ' '
71-
<< std::flush;
72-
7367
double runtime {0.0};
7468

7569
for(unsigned i=0; i<num_rounds; i++) {
70+
71+
std::cout << 'r' << i << ' '
72+
<< "model=" << model << ' '
73+
<< "num_threads=" << num_threads << ' '
74+
<< "num_rounds=" << num_rounds << ' '
75+
<< "num_epochs=" << num_epochs << ' '
76+
<< std::flush;
77+
7678
if(model == "tf") {
7779
runtime += measure_time_taskflow(num_epochs, num_threads).count();
7880
}
@@ -83,10 +85,15 @@ int main(int argc, char *argv[]){
8385
runtime += measure_time_omp(num_epochs, num_threads).count();
8486
}
8587
else assert(false);
88+
89+
std::cout << "avg_cpu(s)=" << runtime / (i+1) / 1e3 << std::endl;
8690
}
8791

88-
std::cout << "runtime(s)=" << runtime / num_rounds / 1e3 << std::endl;
92+
8993

9094
return EXIT_SUCCESS;
9195
}
9296

97+
98+
99+

‎benchmark/parallel_dnn/main.cpp‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ int main(int argc, char *argv[]){
6161

6262
CLI11_PARSE(app, argc, argv);
6363

64-
std::cout << "model=" << model << ' '
65-
<< "num_threads=" << num_threads << ' '
66-
<< "num_rounds=" << num_rounds << ' '
67-
<< "num_epochs=" << num_epochs << ' '
68-
<< std::flush;
69-
7064
{
7165
std::string path = std::experimental::filesystem::current_path();
7266
path = path.substr(0, path.rfind("cpp-taskflow") + 12);
@@ -78,11 +72,19 @@ int main(int argc, char *argv[]){
7872
TEST_LABELS = read_mnist_label(path + "./t10k-labels-idx1-ubyte");
7973
}
8074

81-
//::srand(time(nullptr));
75+
::srand(0);
8276

8377
double runtime {0.0};
8478

8579
for(unsigned i=0; i<num_rounds; i++) {
80+
81+
std::cout << 'r' << i << ' '
82+
<< "model=" << model << ' '
83+
<< "num_threads=" << num_threads << ' '
84+
<< "num_rounds=" << num_rounds << ' '
85+
<< "num_epochs=" << num_epochs << ' '
86+
<< std::flush;
87+
8688
if(model == "tf") {
8789
runtime += measure_time_taskflow(num_epochs, num_threads).count();
8890
}
@@ -93,9 +95,9 @@ int main(int argc, char *argv[]){
9395
runtime += measure_time_omp(num_epochs, num_threads).count();
9496
}
9597
else assert(false);
96-
}
9798

98-
std::cout << "runtime(s)=" << runtime / num_rounds / 1e3 << std::endl;
99+
std::cout << "avg_cpu(s)=" << runtime / (i+1) / 1e3 << std::endl;
100+
}
99101

100102
return EXIT_SUCCESS;
101103
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL