Descargar la presentación
La descarga está en progreso. Por favor, espere
Publicada porRenato Pilar Modificado hace 9 años
1
Algo mas de OPENMP y todo sobre PBS!
2
Algunas rutinas que devuelven variables de entorno void omp_set_num_threads(int num_threads); // numero de threads del sistema (seteados en el entorno) int omp_get_num_threads(void);//numero de threads usados en el programa actual int omp_get_max_threads(void); //maximo nuemro de threads que puedo usar int omp_get_thread_num(void); // rango de los threads int omp_get_num_procs(void);//numero de procesos
3
PI double precision d_pi_est double precision h integer i integer n double precision sum2 double precision x h = 1.0D+00 / dble ( 2 * n ) sum2 = 0.0D+00 !$omp parallel do private(x), shared(h), reduction(+: sum2) do i = 1, n x = h * real ( 2 * i - 1 ) sum2 = sum2 + 1.0D+00 / ( 1.0D+00 + x**2 ) end do d_pi_est = 4.0D+00 * sum2 / dble ( n ) return end
4
wtime = omp_get_wtime ( ); xdoty = test01 ( n, x, y ); wtime = omp_get_wtime ( ) - wtime; Double tes01(n,x,y) { int i; double xdoty=0.0; # pragma omp parallel shared ( n, x, y ), private ( i ), reduction ( + : xdoty ) # pragma omp for for ( i = 0; i < n; i++ ) { xdoty = xdoty + x[i] * y[i]; } return xdoty; }
5
Jacobi diff = 0.0; #pragma omp parallel private (i, j, tdiff) { tdiff = 0.0; #pragma omp for for (i = 1; i < my_rows-1; i++) for (j = 1; j < N-1; j++) { w[i][j] = (u[i-1][j] + u[i+1][j] + u[i][j-1] + u[i][j+1])/4.0; if (fabs(w[i][j] - u[i][j]) > tdiff) tdiff = fabs(w[i][j] - u[i][j]); } #pragma omp for nowait for (i = 1; i < my_rows-1; i++) for (j = 1; j < N-1; j++) u[i][j] = w[i][j]; #pragma omp critical if (tdiff > diff) diff = tdiff; }
6
PBS Ssh clase-scmp@cecar.fcen.uba.ar -p 222clase-scmp@cecar.fcen.uba.ar Pass: SCMP2012 PBS script.sh
Presentaciones similares
© 2024 SlidePlayer.es Inc.
All rights reserved.