Skip to content

Commit

Permalink
fix sycl dockerfile deps installation
Browse files Browse the repository at this point in the history
  • Loading branch information
alifahrri committed Mar 19, 2024
1 parent 8f7cd15 commit b0a757d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sycl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- uses: actions/checkout@v2
- name: build docker
run: |
docker build . --tag nmtools:sycl-clang14-cuda --file docker/sycl-cuda.dockerfile
docker build . --tag nmtools:sycl-clang14-cuda --build-arg BASE=nvidia/cuda:11.8.0-devel-ubuntu22.04 --build-arg cuda_backend=ON --build-arg toolchain=sycl-clang14-cuda --file docker/sycl.dockerfile
23 changes: 17 additions & 6 deletions docker/sycl.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from ubuntu:jammy as dev
# ARG BASE=nvidia/cuda:11.8.0-devel-ubuntu22.04
ARG BASE=ubuntu:jammy
from ${BASE} as dev

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia
Expand Down Expand Up @@ -46,17 +48,26 @@ COPY scripts/install_doctest.sh scripts/install_doctest.sh
RUN bash scripts/install_doctest.sh

RUN apt install -y libclang-dev clang-tools libomp-dev llvm-dev lld libboost-dev libboost-fiber-dev libboost-context-dev
## TODO: read from ARG
ENV OPENCL_BACKEND=OFF
RUN bash scripts/install_opensycl.sh

ARG opencl_backend=OFF
ENV OPENCL_BACKEND=${opencl_backend}

ARG cuda_backend=OFF
ENV CUDA_BACKEND=${cuda_backend}

ARG level_zero_backend=OFF
ENV LEVEL_ZERO_BACKEND=${level_zero_backend}

ARG toolchain=sycl-clang14-omp
ENV TOOLCHAIN=${toolchain}

RUN bash scripts/install_opensycl.sh

RUN mkdir -p build/${toolchain} && cd build/${toolchain} \
&& cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/${toolchain}.cmake \
-DNMTOOLS_BUILD_META_TESTS=OFF -DNMTOOLS_BUILD_UTL_TESTS=OFF -DNMTOOLS_TEST_ALL=OFF \
-DNMTOOLS_BUILD_SYCL_TESTS=ON \
../.. \
&& make -j2 VERBOSE=1 numeric-tests-sycl-doctest

ENV toolchain=${toolchain}
CMD ["sh", "-c", "/workspace/nmtools/build/${toolchain}/tests/sycl/numeric-tests-sycl-doctest"]
CMD ["sh", "-c", "/workspace/nmtools/build/${TOOLCHAIN}/tests/sycl/numeric-tests-sycl-doctest"]
32 changes: 20 additions & 12 deletions scripts/install_opensycl.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
#!/usr/bin/bash

if [[ -z "${LLVM_VERSION}" ]]; then
LLVM_VERSION="14"
LLVM_VERSION="14"
else
LLVM_VERSION="${LLVM_VERSION}"
echo "set LLVM_VERSION from env"
LLVM_VERSION="${LLVM_VERSION}"
echo "set LLVM_VERSION from env"
fi

if [[ -z "${ACCELERATED_CPU}" ]]; then
ACCELERATED_CPU="ON"
ACCELERATED_CPU="ON"
else
ACCELERATED_CPU="${ACCELERATED_CPU}"
echo "set ACCELERATED_CPU from env"
ACCELERATED_CPU="${ACCELERATED_CPU}"
echo "set ACCELERATED_CPU from env"
fi

if [[ -z "${OPENCL_BACKEND}" ]]; then
OPENCL_BACKEND="ON"
OPENCL_BACKEND="OFF"
else
OPENCL_BACKEND="${OPENCL_BACKEND}"
echo "set OPENCL_BACKEND from env"
OPENCL_BACKEND="${OPENCL_BACKEND}"
echo "set OPENCL_BACKEND from env"
fi

if [[ -z "${CUDA_BACKEND}" ]]; then
CUDA_BACKEND="ON"
CUDA_BACKEND="OFF"
else
CUDA_BACKEND="${CUDA_BACKEND}"
echo "set CUDA_BACKEND from env"
CUDA_BACKEND="${CUDA_BACKEND}"
echo "set CUDA_BACKEND from env"
fi

if [[ -z "${LEVEL_ZERO_BACKEND}" ]]; then
LEVEL_ZERO_BACKEND="OFF"
else
LEVEL_ZERO_BACKEND="${LEVEL_ZERO_BACKEND}"
echo "set LEVEL_ZERO_BACKEND from env"
fi

if [[ -z "${BUILD_TYPE}" ]]; then
Expand Down Expand Up @@ -64,6 +71,7 @@ cmake \
-DWITH_ACCELERATED_CPU=${ACCELERATED_CPU} \
-DWITH_OPENCL_BACKEND=${OPENCL_BACKEND} \
-DWITH_CUDA_BACKEND=${CUDA_BACKEND} \
-DWITH_LEVEL_ZERO_BACKEND=${LEVEL_ZERO_BACKEND} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
..
make -j2 VERBOSE=1
Expand Down

0 comments on commit b0a757d

Please sign in to comment.