add cmake option USE_VECTORIZED_MATH_FUNCTIONS, reorganize auto configs

This commit is contained in:
proller 2017-03-14 16:47:39 +03:00 committed by alexey-milovidov
parent 9a1169fef6
commit 28ed324702
18 changed files with 48 additions and 52 deletions

View File

@ -172,8 +172,6 @@ include (cmake/find_readline_edit.cmake)
include (cmake/find_zookeeper.cmake)
include (cmake/find_double-conversion.cmake)
include (cmake/find_re2.cmake)
include (cmake/find_gperftools.cmake)
include (cmake/find_jemalloc.cmake)
set (FULL_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}")
set (FULL_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")

View File

@ -1,10 +1,12 @@
include_directories (${ClickHouse_SOURCE_DIR}/dbms/include)
# for generated config_version.h and config.h:
include_directories (${ClickHouse_BINARY_DIR}/dbms/include)
# TODO:
# move code with incldes from .h to .cpp and clean this list:
include_directories (${ClickHouse_SOURCE_DIR}/libs/libcommon/include)
# for generated config_version.h and config_common.h:
# for generated config_common.h:
include_directories (${ClickHouse_BINARY_DIR}/libs/libcommon/include)
include_directories (${ClickHouse_SOURCE_DIR}/libs/libpocoext/include)
include_directories (${ClickHouse_SOURCE_DIR}/libs/libzkutil/include)

View File

@ -1,3 +1,20 @@
option (USE_VECTORIZED_MATH_FUNCTIONS "Faster math functions" OFF)
set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/include/DB/Common/config_version.h)
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/DB/Common/config.h)
set (CONFIG_BUILD ${CMAKE_CURRENT_BINARY_DIR}/src/Common/config_build.cpp)
include (cmake/version.cmake)
message (STATUS "Will build ${VERSION_FULL}")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/DB/Common/config.h.in ${CONFIG_COMMON})
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/DB/Common/config_version.h.in ${CONFIG_VERSION})
get_property (BUILD_COMPILE_DEFINITIONS DIRECTORY ${ClickHouse_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
get_property (BUILD_INCLUDE_DIRECTORIES DIRECTORY ${ClickHouse_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
string (TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/Common/config_build.cpp.in ${CONFIG_BUILD})
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_include.cmake)
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libdivide)
@ -51,6 +68,9 @@ add_headers_and_sources(dbms Core)
add_headers_and_sources(dbms Client)
add_headers_only(dbms Server)
list (APPEND dbms_sources ${CONFIG_BUILD})
list (APPEND dbms_headers ${CONFIG_VERSION} ${CONFIG_COMMON})
list(REMOVE_ITEM dbms_sources
src/Client/Client.cpp
src/Client/Benchmark.cpp
@ -68,7 +88,7 @@ if (APPLE OR CMAKE_SYSTEM MATCHES "FreeBSD")
src/IO/WriteBufferAIO.cpp)
endif()
include (${CMAKE_SOURCE_DIR}/libs/libcommon/cmake/version.cmake)
#include (${CMAKE_SOURCE_DIR}/libs/libcommon/cmake/version.cmake)
if (USE_STATIC_LIBRARIES)
add_library(dbms ${dbms_headers} ${dbms_sources})

View File

@ -3,7 +3,7 @@
#include <string>
#include <vector>
#include <memory>
#include <common/config_common.h>
#include <DB/Common/config.h>
#include <re2/re2.h>
#if USE_RE2_ST
#include <re2_st/re2.h>

View File

@ -0,0 +1,6 @@
#pragma once
// .h autogenerated by cmake !
#cmakedefine01 USE_RE2_ST
#cmakedefine01 USE_VECTORIZED_MATH_FUNCTIONS

View File

@ -1,16 +1,16 @@
#pragma once
#include <common/exp10.h>
#include <DB/DataTypes/DataTypesNumber.h>
#include <DB/Columns/ColumnsNumber.h>
#include <DB/Columns/ColumnConst.h>
#include <DB/Functions/IFunction.h>
#include <DB/Common/config.h>
/** Более эффективные реализации математических функций возможны при подключении отдельной библиотеки.
* Отключено по-умолчанию из соображения совместимости лицензий.
/** More effective implementations of mathematical functions are possible when connecting a separate library
* Disabled due licence compatibility limitations
* To enable: rebuild with -DUSE_VECTORIZED_MATH_FUNCTIONS=1
*/
#define USE_VECTORIZED_FUNCTIONS 0
namespace DB
@ -166,7 +166,7 @@ struct UnaryFunctionPlain
}
};
#if USE_VECTORIZED_FUNCTIONS
#if USE_VECTORIZED_MATH_FUNCTIONS
template <typename Name, Vec2d(&Function)(const Vec2d &)>
struct UnaryFunctionVectorized
@ -436,7 +436,7 @@ struct BinaryFunctionPlain
}
};
#if USE_VECTORIZED_FUNCTIONS
#if USE_VECTORIZED_MATH_FUNCTIONS
template <typename Name, Vec2d(&Function)(const Vec2d &, const Vec2d &)>
struct BinaryFunctionVectorized
@ -502,7 +502,7 @@ using FunctionLog10 = FunctionMathUnaryFloat64<UnaryFunctionVectorized<Log10Name
using FunctionSqrt = FunctionMathUnaryFloat64<UnaryFunctionVectorized<SqrtName, sqrt>>;
using FunctionCbrt = FunctionMathUnaryFloat64<UnaryFunctionVectorized<CbrtName,
#if USE_VECTORIZED_FUNCTIONS
#if USE_VECTORIZED_MATH_FUNCTIONS
Power_rational<1, 3>::pow
#else
cbrt

