2016-06-22 11:42:04 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-07-31 21:04:15 -07:00
|
|
|
set -x
|
|
|
|
|
2016-11-02 20:56:25 -07:00
|
|
|
# Cause the script to exit if a single command fails.
|
|
|
|
set -e
|
|
|
|
|
2016-06-22 11:42:04 -07:00
|
|
|
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
|
|
|
|
|
2018-05-19 10:09:23 +08:00
|
|
|
function usage()
|
|
|
|
{
|
|
|
|
echo "Usage: build.sh [<args>]"
|
|
|
|
echo
|
|
|
|
echo "Options:"
|
|
|
|
echo " -h|--help print the help info"
|
|
|
|
echo " -d|--debug CMAKE_BUILD_TYPE=Debug (default is RelWithDebInfo)"
|
2018-08-15 02:33:51 +08:00
|
|
|
echo " -l|--language language1[,language2]"
|
|
|
|
echo " a list of languages to build native libraries."
|
|
|
|
echo " Supported languages include \"python\" and \"java\"."
|
|
|
|
echo " If not specified, only python library will be built."
|
2018-05-19 10:09:23 +08:00
|
|
|
echo " -p|--python which python executable (default from which python)"
|
|
|
|
echo
|
|
|
|
}
|
2018-03-01 14:29:56 -08:00
|
|
|
|
2016-06-25 14:02:33 -07:00
|
|
|
# Determine how many parallel jobs to use for make based on the number of cores
|
|
|
|
unamestr="$(uname)"
|
|
|
|
if [[ "$unamestr" == "Linux" ]]; then
|
2019-02-23 11:58:59 -08:00
|
|
|
PARALLEL=1
|
2016-06-25 14:02:33 -07:00
|
|
|
elif [[ "$unamestr" == "Darwin" ]]; then
|
|
|
|
PARALLEL=$(sysctl -n hw.ncpu)
|
|
|
|
else
|
|
|
|
echo "Unrecognized platform."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-08-15 02:33:51 +08:00
|
|
|
RAY_BUILD_PYTHON="YES"
|
|
|
|
RAY_BUILD_JAVA="NO"
|
2018-05-19 10:09:23 +08:00
|
|
|
PYTHON_EXECUTABLE=""
|
|
|
|
BUILD_DIR=""
|
|
|
|
if [ "$VALGRIND" = "1" ]; then
|
|
|
|
CBUILD_TYPE="Debug"
|
|
|
|
else
|
|
|
|
CBUILD_TYPE="RelWithDebInfo"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Parse options
|
|
|
|
while [[ $# > 0 ]]; do
|
|
|
|
key="$1"
|
|
|
|
case $key in
|
|
|
|
-h|--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-d|--debug)
|
|
|
|
CBUILD_TYPE=Debug
|
|
|
|
;;
|
|
|
|
-l|--languags)
|
|
|
|
LANGUAGE="$2"
|
2018-08-15 02:33:51 +08:00
|
|
|
RAY_BUILD_PYTHON="NO"
|
|
|
|
RAY_BUILD_JAVA="NO"
|
|
|
|
if [[ "$LANGUAGE" == *"python"* ]]; then
|
|
|
|
RAY_BUILD_PYTHON="YES"
|
|
|
|
fi
|
|
|
|
if [[ "$LANGUAGE" == *"java"* ]]; then
|
|
|
|
RAY_BUILD_JAVA="YES"
|
|
|
|
fi
|
|
|
|
if [ "$RAY_BUILD_PYTHON" == "NO" ] && [ "$RAY_BUILD_JAVA" == "NO" ]; then
|
|
|
|
echo "Unrecognized language: $LANGUAGE"
|
2018-05-19 10:09:23 +08:00
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-p|--python)
|
|
|
|
PYTHON_EXECUTABLE="$2"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "ERROR: unknown option \"$key\""
|
|
|
|
echo
|
|
|
|
usage
|
|
|
|
exit -1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ -z "$PYTHON_EXECUTABLE" ]]; then
|
|
|
|
PYTHON_EXECUTABLE=`which python`
|
|
|
|
fi
|
|
|
|
echo "Using Python executable $PYTHON_EXECUTABLE."
|
|
|
|
|
2018-08-15 02:33:51 +08:00
|
|
|
RAY_BUILD_PYTHON=$RAY_BUILD_PYTHON \
|
|
|
|
RAY_BUILD_JAVA=$RAY_BUILD_JAVA \
|
|
|
|
bash $ROOT_DIR/setup_thirdparty.sh $PYTHON_EXECUTABLE
|
2018-05-19 10:09:23 +08:00
|
|
|
|
2018-01-11 11:09:01 -08:00
|
|
|
# Now we build everything.
|
2018-06-02 07:28:27 +08:00
|
|
|
BUILD_DIR="$ROOT_DIR/build/"
|
|
|
|
if [ ! -d "${BUILD_DIR}" ]; then
|
|
|
|
mkdir -p ${BUILD_DIR}
|
2018-05-19 10:09:23 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
pushd "$BUILD_DIR"
|
update ray cmake build process (#2853)
* use cmake to build ray project, no need to appply build.sh before cmake, fix some abuse of cmake, improve the build performance
* support boost external project, avoid using the system or build.sh boost
* keep compatible with build.sh, remove boost and arrow build from it.
* bugfix: parquet bison version control, plasma_java lib install problem
* bugfix: cmake, do not compile plasma java client if no need
* bugfix: component failures test timeout machenism has problem for plasma manager failed case
* bugfix: arrow use lib64 in centos, travis check-git-clang-format-output.sh does not support other branches except master
* revert some fix
* set arrow python executable, fix format error in component_failures_test.py
* make clean arrow python build directory
* update cmake code style, back to support cmake minimum version 3.4
2018-09-13 02:19:33 +08:00
|
|
|
|
2019-02-23 11:58:59 -08:00
|
|
|
if [ ! -z "$RAY_USE_CMAKE" ] ; then
|
|
|
|
# avoid the command failed and exits
|
|
|
|
# and cmake will check some directories to determine whether some targets built
|
|
|
|
make clean || true
|
|
|
|
rm -rf external/arrow-install
|
2018-10-13 00:03:30 +08:00
|
|
|
|
2019-02-23 11:58:59 -08:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=$CBUILD_TYPE \
|
|
|
|
-DCMAKE_RAY_LANG_JAVA=$RAY_BUILD_JAVA \
|
|
|
|
-DCMAKE_RAY_LANG_PYTHON=$RAY_BUILD_PYTHON \
|
|
|
|
-DRAY_USE_NEW_GCS=$RAY_USE_NEW_GCS \
|
|
|
|
-DPYTHON_EXECUTABLE:FILEPATH=$PYTHON_EXECUTABLE $ROOT_DIR
|
|
|
|
|
|
|
|
make -j${PARALLEL}
|
|
|
|
else
|
|
|
|
# The following line installs pyarrow from S3, these wheels have been
|
|
|
|
# generated from https://github.com/ray-project/arrow-build from
|
|
|
|
# the commit listed in the command.
|
|
|
|
$PYTHON_EXECUTABLE -m pip install \
|
2019-02-28 12:17:32 -08:00
|
|
|
--target=$ROOT_DIR/python/ray/pyarrow_files pyarrow==0.12.0.RAY \
|
|
|
|
--find-links https://s3-us-west-2.amazonaws.com/arrow-wheels/9357dc130789ee42f8181d8724bee1d5d1509060/index.html
|
2019-03-12 12:21:55 -07:00
|
|
|
bazel build //:ray_pkg -c opt --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHON_EXECUTABLE
|
2019-03-02 13:38:37 -08:00
|
|
|
# Copy files and keep them writeable. This is a workaround, as Bazel
|
|
|
|
# marks all generated files non-writeable. If we would just copy them
|
|
|
|
# over without adding write permission, the copy would fail the next time.
|
|
|
|
# TODO(pcm): It would be great to have a solution here that does not
|
|
|
|
# require us to copy the files.
|
|
|
|
find $ROOT_DIR/bazel-genfiles/ray_pkg/ -exec chmod +w {} \;
|
|
|
|
cp -r $ROOT_DIR/bazel-genfiles/ray_pkg/ray $ROOT_DIR/python || true
|
2019-02-23 11:58:59 -08:00
|
|
|
fi
|
2018-05-19 10:09:23 +08:00
|
|
|
|
2016-11-18 19:57:51 -08:00
|
|
|
popd
|