Skip to content

Commit ebc2f35

Browse files
committed
Add timining to coroutines
1 parent 0021aea commit ebc2f35

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

benchmark.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ path=$(pwd)
99
# ${path}/build/src/taylor_future ${len} 0.5 $i >> $1_taylor_future.csv
1010
#done
1111

12-
for i in {64..1}
13-
do
14-
srun ${path}/build/src/taylor_future_hpx ${len} 0.5 $i --hpx:threads=$i >> $1_taylor_future_hpx.csv
15-
done
12+
#for i in {64..1}
13+
#do
14+
# srun ${path}/build/src/taylor_future_hpx ${len} 0.5 $i --hpx:threads=$i >> $1_taylor_future_hpx.csv
15+
#done
16+
17+
#for i in {64..1}
18+
#do
19+
# srun ${path}/build/src/taylor_par_hpx ${len} 0.5 --hpx:threads=$i >> $1_taylor_par_hpx.csv
20+
#done
1621

17-
for i in {64..1}
22+
for i in {42..1}
1823
do
19-
srun ${path}/build/src/taylor_par_hpx ${len} 0.5 --hpx:threads=$i >> $1_taylor_par_hpx.csv
24+
srun ${path}/build/src/taylor_future_coroutine_hpx ${len} 0.5 $i --hpx:threads=$i >> $1_taylor_coroutine_hpx.csv
2025
done

src/taylor_future_coroutine_hpx.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ int main(int args, char** argv) {
5656
int n = std::stoi(argv[1]);
5757
double x = std::stod(argv[2]);
5858
size_t amount = std::stoi(argv[3]);
59-
59+
60+
auto start = std::chrono::high_resolution_clock::now();
6061
double result = run(n, amount, x).get();
62+
63+
auto end = std::chrono::high_resolution_clock::now();
64+
std::chrono::duration<double> diff = end - start;
65+
std::cout << hpx::get_os_thread_count() << "," << diff.count() << std::endl;
6166
std::cout << "Difference of Taylor and C++ result " << result - std::log1p(x)
6267
<< " after " << n << " iterations." << std::endl;
6368
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)