La lecture en ligne est gratuite
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Partagez cette publication

  
    
 
       
  
        ! "  # $ %  &' ( ")( " (
  

* +    *) +    , --&./0 0  1   + 2#  3    40 56  *     &&$$$77&&$$$77  3"  %
  
*         +   8  +    )   +  +  $ $  8      % 5  +  + 
    
  
,1 $   for (i = 0; i < n; i++) c[i] = a[i] + b[i]; Thr 1 Thr 2 c[0]=... c[4]=... c[1]=... c[5]=... c[2]=... c[6]=... c[3]=... c[7]=...
)%  #pragma omp parallel for for (i = 0; i < n; i++) c[i] = a[i] + b[i];
 "# 
master thread
n fork parallel regions joi ")   51' #       9    5      '    
!
 "
8 ; )  + 5   3+   5  %  81 7 8  ) '  3  "
  
: 3+    8 8  ' 3  *)  5  
$
    #pragma omp parallel if (n>limit) default(none) \ shared(n, a, b, c, x, y, z) private (f, i , scale) { f = 1.0; &"# '   #pragma omp for nowait for (i=0; i<n; i++) z = x #pragma[oim]pfor[in]ow+aiyt[i]; () "#" for (i=0; i<n; i++) a[i] = b[i] + c[i]; #pragma omp barrier *'"+... scale = sum(a,0,n) + sum(z,0,n) + f; }
%
  
 -  
;#     main(){ A; /* Master thread executes */ #pragma omp parallel { /* fork parallel threads */ B; /* Executes in parallel */ } /* join parallel threads */ C; /* Master thread executes */ } $    5 (
/  
    + /  +      + ; + setenv OMP NUM THREADS 8 _ _ <+  p_ _ _ reads(8); om set num th     num_threads(8)
,
.
  
(  "#"
for   sections   single  9 #
 0  
#pragma omp for for (i = 1; i < n; i++) b[i] = (a[i] + a[i-1]) / 2.0;  +        +     $   +(


  
 0  
#pragma omp for schedule(<schedule>, <chunk>) for (i = 1; i < n; i++) b[i] = (a[i] + a[i-1]) / 2.0; <schedule>     +  8    <chunk> 5 % 9    +  
*"# "


*" 0 #" 
#pragma omp sections { #pragma omp section { A; } #pragma omp section { B; } }
 +    *    #  
*1# "#   "
  
#pragma omp single { A; } #pragma omp master { B; }
 +    "    # * "   # 

!
  
2#"   0 * '    $  + 3   # 1 2        + 
*'"
 # *  
$
%
  
## "#
#pragma omp critical { sum = sum + local sum; _ }  +      +5      # +      
"
#pragma omp atomic sum += f(x); *    critical ;        46    #  4#6    "    $
,
.

  
 '"
#pragma omp barrier  +     ;  $        for 0 sections  single    $  +
(' 3
 $     $      
for (i=0; i < N; i++) a[i] = b[i] + c[i]; for (i=0; i < M; i++) // M < N d[i] = a[i] + b[i];
    $ $ 4 6  (



Un pour Un
Permettre à tous d'accéder à la lecture
Pour chaque accès à la bibliothèque, YouScribe donne un accès à une personne dans le besoin