OpenMP First Demo

来源:互联网 发布:js添加css3动画效果 编辑:程序博客网 时间:2024/05/19 19:55
#include<iostream>using namespace std;int main(){#pragma omp parallel{cout << "All Threads run this" << endl;#pragma omp sections{#pragma omp section{cout << "This executes in parallel" << endl;}#pragma omp section{cout << "Sequential statement 1" << endl;cout << "This always executes after statement 1" << endl;}#pragma omp section{cout << "This also executes in parallel" << endl;}}}}

D:\programming\C++>set omp_num_threads=4D:\programming\C++>parallelSectionsAll Threads run thisThis executes in parallelSequential statement 1This always executes after statement 1This also executes in parallelAll Threads run thisAll Threads run thisAll Threads run this
Is OpenmMP "Open Multi Processor"?
0 0
原创粉丝点击