CS475 Fall 2009 - HW 3

Parallel Dynamic Programming Knapsack Solver

Objectives

To learn data decomposition, point-to-point communication, and dynamic programming.

Problem Statement

Design, implement, an MPI based parallel program to determine the optimal profit when filling a knapsack of capacity C choosing out of N objects. Note that, this program will eventually become a module in your class project. This module will be memory efficient in the sense that only O(C) memory is saved in each processor. Measure and analyze its performance, and report your findings.

In this homework, you are not going to implement the backtracking part, nor the part that uses the divide-and-conquer approach to compute the entire solution in a memory efficient manner. You will implement only the part that computes the last row of the table, updating in a row-by-row manner (thus at any time, there are two global arrays, curr and prev and the two are swapped at the end of each iteration of the outer loop. The arrays are distributed in a block-wise manner. Start off with the sequential (rowwise) code provided here, which is a slight modification of the code which was used in the knapsack lab. Your final code should take the same command line arguments and follow the same output format.

Instead of trying to send a variable size each time, we suggest starting from a simpler but less efficient implementation of sending a fixed size (either the full block or max of the weights). However, your final version of the code should implement variable sends efficiently.

What/When/How to Submit:

Good luck and have fun!