-
Notifications
You must be signed in to change notification settings - Fork 17
/
hw11.tex
39 lines (27 loc) · 2.38 KB
/
hw11.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
\documentclass[12pt]{article}
\usepackage{fullpage,hyperref}\setlength{\parskip}{3mm}\setlength{\parindent}{0mm}
\begin{document}
\begin{center}\bf
Homework 11. Due by 11:59pm on Sunday 12/1.
Statistical computing on greatlakes
\end{center}
From homework 10, we understand the relevance of being able to implement embarrassingly parallel calculations. In the context of statistical computing in R, we are motivated to learn to use \texttt{foreach} on the greatlakes cluster. In this homework we carry out a simple example, but once you can run a simple parallel for loop on greatlakes you are prepared for most simulation experiments that arise in statistics PhD research. Work through the questions below and write brief answers to the following questions, by editing the tex file available at \url{https://github.com/ionides/810f24}, and submit the resulting pdf file via Canvas.
\begin{enumerate}
\item R and Python have a reputation of being convenient for data analysis but slow in some situations. Loops can be slow in R, though careful coding may avoid this (\url{https://adv-r.hadley.nz/control-flow.html#common-pitfalls}). If R run time starts limiting your research---i.e., whenever there is a numerical result you would like to see but you don't have the patience to wait for it to be computed---you have various options, including:
\begin{enumerate}
\item Use smaller examples.
\item Write the critical part of your code in C called from R. This can make use of the C functions underpinning the R language\\
(\url{https://cran.r-project.org/doc/manuals/R-exts.html#The-R-API}).
\\
Alternatively, the Rcpp package facilitates combining R with compiled C++ code.
\item Work on rewriting your R code to make it more efficient.
\item Run your code on a more powerful machine, maybe moving from your laptop to greatlakes.
\end{enumerate}
Comment on situations when each approach might be suitable. Do you have advice, or relevant experiences?
YOUR ANSWER HERE.
\item Follow the instructions at \url{https://ionides.github.io/810f24/gl/slides.pdf} to run a job testing foreach on greatlakes. Report back on any problems that arose.
YOUR ANSWER HERE.
\item How do you explain the differences in results between running \texttt{test.sbat} and \texttt{test2.sbat}? You will need to inspect the code in \texttt{test.R} and \texttt{test2.R}.
YOUR ANSWER HERE.
\end{enumerate}
\end{document}