代码: #include <omp.h> #include <iostream> #include <cstdlib> #include <ctime> using namespace std; const int NUM = 8000; const int MAX = 1000000; const int MIN = 0; const int NUM_THREADS = 8; int arr[NUM]; int main() { cout <<
什么是OpenMP?“OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms
奇偶排序法的思路是在数组中重复两趟扫描.第一趟扫描选择所有的数据项对,a[j]和a[j+1],j是奇数(j=1, 3, 5……).如果它们的关键字的值次序颠倒,就交换它们.第二趟扫描对所有的偶数数据项进行同样的操作(j=2, 4,6……).重复进行这样两趟的排序直到数组全部有序. public static void oddEvenSort(int[] arr){ int len = arr.length; int groupNumber = (int) Math.ceil((double)le
原文:http://blog.csdn.net/gengshenghong/article/details/7000979 schedule的语法为: schedule(kind, [chunk_size]) kind: • static: Iterations are divided into chunks of size chunk_size. Chunks are assigned to threads in the team in round-robin fashion in order