13.11.2016 Views

OpenMP Application Programming Interface Examples

2fZ58Wr

2fZ58Wr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

1.1 A Simple Parallel Loop<br />

The following example demonstrates how to parallelize a simple loop using the parallel loop<br />

construct. The loop iteration variable is private by default, so it is not necessary to specify it<br />

explicitly in a private clause.<br />

Example ploop.1.c<br />

C / C++<br />

S-1 void simple(int n, float *a, float *b)<br />

S-2 {<br />

S-3 int i;<br />

S-4<br />

S-5 #pragma omp parallel for<br />

S-6 for (i=1; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!