OpenMP Tutorial

Reviews
Shared by: techmaster
Stats
views:
33
rating:
not rated
reviews:
0
posted:
10/29/2008
language:
pages:
0
OpenMP Tutorial Seung-Jai Min (smin@purdue.edu) School of Electrical and Computer Engineering Purdue University, West Lafayette, IN High-Performance Parallel Scientific Computing 2008 Purdue University Shared Memory Parallel Programming in the Multi-Core Era • Desktop and Laptop – 2, 4, 8 cores and … ? • A single node in distributed memory clusters – Steele cluster node: 2  8  (16) cores – /proc/cpuinfo • Shared memory hardware Accelerators • Cell processors: 1 PPE and 8 SPEs • Nvidia Quadro GPUs: 128 processing units High-Performance Parallel Scientific Computing 2008 Purdue University OpenMP: Some syntax details to get us started • Most of the constructs in OpenMP are compiler directives or pragmas. – For C and C++, the pragmas take the form: #pragma omp construct [clause [clause]…] – For Fortran, the directives take one of the forms: C$OMP construct [clause [clause]…] !$OMP construct [clause [clause]…] *$OMP construct [clause [clause]…] • Include files #include “omp.h” High-Performance Parallel Scientific Computing 2008 Purdue University How is OpenMP typically used? • OpenMP is usually used to parallelize loops: • Find your most time consuming loops. • Split them up between threads. Parallel Program Sequential Program void main() { int i, k, N=1000; double A[N], B[N], C[N]; for (i=0; i1) goto more; } printf(“ All done \n”); if(count==1) goto more; #pragma omp parallel { more: do_big_job(id); if(++count>1) goto done; } done: if(!really_done()) goto more; Not A structured block A structured block High-Performance Parallel Scientific Computing 2008 Purdue University Structured Block Boundaries • In C/C++: a block is a single statement or a group of statements between brackets {} #pragma omp parallel { id = omp_thread_num(); A[id] = big_compute(id); } #pragma omp for for (I=0;I
Related docs
Introduction to OpenMP
Views: 22  |  Downloads: 3
Introduction to OpenMP
Views: 16  |  Downloads: 1
The Future of OpenMP in the Multi-Core Era
Views: 217  |  Downloads: 5
OpenMP Application Program Interface
Views: 2  |  Downloads: 1
MPI tutorial
Views: 61  |  Downloads: 17
PETSc Tutorial
Views: 81  |  Downloads: 0
premium docs
Other docs by techmaster
Idaho Public Policy Survey
Views: 759  |  Downloads: 3
Why Patients Use Alternative Medicine
Views: 396  |  Downloads: 5
app004
Views: 122  |  Downloads: 0
Hardy v LaBelle
Views: 440  |  Downloads: 2
dv145v
Views: 198  |  Downloads: 0
McCoy Kelly
Views: 171  |  Downloads: 1
Be Still and Know
Views: 212  |  Downloads: 1
dv250
Views: 101  |  Downloads: 0
We Fall Down
Views: 209  |  Downloads: 2
dv145
Views: 132  |  Downloads: 0
Torts -- Prof. Cochran
Views: 626  |  Downloads: 59
Lease Default
Views: 1091  |  Downloads: 3
dv170c
Views: 86  |  Downloads: 0
Shout to the Lord
Views: 279  |  Downloads: 3
de121
Views: 105  |  Downloads: 0