日期:2014-05-20 浏览次数:21248 次
#pragma omp parallel for shared(elementIndexToBoundsSet, elementIndexToSizeSet, bufferPtr) private(currentCoord) firstprivate(elementIndex, threadId) num_threads(numOfThreads) for (int i = 0; i < bufferSize; i++) { // Get element index elementIndex = bufferPtr[i]; // In case no element - continue if (elementIndex == 0) continue; // One time read of the threadId if (threadId == -1) threadId = omp_get_thread_num(); // Update element size elementIndexToSizeSet->at(threadId)->at(elementIndex)++; }