Commit ee90ffd2 authored by Berenger Bramas's avatar Berenger Bramas

Protect OpenMP code in case it is not available

parent efb37fb6
......@@ -24,7 +24,10 @@
#include <climits>
#include <cfloat>
#include <algorithm>
#if defined(_OPENMP)
#include <omp.h>
#endif
namespace Sort512 {
......@@ -5946,6 +5949,8 @@ static void CoreSort(SortType array[], const IndexType left, const IndexType rig
}
}
#if defined(_OPENMP)
template <class SortType, class IndexType = size_t>
static inline void CoreSortTask(SortType array[], const IndexType left, const IndexType right, const int deep){
static const int SortLimite = 16*64/sizeof(SortType);
......@@ -5991,6 +5996,8 @@ static inline void SortOmp(SortType array[], const IndexType size){
}
}
}
#endif
}
......
......@@ -855,6 +855,7 @@ void testQs512(){
Sort512::Sort<NumType,size_t>(array.get(), idx);
assertNotSorted(array.get(), idx, "");
}
#if defined(_OPENMP)
for(size_t idx = 1 ; idx <= (1<<10); idx *= 2){
std::cout << " " << idx << std::endl;
std::unique_ptr<NumType[]> array(new NumType[idx]);
......@@ -862,6 +863,7 @@ void testQs512(){
Sort512::SortOmp<NumType,size_t>(array.get(), idx);
assertNotSorted(array.get(), idx, "");
}
#endif
}
template <class NumType>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment