PrepAway - Latest Free Exam Questions & Answers

Tag: 70-691

Exam 70-691: TS: Windows HPC Server 2008, Developing

What should you do?

You create an OpenMP application by using Microsoft Visual C++. You write the following code segment to efficiently calculate the total number of odd and even numbers in the array data in parallel. (Line numbers are included for reference only.)

01 int data[100000];
02 //Initialize array values
03 int even=0;
04 int odd=0;
05 #pragma omp parallel for
06 for(int cnt=0;cnt<100000;cnt++)
07 {
09 if(data[cnt]%2==0)
10 {
12 even++;
13 }
14 else
15 {
17 odd++;
18 }
20 }
21 std::cout << "even: " << even << ", odd: " << odd << "n";

You discover that the code segment does not compute the correct result when it is executed with more than one thread. You need to ensure that the application computes the result correctly regardless of the number of threads.
What should you do?

Which code segment should you insert at line 06?

You create a Microsoft Message Passing Interface (MPI) application by using Microsoft Visual C++. You write the following code segment. (Line numbers are included for reference only.)

01 int data;
02 //Assign value to variable data
03 MPI_Request myRequest;
04 MPI_Isend(&data, 1, MPI_INT, 0, 1, MPI_COMM_WORLD, &myRequest);
05 //Other calculations not involving variable data
06 //Alter variable data

You discover that at times, an incorrect value is sent to rank 0. You need to ensure that the variable data is ready to be modified at line 08.
Which code segment should you insert at line 06?

What should you do?

You create an OpenMP application by using Microsoft Visual C++.

You write the following code segment. (Line numbers are included for reference only.)

01 int addIndices(int a,int b)
02 {
03 return a+b;
04 }
05 int _tmain(int argc, _TCHAR* argv[])
06 {
07 int i, j;
08 int a[10][10];
09 #pragma omp parallel for
10 for (i = 0; i < 10; i++)
11 for (j = 0; j < 10; j++)
12 {
14 a[i][j] = addIndices(i, j);
15 }
16 }

The code segment stores some incorrect data in the array. You need to ensure that the code segment stores only correct data in the array.
What should you do?

Which code segment should you write?

You create an OpenMP application by using Microsoft Visual C++. You write the following code segment. (Line numbers are included for reference only.)

01 #pragma omp parallel for
02 for(int i=0;i<10000;i++)
03 {
04 //Do some calculations
06 }
07 #pragma omp parallel for
08 for(int j=0;j<22000;j++)
09 {
10 //Do some calculations
11 }

Both for loops are mutually independent and no load imbalance occurs. You need to rewrite the code segment to remove any overhead and to improve the performance of the application.

Which code segment should you write?

Which code segment should you use to replace lines 04 and 05?

You create an OpenMP application by using Microsoft Visual C++. You write the following code segment. (Line numbers are included for reference only.)

01 #pragma omp parallel for
02 for(int i=0;i<50000;i++)
03 {
04 doWorkA(i);
05 doWorkB(i);
06 }

The doWorkA and doWorkB methods are independent method calls. You need to optimize performance while protecting the method calls against multiple thread access.Which code segment should you use to replace lines 04 and 05?

Which code segment should you insert at line 14?

You create a parallel application by using Microsoft Visual C++. You write the following code segment. (Line numbers are included for reference only.)

01 MPI_Init(&argc, &argv);
02 int a[10], myrank;
03 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
04 if (myrank==0)
05 {
06 //Do some work
07 MPI_Send(&a, 10, MPI_INT, 1, 1, MPI_COMM_WORLD); 08 }
09 else if(myrank==1)
10 {
11 int b[10];
12 MPI_Status status;
13 MPI_Request req;
15 }

Data sent by rank 0 must be received by rank 1.
You need to ensure that while rank 1 is waiting to receive data, the process continues to call an external
method for additional tasks.
Which code segment should you insert at line 14?

Which two lines of code should you remove?

You create an OpenMP application by using Microsoft Visual C++. You write the following lines of code. (Line numbers are included for reference only.)

01 omp_set_num_threads(10);
02 int dataA, dataB, dataC, dataD;
03 #pragma omp parallel private(dataC)
04 {
05 #pragma omp critical
06 dataC=dataA++;
07 #pragma omp atomic
08 dataC++;
09 #pragma omp master
10 {
11 #pragma omp critical
12 dataD++;
13 }
14 #pragma omp atomic
15 dataB++;
16 }

You need to remove unnecessary synchronization constructs. Which two lines of code should you remove? (Each correct answer presents part of the solution. Choose two.)

Which two communication semantics should you choose?

You are developing a parallel application that will be deployed to a Windows HPC Server 2008 cluster.You plan to use the Microsoft Message Passing Interface (MPI) library. You need to implement a new procedure for send and receive operations to allow overlapping of computation with communication routines. Which two communication semantics should you choose? (Each correct answer presents part of the solution. Choose two.)

What should you do?

You are creating an application that uses Microsoft Message Passing Interface (MPI). The library has the following communication primitives:
Blocking communication primitives like send and receive operations Non-blocking communication primitives like n_send and n_receive operations You write the following code segment for the processes named P0 and P1 in the application.
(Line numbers are included for reference only.)

01 P0:
02 for (i = 0; i < 1000; i++) {
03 produce_data(&data[i]);
04 send(&data[i], 1, P1);
05 }
06
07 P1:
08 for (i = 0; i < 1000; i++) {
09 receive(&a, 1, P0);
10 process_data(&a);
11 }

Users report that the application processes data slowly. You need to ensure that the application processes data quickly.
What should you do?


Page 3 of 812345...Last »