1 | |
---|
2 | a native MPI library (e.g.\ LAM/MPI or MPICH), |
---|
3 | that |
---|
4 | that the MPI runtime system is up and running (e.g.\ using \texttt{lamboot}). |
---|
5 | If not please see the installation notes at the pypar web site. |
---|
6 | |
---|
7 | |
---|
8 | %Taken from exercise 5 |
---|
9 | |
---|
10 | \subsection*{Preliminaries} |
---|
11 | |
---|
12 | \subsubsection*{The shell configuration} |
---|
13 | Log in using the username you created previously. |
---|
14 | You will need to configure a few environment variables to make |
---|
15 | life simpler. |
---|
16 | Environment variables control the way you personally interact with the |
---|
17 | shell and they are defined in the file \texttt{.bashrc} which lives in |
---|
18 | your home directory. Edit \texttt{.bashrc} and add the following lines |
---|
19 | |
---|
20 | \begin{verbatim} |
---|
21 | export PATH=.:$HOME/bin:${PATH} |
---|
22 | export LAMRSH="ssh -x" |
---|
23 | \end{verbatim} |
---|
24 | |
---|
25 | The first line asks the shell to always look for files in the directory |
---|
26 | you are working in. The second tells the MPI runtime system to use |
---|
27 | secure shell (ssh) without graphics capabilities (X11). |
---|
28 | Close the shell window and open a new one for this to take effect. |
---|
29 | |
---|
30 | \subsubsection*{Setting up the secure shell environment} |
---|
31 | |
---|
32 | Next we will make sure that you can access all machines without having to |
---|
33 | type in your password every time. The secure shell (ssh) has a capability |
---|
34 | to store your password encrypted on your disk and automatically provide |
---|
35 | it when needed. To accomplish this you need the following steps: |
---|
36 | |
---|
37 | \begin{enumerate} |
---|
38 | \item ssh-keygen -t rsa (Generate codes for the encryption)\\ |
---|
39 | \emph{When asked for a filename, just go with the suggested default. |
---|
40 | When asked for a passphrase just press \textbf{Enter} twice} |
---|
41 | \item cd \verb+~/.ssh+ |
---|
42 | \item cp id\_rsa.pub authorized\_keys |
---|
43 | \end{enumerate} |
---|
44 | |
---|
45 | Whenever you try to log into a remote host using ssh, your host will |
---|
46 | negotiate with the remote host using these keys and if accepted provide |
---|
47 | the password automatically. To test try |
---|
48 | \begin{verbatim} |
---|
49 | ssh ninja-n whoami |
---|
50 | \end{verbatim} |
---|
51 | where |
---|
52 | \[ |
---|
53 | n = 1, 2, \ldots 8 |
---|
54 | \] |
---|
55 | This will log you in briefly issue the command \texttt{whoami}, |
---|
56 | display the result and log you out again. |
---|
57 | |
---|
58 | The first time you do this you will see the message |
---|
59 | \begin{verbatim} |
---|
60 | The authenticity of host 'ninja-8 (192.168.1.8)' can't be established. |
---|
61 | RSA key fingerprint is 06:eb:b3:e0:f1:57:35:0e:58:49:b4:48:46:fb:5c:aa. |
---|
62 | Are you sure you want to continue connecting (yes/no)? |
---|
63 | \end{verbatim} |
---|
64 | which means that this is the first time the encrypted connection |
---|
65 | is to be established. Just type \texttt{yes}. |
---|
66 | You might also see a warning message about X11 forwarding which |
---|
67 | you can ignore. From now on you should be able to move freely among |
---|
68 | the hosts in our cluster. |
---|
69 | See \texttt{man ssh} for more information. |
---|
70 | |
---|
71 | \subsection*{The MPI runtime system} |
---|
72 | |
---|
73 | We are now ready to start the \emph{MPI runtime system} which comprises a |
---|
74 | number of servers (one on each machine) who will allow you to execute |
---|
75 | MPI programs in parallel. |
---|
76 | |
---|
77 | The runtime system needs a configuration file listing |
---|
78 | the hosts who are participating in the cluster. |
---|
79 | Create a file called \texttt{.lamhosts} in your |
---|
80 | home directory (\verb+~+). |
---|
81 | To begin with list \emph{only} the machine you are working on, e.g. |
---|
82 | \begin{verbatim} |
---|
83 | ninja-n |
---|
84 | \end{verbatim} |
---|
85 | where n is the number you are working on. |
---|
86 | Later we will add more machines. |
---|
87 | %namely \texttt{ninja-1} to \texttt{ninja-8}. |
---|
88 | |
---|
89 | The MPI runtime is then started by issuing the command |
---|
90 | \begin{verbatim} |
---|
91 | lamboot -v ~/.lamhosts |
---|
92 | \end{verbatim} |
---|
93 | which reads the configuration file, logs in to all listed hosts and |
---|
94 | start the MPI servers. |
---|
95 | You should see a diagnostic message like |
---|
96 | \begin{verbatim} |
---|
97 | LAM 6.5.8/MPI 2 C++/ROMIO - Indiana University |
---|
98 | |
---|
99 | Executing hboot on n2 (ninja-n - 1 CPU)... |
---|
100 | \end{verbatim} |
---|
101 | and you are ready to run MPI. |
---|
102 | |
---|
103 | |
---|
104 | |
---|