Only use collapse() directive with OpenMP 3.0 or higher

Change-Id: Icba544c0494763c57eb6dc61e98379312ca15972
This commit is contained in:
Keir Mierle
2016-04-07 12:03:16 -07:00
parent d61e94da52
commit 5512f58536
+8 -1
View File
@@ -337,7 +337,14 @@ bool CovarianceImpl::GetCovarianceMatrixInTangentOrAmbientSpace(
max_covariance_block_size]);
bool success = true;
#pragma omp parallel for num_threads(num_threads) schedule(dynamic) collapse(2)
// The collapse() directive is only supported in OpenMP 3.0 and higher. OpenMP
// 3.0 was released in May 2008 (hence the version number).
#if _OPENMP >= 200805
# pragma omp parallel for num_threads(num_threads) schedule(dynamic) collapse(2)
#else
# pragma omp parallel for num_threads(num_threads) schedule(dynamic)
#endif
for (int i = 0; i < parameters.size(); ++i) {
for (int j = 0; j < parameters.size(); ++j) {
// The second loop can't start from j = i for compatibility with OpenMP