Skip to content

Commit 4215101

Browse files
committed
Merge pull request #427 from shehzan10/develop
BUGFIX enable double for key type in radix sort by key
2 parents de76e66 + 4961a61 commit 4215101

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/boost/compute/algorithm/detail/radix_sort.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,22 @@ struct radix_sort_value_type<8>
7171
typedef ulong_ type;
7272
};
7373

74+
template<typename T>
75+
inline const char* enable_double()
76+
{
77+
return " -DT2_double=0";
78+
}
79+
80+
template<>
81+
inline const char* enable_double<double>()
82+
{
83+
return " -DT2_double=1";
84+
}
85+
7486
const char radix_sort_source[] =
87+
"#if T2_double\n"
88+
"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n"
89+
"#endif\n"
7590
"#define K2_BITS (1 << K_BITS)\n"
7691
"#define RADIX_MASK ((((T)(1)) << K_BITS) - 1)\n"
7792
"#define SIGN_BIT ((sizeof(T) * CHAR_BIT) - 1)\n"
@@ -259,6 +274,7 @@ inline void radix_sort_impl(const buffer_iterator<T> first,
259274
if(sort_by_key){
260275
options << " -DSORT_BY_KEY";
261276
options << " -DT2=" << type_name<T2>();
277+
options << enable_double<T2>();
262278
}
263279

264280
// load (or create) radix sort program

0 commit comments

Comments
 (0)