For each of the following two code segments , decide whether it is suitable for parallel execution
Fantastic news! We've Found the answer you've been seeking!
Question:
For eachof the followingtwocode segments,decidewhether it is suitable for parallel execution and responseaccording to your justification: addOpenMP pragmas tomakethe loop parallel or briefly explain whythecode segmentis notsuitable for parallel execution.
(A): for ( i = 0; i < n; i++ ) {
x [ i ] = 3 * i + 5;
y [ i ] = log ( x [ i ] );
}
(B): x [ 0 ] = 1;
x [ 1 ] = 2;
for ( i = 2; i < n; i++ )
x [ i ] = x [ i - 1 ] * x [ i - 2 ] ;
Related Book For
Cost Management Accounting and Control
ISBN: 978-0324559675
6th Edition
Authors: Don R. Hansen, Maryanne M. Mowen, Liming Guan
Posted Date: