Scheduled maintenance on Monday 2019-06-24 between 10:00-11:00 CEST

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 @@ ...@@ -24,7 +24,10 @@
#include <climits> #include <climits>
#include <cfloat> #include <cfloat>
#include <algorithm> #include <algorithm>
#if defined(_OPENMP)
#include <omp.h> #include <omp.h>
#endif
namespace Sort512 { namespace Sort512 {
...@@ -5946,6 +5949,8 @@ static void CoreSort(SortType array[], const IndexType left, const IndexType rig ...@@ -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> template <class SortType, class IndexType = size_t>
static inline void CoreSortTask(SortType array[], const IndexType left, const IndexType right, const int deep){ static inline void CoreSortTask(SortType array[], const IndexType left, const IndexType right, const int deep){
static const int SortLimite = 16*64/sizeof(SortType); static const int SortLimite = 16*64/sizeof(SortType);
...@@ -5991,6 +5996,8 @@ static inline void SortOmp(SortType array[], const IndexType size){ ...@@ -5991,6 +5996,8 @@ static inline void SortOmp(SortType array[], const IndexType size){
} }
} }
} }
#endif
} }
......
...@@ -855,6 +855,7 @@ void testQs512(){ ...@@ -855,6 +855,7 @@ void testQs512(){
Sort512::Sort<NumType,size_t>(array.get(), idx); Sort512::Sort<NumType,size_t>(array.get(), idx);
assertNotSorted(array.get(), idx, ""); assertNotSorted(array.get(), idx, "");
} }
#if defined(_OPENMP)
for(size_t idx = 1 ; idx <= (1<<10); idx *= 2){ for(size_t idx = 1 ; idx <= (1<<10); idx *= 2){
std::cout << " " << idx << std::endl; std::cout << " " << idx << std::endl;
std::unique_ptr<NumType[]> array(new NumType[idx]); std::unique_ptr<NumType[]> array(new NumType[idx]);
...@@ -862,6 +863,7 @@ void testQs512(){ ...@@ -862,6 +863,7 @@ void testQs512(){
Sort512::SortOmp<NumType,size_t>(array.get(), idx); Sort512::SortOmp<NumType,size_t>(array.get(), idx);
assertNotSorted(array.get(), idx, ""); assertNotSorted(array.get(), idx, "");
} }
#endif
} }
template <class NumType> 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