Created
June 11, 2017 01:01
-
-
Save sat0b/57ce05d85b114b9dabb1fc0feea9f900 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <iostream> | |
| #include <omp.h> | |
| #include <thread> | |
| using namespace std; | |
| void sleep(int num) { | |
| std::this_thread::sleep_for(std::chrono::seconds(3)); | |
| } | |
| int main() { | |
| #ifdef _OPENMP | |
| #pragma omp parallel for | |
| for (int i = 0; i < 10; ++i) { | |
| printf("%d\n", i); | |
| sleep(i); | |
| } | |
| #else | |
| cout << "OpenMP is not used" << endl; | |
| #endif | |
| return 0; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clang-omp++ test_openmp.cpp -o test_openmp