📄 105.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif;} a.at-term { font-style: italic; } </style> <title>Course Problem Set</title> <meta name="Generator" content="ATutor"> <meta name="Keywords" content=""></head><body> <p>
The first four problems are modifications and extensions to the search program shown in Chapter 7. For both these problems remove the code that performs the ISHELL command (for Fortran) and the system command (for C).</p>
<ol>
<li>
You may have noticed in the search program that the boss process sends the appropriate array subsections then does nothing. First, modify the search code so that size of the array b is 12000. Then, have the boss process send out the
second, third, and fourth fourths of b to processes 1, 2, 3 respectively. It should keep the first fourth of b for itself and perform the same search as the workers. All the processes (now including the boss) should send
their output to standard out (the monitor).</li>
<!--<center>
<A HREF="mailto:<a href="mailto:mlp@osc.edu">mlp@osc.edu</a>">Mail Solution</A>
</center></ol><p>-->
<li>
Repeat Probem 1, but this time whenever a worker process finds the mark it should send the global index to the boss process that should receive it. At the finish of the code, the boss process alone should output all the locations to a file called "indices.dat".</li>
<!--<center>
<A HREF="mailto:<a href="mailto:mlp@osc.edu">mlp@osc.edu</a>">Mail Solution</A>
</center><p>-->
<li>
Modify Problem 1 so that each process counts the number of times the mark appears in its sub-array, not the indices where it can be found. Have each process output its part of the total count to standard out.</li>
<!--<center>
<A HREF="mailto:<a href="mailto:mlp@osc.edu">mlp@osc.edu</a>">Mail Solution</A>
</center><p>-->
<li>
Do three separate receive statements have to be made in the search program? If not, rewrite it so that only one receive statement is written. Use the status array to ensure that the proper reception occurred. </li>
<!--<center>
<A HREF="mailto:<a href="mailto:mlp@osc.edu">mlp@osc.edu</a>">Mail Solution</A>
</center><p>-->
<li>
Write an MLP program in which data are exchanged between the rank1 MPI process and the rank3 MPI process. The rank1 MPI processes should calculate the square of the first 200 integers. The resulting values should then be transferred to the rank3 MPI process. The rank3 MPI process should calculate the square root of 100 real values between 20.0 and 70.0. The resulting values should then be transferred to the rank1 MPI process. <em>THE CALCULATIONS DONE BY EACH PROCESS SHOULD BE PERFORMED IN PARALLEL WITH OPENMP THREADS.</em> Output whatever you feel is necessary to confirm that the assigned data transfers occurred
correctly.</li>
<!--<center>
<A HREF="mailto:<a href="mailto:mlp@osc.edu">mlp@osc.edu</a>">Mail Solution</A>
</center><p>-->
<li>
Write an MLP program in which all the MPI processes generate and examine different sets of 2500 random integers. In addition, the rank4 MPI process should use a variable called EvenCount to keep a running total of all the even numbers found by all the MPI processes. That is, if any MPI processes finds an even number it should increment (safely)
the EvenCount variable. The processing of the random numbers used by each MPI process should be done in parallel with OpenMP threads. After all the MPI processes are finished, the rank3 MPI process should output the fraction of
integers found and we will see if it is close to 50%.</li>
<!--<center>
<A HREF="mailto:<a href="mailto:mlp@osc.edu">mlp@osc.edu</a>">Mail Solution</A>
</center>-->
</ol></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -