Which line of code should you use to replace the code at line 04?
You are an application developer for your company. Users report that the performance of an application installed on your company s net wor k i s sl ow You use a profiler to identify the problem. You discover that in a parallel loop, one type of task takes only a few seconds to complete, whereas another type of task takes a few minutes to complete. You also discover that the tasks do not modify input data. The parallel loop is shown in the following code segment. (Line numbers are included for reference only.)
01 #pragma omp parallel shared(x) private(i, res)
03 {
04 #pragma omp for
05 for (i=0; i < N; i++)
06 {
07 res = f(i);
08 if (res < 7)
09 smallwork(x[i]);
10 else
11 bigwork(x[i]);
12 }
13 }
You need to ensure that the workload is balanced among the processors that run the application, regardless of the OpenMP API default settings. Which line of code should you use to replace the code at line 04?
Which set of variables should you select?
You are designing a parallel algorithm for an OpenMP application. You write the following pseudocode to represent the sequential logic of the algorithm. (Line numbers are included for reference only.)
01 do i = 1, m
02 do j = 1, n
03 x = i/real(m)
04 y = j/real(n)
05 depth[j, i] = calculate_val(x, y)
06 enddo
07 enddo
You need to identify the variables that must be declared as private variables to correctly parallelize the algorithm. Which set of variables should you select?
Which two actions should you perform?
You design an application that processes large amount of user data. The application consists of multiple producer and consumer threads. All threads share a single task queue. You write the following pseudocode. (Line numbers are included for reference only.)
01 task_available = 0; // shared variable
02 Producer_Thread:
03 inserted = 0 // private
04 while (!done()) {
05 inserted = 0;
06 create_task(my_task); //private
07 while (inserted == 0) {
08 if (task_available == 0) {
09 insert_into_queue(my_task);
10 task_available = 1;
11 inserted = 1;
12 }
13 }
14 }
15 end Producer_Thread
16 Consumer_Thread:
17 extracted = 0; // private
18 while (!done()) {
19 extracted = 0;
20 while (extracted == 0) {
21 if (task_available == 1) {
22 extract_from_queue(my_task);
23 task_available = 0;
24 extracted = 1;
25 }
26 }
27 }
28 process_task(my_task);
29 end Consumer_Thread
You need to ensure that multiple instances of the producer and consumer threads can run without deadlocks.
Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)
What should you do?
You review the design of a module of an online banking system. The module will provide real-time statistics related to payments made by the users. The module must support 1,000 concurrent users. A new instance named Thread1 is created for every user who accesses the banking system. The following pseudocode represents the design of the module. (Line numbers are included for reference only.)
01 var amount = 0 // shared variable represents amount of transfer
02 var credit = 0 // shared variable represents total credit
03 var debit = 0 // shared variable represents total debit
04 Thread1:
05 reads userInput from console
06 amount = userInput
07 creates new Thread2 instance and runs it
08 creates new Thread3 instance and runs it
09 Thread2:
10 value = amount
11 if (value > 0) debit = debit – value
12 Thread3:
13 value = amount
14 if (value > 0) credit = credit + value
A new instance named Thread1 is created for every user who accesses the banking system. You need to ensure that no data race occurs when the module runs.
What should you do?
What should you do?
You create a new Microsoft Message Passing Interface (MPI) application. The application will be deployed on a Windows HPC Server 2008 cluster. You plan to debug the application by using the MPI Cluster Debugger in Visual Studio 2008. You need to ensure that you can successfully launch and use the MPI Cluster Debugger.
What should you do?
What should you do?
You are an application developer.
You plan to debug a Microsoft Message Parsing Interface (MPI) application by using the MPI Cluster Debugger. You set appropriate breakpoints in the application. You need to evaluate the value of a variable on different MPI ranks when a breakpoint is encountered. What should you do?
What should you do?
You create a Microsoft Message Passing Interface (MPI) application by using Microsoft Visual Studio 2008. You plan to debug the application by using Visual Studio 2008. You need to configure the nodes that will be used for debugging.
What should you do?
Which process should you attach to?
You create a Microsoft Message Passing Interface (MPI) application by using Microsoft Visual Studio 2008. The application process is named MPIApplication.exe. You plan to debug the application by using the MPI Cluster Debugger in Visual Studio 2008. You need to attach the debugger to the remote process on a compute node.
Which process should you attach to?
What should you do?
You plan to create a parallel application by using Microsoft Visual C++. You want to use the Microsoft Message Passing Interface (MPI) library in the application. You need to ensure that the application can be compiled for both 32-bit and 64-bit platforms. You also need to ensure that targeting both platforms requires minimum maintenance.
What should you do?
Which set of tasks should you include in the application?
You create a parallel application by using Microsoft Visual Studio 2008. The application prints a message to the console of all Microsoft Message Passing Interface (MPI) processes except for one. The application terminates and displays an error message. You need to change the code in the application so that the application completes successfully. Which set of tasks should you include in the application?