-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial SYCL build system and examples (#5081)
- Loading branch information
Showing
40 changed files
with
1,310 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
matrix: | ||
CONFIG: [ON, OFF] | ||
env: | ||
SHARED: ${{ matrix.CONFIG }} | ||
BUILD_SHARED_LIBS: ${{ matrix.CONFIG }} | ||
BUILD_CUDA_MODULE: OFF | ||
BUILD_TENSORFLOW_OPS: ${{ matrix.CONFIG }} | ||
BUILD_PYTORCH_OPS: ${{ matrix.CONFIG }} | ||
|
@@ -68,7 +68,7 @@ jobs: | |
DEVEL_PKG_NAME="$(basename package/open3d-devel-*.tar.xz)" | ||
echo "DEVEL_PKG_NAME=$DEVEL_PKG_NAME" >> $GITHUB_ENV | ||
- name: Build Open3D viewer app | ||
if: ${{ env.SHARED == 'OFF' }} | ||
if: ${{ env.BUILD_SHARED_LIBS == 'OFF' }} | ||
run: | | ||
PATH=/usr/local/var/homebrew/linked/ccache/libexec:$PATH | ||
pushd build | ||
|
@@ -78,15 +78,15 @@ jobs: | |
ccache -s | ||
- name: Upload package | ||
if: ${{ env.SHARED == 'ON' }} | ||
if: ${{ env.BUILD_SHARED_LIBS == 'ON' }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: open3d-devel-macosx | ||
path: build/package/${{ env.DEVEL_PKG_NAME }} | ||
if-no-files-found: error | ||
|
||
- name: GCloud CLI setup | ||
if: ${{ github.ref == 'refs/heads/master' && env.SHARED == 'ON' }} | ||
if: ${{ github.ref == 'refs/heads/master' && env.BUILD_SHARED_LIBS == 'ON' }} | ||
# https://github.com/GoogleCloudPlatform/github-actions/issues/100#issuecomment-650798308 | ||
uses: google-github-actions/[email protected] | ||
with: | ||
|
@@ -96,14 +96,14 @@ jobs: | |
export_default_credentials: true | ||
|
||
- name: Upload package to GCS bucket | ||
if: ${{ github.ref == 'refs/heads/master' && env.SHARED == 'ON' }} | ||
if: ${{ github.ref == 'refs/heads/master' && env.BUILD_SHARED_LIBS == 'ON' }} | ||
run: | | ||
gsutil cp build/package/${{ env.DEVEL_PKG_NAME }} gs://open3d-releases-master/devel/ | ||
echo "Download devel package at: https://storage.googleapis.com/open3d-releases-master/devel/${{ env.DEVEL_PKG_NAME }}" | ||
- name: Upload Open3D viewer app | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ env.SHARED == 'OFF' }} | ||
if: ${{ env.BUILD_SHARED_LIBS == 'OFF' }} | ||
with: | ||
name: open3d-app-macosx-10_15 | ||
path: build/bin/open3d-app-macosx-10_15.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Ubuntu SYCL | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
NPROC: 2 | ||
GCE_CLI_GHA_VERSION: "302.0.0" | ||
|
||
jobs: | ||
ubuntu-sycl: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
BUILD_SHARED_LIBS: [ON, OFF] | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v2 | ||
- name: Maximize build space | ||
run: | | ||
source util/ci_utils.sh | ||
maximize_ubuntu_github_actions_build_space | ||
- name: Docker build | ||
run: | | ||
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ]; then | ||
docker/docker_build.sh sycl-shared | ||
else | ||
docker/docker_build.sh sycl-static | ||
fi | ||
- name: Docker test | ||
run: | | ||
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ]; then | ||
docker/docker_test.sh sycl-shared | ||
else | ||
docker/docker_test.sh sycl-static | ||
fi | ||
- name: GCloud CLI setup | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
uses: google-github-actions/[email protected] | ||
with: | ||
version: ${{ env.GCE_CLI_GHA_VERSION }} | ||
service_account_key: ${{ secrets.GCE_SA_KEY_DOCS_CI }} | ||
project_id: ${{ secrets.GCE_DOCS_PROJECT }} | ||
export_default_credentials: true | ||
- name: Upload ccache to GCS | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
run: | | ||
gsutil cp ${GITHUB_WORKSPACE}/open3d-ci-sycl.tar.gz gs://open3d-ci-cache/ || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,13 +27,13 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
SHARED: [ON, OFF] | ||
BUILD_SHARED_LIBS: [ON, OFF] | ||
MLOPS: [ON, OFF] | ||
exclude: | ||
- SHARED: OFF | ||
- BUILD_SHARED_LIBS: OFF | ||
MLOPS: ON | ||
env: | ||
SHARED: ${{ matrix.SHARED }} | ||
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }} | ||
BUILD_CUDA_MODULE: OFF | ||
BUILD_TENSORFLOW_OPS: ${{ matrix.MLOPS }} | ||
BUILD_PYTORCH_OPS: ${{ matrix.MLOPS }} | ||
|
@@ -47,39 +47,39 @@ jobs: | |
maximize_ubuntu_github_actions_build_space | ||
- name: Docker build | ||
run: | | ||
if [ "${{ matrix.SHARED }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ]; then | ||
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ]; then | ||
docker/docker_build.sh cpu-static | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
docker/docker_build.sh cpu-shared | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
docker/docker_build.sh cpu-shared-release | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
docker/docker_build.sh cpu-shared-ml | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
docker/docker_build.sh cpu-shared-ml-release | ||
fi | ||
- name: Docker test | ||
run: | | ||
if [ "${{ matrix.SHARED }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ]; then | ||
if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "OFF" ] && [ "${{ matrix.MLOPS }}" = "OFF" ]; then | ||
docker/docker_test.sh cpu-static | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
docker/docker_test.sh cpu-shared | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "OFF" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
docker/docker_test.sh cpu-shared-release | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "ON" ]; then | ||
docker/docker_test.sh cpu-shared-ml | ||
elif [ "${{ matrix.SHARED }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
elif [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ] && [ "${{ matrix.MLOPS }}" = "ON" ] && [ "${{ env.DEVELOPER_BUILD }}" = "OFF" ]; then | ||
docker/docker_test.sh cpu-shared-ml-release | ||
fi | ||
- name: Upload package to GitHub artifacts | ||
if: ${{ env.SHARED == 'ON' }} | ||
if: ${{ env.BUILD_SHARED_LIBS == 'ON' }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: open3d-devel-linux-x86_64 | ||
path: open3d-devel-*.tar.xz | ||
if-no-files-found: error | ||
- name: GCloud CLI setup | ||
if: ${{ github.ref == 'refs/heads/master' && env.SHARED == 'ON' }} | ||
if: ${{ github.ref == 'refs/heads/master' && env.BUILD_SHARED_LIBS == 'ON' }} | ||
# https://github.com/GoogleCloudPlatform/github-actions/issues/100#issuecomment-650798308 | ||
uses: google-github-actions/[email protected] | ||
with: | ||
|
@@ -88,7 +88,7 @@ jobs: | |
project_id: ${{ secrets.GCE_DOCS_PROJECT }} | ||
export_default_credentials: true | ||
- name: Upload package to GCS bucket | ||
if: ${{ github.ref == 'refs/heads/master' && env.SHARED == 'ON' }} | ||
if: ${{ github.ref == 'refs/heads/master' && env.BUILD_SHARED_LIBS == 'ON' }} | ||
run: | | ||
gsutil cp open3d-devel-*.tar.xz gs://open3d-releases-master/devel/ | ||
echo "Download devel package at: https://storage.googleapis.com/open3d-releases-master/devel/${{ env.DEVEL_PKG_NAME }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,25 +38,25 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
SHARED: [ON, OFF] | ||
BUILD_SHARED_LIBS: [ON, OFF] | ||
STATIC_RUNTIME: [ON, OFF] | ||
BUILD_CUDA: [ON, OFF] | ||
BUILD_CUDA_MODULE: [ON, OFF] | ||
CONFIG: [Release, Debug] | ||
exclude: | ||
- SHARED: ON | ||
- BUILD_SHARED_LIBS: ON | ||
STATIC_RUNTIME: ON | ||
include: | ||
- BUILD_CUDA: ON | ||
- BUILD_CUDA_MODULE: ON | ||
CUDA_VERSION: 11.0.3 | ||
env: | ||
BUILD_WEBRTC: ${{ ( matrix.SHARED == 'OFF' && matrix.STATIC_RUNTIME == 'ON' ) && 'ON' || 'OFF' }} | ||
BUILD_WEBRTC: ${{ ( matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' ) && 'ON' || 'OFF' }} | ||
|
||
steps: | ||
- name: Disk space used | ||
run: Get-PSDrive | ||
|
||
- name: Install CUDA | ||
if: ${{ matrix.BUILD_CUDA == 'ON' }} | ||
if: ${{ matrix.BUILD_CUDA_MODULE == 'ON' }} | ||
run: | | ||
# Define variables | ||
$CUDA_VER_FULL = "${{ matrix.CUDA_VERSION }}" | ||
|
@@ -109,13 +109,13 @@ jobs: | |
-DDEVELOPER_BUILD="${env:DEVELOPER_BUILD}" ` | ||
-DBUILD_EXAMPLES=OFF ` | ||
-DCMAKE_INSTALL_PREFIX="C:\Program Files\Open3D" ` | ||
-DBUILD_SHARED_LIBS=${{ matrix.SHARED }} ` | ||
-DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ` | ||
-DSTATIC_WINDOWS_RUNTIME=${{ matrix.STATIC_RUNTIME }} ` | ||
-DBUILD_COMMON_ISPC_ISAS=ON ` | ||
-DBUILD_LIBREALSENSE=ON ` | ||
-DBUILD_WEBRTC=${{ env.BUILD_WEBRTC }} ` | ||
-DBUILD_UNIT_TESTS=ON ` | ||
-DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA }} ` | ||
-DBUILD_CUDA_MODULE=${{ matrix.BUILD_CUDA_MODULE }} ` | ||
${{ env.SRC_DIR }} | ||
- name: Build | ||
|
@@ -129,7 +129,7 @@ jobs: | |
- name: Package | ||
working-directory: ${{ env.BUILD_DIR }} | ||
if: ${{ matrix.SHARED == 'ON' && matrix.BUILD_CUDA == 'OFF' }} | ||
if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' && matrix.BUILD_CUDA_MODULE == 'OFF' }} | ||
run: | | ||
$ErrorActionPreference = 'Stop' | ||
cmake --build . --parallel ${{ env.NPROC }} --config ${{ matrix.CONFIG }} ` | ||
|
@@ -143,15 +143,15 @@ jobs: | |
$env:GITHUB_ENV -Encoding utf8 -Append | ||
- name: Upload package | ||
if: ${{ matrix.SHARED == 'ON' && matrix.BUILD_CUDA == 'OFF' }} | ||
if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' && matrix.BUILD_CUDA_MODULE == 'OFF' }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: open3d-devel-windows | ||
path: ${{ env.BUILD_DIR }}/package/${{ env.DEVEL_PKG_NAME }} | ||
if-no-files-found: error | ||
|
||
- name: GCloud CLI setup | ||
if: ${{ github.ref == 'refs/heads/master' && matrix.SHARED == 'ON' && matrix.BUILD_CUDA == 'OFF' }} | ||
if: ${{ github.ref == 'refs/heads/master' && matrix.BUILD_SHARED_LIBS == 'ON' && matrix.BUILD_CUDA_MODULE == 'OFF' }} | ||
# https://github.com/GoogleCloudPlatform/github-actions/issues/100#issuecomment-650798308 | ||
uses: google-github-actions/[email protected] | ||
env: | ||
|
@@ -163,7 +163,7 @@ jobs: | |
export_default_credentials: true | ||
|
||
- name: Upload package to GCS bucket | ||
if: ${{ github.ref == 'refs/heads/master' && matrix.SHARED == 'ON' && matrix.BUILD_CUDA == 'OFF' }} | ||
if: ${{ github.ref == 'refs/heads/master' && matrix.BUILD_SHARED_LIBS == 'ON' && matrix.BUILD_CUDA_MODULE == 'OFF' }} | ||
env: | ||
CLOUDSDK_PYTHON: ${{env.PYTHON_EXECUTABLE}} | ||
run: | | ||
|
@@ -176,7 +176,7 @@ jobs: | |
} | ||
- name: Run C++ unit tests | ||
if: ${{ matrix.BUILD_CUDA == 'OFF' }} | ||
if: ${{ matrix.BUILD_CUDA_MODULE == 'OFF' }} | ||
working-directory: ${{ env.BUILD_DIR }} | ||
run: | | ||
echo "Add --gtest_random_seed=SEED to the test command to repeat this test sequence." | ||
|
@@ -206,8 +206,8 @@ jobs: | |
idna==${{ env.IDNA_VER }} | ||
cmake --build . --config ${{ matrix.CONFIG }} --target install-pip-package | ||
- name: Import python package | ||
# If SHARED == ON, Open3D.dll needs to be copied, which is not recommended for python. | ||
if: ${{ matrix.SHARED == 'OFF' && matrix.BUILD_CUDA == 'OFF' }} | ||
# If BUILD_SHARED_LIBS == ON, Open3D.dll needs to be copied, which is not recommended for python. | ||
if: ${{ matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.BUILD_CUDA_MODULE == 'OFF' }} | ||
run: | | ||
python -c "import open3d; print('Imported:', open3d)" | ||
python -c "import open3d; print('CUDA enabled: ', open3d.core.cuda.is_available())" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Open3D SYCL | ||
|
||
Note: this file will be moved to the `docs` folder once SYCL support is mature. | ||
|
||
## Concepts | ||
|
||
- **OpenCL**: Low-level programming interface for heterogeneous platforms. | ||
- **SYCL**: High-level programming interface for heterogeneous platforms. SYCL | ||
was originally based on OpenCL but now SYCL is an independent standard. | ||
- **DPC++**: Intel's implementation of the SYCL standard. | ||
- **oneAPI**: A collection of open standards, including DPC++, oneMKL, oneTBB, etc. | ||
|
||
Open3D's SYCL support runs on DPC++ and requires oneAPI dependencies. For | ||
convenience, in the source code, we use the term "SYCL" although we may be | ||
referring to "DPC++". | ||
|
||
## Setup | ||
|
||
1. Install oneAPI for Linux: [install via apt-get](https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html) | ||
2. Prepare environment | ||
```bash | ||
# Source environments | ||
source /opt/intel/oneapi/setvars.sh | ||
|
||
# We'll be using oneAPI's distribution of conda and Python | ||
# Python 3.6+ will work | ||
conda create -n sycl python=3.8 | ||
conda activate sycl | ||
``` | ||
3. Check your environment | ||
```bash | ||
which icx # /opt/intel/oneapi/compiler/<version>/linux/bin/icx | ||
which icpx # /opt/intel/oneapi/compiler/<version>/linux/bin/icpx | ||
which python # ${HOME}/.conda/envs/sycl/bin/python | ||
python --version # Python 3.8.12 :: Intel Corporation | ||
``` | ||
4. Config and build | ||
```bash | ||
cmake -DBUILD_SYCL_MODULE=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx .. | ||
make -j$(nproc) | ||
``` | ||
5. Run demos | ||
We provide several ways to run SYCL demos. This ensures the linking are | ||
correct and all run-time dependencies are satisfied. | ||
```bash | ||
# C++ test | ||
make tests -j$(nproc) | ||
./bin/tests --gtest_filter="*SYCLDemo*" | ||
|
||
# C++ example | ||
make SYCLDemo -j$(nproc) | ||
./bin/examples/SYCLDemo | ||
|
||
# Python | ||
make install-pip-package -j$(nproc) | ||
pytest ../python/test/core/test_sycl_utils.py -s | ||
``` | ||
|
||
## Known limitations/requirement | ||
|
||
- Limitations (not implemented yet) | ||
- Only supports Linux | ||
- Only supports `BUILD_CUDA_MODULE=OFF` | ||
- ML ops not supported (C++17 cannot be enabled for TF) | ||
- Requirements (required by DPC++) | ||
- Only supports `GLIBCXX_USE_CXX11_ABI=ON` | ||
- Only supports `set(CMAKE_CXX_STANDARD 17)` | ||
|
||
|
||
## List of oneAPI Python packages | ||
|
||
To make `pip install open3d` works out-of-the box on SYCL-enabled platforms, | ||
we can utilize runtime libraries released via PyPI. This feature needs to be | ||
implemented. | ||
|
||
User: | ||
- https://pypi.org/user/IntelAutomationEngineering/ | ||
|
||
Libraries: | ||
- dpcpp-cpp-rt https://pypi.org/project/dpcpp-cpp-rt/#history | ||
- mkl https://pypi.org/project/mkl/#history | ||
- mkl-static https://pypi.org/project/mkl-static/#history | ||
- mkl-include https://pypi.org/project/mkl-include/#history | ||
- mkl-dpcpp https://pypi.org/project/mkl-dpcpp/#history | ||
- mkl-devel-dpcpp https://pypi.org/project/mkl-devel-dpcpp/#history | ||
- ipp https://pypi.org/project/ipp/#history | ||
- ipp-static https://pypi.org/project/ipp-static/#history | ||
- tbb https://pypi.org/project/tbb/#history |
Oops, something went wrong.