Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit ef6910f

Browse files
author
Aaron Tian
committed
Merge branch 'master' into logging
2 parents 4627b6a + d052644 commit ef6910f

File tree

192 files changed

+6916
-4111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+6916
-4111
lines changed

.travis.yml

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,6 @@ matrix:
1414
- PELOTON_BUILD_TYPE=Debug
1515
- COVERALLS=Off
1616

17-
# Linux builds for gcc 4.8
18-
- os: linux
19-
sudo: required
20-
dist: trusty
21-
compiler: gcc
22-
addons:
23-
apt:
24-
sources:
25-
- llvm-toolchain-precise-3.7
26-
- ubuntu-toolchain-r-test
27-
packages:
28-
- g++-4.8
29-
env:
30-
# NAME has no actual use, just to make the travis jobs overview more clear
31-
- NAME="gcc4.8 Debug"
32-
- CXX=g++-4.8
33-
- CC=gcc-4.8
34-
- PELOTON_BUILD_TYPE=Debug
35-
# COVERALLS: we run coveralls only for one compiler
36-
- COVERALLS=Off
37-
38-
- os: linux
39-
sudo: required
40-
dist: trusty
41-
compiler: gcc
42-
addons:
43-
apt:
44-
sources:
45-
- llvm-toolchain-precise-3.7
46-
- ubuntu-toolchain-r-test
47-
packages:
48-
- g++-4.8
49-
env:
50-
# NAME has no actual use, just to make the travis jobs overview more clear
51-
- NAME="gcc4.8 Release"
52-
- CXX=g++-4.8
53-
- CC=gcc-4.8
54-
- PELOTON_BUILD_TYPE=Release
55-
- COVERALLS=Off
56-
5717
# Linux builds for gcc 5
5818
- os: linux
5919
sudo: required

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ include(cmake/Dependencies.cmake)
4242

4343
# ---[ C++11 Flags
4444
include(CheckCXXCompilerFlag)
45-
check_cxx_compiler_flag("-std=c++1y" COMPILER_SUPPORTS_CXX1Y)
45+
check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
4646

47-
if(COMPILER_SUPPORTS_CXX1Y)
48-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
47+
if(COMPILER_SUPPORTS_CXX11)
48+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-c++14-compat")
4949
else()
50-
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++1Y support. Please use a different C++ compiler.")
50+
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
5151
endif()
5252

5353
# Create a new pre-processor macro __PELOTONFILE__ that has a truncated
@@ -77,6 +77,10 @@ if(UNIX OR APPLE)
7777
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
7878
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-undefined-compare -Wno-unused-private-field -Wno-braced-scalar-init -Wno-constant-conversion -Wno-potentially-evaluated-expression -Wno-infinite-recursion -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I/usr/local/opt/openssl/include")
7979
endif()
80+
# ---[ close$NOCANCEL for Mac OS
81+
if(APPLE)
82+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-dollar-in-identifier-extension")
83+
endif()
8084
endif()
8185

8286
# There is a problem with building on g++5.4 on Ubuntu 17.10 where

Jenkinsfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,15 @@ pipeline {
4343
}
4444
}
4545

