-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexercise-optional-1.tex
61 lines (39 loc) · 1.25 KB
/
exercise-optional-1.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
\documentclass[11pt]{article}
\include{packages}
\begin{document}
% ========== Edit your name here
%\author{Your Name}
\title{\coursename~Quiz Optional 1: Due by 11/5/2021}
\date{}
\maketitle
\medskip
% ========== Begin answering questions here
\section*{Programming exercises}
\begin{lstlisting}
double result = 0;
size_t n = 1e6;
for(size_t i = 0 ; i < n ; i++)
{
result -= std::power(x,i)/i;
}
\end{lstlisting}
\begin{enumerate}
\item
Asynchronous programming using the C++ standard library (10 credits): \\
\begin{enumerate}
\item Write a function to compute a slice of the above \lstinline{for} loop.
\item Split the computation in 2 partitions and use \lstinline{std::async} and \lstinline{std::future} to compute the partial results concurrently.
\item Now, use a \lstinline{std::vector<std::future<double>>} to compute the result for an arbitrary number of partitions $m$.
\end{enumerate}
\item Asynchronous programming using HPX (10 credits)\\
\begin{enumerate}
\item Repeat the above steps using HPX.
\item Use \lstinline{hpx::when_all().then()} to gather the results.
\item Use \lstinline{hpx::dataflow} to gather the results.
\end{enumerate}
% ========== Continue adding items as needed
\end{enumerate}
\doclicenseThis
\end{document}
\grid
\grid