View File

@ -2,29 +2,21 @@
#include <stdlib.h>
#include <fcntl.h>
#include <signal.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <experimental/optional>
#include <unordered_set>
#include <algorithm>
#include <boost/program_options.hpp>
#include <Poco/File.h>
#include <Poco/Util/Application.h>
#include <common/ClickHouseRevision.h>
#include <DB/Common/Stopwatch.h>
#include <DB/Common/Exception.h>
#include <DB/Common/ShellCommand.h>
#include <DB/Core/Types.h>
#include <DB/Core/QueryProcessingStage.h>
#include <DB/IO/ReadBufferFromFileDescriptor.h>
#include <DB/IO/WriteBufferFromFileDescriptor.h>
#include <DB/IO/WriteBufferFromFile.h>
@ -32,10 +24,8 @@
#include <DB/IO/ReadBufferFromMemory.h>
#include <DB/IO/ReadHelpers.h>
#include <DB/IO/WriteHelpers.h>
#include <DB/DataStreams/AsynchronousBlockInputStream.h>
#include <DB/DataStreams/TabSeparatedRowInputStream.h>
#include <DB/Parsers/ParserQuery.h>
#include <DB/Parsers/ASTSetQuery.h>
#include <DB/Parsers/ASTUseQuery.h>
@ -46,21 +36,14 @@
#include <DB/Parsers/ASTIdentifier.h>
#include <DB/Parsers/formatAST.h>
#include <DB/Parsers/parseQuery.h>
#include <DB/Interpreters/Context.h>
#include <DB/Client/Connection.h>
#include "InterruptListener.h"
#include <DB/Common/ExternalTable.h>
#include <DB/Common/UnicodeBar.h>
#include <DB/Common/formatReadable.h>
#include <DB/Columns/ColumnString.h>
#include <DB/Common/NetException.h>
#include <common/config_common.h>
#include <common/readline_use.h>

View File

@ -1,7 +1,7 @@
// .cpp autogenerated by cmake !
#include <common/config_build.h>
#include <DB/Common/config_build.h>
const std::vector<const char *> auto_config_build {
"VERSION_FULL", "@VERSION_FULL@",

View File

@ -2,16 +2,16 @@
#include <memory>
#include <mutex>
#include <re2/re2.h>
#include <re2/stringpiece.h>
#include <Poco/UTF8String.h>
#include <common/config_common.h>
#include <DB/Columns/ColumnFixedString.h>
#include <DB/Common/Volnitsky.h>
#include <DB/DataTypes/DataTypeFixedString.h>
#include <DB/Functions/FunctionFactory.h>
#include <DB/Functions/Regexps.h>
#include <DB/IO/WriteHelpers.h>
#include <DB/Common/config.h>
#include <re2/re2.h>
#include <re2/stringpiece.h>
#if USE_RE2_ST
#include <re2_st/re2.h>

View File

@ -4,7 +4,7 @@
#include <DB/DataStreams/OneBlockInputStream.h>
#include <DB/Interpreters/Settings.h>
#include <DB/Storages/System/StorageSystemBuildOptions.h>
#include <common/config_build.h>
#include <DB/Common/config_build.h>
namespace DB
{

View File

@ -1,2 +1,2 @@
# Settings -> Configure KDevelop -> Source Formatter -> C++ ; Custom Script Formatter ; Kdevelop: kdev_format_source
*.cpp *.c *.h : mv $TMPFILE $TMPFILE.tmp; cat $TMPFILE.tmp | clang-format -style=file -assume-filename=`pwd`/.clang-format > $TMPFILE
*.c *.cpp *.h *.hpp: mv $TMPFILE $TMPFILE.tmp; cat $TMPFILE.tmp | clang-format -style=file -assume-filename=`pwd`/.clang-format > $TMPFILE

View File

@ -1,7 +1,3 @@
set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_version.h)
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_common.h)
set (CONFIG_BUILD ${CMAKE_CURRENT_BINARY_DIR}/src/config_build.cpp)
include_directories (include)
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libcctz/include)
@ -15,16 +11,8 @@ if (APPLE)
endif ()
endif ()
include (cmake/version.cmake)
message (STATUS "Will build ${VERSION_FULL}")
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_common.h)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/config_common.h.in ${CONFIG_COMMON})
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/config_version.h.in ${CONFIG_VERSION})
get_property (BUILD_COMPILE_DEFINITIONS DIRECTORY ${ClickHouse_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
get_property (BUILD_INCLUDE_DIRECTORIES DIRECTORY ${ClickHouse_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
string (TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/config_build.cpp.in ${CONFIG_BUILD})
if (APPLE)
add_library (apple_rt
@ -55,7 +43,6 @@ add_library (common
include/common/singleton.h
include/common/strong_typedef.h
include/common/JSON.h
include/common/config_build.h
include/ext/bit_cast.hpp
include/ext/collection_cast.hpp
@ -68,11 +55,12 @@ add_library (common
include/ext/size.hpp
include/ext/unlock_guard.hpp
${CONFIG_VERSION}
${CONFIG_COMMON}
${CONFIG_BUILD}
)
include (cmake/find_gperftools.cmake)
include (cmake/find_jemalloc.cmake)
# When testing for memory leaks, dont link tcmalloc or jemalloc.
if (USE_JEMALLOC)

View File

@ -8,4 +8,3 @@
#cmakedefine01 USE_READLINE
#cmakedefine01 USE_LIBEDIT
#cmakedefine01 HAVE_READLINE_HISTORY
#cmakedefine01 USE_RE2_ST