Skip to content

Commit

Permalink
Set cxx11_abi based on tf / torch ops in ci_utls.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheorey committed Oct 14, 2023
1 parent 52206a5 commit 8af2f8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
3 changes: 3 additions & 0 deletions docs/docker.in.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,6 @@ sample configuration options available are shown below.
Run ``./docker_build.sh`` without arguments to get a list of all available build
configurations.
.. note:: You can control support for PyTorch and Tensorflow with environment variables:
`BUILD_PYTORCH_OPS=ON` and `BUILD_TENSORFLOW_OPS=ON`
24 changes: 15 additions & 9 deletions util/ci_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ TENSORFLOW_VER="2.13.0"
TORCH_VER="2.0.1"
TORCH_CPU_GLNX_VER="${TORCH_VER}+cpu"
TORCH_CUDA_GLNX_VER="${TORCH_VER}+cu117" # match CUDA_VERSION in docker/docker_build.sh
PYTHON_VER=$(python -c 'import sys; ver=f"{sys.version_info.major}{sys.version_info.minor}"; print(f"cp{ver}-cp{ver}{sys.abiflags}")' 2>/dev/null || true)
TORCH_MACOS_VER="${TORCH_VER}"
TORCH_REPO_URL="https://download.pytorch.org/whl/torch/"
# Python
Expand Down Expand Up @@ -71,14 +70,14 @@ install_python_dependencies() {
if [ "$BUILD_TENSORFLOW_OPS" == "ON" ]; then
# TF happily installs both CPU and GPU versions at the same time, so remove the other
python -m pip uninstall --yes "$TF_ARCH_DISABLE_NAME"
python -m pip install -U "$TF_ARCH_NAME"=="$TENSORFLOW_VER"
python -m pip install -U "$TF_ARCH_NAME"=="$TENSORFLOW_VER" # ML/requirements-tensorflow.txt
fi
if [ "$BUILD_PYTORCH_OPS" == "ON" ]; then
if [ "$BUILD_PYTORCH_OPS" == "ON" ]; then # ML/requirements-torch.txt
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
python -m pip install -U "${TORCH_GLNX}" -f "$TORCH_REPO_URL"
python -m pip install -U "${TORCH_GLNX}" -f "$TORCH_REPO_URL" tensorboard

elif [[ "$OSTYPE" == "darwin"* ]]; then
python -m pip install -U torch=="$TORCH_MACOS_VER" -f "$TORCH_REPO_URL"
python -m pip install -U torch=="$TORCH_MACOS_VER" -f "$TORCH_REPO_URL" tensorboard
else
echo "unknown OS $OSTYPE"
exit 1
Expand Down Expand Up @@ -106,7 +105,7 @@ build_all() {
cd build

cmakeOptions=(
-DDEVELOPER_BUILD=$DEVELOPER_BUILD
-DDEVELOPER_BUILD="$DEVELOPER_BUILD"
-DBUILD_SHARED_LIBS="$BUILD_SHARED_LIBS"
-DCMAKE_BUILD_TYPE=Release
-DBUILD_LIBREALSENSE=ON
Expand Down Expand Up @@ -169,6 +168,13 @@ build_pip_package() {
echo "Jupyter extension disabled in Python wheel."
BUILD_JUPYTER_EXTENSION=OFF
fi
CXX11_ABI=ON
if [ "$BUILD_TENSORFLOW_OPS" == "ON" ]; then
CXX11_ABI=$(python -c "import tensorflow as tf; print('ON' if tf.__cxx11_abi_flag__ else 'OFF')")
elif [ "$BUILD_PYTORCH_OPS" == "ON" ]; then
CXX11_ABI=$(python -c "import torch; print('ON' if torch._C._GLIBCXX_USE_CXX11_ABI else 'OFF')")
fi
echo Building with GLIBCXX_USE_CXX11_ABI="$CXX11_ABI"
set -u

echo
Expand All @@ -179,8 +185,8 @@ build_pip_package() {
"-DDEVELOPER_BUILD=$DEVELOPER_BUILD"
"-DBUILD_COMMON_ISPC_ISAS=ON"
"-DBUILD_AZURE_KINECT=$BUILD_AZURE_KINECT"
"-DBUILD_LIBREALSENSE=ON"
"-DGLIBCXX_USE_CXX11_ABI=OFF"
"-DBUILD_LIBREALSENSE=OFF"
"-DGLIBCXX_USE_CXX11_ABI=$CXX11_ABI"
"-DBUILD_TENSORFLOW_OPS=$BUILD_TENSORFLOW_OPS"
"-DBUILD_PYTORCH_OPS=$BUILD_PYTORCH_OPS"
"-DBUILD_FILAMENT_FROM_SOURCE=$BUILD_FILAMENT_FROM_SOURCE"
Expand Down Expand Up @@ -282,7 +288,7 @@ run_python_tests() {
python -m pip install -U -r python/requirements_test.txt
echo Add --randomly-seed=SEED to the test command to reproduce test order.
pytest_args=("$OPEN3D_SOURCE_ROOT"/python/test/)
if [ "$BUILD_PYTORCH_OPS" == "OFF" ] || [ "$BUILD_TENSORFLOW_OPS" == "OFF" ]; then
if [ "$BUILD_PYTORCH_OPS" == "OFF" ] && [ "$BUILD_TENSORFLOW_OPS" == "OFF" ]; then
echo Testing ML Ops disabled
pytest_args+=(--ignore "$OPEN3D_SOURCE_ROOT"/python/test/ml_ops/)
fi
Expand Down

0 comments on commit 8af2f8f

Please sign in to comment.