diff --git a/CMakeLists.txt b/CMakeLists.txt index e8bd351ab..215f58047 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8) project(orchestra) +set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty") + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) find_package(Protobuf REQUIRED) @@ -71,7 +73,7 @@ set(GENERATED_PROTOBUF_FILES ${ORCHESTRA_PB_H_FILE} ${ORCHESTRA_PB_CPP_FILE} ${TYPES_GRPC_PB_H_FILE} ${TYPES_GRPC_PB_CPP_FILE}) include_directories(${GENERATED_PROTOBUF_PATH}) -link_libraries(grpc++_unsecure grpc pthread ${PROTOBUF_LIBRARY}) +link_libraries(grpc++_unsecure grpc pthread protobuf) if (UNIX AND NOT APPLE) link_libraries(rt) endif() diff --git a/README.md b/README.md index be044884c..ad5d738a4 100644 --- a/README.md +++ b/README.md @@ -11,62 +11,8 @@ For a description of our design decisions, see ## Setup -**Install Arrow** - -1. `git clone https://github.com/apache/arrow.git` -2. `cd ~/arrow` -3. `git checkout 2d8627cd81f83783b0ceb01d137a46b581ecba26` -4. `cd ~/arrow/cpp` -5. `bash setup_build_env.sh` -6. `cd ~/arrow/cpp/thirdparty/flatbuffers-1.3.0` -7. `export FLATBUFFERS_HOME=~/arrow/cpp/thirdparty/installed` (or equivalent) -8. `cd ~/arrow/cpp/build` -9. `cmake ..` -10. `make` -11. `sudo make install` -12. add `export LD_LIBRARY_PATH=LD_LIBRARY_PATH:/usr/local/lib` to your `~/.bashrc` -13. `source ~/.bashrc` - -**Install GRPC** - -1. Follow the instructions [here](https://github.com/grpc/grpc/blob/master/INSTALL), though some of the instructions are outdated. -2. `cd ~/grpc` -3. `mkdir build` -4. `cd build` -5. `cmake ..` -6. `make` -7. `make install` -8. `cd ..` -9. `python setup.py install` - -**Install Numbuf** - -1. `git clone git@github.com:amplab/numbuf.git` -2. `cd numbuf/cpp/` -3. `mkdir build` -4. `cd build` -5. `cmake ..` -6. `sudo make install` -7. `cd ../..` -8. `cd python/` -9. `mkdir build` -10. `cd build` -11. `cmake ..` -12. `sudo make install` -13. `cd ..` -14. `sudo python setup.py install` - - -**Install Orchestra** - -1. `git clone git@github.com:amplab/photon.git` -2. `cd photon` -3. `mkdir build` -4. `cd build` -5. `cmake ..` -6. `make install` -7. `cd ../lib/orchpy` -8. `python setup.py install` -9. `cd ~/orch/test` -10. `bash gen-python-code.sh` -11. `python runtest.py` +1. sudo apt-get update +2. sudo apt-get install git +3. git clone https://github.com/amplab/photon.git +4. cd photon +5. bash setup.sh diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..e3736ee5c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +six >= 1.10 +typing +subprocess32 +grpcio diff --git a/setup.sh b/setup.sh new file mode 100644 index 000000000..b0aae4fc1 --- /dev/null +++ b/setup.sh @@ -0,0 +1,16 @@ +sudo apt-get update +sudo apt-get install git cmake build-essential python-dev python-numpy automake autoconf libtool python-pip libboost-all-dev unzip +sudo pip install --ignore-installed six # getting rid of an old version of six, if it is installed (needed for Ubuntu 14.04) +sudo pip install -r requirements.txt +cd thirdparty +bash download_thirdparty.sh +bash build_thirdparty.sh +cd numbuf +cd python +sudo python setup.py install +mkdir -p ../../../build +cd ../../../build +cmake .. +sudo make install +cd ../lib/orchpy +sudo python setup.py install diff --git a/thirdparty/build_thirdparty.sh b/thirdparty/build_thirdparty.sh new file mode 100644 index 000000000..937259c90 --- /dev/null +++ b/thirdparty/build_thirdparty.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -x +set -e + +TP_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd) +PREFIX=$TP_DIR/installed + +# Determine how many parallel jobs to use for make based on the number of cores +if [[ "$OSTYPE" =~ ^linux ]]; then + PARALLEL=$(grep -c processor /proc/cpuinfo) +elif [[ "$OSTYPE" == "darwin"* ]]; then + PARALLEL=$(sysctl -n hw.ncpu) +else + echo Unsupported platform $OSTYPE + exit 1 +fi + +echo "installing arrow" +export FLATBUFFERS_HOME=$TP_DIR/arrow/cpp/thirdparty/installed/ +$TP_DIR/arrow/cpp/thirdparty/download_thirdparty.sh +$TP_DIR/arrow/cpp/thirdparty/build_thirdparty.sh +mkdir -p $TP_DIR/arrow/cpp/build +cd $TP_DIR/arrow/cpp/build +cmake -DCMAKE_BUILD_TYPE=Release .. +make VERBOSE=1 -j$PARALLEL +sudo make VERBOSE=1 install + +echo "installing numbuf" +mkdir -p $TP_DIR/numbuf/cpp/build +cd $TP_DIR/numbuf/cpp/build +cmake -DCMAKE_BUILD_TYPE=Release .. +make VERBOSE=1 -j$PARALLEL +sudo make VERBOSE=1 install +mkdir -p $TP_DIR/numbuf/python/build +cd $TP_DIR/numbuf/python/build +cmake -DCMAKE_BUILD_TYPE=Release .. +make VERBOSE=1 -j$PARALLEL +sudo make VERBOSE=1 install + +echo "installing GRPC" +cd $TP_DIR/grpc/third_party/protobuf +./autogen.sh +export CXXFLAGS="$CXXFLAGS -fPIC" +./configure --enable-static=no +sudo make install +sudo ldconfig +cd python +sudo python setup.py install +cd $TP_DIR/grpc +make VERBOSE=1 -j$PARALLEL +sudo make VERBOSE=1 install diff --git a/thirdparty/download_thirdparty.sh b/thirdparty/download_thirdparty.sh new file mode 100644 index 000000000..219048cd1 --- /dev/null +++ b/thirdparty/download_thirdparty.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -x +set -e + +TP_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd) + +if [ ! -d arrow ]; then + echo "Fetching arrow" + git clone https://github.com/apache/arrow.git + cd arrow + git checkout 4bd13b852d376065fdb16c36fa821ab0e167f0fc + cd .. +fi + +if [ ! -d numbuf ]; then + echo "Fetching numbuf" + git clone https://github.com/amplab/numbuf.git +fi + +if [ ! -d grpc ]; then + echo "Fetching GRPC" + git clone https://github.com/grpc/grpc.git + cd grpc + git submodule update --init + cd .. +fi