|
Parallel programming Practical 2011/2012 |
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
The Java assignmentIntroductionThis assignment for the parallel programming course consists of writing a parallel program in Java using the Ibis systeem and running it on the DAS-3. Your task is to write a parallel branch-and-bound program that uses the IDA* search strategy to solve the 15-puzzle. Send any questions you have for this assignment to Timo van Kessel: The 15-puzzle is played on a 4 X 4 board, in which fifteen tiles are placed. A move consists of sliding one of the fifteen tiles into the remaining space. The object is to reach the goal state shown in Figure 1(b).
The IDA* search strategyThe Iterative Deepening A* algorithm is a depth first search technique. A pseudo code implementation is given below: FUNCTION Solve(state, depth) : Boolean; BEGIN
IF depth+Estimate(state) <= MaxDepth THEN
IF Goal(state) THEN
PrintSolution;
RETURN true;
ELSE
FOR s IN Moves(state) DO
IF Solve(s, depth+1) THEN
RETURN true;
FI;
OD;
FI;
FI;
RETURN false; END;
MaxDepth := Estimate(Start); WHILE NOT Solve(Start, 0) DO
MaxDepth +:= 1; OD;
IDA* repeatedly performs a depth-first search. Initially the maximum depth to search with is set to the estimated number of moves to solve the starting position. As long as no solution is found the global variable MaxDepth is increased by one, and the search continues. In the case of solving the 15-puzzle with an Estimate() function using Manhattan distances MaxDepth can be even increased by two.
The Manhattan distance
is the distance between two points (x, y) and (u, v) given by the metric
Solve() implements IDA* using the following functions:
It is straightforward to parallelize the IDA* algorithm, because the loop iterations over the possible moves in Solve() are independent of each other. For efficiency, however, the grain size of the leaf jobs should be controlled to avoid creating many very small jobs. The Ibis Portability Layer (IPL)The Ibis Portability Layer (IPL) is a communication library, and part of the Ibis project at the VU. The IPL is capable of providing applications with a simple yet powerful way of communicating between Java applications. See the Ibis site for more information. A good starting point for the IPL might be the programmers's manual and user's guide included in the distribution (and the template of the assignment). If you have any questions on the IPL after reading the manual, please send mail to the practical mail address, not the Ibis mailing lists. RequirementsConvert the given sequential version of the solver into a parallel application that it is capable of running on multiple DAS-3 machines in parallel. To communicate, use the Ibis Portability Layer (IPL). Implement a work queue to handle passing work to the machines. You can use a single work queue, located on one of the machines. You can, for instance, elect one of the machines as "master" using the election mechanism of the IPL Benchmark your application by running it on the DAS-3 system. Try to get as close to perfect speedups as you can. Also, try to explain the reasons why you get lower than perfect performance. Test your application on 1, 2, 4, 8 and 16 nodes. Make sure you use prun to submit your job, even for jobs using on only one machine. If you run a job on the frontend instead of a node, you will both overload the frontend, which is used by a lot of people, and get useless performance measurements! You can use the timers provided by Java (System.currentTimeMillis or even System.currentTimeNanos) to measure the performance of sections of your code. Optimize your program such that the grain size of the leaf jobs is controlled to improve performance (i.e., do not put very small jobs in the job queue, but calculate them directly).Write a small report (in English, about five pages) describing your experiences with Java, the difficulties you encountered and how you solved them. Include measurements of your program. Report elapsed execution times as well as speedups. Don't just show numbers, but present a speedup graph as well. If the program does not achieve linear speedup, give an explanation including a performance breakdown for the slowdown. The document should also describe how you implemented the programs and how you measured their performance. The programs themselves should contain useful comments that illustrate how they work. Compiling an Running your Java programsYou can compile your Java programs with javac or with ant using the provided build.xml. Be sure to use the "module" command on the DAS-3 to set the applications used. For more information see the DAS-3 section of this website. To run a parallel program on the DAS nodes, you need to make use of the prun script (see the DAS-3 site for more information on the DAS-3 and prun). Furthermore, to run your application, you can simply use java or use the provided java-run script (which adds all jars to the classpath automatically). It expects to find a lib directory in the current directory.
For more information on compiling and running IPL applications, see the users's guide and programmer's manual of the IPL included in the distribution (and the assignment template). SubmittingYou have to submit your code (preferably containing useful comments that illustrate how the application works) and the report. Important: Because we use automatic test scripts to test and benchmark your submissions, you must strictly follow the instructions below.
Documentation
GradingA correct implementation of all the requirements above is graded with 8. Up to 2 bonus points (to grade 10) can ben given for extra work on implementation, optimizations, testing and benchmarking. For example:
To get the bonus points, it is up to your fantasy on how you improve the parallel application or your evaluation of the application. Optimizing the sequential algorithm however, does not count as a parallel optimization for the bonus assignment. If you reimplement (parts of) your program for the bonus assignment, please put your new program in the ida.bonus package. This way, it is easier for us to grade it, and additionally you do not break the entire assignment when you make a mistake in the extra code. TODO listIn order to complete this part of the practical, please follow the following receipt:
|
|