[Solved] CS4000 Homework # 1

$25

File Name: CS4000_Homework___1.zip
File Size: 178.98 KB

SKU: [Solved] CS4000 Homework # 1 Category: Tag:
5/5 - (1 vote)
  1. (10 pts.) Implement a hello-world program using OpenMP. Your program should create as many threads as their are processors/cores on your current machine. From each thread that you create, your program should print:

Hello from thread i.

This is <Your Name>s first parallel program

There are currently n threads running

Implement your program so that the text given above is printed in one block for each thread.

  1. (10 pts.) Consider the following problem. Given an nn matrix of numbers, an integer m, and a modulus q, find the largest product of m modulo q numbers in a row, either vertically, horizontally, or diagonally. Write a program that outputs the value of the largest product on a line by itself. For example, consider the following 5 5 matrix of values with the value m = 4 and q = 1000000 :

10 1 1 1 1

1 10 11 12 13 1 1 10 11 12

1 1 1 10 1

1 1 1 1 10

Your program should produce the answer 17160 (10 11 12 13). When m = 5, your program should answer 100000

Implement your program in C++ and provide adequate documentation. Test input/output examples will be provided to help you debug your code.

  1. (20 pts.) Use OpenMP to implement a parallel version of the program that you implemented in problem #2. Implement your program using #pragma omp parallel.

Compare your programs running time to your original program. Your program should be at least 75% efficient on a four core machine on put of a 1000 x 1000 array with m = 500.

Implement your program in C++ and provide adequate documentation.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS4000 Homework # 1[Solved] CS4000 Homework # 1
$25