Created
November 6, 2013 22:19
-
-
Save serge-rgb/7345176 to your computer and use it in GitHub Desktop.
OpenMP Task based parallelism
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
static void do_something(int i) { | |
for (int j = 0; j < 3000; ++j) | |
{ | |
sqrt(double(i*j)); | |
} | |
} | |
int main(int argc, char *argv[]) | |
{ | |
#pragma omp parallel | |
#pragma omp single | |
{ | |
for (int i = 0; i < 1000000; ++i) { | |
#pragma omp task | |
do_something(i); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment