Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename verax to optimizer in github #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ FOR_EACH, FOR_EACH_R, FOR_EACH_RANGE, ]
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...
135 changes: 135 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.14)

# Set the project name.
project(Verax)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

add_compile_definitions(DISABLE_META_INTERNAL_COMPRESSOR=1)

# Sets new behavior for CMP0135, which controls how timestamps are extracted
# when using ExternalProject_Add():
# https://cmake.org/cmake/help/latest/policy/CMP0135.html
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
endif()

# Use ThirdPartyToolchain dependencies macros from Velox.
list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake"
"${PROJECT_SOURCE_DIR}/velox/CMake")
include(ResolveDependency)

set(VELOX_BUILD_VECTOR_TEST_UTILS
ON
CACHE BOOL "Velox vector test utilities (VectorMaker).")

set(VELOX_ENABLE_PARQUET ON)

set(VELOX_DEPENDENCY_SOURCE
AUTO
CACHE STRING "Default dependency source: AUTO SYSTEM or BUNDLED.")

message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

set(BOOST_INCLUDE_LIBRARIES
atomic
context
date_time
filesystem
program_options
regex
system
thread)

velox_set_source(Boost)
velox_resolve_dependency(Boost 1.77.0 COMPONENTS ${BOOST_INCLUDE_LIBRARIES})

# Ignore known compiler warnings.
check_cxx_compiler_flag("-Wstringop-overread" COMPILER_HAS_W_STRINGOP_OVERREAD)
if(COMPILER_HAS_W_STRINGOP_OVERREAD)
string(APPEND CMAKE_CXX_FLAGS " -Wno-stringop-overread")
endif()

check_cxx_compiler_flag("-Wdeprecated-declarations"
COMPILER_HAS_W_DEPRECATED_DECLARATIONS)
if(COMPILER_HAS_W_DEPRECATED_DECLARATIONS)
string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated-declarations")
endif()

check_cxx_compiler_flag("-Wmaybe-uninitialized"
COMPILER_HAS_W_MAYBE_UNINITIALIZED)
if(COMPILER_HAS_W_MAYBE_UNINITIALIZED)
string(APPEND CMAKE_CXX_FLAGS " -Wno-maybe-uninitialized")
endif()

check_cxx_compiler_flag("-Wunknown-warning-option"
COMPILER_HAS_W_UNKNOWN_WARNING_OPTION)
if(COMPILER_HAS_W_UNKNOWN_WARNING_OPTION)
string(APPEND CMAKE_CXX_FLAGS " -Wno-unknown-warning-option")
endif()

check_cxx_compiler_flag("-Wnullability-completeness"
COMPILER_HAS_W_NULLABILITY_COMPLETENESS)
if(COMPILER_HAS_W_NULLABILITY_COMPLETENESS)
string(APPEND CMAKE_CXX_FLAGS " -Wno-nullability-completeness")
endif()

# Verax, Velox and folly need to be compiled with the same compiler flags.
execute_process(
COMMAND
bash -c
"( source ${CMAKE_CURRENT_SOURCE_DIR}/velox/scripts/setup-helper-functions.sh && echo -n $(get_cxx_flags $ENV{CPU_TARGET}))"
OUTPUT_VARIABLE SCRIPT_CXX_FLAGS
RESULT_VARIABLE COMMAND_STATUS)

if(COMMAND_STATUS EQUAL "1")
message(FATAL_ERROR "Unable to determine compiler flags!")
endif()
message("Setting CMAKE_CXX_FLAGS=${SCRIPT_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}")

message("FINAL CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

include(CTest) # include after project() but before add_subdirectory()

velox_set_source(gtest)
velox_resolve_dependency(gtest)

velox_set_source(glog)
velox_resolve_dependency(glog)

velox_set_source(gflags)
velox_resolve_dependency(gflags COMPONENTS shared)

set(BOOST_INCLUDE_LIBRARIES algorithm context filesystem program_options)

velox_set_source(Boost)
velox_resolve_dependency(Boost 1.77.0 COMPONENTS ${BOOST_INCLUDE_LIBRARIES})

velox_set_source(folly)
velox_resolve_dependency(folly)

# Use xxhash and xsimd from Velox for now.
include_directories(.)
include_directories(${CMAKE_BINARY_DIR})
include_directories(SYSTEM velox)
include_directories(SYSTEM velox/velox/external/xxhash)
include_directories(SYSTEM ${CMAKE_BINARY_DIR}/_deps/xsimd-src/include/)

add_subdirectory(velox)
add_subdirectory(optimizer)
90 changes: 90 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright (c) Meta Platforms, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: all cmake build clean debug release unit submodules

BUILD_BASE_DIR=_build
BUILD_DIR=release
BUILD_TYPE=Release

CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)

# Use Ninja if available. If Ninja is used, pass through parallelism control flags.
USE_NINJA ?= 1
ifeq ($(USE_NINJA), 1)
ifneq ($(shell which ninja), )
GENERATOR := -GNinja

# Ninja makes compilers disable colored output by default.
GENERATOR += -DVELOX_FORCE_COLORED_OUTPUT=ON
endif
endif

ifndef USE_CCACHE
ifneq ($(shell which ccache), )
USE_CCACHE=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
endif
endif

NUM_THREADS ?= $(shell getconf _NPROCESSORS_CONF 2>/dev/null || echo 1)
CPU_TARGET ?= "avx"

all: release #: Build the release version

clean: #: Delete all build artifacts
rm -rf $(BUILD_BASE_DIR)

submodules:
git submodule sync --recursive
git submodule update --init --recursive

cmake: submodules #: Use CMake to create a Makefile build system
mkdir -p $(BUILD_BASE_DIR)/$(BUILD_DIR) && \
cmake -B \
"$(BUILD_BASE_DIR)/$(BUILD_DIR)" \
${CMAKE_FLAGS} \
$(GENERATOR) \
$(USE_CCACHE) \
${EXTRA_CMAKE_FLAGS}

build: #: Build the software based in BUILD_DIR and BUILD_TYPE variables
cmake --build $(BUILD_BASE_DIR)/$(BUILD_DIR) -j $(NUM_THREADS)

debug: #: Build with debugging symbols
$(MAKE) cmake BUILD_DIR=debug BUILD_TYPE=Debug
$(MAKE) build BUILD_DIR=debug -j ${NUM_THREADS}

release: #: Build the release version
$(MAKE) cmake BUILD_DIR=release BUILD_TYPE=Release && \
$(MAKE) build BUILD_DIR=release

unittest: debug #: Build with debugging and run unit tests
cd $(BUILD_BASE_DIR)/debug && ctest -j ${NUM_THREADS} -VV --output-on-failure

format-fix: #: Fix formatting issues in the main branch
scripts/format-check.py format main --fix

format-check: #: Check for formatting issues on the main branch
clang-format --version
scripts/format-check.py format main

header-fix: #: Fix license header issues in the current branch
scripts/format-check.py header main --fix

header-check: #: Check for license header issues on the main branch
scripts/format-check.py header main

help: #: Show the help messages
@cat $(firstword $(MAKEFILE_LIST)) | \
awk '/^[-a-z]+:/' | \
awk -F: '{ printf("%-20s %s\n", $$1, $$NF) }'
13 changes: 13 additions & 0 deletions license.header
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) Meta Platforms, Inc. and its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading