You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ Several of the C examples come for Windows or Linux. GCC allows you to cross-com
82
82
83
83
### 2.8. MPICH
84
84
85
-
In order to build and compile our [examples](http://github.com/thomasWeise/distributedComputingExamples/tree/master/mpi/) for using the Message Passing Interface (MPI), we need an MPI implementation. We choose MPICH.
85
+
In order to build and compile our [examples](http://github.com/thomasWeise/distributedComputingExamples/tree/master/mpi/) for using the Message Passing Interface (MPI), we need an [MPI implementation](https://en.wikipedia.org/wiki/Message_Passing_Interface#Implementations). We choose [MPICH](https://en.wikipedia.org/wiki/MPICH).
86
86
87
87
Under Linux, you can install the required files via `sudo apt-get install mpich libmpich-dev`.
A simple MPI test program which does nothing except of initializing and disposing the MPI sub system and printing the size of the current communicator and the rank of the current process in it. Launch any number of instances.
A simple MPI program which performs some simple point-to-point communication: Each process with an even rank sends a message to the process with the next-higher rank and wants to receive a message from the process with the next-lower rank. For the odd-ranked processes, it is the other way around. Launch 2 instances, or 2n instances.
A simple MPI program which performs some simple point-to-point communication: The process with rank 0 sends a string to the process with rank 1 who receives it. Launch two instances.
## 1.5. Estimate Pi with Point-to-Point Communication
34
42
35
43
This program tries to estimate Pi in the same way as done in our Java [client](http://github.com/thomasWeise/distributedComputingExamples/tree/master/sockets/java/src/PiClient.java)/[server](http://github.com/thomasWeise/distributedComputingExamples/tree/master/sockets/java/src/PiServer.java) example for [sockets](http://github.com/thomasWeise/distributedComputingExamples/tree/master/sockets/java/) - just with MPI. Launch 4 or 5 instances. See also examples 1.8 and 1.12.
This program compiles but will enter a deadlock if you run it. The reason is that the processes wait for each other in a cycle. Launch two instances to see how they hang.
### 1.7. Non-Blocking Point-to-Point Communication
46
58
47
59
This program is very similar to the previous one which caused a deadlock. However, we now use non-blocking point-to-point communication. This means that we can initiate a message receive action and then send a message and then wait for the receive to complete. The deadlock disappears. Launch 2 instances.
### 1.8. Estimate Pi with Non-Blocking Point-to-Point Communication
52
66
53
67
Like example 1.5, we try to estimate Pi with point-to-point communication. However, now we perform an asynchronous computation and use non-block point-to-point communication. Launch 4 or 5 instances. See also examples 1.5 and 1.12.
We use a gather-scatter based communication to count the prime numbers amongst the first 1024 numbers. The number range is divided among all workers. See also example 14, launch 4 instances.
This example again tries to estimate Pi, but this time we use gather-scatter based communication. Launch 4 or 5 instances. See also examples 1.5 and 1.8.
Like in example 1.11, we want to count the number of primes amongst the first 1024 natural numbers. This time we use `reduce` in the communication. Launch 4 instances
This example does no communication at all, but it prints the memory layout of a `struct`. This shows that the compiler may align fields in many ways and we cannot compute on where a field of a `struct` but need to use proper addressing.
In order to build and run our examples, you need to have a [C compiler](https://en.wikipedia.org/wiki/List_of_compilers#C_compilers) and an [MPI implementation](https://en.wikipedia.org/wiki/Message_Passing_Interface#Implementations). Here we use [GCC](https://en.wikipedia.org/wiki/GNU_Compiler_Collection) and [MPICH](https://en.wikipedia.org/wiki/MPICH).
132
+
133
+
### 2.1. Installation
134
+
135
+
#### 2.1.1. Linux
136
+
137
+
Under Linux, GCC is usually already installed, otherwise you can do `sudo apt-get install gcc`.
138
+
MPICH can be installed using `sudo apt-get install mpich libmpich-dev`.
139
+
140
+
In some environments, such as [travis ci](https://github.com/travis-ci/apt-package-whitelist/issues/406), it is not possible to install MPICH directly. Here you can do it manually, by executing the following lines in your terminal:
Until a two or so years ago (at the time of this writing), you could use [MPICH](https://en.wikipedia.org/wiki/MPICH) under Windows. Unfortunately, it seems that MPICH supported Windows only [until version `1.4.1p`](http://stackoverflow.com/questions/21153750) and it seems there is no MPICH for Windows anymore, at the time of this writing. We could use `MS-MPI` instead, but getting this to work seems to be a a hassle, see
For now, I list how you can get to MS-MPI from the MPICH size. *I have not yet found out how to get it to run with MinGW (let alone for crosscompilation from Linux to Windows).*_This summary below is thus, basically, useless._
165
+
166
+
1. To download MPICH visit [http://www.mpich.org/downloads/](http://www.mpich.org/downloads/)
167
+
2. Naturally, you would select a Windows distribution of MPICH - scroll down the page until point `Microsoft Windows` at the very bottom.
168
+
3. Click the link. At the time of this writing, this is version [1.0.3](http://msdn.microsoft.com/en-us/library/bb524831%28v=vs.85%29.aspx).
169
+
4. Interestingly, this link will lead you to [Microsoft](https://msdn.microsoft.com/en-us/library/bb524831(v=vs.85).aspx): scroll to "MS-MPI downloads" and click. At the time of this writing, this is [MS-MPI v7](http://go.microsoft.com/FWLink/p/?LinkID=389556).
170
+
5. You arrive at (yet another) [download page](https://www.microsoft.com/en-us/download/details.aspx?id=49926) which also provides installation instructions. Oddly enough, on the page, there is neither a button nor any link for doing the downlad as the time of this writing.
171
+
6. Well, I found [http://www.microsoft.com/en-us/download/details.aspx?id=47259](http://www.microsoft.com/en-us/download/details.aspx?id=47259) from where you can seemingly download version 6 of MS-MPI. Not as good as version 7, but it will do.
172
+
7. When clicking the download button on that page, you get to (arghh!!!) [another download](http://www.microsoft.com/en-us/download/confirmation.aspx?id=47259). There I choose to [download `MSMpiSetup.exe`](https://download.microsoft.com/download/6/4/A/64A7852A-A8C3-476D-908C-30501F761DF3/MSMpiSetup.exe).
173
+
8. After downloading `MSMpiSetup.exe`, right-click it an choose `Run as Administrator`.
174
+
9. In the opening install screen, click `Next`, accept the license agreement by checking the check box and click `Next` again.
175
+
10. Leave the installation path as is (`C:\Program Files\Microsoft MPI\`) and click `Next` again. Then click `Install` and after the process completes, click `Finish`.
176
+
177
+
### 2.2. Building
178
+
179
+
#### 2.2.1. Linux
180
+
181
+
Under Linux, you can now compile each example using `mpicc` which becomes available after the above installation. For instance, you would compile example 1.5. as `mpicc piPointToPoint.c -o piPointToPoint`. For some examples (such as 1.11 and 1.13), you need to add the parameter [`-lm`](http://www.stackoverflow.com/questions/10447791/), as they need to be linked against the math library.
182
+
183
+
#### 2.2.2. Windows
184
+
185
+
As said before, currently not supported by this README.md, sorry.
186
+
187
+
### 2.3. Execution
188
+
189
+
### 2.3.1. Linux
190
+
191
+
After compiling, you can now execute the programs using `mpirun`. For the example 1.5 above, you would do `mpirun -n 4 ./piPointToPoint`.
192
+
193
+
### 2.3.2. Windows
194
+
195
+
As said before, currently not supported by this README.md, sorry.
0 commit comments