| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8795339 commit 9c28cce
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,15 +64,17 @@ int main(int argc, char *argv[]){ | |||
| 64 | 64 | ||
| 65 | 65 | CLI11_PARSE(app, argc, argv); | |
| 66 | 66 | ||
| 67 | - std::cout << "model=" << model << ' ' | ||
| 68 | - << "num_threads=" << num_threads << ' ' | ||
| 69 | - << "num_rounds=" << num_rounds << ' ' | ||
| 70 | - << "num_epochs=" << num_epochs << ' ' | ||
| 71 | - << std::flush; | ||
| 72 | - | ||
| 73 | 67 | double runtime {0.0}; | |
| 74 | 68 | ||
| 75 | 69 | 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 | + | ||
| 76 | 78 | if(model == "tf") { | |
| 77 | 79 | runtime += measure_time_taskflow(num_epochs, num_threads).count(); | |
| 78 | 80 | } | |
@@ -83,10 +85,15 @@ int main(int argc, char *argv[]){ | |||
| 83 | 85 | runtime += measure_time_omp(num_epochs, num_threads).count(); | |
| 84 | 86 | } | |
| 85 | 87 | else assert(false); | |
| 88 | + | ||
| 89 | + std::cout << "avg_cpu(s)=" << runtime / (i+1) / 1e3 << std::endl; | ||
| 86 | 90 | } | |
| 87 | 91 | ||
| 88 | - std::cout << "runtime(s)=" << runtime / num_rounds / 1e3 << std::endl; | ||
| 92 | + | ||
| 89 | 93 | ||
| 90 | 94 | return EXIT_SUCCESS; | |
| 91 | 95 | } | |
| 92 | 96 | ||
| 97 | + | ||
| 98 | + | ||
| 99 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,12 +61,6 @@ int main(int argc, char *argv[]){ | |||
| 61 | 61 | ||
| 62 | 62 | CLI11_PARSE(app, argc, argv); | |
| 63 | 63 | ||
| 64 | - std::cout << "model=" << model << ' ' | ||
| 65 | - << "num_threads=" << num_threads << ' ' | ||
| 66 | - << "num_rounds=" << num_rounds << ' ' | ||
| 67 | - << "num_epochs=" << num_epochs << ' ' | ||
| 68 | - << std::flush; | ||
| 69 | - | ||
| 70 | 64 | { | |
| 71 | 65 | std::string path = std::experimental::filesystem::current_path(); | |
| 72 | 66 | path = path.substr(0, path.rfind("cpp-taskflow") + 12); | |
@@ -78,11 +72,19 @@ int main(int argc, char *argv[]){ | |||
| 78 | 72 | TEST_LABELS = read_mnist_label(path + "./t10k-labels-idx1-ubyte"); | |
| 79 | 73 | } | |
| 80 | 74 | ||
| 81 | - //::srand(time(nullptr)); | ||
| 75 | + ::srand(0); | ||
| 82 | 76 | ||
| 83 | 77 | double runtime {0.0}; | |
| 84 | 78 | ||
| 85 | 79 | 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 | + | ||
| 86 | 88 | if(model == "tf") { | |
| 87 | 89 | runtime += measure_time_taskflow(num_epochs, num_threads).count(); | |
| 88 | 90 | } | |
@@ -93,9 +95,9 @@ int main(int argc, char *argv[]){ | |||
| 93 | 95 | runtime += measure_time_omp(num_epochs, num_threads).count(); | |
| 94 | 96 | } | |
| 95 | 97 | else assert(false); | |
| 96 | - } | ||
| 97 | 98 | ||
| 98 | - std::cout << "runtime(s)=" << runtime / num_rounds / 1e3 << std::endl; | ||
| 99 | + std::cout << "avg_cpu(s)=" << runtime / (i+1) / 1e3 << std::endl; | ||
| 100 | + } | ||
| 99 | 101 | ||
| 100 | 102 | return EXIT_SUCCESS; | |
| 101 | 103 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments