-
Notifications
You must be signed in to change notification settings - Fork 18
/
Questions.txt.OMP
63 lines (43 loc) · 1.73 KB
/
Questions.txt.OMP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
DESCRIPTION
Students: Please note instructions in paper copy of quiz. Save your
files often, make sure OMSI fills your entire screen at all times, etc.
QUESTION
Name the three basic groups of wires in a basic system bus.
QUESTION
On p.21, it is mentioned that MPI accommmodates heterogeneous systems,
e.g in which some of the nodes are little-endian and some are
big-endian. In class we discussed another type of heterogeneity
accommmodated by MPI. What was it?
QUESTION
In the MPI example, pp.18ff, how many pairs of sockets are
set up? How many are actually used? EXPLAIN.
QUESTION -ext .c -com gcc -run "./omsi_answer4 12"
Write a C program to read an integer from the keyboard and print out double
it.
QUESTION -ext .c -com gcc -flags "-fopenmp" -run ./omsi_answer5
Below is the code you used to test OpenMP on your machine. Use an
OpenMP pragma to replace the "if," with the understanding that
we no longer care which threas prints out the number of threads; we
just need it so that that printing is done only once.
For full credit, your submission must be compilable and runnable.
Try it! That is a major point of using OMSI.
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
int nthreads, tid;
#pragma omp parallel private(nthreads, tid)
{
tid = omp_get_thread_num();
printf("Hello World from thread = %d\n", tid);
if (tid == 0) {
nthreads = omp_get_num_threads();
printf("Number of threads = %d\n", nthreads);
}
}
}
QUESTION
Consider the pthreads example, pp.8ff. Suppose we did not want to have
global variables, and wish to change the code accordingly. We start
small, changing only basename. State what changes would need to be
made.