46-
stage('Ubuntu Trusty/gcc-4.8.4/llvm-3.7.1 (Debug)') {
46+
stage('Ubuntu Trusty/gcc-5.4.0/llvm-3.7.1 (Debug)') {
4747
agent { docker { image 'ubuntu:trusty' } }
4848
steps {
4949
sh 'sudo /bin/bash -c "source ./script/installation/packages.sh"'
50+
sh 'sudo apt-get -y install software-properties-common'
51+
sh 'sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test'
52+
sh 'sudo apt-get update'
53+
sh 'sudo apt-get -y install gcc-5 g++-5'
54+
sh 'sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1 --slave /usr/bin/g++ g++ /usr/bin/g++-5'
5055
sh 'python script/validators/source_validator.py'
5156
sh 'mkdir build'
5257
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZER=Address -DCOVERALLS=False .. && make -j4'
@@ -59,10 +64,15 @@ pipeline {
5964
}
6065
}
6166

62-
stage('Ubuntu Trusty/gcc-4.8.4/llvm-3.7.1 (Release)') {
67+
stage('Ubuntu Trusty/gcc-5.4.0/llvm-3.7.1 (Release)') {
6368
agent { docker { image 'ubuntu:trusty' } }
6469
steps {
6570
sh 'sudo /bin/bash -c "source ./script/installation/packages.sh"'
71+
sh 'sudo apt-get -y install software-properties-common'
72+
sh 'sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test'
73+
sh 'sudo apt-get update'
74+
sh 'sudo apt-get -y install gcc-5 g++-5'
75+
sh 'sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1 --slave /usr/bin/g++ g++ /usr/bin/g++-5'
6676
sh 'python script/validators/source_validator.py'
6777
sh 'mkdir build'
6878
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCOVERALLS=False .. && make -j4'

cmake/Dependencies.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ find_library(TFlowC
4242
PATHS "/usr/local/lib")
4343
list(APPEND Peloton_LINKER_LIBS ${TFlowC})
4444

45+
# --[ Eigen3
46+
find_package(Eigen3 REQUIRED)
47+
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
48+
4549
# ---[ Libevent
4650
find_package(Libevent REQUIRED)
4751
include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS})

cmake/Modules/FindEigen3.cmake

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# - Try to find Eigen3 lib
2+
#
3+
# This module supports requiring a minimum version, e.g. you can do
4+
# find_package(Eigen3 3.1.2)
5+
# to require version 3.1.2 or newer of Eigen3.
6+
#
7+
# Once done this will define
8+
#
9+
# EIGEN3_FOUND - system has eigen lib with correct version
10+
# EIGEN3_INCLUDE_DIR - the eigen include directory
11+
# EIGEN3_VERSION - eigen version
12+
#
13+
# This module reads hints about search locations from
14+
# the following enviroment variables:
15+
#
16+
# EIGEN3_ROOT
17+
# EIGEN3_ROOT_DIR
18+
19+
# Copyright (c) 2006, 2007 Montel Laurent, <[email protected]>
20+
# Copyright (c) 2008, 2009 Gael Guennebaud, <[email protected]>
21+
# Copyright (c) 2009 Benoit Jacob <[email protected]>
22+
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
23+
24+
if(NOT Eigen3_FIND_VERSION)
25+
if(NOT Eigen3_FIND_VERSION_MAJOR)
26+
set(Eigen3_FIND_VERSION_MAJOR 2)
27+
endif(NOT Eigen3_FIND_VERSION_MAJOR)
28+
if(NOT Eigen3_FIND_VERSION_MINOR)
29+
set(Eigen3_FIND_VERSION_MINOR 91)
30+
endif(NOT Eigen3_FIND_VERSION_MINOR)
31+
if(NOT Eigen3_FIND_VERSION_PATCH)
32+
set(Eigen3_FIND_VERSION_PATCH 0)
33+
endif(NOT Eigen3_FIND_VERSION_PATCH)
34+
35+
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
36+
endif(NOT Eigen3_FIND_VERSION)
37+
38+
macro(_eigen3_check_version)
39+
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
40+
41+
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
42+
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
43+
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
44+
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
45+
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
46+
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
47+
48+
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
49+
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
50+
set(EIGEN3_VERSION_OK FALSE)
51+
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
52+
set(EIGEN3_VERSION_OK TRUE)
53+
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
54+
55+
if(NOT EIGEN3_VERSION_OK)
56+
57+
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
58+
"but at least version ${Eigen3_FIND_VERSION} is required")
59+
endif(NOT EIGEN3_VERSION_OK)
60+
endmacro(_eigen3_check_version)
61+
62+
if (EIGEN3_INCLUDE_DIR)
63+
64+
# in cache already
65+
_eigen3_check_version()
66+
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
67+
68+
else (EIGEN3_INCLUDE_DIR)
69+
70+
# search first if an Eigen3Config.cmake is available in the system,
71+
# if successful this would set EIGEN3_INCLUDE_DIR and the rest of
72+
# the script will work as usual
73+
find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
74+
75+
if(NOT EIGEN3_INCLUDE_DIR)
76+
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
77+
HINTS
78+
ENV EIGEN3_ROOT
79+
ENV EIGEN3_ROOT_DIR
80+
PATHS
81+
${CMAKE_INSTALL_PREFIX}/include
82+
${KDE4_INCLUDE_DIR}
83+
PATH_SUFFIXES eigen3 eigen
84+
)
85+
endif(NOT EIGEN3_INCLUDE_DIR)
86+
87+
if(EIGEN3_INCLUDE_DIR)
88+
_eigen3_check_version()
89+
endif(EIGEN3_INCLUDE_DIR)
90+
91+
include(FindPackageHandleStandardArgs)
92+
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
93+
94+
mark_as_advanced(EIGEN3_INCLUDE_DIR)
95+
96+
endif(EIGEN3_INCLUDE_DIR)
97+

script/installation/packages.sh

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -42,46 +42,53 @@ TF_TYPE="cpu"
4242

4343

4444
function install_protobuf3.4.0() {
45-
# Install Relevant tooling
46-
# Remove any old versions of protobuf
47-
DISTRIB=$1 # ubuntu/fedora
48-
if [ "$DISTRIB" == "ubuntu" ]
49-
then
50-
sudo apt-get --yes --force-yes remove --purge libprotobuf-dev protobuf-compiler
51-
elif [ "$DISTRIB" == "fedora" ]
52-
then
53-
sudo dnf -q remove -y protobuf protobuf-devel protobuf-compiler
54-
else
55-
echo "Only Ubuntu and Fedora is supported currently!"
56-
return 0
57-
fi
58-
wget -O protobuf-cpp-3.4.0.tar.gz https://github.com/google/protobuf/releases/download/v3.4.0/protobuf-cpp-3.4.0.tar.gz
59-
tar -xzf protobuf-cpp-3.4.0.tar.gz
60-
cd protobuf-3.4.0
61-
./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig
62-
cd ..
63-
# Cleanup
64-
rm -rf protobuf-3.4.0 protobuf-cpp-3.4.0.tar.gz
45+
# Install Relevant tooling
46+
# Remove any old versions of protobuf
47+
DISTRIB=$1 # ubuntu/fedora
48+
if [ "$DISTRIB" == "ubuntu" ]; then
49+
sudo apt-get --yes --force-yes remove --purge libprotobuf-dev protobuf-compiler
50+
elif [ "$DISTRIB" == "fedora" ]; then
51+
sudo dnf -q remove -y protobuf protobuf-devel protobuf-compiler
52+
else
53+
echo "Only Ubuntu and Fedora is supported currently!"
54+
return 0
55+
fi
56+
if /usr/local/bin/protoc --version == "libprotoc 3.4.0"; then
57+
echo "protobuf-3.4.0 already installed"
58+
return
59+
fi
60+
wget -O protobuf-cpp-3.4.0.tar.gz https://github.com/google/protobuf/releases/download/v3.4.0/protobuf-cpp-3.4.0.tar.gz
61+
tar -xzf protobuf-cpp-3.4.0.tar.gz
62+
cd protobuf-3.4.0
63+
./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig
64+
cd ..
65+
# Cleanup
66+
rm -rf protobuf-3.4.0 protobuf-cpp-3.4.0.tar.gz
6567
}
6668

6769
# Utility function for installing tensorflow components of python/C++
6870
function install_tf() {
69-
TFCApiFile=$1
70-
TF_VERSION=$2
71-
LinkerConfigCmd=$3
72-
TARGET_DIRECTORY="/usr/local"
73-
# Install Tensorflow Python Binary
74-
sudo -E pip3 install --upgrade pip
75-
sudo -E pip3 install --upgrade tensorflow==${TF_VERSION}
71+
if pip show -q tensorflow && [ -d /usr/local/include/tensorflow/c ]; then
72+
echo "tensorflow already installed"
73+
return
74+
fi
75+
TFCApiFile=$1
76+
TF_VERSION=$2
77+
LinkerConfigCmd=$3
78+
TARGET_DIRECTORY="/usr/local"
79+
# Install Tensorflow Python Binary
80+
sudo -E pip3 install --upgrade pip
81+
# Related issue: https://github.com/pypa/pip/issues/3165
82+
sudo -E pip3 install tensorflow==${TF_VERSION} --upgrade --ignore-installed six
7683

77-
# Install C-API
78-
TFCApiURL="https://storage.googleapis.com/tensorflow/libtensorflow/${TFCApiFile}"
79-
wget -O $TFCApiFile $TFCApiURL
80-
sudo tar -C $TARGET_DIRECTORY -xzf $TFCApiFile || true
81-
# Configure the Linker
82-
eval $LinkerConfigCmd
83-
# Cleanup
84-
rm -rf ${TFCApiFile}
84+
# Install C-API
85+
TFCApiURL="https://storage.googleapis.com/tensorflow/libtensorflow/${TFCApiFile}"
86+
wget -O $TFCApiFile $TFCApiURL
87+
sudo tar -C $TARGET_DIRECTORY -xzf $TFCApiFile || true
88+
# Configure the Linker
89+
eval $LinkerConfigCmd
90+
# Cleanup
91+
rm -rf ${TFCApiFile}
8592
}
8693

8794
## ------------------------------------------------
@@ -161,7 +168,8 @@ if [ "$DISTRO" = "UBUNTU" ]; then
161168
libtool \
162169
make \
163170
g++ \
164-
ant \
171+
libeigen3-dev \
172+
ant \
165173
unzip
166174
# Install version of protobuf needed by C-API
167175
install_protobuf3.4.0 "ubuntu"
@@ -194,7 +202,8 @@ elif [ "$DISTRO" = "DEBIAN OS" ]; then
194202
llvm-dev \
195203
libedit-dev \
196204
postgresql-client \
197-
libtbb-dev
205+
libtbb-dev \
206+
libeigen3-dev
198207

199208
## ------------------------------------------------
200209
## FEDORA
@@ -239,7 +248,7 @@ elif [[ "$DISTRO" == *"FEDORA"* ]]; then
239248
automake \
240249
libtool
241250
# Install version of protobuf needed by C-API
242-
install_protobuf3.4.0 "fedora"
251+
install_protobuf3.4.0 "fedora"
243252
# Install tensorflow
244253
install_tf "$TFCApiFile" "$TF_VERSION" "$LinkerConfigCmd"
245254

@@ -343,6 +352,7 @@ elif [ "$DISTRO" = "DARWIN" ]; then
343352
brew install wget
344353
brew install python
345354
brew upgrade python
355+
brew install eigen
346356
# Brew installs correct version of Protobuf(3.5.1 >= 3.4.0)
347357
# So we can directly install tensorflow
348358
install_tf "$TFCApiFile" "$TF_VERSION" "$LinkerConfigCmd"

src/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,6 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/libpg_query/ libpg_query.a)
3636

3737
##################################################################################
3838

39-
# --[ tensorflow
40-
# Generate essential model files
41-
set(MODEL_GEN_DIR ${CMAKE_CURRENT_LIST_DIR}/brain/modelgen)
42-
set(MODEL_GEN_PY ${MODEL_GEN_DIR}/model_generator.py)
43-
set(MODEL_GEN_SETTINGS ${MODEL_GEN_DIR}/settings.json)
44-
set(MODEL_GEN_COMMAND python3 ${MODEL_GEN_PY} ${MODEL_GEN_SETTINGS} ${MODEL_GEN_DIR})
45-
46-
message(STATUS "Tensorflow models being generated")
47-
execute_process(COMMAND ${MODEL_GEN_COMMAND}
48-
RESULT_VARIABLE RETURN_VALUE)
49-
50-
if (NOT RETURN_VALUE EQUAL 0)
51-
message(FATAL_ERROR "Failed to generate tensorflow models.")
52-
endif()
53-
54-
##################################################################################
55-
5639
# --[ Peloton library
5740

5841
# creates 'srcs' lists

0 commit comments

Comments
 (0)