Difference between revisions of "OpenMP in Small Bites/Worksharing"
OpenMP in Small Bites/Worksharing
Jump to navigation
Jump to search
Line 31: | Line 31: | ||
|type="()"} | |type="()"} | ||
+ Click and submit to see the answer | + Click and submit to see the answer | ||
− | || C/C++:<br /><code>int i; <br />#pragma omp parallel <br />#pragma omp for <br /> for (i = 0; i < 100; i++){</code> <div style="margin-left: 1em;"> <code> a[i] = b[i] + c[i]; </code> </div> <code> } </code> <br /> Fortran:<br /> <code> INTEGER :: i <br />!$omp parallel <br />!$omp do <br /> DO i = 0, 99</code> <div style="margin-left: 1em;"> <code> a[i] = b[i] + c[i] </code> </div> <code>END DO </code> | + | || C/C++:<br /><code>int i; <br />#pragma omp parallel <br />#pragma omp for <br /> for (i = 0; i < 100; i++){</code> <div style="margin-left: 1em;"> <code> a[i] = b[i] + c[i]; </code> </div> <code> } </code> <br /> Fortran:<br /> <code> INTEGER :: i <br />!$omp parallel <br />!$omp do <br /> DO i = 0, 99</code> <div style="margin-left: 1em;"> <code> a[i] = b[i] + c[i] </code> </div><code>END DO </code> |
</quiz> | </quiz> | ||
{{hidden end}} | {{hidden end}} |
Revision as of 12:01, 2 November 2020
HPC.NRW | |
---|---|
Other HPC Courses | |
1. | Gprof Tutorial |
2. | Introduction to Linux in HPC |
OpenMP in Small Bites | |
1. | Overview |
2. | Worksharing |
3. | Data Scoping |
4. | Non-Uniform Memory Access
|
Video
Quiz
1. What is most commenly used worksharing construct in OpenMP to distribute work among loop interations?
2. Give an example for a parallel vector addition using OpenMP worksharing!
3. Can the following code snipped be parallelized with the OpenMP for-construct with out breaking the semantic? Justify your answer.