build fixes

This commit is contained in:
Artem Zuikov 2020-05-15 02:57:22 +03:00
parent fc7afaa639
commit 8e8a2a17d6
22 changed files with 359 additions and 353 deletions

View File

@ -384,11 +384,12 @@ if (OS_LINUX AND NOT ENABLE_JEMALLOC)
endif () endif ()
if (USE_OPENCL) if (USE_OPENCL)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBITONIC_SORT_PREFERRED") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_OPENCL=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBITONIC_SORT_PREFERRED") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_OPENCL=1")
if (OS_DARWIN) if (OS_DARWIN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework OpenCL") set(OPENCL_LINKER_FLAGS "-framework OpenCL")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENCL_LINKER_FLAGS}")
endif () endif ()
endif () endif ()

View File

@ -61,7 +61,7 @@
#include <Common/ThreadFuzzer.h> #include <Common/ThreadFuzzer.h>
#include "MySQLHandlerFactory.h" #include "MySQLHandlerFactory.h"
#ifdef BITONIC_SORT_PREFERRED #ifdef USE_OPENCL
#include "Common/BitonicSort.h" #include "Common/BitonicSort.h"
#endif #endif
@ -225,7 +225,7 @@ int Server::main(const std::vector<std::string> & /*args*/)
registerDictionaries(); registerDictionaries();
registerDisks(); registerDisks();
#if defined (BITONIC_SORT_PREFERRED) #if defined (USE_OPENCL)
BitonicSort::getInstance().configure(); BitonicSort::getInstance().configure();
#endif #endif

View File

@ -35,8 +35,10 @@ target_link_libraries (compact_array PRIVATE clickhouse_common_io)
add_executable (radix_sort radix_sort.cpp) add_executable (radix_sort radix_sort.cpp)
target_link_libraries (radix_sort PRIVATE clickhouse_common_io) target_link_libraries (radix_sort PRIVATE clickhouse_common_io)
if (USE_OPENCL)
add_executable (bitonic_sort bitonic_sort.cpp) add_executable (bitonic_sort bitonic_sort.cpp)
target_link_libraries (bitonic_sort PRIVATE clickhouse_common_io "-framework OpenCL") target_link_libraries (bitonic_sort PRIVATE clickhouse_common_io ${OPENCL_LINKER_FLAGS})
endif ()
add_executable (arena_with_free_lists arena_with_free_lists.cpp) add_executable (arena_with_free_lists arena_with_free_lists.cpp)
target_link_libraries (arena_with_free_lists PRIVATE dbms) target_link_libraries (arena_with_free_lists PRIVATE dbms)

View File

@ -140,8 +140,9 @@ void sortBlock(Block & block, const SortDescription & description, UInt64 limit)
/// will be passed to `getPermutation` method with value 42. /// will be passed to `getPermutation` method with value 42.
if (description[0].special_sort == SpecialSort::OPENCL_BITONIC) if (description[0].special_sort == SpecialSort::OPENCL_BITONIC)
{ {
#ifdef USE_OPENCL
nan_direction_hint = 42; nan_direction_hint = 42;
#ifndef BITONIC_SORT_PREFERRED #else
throw DB::Exception("Bitonic sort specified as preferred, but OpenCL not available", DB::ErrorCodes::OPENCL_ERROR); throw DB::Exception("Bitonic sort specified as preferred, but OpenCL not available", DB::ErrorCodes::OPENCL_ERROR);
#endif #endif
} }

View File

@ -0,0 +1,336 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -0,0 +1,10 @@
-- TODO: set special_sort = 'opencl_bitonic';
select toUInt8(number * 2) as x from numbers(42) order by x desc;
select toInt8(number * 2) as x from numbers(42) order by x desc;
select toUInt16(number * 2) as x from numbers(42) order by x desc;
select toInt16(number * 2) as x from numbers(42) order by x desc;
select toUInt32(number * 2) as x from numbers(42) order by x desc;
select toInt32(number * 2) as x from numbers(42) order by x desc;
select toUInt64(number * 2) as x from numbers(42) order by x desc;
select toInt64(number * 2) as x from numbers(42) order by x desc;

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toUInt8(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toInt8(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toUInt16(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toInt16(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toUInt32(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toInt32(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toUInt64(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'

View File

@ -1,42 +0,0 @@
82
80
78
76
74
72
70
68
66
64
62
60
58
56
54
52
50
48
46
44
42
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0

View File

@ -1 +0,0 @@
select toInt64(number * 2) as x from numbers(42) order by x desc settings special_sort = 'opencl_bitonic'