From 946de08c6262515825fd35f6dfa84add618ca8ef Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Fri, 11 Apr 2025 17:02:52 -0400 Subject: [PATCH 01/14] Add Docker scripts for building ArrayFire 3.10 release. --- Dockerfile | 80 ----------- README | 9 ++ README.md | 51 ------- arrayfire/manylinux/cuda_deps/Dockerfile | 20 +++ arrayfire/manylinux/dependencies/Dockerfile | 41 ++++++ arrayfire/manylinux/dev_base/Dockerfile | 23 +++ arrayfire/scripts/build_arrayfire.sh | 150 ++++++++++++++++++++ arrayfire/ubuntu/cuda_deps/Dockerfile | 20 +++ arrayfire/ubuntu/dependencies/Dockerfile | 26 ++++ arrayfire/ubuntu/dev_base/Dockerfile | 32 +++++ docker-compose.yml | 95 +++++++++++++ test_dockers/STGZ/Dockerfile | 20 +++ 12 files changed, 436 insertions(+), 131 deletions(-) delete mode 100644 Dockerfile create mode 100644 README delete mode 100644 README.md create mode 100644 arrayfire/manylinux/cuda_deps/Dockerfile create mode 100644 arrayfire/manylinux/dependencies/Dockerfile create mode 100644 arrayfire/manylinux/dev_base/Dockerfile create mode 100755 arrayfire/scripts/build_arrayfire.sh create mode 100644 arrayfire/ubuntu/cuda_deps/Dockerfile create mode 100644 arrayfire/ubuntu/dependencies/Dockerfile create mode 100644 arrayfire/ubuntu/dev_base/Dockerfile create mode 100644 docker-compose.yml create mode 100644 test_dockers/STGZ/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 15a004e..0000000 --- a/Dockerfile +++ /dev/null @@ -1,80 +0,0 @@ -FROM nvidia/cuda:11.4.2-devel-ubuntu20.04 -MAINTAINER support@arrayfire.com - -ENV DEBIAN_FRONTEND=nonintercative - -RUN apt-get update && apt-get install -y software-properties-common && \ - apt-get install -y --no-install-recommends \ - build-essential \ - clinfo \ - cmake \ - git \ - libboost-all-dev \ - libfftw3-dev \ - libfontconfig1-dev \ - libfreeimage-dev \ - liblapack-dev \ - liblapacke-dev \ - libopenblas-dev \ - ocl-icd-opencl-dev \ - opencl-headers \ - wget \ - xorg-dev && \ - rm -rf /var/lib/apt/lists/* - -# Setting up symlinks for libcuda and OpenCL ICD -RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib/libcuda.so.1 && \ - ln -s /usr/lib/libcuda.so.1 /usr/lib/libcuda.so && \ - mkdir -p /etc/OpenCL/vendors && \ - echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \ - echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ - echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf -ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} - -WORKDIR /root - -# Build GLFW from source -RUN git clone --depth 1 --branch 3.3.4 https://github.com/glfw/glfw.git && \ - cd glfw && \ - mkdir build && \ - cd build && \ - cmake -DCMAKE_INSTALL_PREFIX=/usr .. && \ - make -j4 && \ - make install - -RUN cd /tmp && \ - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \ - apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \ - rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \ - echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \ - add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" && \ - apt update -y && apt install -y intel-basekit - -SHELL ["/bin/bash", "-c"] - -# AF_DISABLE_GRAPHICS - Environment variable to disable graphics at -# runtime due to lack of graphics support by docker - visit -# http://arrayfire.org/docs/configuring_environment.htm#af_disable_graphics -# for more information -ENV AF_PATH=/opt/arrayfire AF_DISABLE_GRAPHICS=1 -ARG COMPILE_GRAPHICS=OFF -RUN source /opt/intel/oneapi/setvars.sh && \ - git clone --depth 1 --recursive https://github.com/arrayfire/arrayfire.git -b master && \ - cd arrayfire && mkdir build && cd build && \ - cmake .. -DCMAKE_INSTALL_PREFIX=/opt/arrayfire-3 \ - -DCMAKE_BUILD_TYPE=Release \ - -DAF_BUILD_CPU=ON \ - -DAF_BUILD_CUDA=ON \ - -DAF_BUILD_DOCS=OFF \ - -DAF_BUILD_EXAMPLES=ON \ - -DAF_BUILD_OPENCL=ON \ - -DAF_BUILD_UNIFIED=ON \ - -DAF_WITH_FREEIMAGE_STATIC=OFF && \ - # -DCOMPUTES_DETECTED_LIST="30;35;37;50;52;60" \ - make -j8 && make install && \ - mkdir -p ${AF_PATH} && ln -s /opt/arrayfire-3/* ${AF_PATH}/ && \ - echo "${AF_PATH}/lib" >> /etc/ld.so.conf.d/arrayfire.conf && \ - echo "/usr/local/cuda/nvvm/lib64" >> /etc/ld.so.conf.d/arrayfire.conf && \ - ldconfig - -WORKDIR /root/arrayfire diff --git a/README b/README new file mode 100644 index 0000000..d27fe16 --- /dev/null +++ b/README @@ -0,0 +1,9 @@ +Builders are defined in the docker-compose.yml file. + +To run a particular build, do: docker-compose up + +The build script used is: arrayfire/scripts/build_arrayfire.sh + +A directory will be created here with the build files with the form: build__arrayfire__ + +The installer can be tested by copying the installer package to the test docker in test_dockers and building (note for the CUDA back end you will need an Nvidia GPU and the CUDA docker toolkit installed). diff --git a/README.md b/README.md deleted file mode 100644 index dc1adf3..0000000 --- a/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# arrayfire-docker - -Dockerfile for Building and Using ArrayFire https://github.com/arrayfire/arrayfire.git - -## Dependencies - -[nvidia-docker](https://github.com/NVIDIA/nvidia-docker) - -## Building image - -``` -nvidia-docker build -t arrayfire . -``` - -Make sure to modify ArrayFire's -[build arguments](https://github.com/arrayfire/arrayfire-docker/blob/master/Dockerfile#L43) -in the `Dockerfile` to suit your needs prior to building the image. - -## Running container - -``` -nvidia-docker run --rm -ti arrayfire -``` - -Once running, invoke the -[unified backend](http://arrayfire.org/docs/unifiedbackend.htm) test to show -available devices for each of ArrayFire's backends: - -``` -./build/test/backend_unified -``` - -## Compiling stand-alone examples - -``` -cp -R /opt/arrayfire/share/ArrayFire/examples /root/arrayfire-examples -cd /root/arrayfire-examples && mkdir build && cd build -cmake .. -DArrayFire_DIR=/opt/arrayfire/share/ArrayFire/cmake -make -j8 -``` - -Take a look at the examples -[`README.md`](https://github.com/arrayfire/arrayfire/blob/devel/examples/README.md) -for more information. - -### Support and Contact Info - -* Google Groups: https://groups.google.com/forum/#!forum/arrayfire-users -* ArrayFire Services: [Consulting](http://arrayfire.com/consulting/) | [Support](http://arrayfire.com/support/) | [Training](http://arrayfire.com/training/) -* ArrayFire Blogs: http://arrayfire.com/blog/ -* Email: diff --git a/arrayfire/manylinux/cuda_deps/Dockerfile b/arrayfire/manylinux/cuda_deps/Dockerfile new file mode 100644 index 0000000..bb329d9 --- /dev/null +++ b/arrayfire/manylinux/cuda_deps/Dockerfile @@ -0,0 +1,20 @@ +FROM af/manylinux/dependencies +MAINTAINER Christophe Murphy + +ARG AF_CUDA_VERSION + +RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && \ + dnf clean all && \ + dnf -y install cuda-toolkit-${AF_CUDA_VERSION} && \ + dnf -y install cudnn-cuda-${AF_CUDA_VERSION} && \ + dnf clean all + +# Create Nvidia's ICD and missing standard simlinks for the CUDA driver and OpenCL +RUN mkdir -p /etc/OpenCL/vendors && \ + echo "/usr/local/cuda/targets/x86_64-linux/lib/libOpenCL.so" > /etc/OpenCL/vendors/nvidia.icd && \ + ldconfig && \ + ln -s /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so \ + /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so.1 + +ENV PATH /usr/local/cuda/bin:${PATH} +ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:${LD_LIBRARY_PATH} diff --git a/arrayfire/manylinux/dependencies/Dockerfile b/arrayfire/manylinux/dependencies/Dockerfile new file mode 100644 index 0000000..8e79498 --- /dev/null +++ b/arrayfire/manylinux/dependencies/Dockerfile @@ -0,0 +1,41 @@ +FROM af/manylinux/dev_base +MAINTAINER Christophe Murphy + +# Boost +FROM af/manylinux/dev_base as boost +RUN cd /usr/src && \ + wget https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz && \ + tar -xvzf boost_1_87_0.tar.gz && \ + cd boost_1_87_0 && \ + ./bootstrap.sh --prefix=/artifact && \ + ./b2 install && \ + cd /usr/src && rm -rf boost_1_87_0* + +# Doxygen +FROM af/manylinux/dev_base as doxygen +RUN cd /usr/src && \ + git clone -b Release_1_13_2 https://github.com/doxygen/doxygen.git && \ + cd doxygen && \ + mkdir build && cd build && \ + cmake -DCMAKE_INSTALL_PREFIX:PATH=/artifact .. && \ + make -j$(grep -c processor /proc/cpuinfo) install && \ + cd /usr/src && rm -rf doxygen + +FROM af/manylinux/dev_base +MAINTAINER Christophe Murphy + +# Boost +COPY --from=boost /artifact /usr +# Doxgyen +COPY --from=doxygen /artifact /usr + +# oneAPI +RUN echo $'[oneAPI]\n\ +name=IntelĀ® oneAPI repository\n\ +baseurl=https://yum.repos.intel.com/oneapi\n\ +enabled=1\n\ +gpgcheck=1\n\ +repo_gpgcheck=1\n\ +gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB' > /etc/yum.repos.d/oneAPI.repo && \ +cat /etc/yum.repos.d/oneAPI.repo && \ +dnf -y update && dnf -y install intel-oneapi-base-toolkit && dnf clean all diff --git a/arrayfire/manylinux/dev_base/Dockerfile b/arrayfire/manylinux/dev_base/Dockerfile new file mode 100644 index 0000000..a3fab21 --- /dev/null +++ b/arrayfire/manylinux/dev_base/Dockerfile @@ -0,0 +1,23 @@ +FROM quay.io/pypa/manylinux_2_28_x86_64 +MAINTAINER Christophe Murphy +RUN dnf update -y && \ + dnf groupinstall -y "Development Tools" && \ + dnf -y install ocl-icd ocl-icd-devel opencl-headers \ + wget freetype-devel fontconfig-devel \ + fftw-devel openblas-devel lapack-devel \ + glfw-devel graphviz graphviz-devel \ + mesa-libGLU-devel freeimage-devel && \ + dnf clean all + +# Set location for OpenCL library +ENV OCL_ROOT /usr +ENV OPENCL_ROOT /usr + +# Ninja build system +RUN cd /usr/src && \ + git clone https://github.com/ninja-build/ninja.git && \ + cd ninja && \ + git checkout v1.12.1 && \ + ./configure.py --bootstrap && \ + mv ninja /usr/bin/ && \ + cd .. && rm -rf ninja diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh new file mode 100755 index 0000000..ec30bc5 --- /dev/null +++ b/arrayfire/scripts/build_arrayfire.sh @@ -0,0 +1,150 @@ +#!/bin/bash +set -e +set -x + +use_oneapi=ON +with_graphics=ON +build_cpu=ON +build_cuda=ON +build_oneapi=ON +build_opencl=ON +build_type="RelWithDebInfo" +compute_library_cmake_flag="-DAF_COMPUTE_LIBRARY=Intel-MKL" + +distro=$(paste -d "_" <(cat /etc/*release | grep "^NAME=" | head -n 1 | cut -d '"' -f 2) <(cat /etc/*release | grep "^VERSION_ID=" | head -n 1 | cut -d '"' -f 2)) +build_dir=build_$distro + +AF_CUDA_arch_build_targets="5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX" + +LONGOPTIONS=no-gl,build-type:,no-mkl,no-cpu,no-cuda,no-oneapi,no-opencl,package-type:,cuda-arch: +PARSED=$(getopt --options="" --longoptions=$LONGOPTIONS --name "$0" -- "$@") +if [[ $? -ne 0 ]]; then + # e.g. $? == 1 + # then getopt has complained about wrong arguments to stdout + exit 2 +fi + +eval set -- "$PARSED" + +while true; do + case "$1" in + --no-gl) + with_graphics=OFF + shift + ;; + --build-type) + build_type="$2" + shift 2 + ;; + --no-mkl) + use_oneapi=OFF + build_oneapi=OFF + compute_library_cmake_flag="-DAF_COMPUTE_LIBRARY=FFTW/LAPACK/BLAS -DBLA_VENDOR=OpenBLAS" + shift + ;; + --no-cpu) + build_cpu=OFF + shift + ;; + --no-cuda) + build_cuda=OFF + shift + ;; + --no-oneapi) + build_oneapi=OFF + shift + ;; + --no-opencl) + build_opencl=OFF + shift + ;; + --package-type) + package_type="$2" + shift 2 + ;; + --cuda-arch) + AF_CUDA_arch_build_targets="$2" + shift 2 + ;; + --) + shift + break + ;; + *) + echo "Programming error" + exit 3 + ;; + esac +done + +cd /usr/src + +if [[ ! -d arrayfire/ ]]; then + git clone --recursive https://github.com/arrayfire/arrayfire + cd arrayfire + git config user.email "installer@docker.xyz" + git config user.name "Installer Builder" + git merge -m "add_mkl_install_libs" origin/add_mkl_install_libs + git merge -m "allow_minor_ver_compat" origin/allow_minor_ver_compat + git merge -m "update_af_deps" origin/update_af_deps +else + cd arrayfire + git pull +fi + +mkdir -p "$build_dir" +cd "$build_dir" + +if [ "$use_oneapi" = "ON" ]; then + set +x + source /opt/intel/oneapi/setvars.sh + set -x + # Additional libraries are not needed because they are provided by the runtime + #compute_library_cmake_flag+=" -DAF_ADDITIONAL_MKL_LIBRARIES:FILEPATHS=`find $TBBROOT -name libtbb.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;`find $CMPLR_ROOT/lib -name libintlc.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;`find $CMPLR_ROOT/lib -name libsycl.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;`find $CMPLR_ROOT/lib -name libur_loader.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`" +fi + +# Look for correct OpenCL library and headers, location depends on the distro +for ocl in "/usr/lib64/libOpenCL.so.1" "/usr/lib/x86_64-linux-gnu/libOpenCL.so.1"; do + if [ -f "$ocl" ]; then ocl_dir=$ocl; break; fi +done +if [ -z "$ocl_dir" ]; then + echo "Couldn't find OpenCL library!" + exit 1 +else + opencl_library_cmake_flag=" -DOpenCL_LIBRARY=$ocl_dir -DOPENCL_LIBRARIES=$ocl_dir" +fi +opencl_include_cmake_flag=" -DOPENCL_INCLUDE_DIRS=${OCL_ROOT}/include -DOpenCL_INCLUDE_DIR=${OCL_ROOT}/include" + +cmake -G Ninja \ + -DCMAKE_BUILD_TYPE:STRING="$build_type" \ + -DFG_USE_STATIC_CPPFLAGS:BOOL=OFF \ + -DAF_WITH_STATIC_CUDA_NUMERIC_LIBS=OFF \ + -DFG_WITH_FREEIMAGE:BOOL=ON \ + $compute_library_cmake_flag \ + -DAF_BUILD_CPU:BOOL="$build_cpu" \ + -DAF_BUILD_DOCS:BOOL=ON \ + -DAF_BUILD_EXAMPLES:BOOL=OFF \ + -DAF_BUILD_ONEAPI:BOOL="$build_oneapi" \ + -DAF_BUILD_CUDA:BOOL="$build_cuda" \ + -DAF_BUILD_OPENCL:BOOL="$build_opencl" \ + -DAF_BUILD_FORGE:BOOL=$with_graphics \ + -DCMAKE_SYCL_COMPILER=icpx \ + -DCMAKE_SYCL_FLAGS="-fsycl -D_GLIBCXX_USE_CXX11_ABI=1" \ + -DAF_WITH_IMAGEIO:BOOL=ON \ + -DAF_WITH_LOGGING:BOOL=ON \ + -DAF_INSTALL_STANDALONE:BOOL=ON \ + -DAF_WITH_SPDLOG_HEADER_ONLY=ON \ + -DAF_WITH_FMT_HEADER_ONLY=ON \ + -DBUILD_TESTING:BOOL=OFF \ + -DCUDA_architecture_build_targets:STRING=$AF_CUDA_arch_build_targets \ + $opencl_library_cmake_flag \ + $opencl_include_cmake_flag \ + .. + +# This may need to be adjusted depending on how much memory your system has. +# oneAPI backend compilation uses a lot. +#cmake --build . -- -v +cmake --build . -j 4 -- -v + +cpack -G "$package_type" + diff --git a/arrayfire/ubuntu/cuda_deps/Dockerfile b/arrayfire/ubuntu/cuda_deps/Dockerfile new file mode 100644 index 0000000..564fe3d --- /dev/null +++ b/arrayfire/ubuntu/cuda_deps/Dockerfile @@ -0,0 +1,20 @@ +FROM af/ubuntu/dependencies +MAINTAINER Christophe Murphy + +ARG AF_CUDA_VERSION + +RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \ + dpkg -i cuda-keyring_1.1-1_all.deb && apt-get update -y && \ + apt-get -y install cuda-toolkit-${AF_CUDA_VERSION} && \ + apt-get -y install cudnn9-cuda-${AF_CUDA_VERSION} && \ + apt-get clean -y && rm -rf cuda-keyring_1.1-1_all.deb + +# Create Nvidia's ICD and missing standard simlink for CUDA stub library +RUN mkdir -p /etc/OpenCL/vendors && \ + echo "/usr/local/cuda/targets/x86_64-linux/lib/libOpenCL.so" > /etc/OpenCL/vendors/nvidia.icd && \ + ldconfig && \ + ln -s /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so \ + /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so.1 + +ENV PATH /usr/local/cuda/bin:${PATH} +ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:${LD_LIBRARY_PATH} diff --git a/arrayfire/ubuntu/dependencies/Dockerfile b/arrayfire/ubuntu/dependencies/Dockerfile new file mode 100644 index 0000000..6f3878f --- /dev/null +++ b/arrayfire/ubuntu/dependencies/Dockerfile @@ -0,0 +1,26 @@ +FROM af/ubuntu/dev_base +MAINTAINER Christophe Murphy + +RUN apt-get update -y + +# Boost +RUN apt-get install -y libboost-all-dev + +# Doxygen +RUN apt-get install -y graphviz libgraphviz-dev flex bison +RUN cd /usr/src && \ + git clone -b Release_1_13_2 https://github.com/doxygen/doxygen.git && \ + cd doxygen && \ + mkdir build && cd build && \ + cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && \ + make -j$(grep -c processor /proc/cpuinfo) install && \ + cd /usr/src && rm -rf doxygen + +# oneAPI +RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \ + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ + | tee /etc/apt/sources.list.d/oneAPI.list && \ + apt-get update -y && apt-get install -y intel-oneapi-base-toolkit + +RUN apt-get clean -y diff --git a/arrayfire/ubuntu/dev_base/Dockerfile b/arrayfire/ubuntu/dev_base/Dockerfile new file mode 100644 index 0000000..9206181 --- /dev/null +++ b/arrayfire/ubuntu/dev_base/Dockerfile @@ -0,0 +1,32 @@ +ARG UBUNTU_LTS_VERSION + +FROM ubuntu:$UBUNTU_LTS_VERSION +MAINTAINER Christophe Murphy +RUN apt-get update -y && \ + apt-get install -y wget build-essential git \ + libopenblas-dev libfftw3-dev \ + libfreetype-dev libfontconfig-dev \ + liblapacke-dev ocl-icd-opencl-dev \ + opencl-headers libglfw3-dev \ + libfreeimage-dev libglu1-mesa-dev + +# Set location for OpenCL library +ENV OCL_ROOT /usr + +# CMake +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \ + | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \ + echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' \ + | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \ + apt-get update -y && apt-get install -y cmake + +RUN apt-get clean -y + +# Ninja build system +RUN cd /usr/src && \ + git clone https://github.com/ninja-build/ninja.git && \ + cd ninja && \ + git checkout v1.12.1 && \ + ./configure.py --bootstrap && \ + mv ninja /usr/bin/ && \ + cd .. && rm -rf ninja diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..416884d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,95 @@ +version: "3.4" + +services: + af_manylinux_2_28_base: + build: + context: ./arrayfire/manylinux/dev_base + image: af/manylinux/dev_base + + af_manylinux_2_28_deps: + build: + context: ./arrayfire/manylinux/dependencies + image: af/manylinux/dependencies + depends_on: + - af_manylinux_2_28_base + + af_manylinux_2_28_cuda_12.8: + build: + context: ./arrayfire/manylinux/cuda_deps + args: + AF_CUDA_VERSION: 12-8 + image: af/manylinux/cuda:12.8 + depends_on: + - af_manylinux_2_28_deps + + af_manylinux_2_28_arrayfire_mkl: + image: af/manylinux/cuda:12.8 + depends_on: + - af_manylinux_2_28_cuda_12.8 + volumes: + - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts + - /home/arrayfire/build_dockers/build_manylinux_arrayfire_mkl_2025_cuda_12_8:/usr/src + stdin_open: true + tty: true + command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo + --package-type STGZ --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\"" + + af_manylinux_2_28_arrayfire_openblas: + image: af/manylinux/cuda:12.8 + depends_on: + - af_manylinux_2_28_cuda_12.8 + volumes: + - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts + - /home/arrayfire/build_dockers/build_manylinux_arrayfire_openblas_cuda_12_8:/usr/src + stdin_open: true + tty: true + command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo + --package-type STGZ --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\" --no-mkl" + + af_ubuntu_22_04_base: + build: + context: ./arrayfire/ubuntu/dev_base + args: + UBUNTU_LTS_VERSION: 22.04 + image: af/ubuntu/dev_base + + af_ubuntu_22_04_deps: + build: + context: ./arrayfire/ubuntu/dependencies + image: af/ubuntu/dependencies + depends_on: + - af_ubuntu_22_04_base + + af_ubuntu_22_04_cuda_12.8: + build: + context: ./arrayfire/ubuntu/cuda_deps + args: + AF_CUDA_VERSION: 12-8 + image: af/ubuntu/cuda:12.8 + depends_on: + - af_ubuntu_22_04_deps + + af_ubuntu_22_04_arryfire_mkl: + image: af/ubuntu/cuda:12.8 + depends_on: + - af_ubuntu_22_04_cuda_12.8 + volumes: + - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts + - /home/arrayfire/build_dockers/build_ubuntu_arrayfire_mkl_2025_cuda_12_8:/usr/src + stdin_open: true + tty: true + command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo + --package-type DEB --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\"" + + af_ubuntu_22_04_openblas_cuda_12.8: + image: af/ubuntu/cuda:12.8 + depends_on: + - af_ubuntu_22_04_cuda_12.8 + volumes: + - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts + - /home/arrayfire/build_dockers/build_ubuntu_arrayfire_openblas_cuda_12_8:/usr/src + stdin_open: true + tty: true + command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo + --package-type DEB --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\" --no-mkl" + diff --git a/test_dockers/STGZ/Dockerfile b/test_dockers/STGZ/Dockerfile new file mode 100644 index 0000000..180104f --- /dev/null +++ b/test_dockers/STGZ/Dockerfile @@ -0,0 +1,20 @@ +FROM nvidia/cuda:12.8.1-base-ubuntu22.04 + +RUN apt update && apt-get -y install nvidia-compute-utils-570 wget clinfo build-essential cmake + +RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \ + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \ + apt update && apt-get -y install intel-oneapi-runtime-opencl intel-oneapi-compiler-dpcpp-cpp-runtime + +COPY ArrayFire-3.10.0-Linux.sh /usr/src + +RUN cd /usr/src && ./ArrayFire-3.10.0-Linux.sh --skip-license && rm ArrayFire-3.10.0-Linux.sh + +RUN cd /usr/src/share/ArrayFire/examples && mkdir build && cd build && \ + . /opt/intel/oneapi/setvars.sh && \ + cmake -DArrayFire_DIR=/usr/src/share/ArrayFire/cmake .. && make -j 14 + +RUN echo '\n\ +# Source the runtime so we can run oneapi back end\n\ +. /opt/intel/oneapi/setvars.sh' >> /etc/bash.bashrc From 849f2061a6e0fad9e0a95b7ff164709cf9559a26 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Fri, 11 Apr 2025 17:08:39 -0400 Subject: [PATCH 02/14] Remove already merged branch from script --- arrayfire/scripts/build_arrayfire.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index ec30bc5..c247fed 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -85,7 +85,6 @@ if [[ ! -d arrayfire/ ]]; then git config user.email "installer@docker.xyz" git config user.name "Installer Builder" git merge -m "add_mkl_install_libs" origin/add_mkl_install_libs - git merge -m "allow_minor_ver_compat" origin/allow_minor_ver_compat git merge -m "update_af_deps" origin/update_af_deps else cd arrayfire From 9a499f4c495d63a5b40fa5d2d0b85f6ac4511781 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Tue, 15 Apr 2025 13:47:54 -0700 Subject: [PATCH 03/14] Pre-package oneAPI libraries. --- arrayfire/scripts/build_arrayfire.sh | 17 +++++++++++++++-- test_dockers/STGZ/Dockerfile | 7 +------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index c247fed..c5891e6 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -1,4 +1,9 @@ #!/bin/bash + +function getLibrary { + echo "`find $1 -name $2.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;" +} + set -e set -x @@ -98,8 +103,16 @@ if [ "$use_oneapi" = "ON" ]; then set +x source /opt/intel/oneapi/setvars.sh set -x - # Additional libraries are not needed because they are provided by the runtime - #compute_library_cmake_flag+=" -DAF_ADDITIONAL_MKL_LIBRARIES:FILEPATHS=`find $TBBROOT -name libtbb.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;`find $CMPLR_ROOT/lib -name libintlc.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;`find $CMPLR_ROOT/lib -name libsycl.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;`find $CMPLR_ROOT/lib -name libur_loader.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`" + compute_library_cmake_flag+=" -DAF_ADDITIONAL_MKL_LIBRARIES:FILEPATHS=" + compute_library_cmake_flag+=$(getLibrary $TBBROOT libtbb) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libimf) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libsycl) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libsvml) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libirng) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libintlc) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libur_loader) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libur_adapter_opencl) + compute_library_cmake_flag+=$(getLibrary $UMF_ROOT/lib libumf) fi # Look for correct OpenCL library and headers, location depends on the distro diff --git a/test_dockers/STGZ/Dockerfile b/test_dockers/STGZ/Dockerfile index 180104f..b67718a 100644 --- a/test_dockers/STGZ/Dockerfile +++ b/test_dockers/STGZ/Dockerfile @@ -5,16 +5,11 @@ RUN apt update && apt-get -y install nvidia-compute-utils-570 wget clinfo build- RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \ echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \ - apt update && apt-get -y install intel-oneapi-runtime-opencl intel-oneapi-compiler-dpcpp-cpp-runtime + apt update && apt-get -y install intel-oneapi-runtime-opencl COPY ArrayFire-3.10.0-Linux.sh /usr/src RUN cd /usr/src && ./ArrayFire-3.10.0-Linux.sh --skip-license && rm ArrayFire-3.10.0-Linux.sh RUN cd /usr/src/share/ArrayFire/examples && mkdir build && cd build && \ - . /opt/intel/oneapi/setvars.sh && \ cmake -DArrayFire_DIR=/usr/src/share/ArrayFire/cmake .. && make -j 14 - -RUN echo '\n\ -# Source the runtime so we can run oneapi back end\n\ -. /opt/intel/oneapi/setvars.sh' >> /etc/bash.bashrc From 586b1e9130dd63d60b6ac617d1c2d8c0faa9fc39 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Tue, 15 Apr 2025 13:48:32 -0700 Subject: [PATCH 04/14] Make docker-compose volumes paths relative. --- docker-compose.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 416884d..29b9ff3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,8 +27,8 @@ services: depends_on: - af_manylinux_2_28_cuda_12.8 volumes: - - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts - - /home/arrayfire/build_dockers/build_manylinux_arrayfire_mkl_2025_cuda_12_8:/usr/src + - ./arrayfire/scripts:/scripts + - ./build_manylinux_arrayfire_mkl_2025_cuda_12_8:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo @@ -39,8 +39,8 @@ services: depends_on: - af_manylinux_2_28_cuda_12.8 volumes: - - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts - - /home/arrayfire/build_dockers/build_manylinux_arrayfire_openblas_cuda_12_8:/usr/src + - ./arrayfire/scripts:/scripts + - ./build_manylinux_arrayfire_openblas_cuda_12_8:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo @@ -74,8 +74,8 @@ services: depends_on: - af_ubuntu_22_04_cuda_12.8 volumes: - - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts - - /home/arrayfire/build_dockers/build_ubuntu_arrayfire_mkl_2025_cuda_12_8:/usr/src + - ./arrayfire/scripts:/scripts + - ./build_ubuntu_arrayfire_mkl_2025_cuda_12_8:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo @@ -86,8 +86,8 @@ services: depends_on: - af_ubuntu_22_04_cuda_12.8 volumes: - - /home/arrayfire/build_dockers/arrayfire/scripts:/scripts - - /home/arrayfire/build_dockers/build_ubuntu_arrayfire_openblas_cuda_12_8:/usr/src + - ./arrayfire/scripts:/scripts + - ./build_ubuntu_arrayfire_openblas_cuda_12_8:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo From 5c31f6c1503b11cf22b9b235c379f01b6b4e8efc Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Wed, 16 Apr 2025 12:39:37 -0700 Subject: [PATCH 05/14] Install additional libraries required for the oneAPI back end. Library run paths needed to be patched. --- arrayfire/manylinux/dev_base/Dockerfile | 2 +- arrayfire/scripts/build_arrayfire.sh | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arrayfire/manylinux/dev_base/Dockerfile b/arrayfire/manylinux/dev_base/Dockerfile index a3fab21..b96c009 100644 --- a/arrayfire/manylinux/dev_base/Dockerfile +++ b/arrayfire/manylinux/dev_base/Dockerfile @@ -6,7 +6,7 @@ RUN dnf update -y && \ wget freetype-devel fontconfig-devel \ fftw-devel openblas-devel lapack-devel \ glfw-devel graphviz graphviz-devel \ - mesa-libGLU-devel freeimage-devel && \ + mesa-libGLU-devel freeimage-devel patchelf && \ dnf clean all # Set location for OpenCL library diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index c5891e6..57f5ae7 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -1,7 +1,13 @@ #!/bin/bash function getLibrary { - echo "`find $1 -name $2.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;" + find $1 -name $2.so* -exec cp "{}" /tmp \; + find /tmp -name $2.so* -exec patchelf --set-rpath '$ORIGIN' "{}" \; + echo "`find /tmp -name $2.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;" +} + +function getFile { + echo "`find $1 -name $2 | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;" } set -e @@ -112,6 +118,14 @@ if [ "$use_oneapi" = "ON" ]; then compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libintlc) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libur_loader) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libur_adapter_opencl) + compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib cl.cfg) + compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib clbltfn*.rtl) + compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib cllibrary.rtl) + compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib cllibrary*.o) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libcommon_clang) + compute_library_cmake_flag+=$(getLibrary $TCM_ROOT/lib libhwloc) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libintelocl) + compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libocl_svml_*) compute_library_cmake_flag+=$(getLibrary $UMF_ROOT/lib libumf) fi From 468fcb36b9ea58450ccfc17ed7280ed86324ccba Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Wed, 30 Apr 2025 10:34:40 -0700 Subject: [PATCH 06/14] Fix syntax and separate CUDA major and minor versions. --- arrayfire/manylinux/cuda_deps/Dockerfile | 15 ++++++++------- arrayfire/manylinux/dev_base/Dockerfile | 4 ++-- arrayfire/ubuntu/cuda_deps/Dockerfile | 15 ++++++++------- arrayfire/ubuntu/dev_base/Dockerfile | 2 +- docker-compose.yml | 6 ++++-- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/arrayfire/manylinux/cuda_deps/Dockerfile b/arrayfire/manylinux/cuda_deps/Dockerfile index bb329d9..ba53a8b 100644 --- a/arrayfire/manylinux/cuda_deps/Dockerfile +++ b/arrayfire/manylinux/cuda_deps/Dockerfile @@ -1,20 +1,21 @@ FROM af/manylinux/dependencies MAINTAINER Christophe Murphy -ARG AF_CUDA_VERSION +ARG AF_CUDA_MAJOR_VERSION +ARG AF_CUDA_MINOR_VERSION RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && \ dnf clean all && \ - dnf -y install cuda-toolkit-${AF_CUDA_VERSION} && \ - dnf -y install cudnn-cuda-${AF_CUDA_VERSION} && \ + dnf -y install cuda-toolkit-${AF_CUDA_MAJOR_VERSION}-${AF_CUDA_MINOR_VERSION} && \ + dnf -y install cudnn-cuda-${AF_CUDA_MAJOR_VERSION}-${AF_CUDA_MINOR_VERSION} && \ dnf clean all # Create Nvidia's ICD and missing standard simlinks for the CUDA driver and OpenCL RUN mkdir -p /etc/OpenCL/vendors && \ echo "/usr/local/cuda/targets/x86_64-linux/lib/libOpenCL.so" > /etc/OpenCL/vendors/nvidia.icd && \ ldconfig && \ - ln -s /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so \ - /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so.1 + ln -s /usr/local/cuda-${AF_CUDA_MAJOR_VERSION}.${AF_CUDA_MINOR_VERSION}/targets/x86_64-linux/lib/stubs/libcuda.so \ + /usr/local/cuda-${AF_CUDA_MAJOR_VERSION}.${AF_CUDA_MINOR_VERSION}/targets/x86_64-linux/lib/stubs/libcuda.so.1 -ENV PATH /usr/local/cuda/bin:${PATH} -ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:${LD_LIBRARY_PATH} +ENV PATH=/usr/local/cuda/bin:${PATH} +ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH} diff --git a/arrayfire/manylinux/dev_base/Dockerfile b/arrayfire/manylinux/dev_base/Dockerfile index b96c009..cf05ec7 100644 --- a/arrayfire/manylinux/dev_base/Dockerfile +++ b/arrayfire/manylinux/dev_base/Dockerfile @@ -10,8 +10,8 @@ RUN dnf update -y && \ dnf clean all # Set location for OpenCL library -ENV OCL_ROOT /usr -ENV OPENCL_ROOT /usr +ENV OCL_ROOT=/usr +ENV OPENCL_ROOT=/usr # Ninja build system RUN cd /usr/src && \ diff --git a/arrayfire/ubuntu/cuda_deps/Dockerfile b/arrayfire/ubuntu/cuda_deps/Dockerfile index 564fe3d..82db433 100644 --- a/arrayfire/ubuntu/cuda_deps/Dockerfile +++ b/arrayfire/ubuntu/cuda_deps/Dockerfile @@ -1,20 +1,21 @@ FROM af/ubuntu/dependencies MAINTAINER Christophe Murphy -ARG AF_CUDA_VERSION +ARG AF_CUDA_MAJOR_VERSION +ARG AF_CUDA_MINOR_VERSION RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \ dpkg -i cuda-keyring_1.1-1_all.deb && apt-get update -y && \ - apt-get -y install cuda-toolkit-${AF_CUDA_VERSION} && \ - apt-get -y install cudnn9-cuda-${AF_CUDA_VERSION} && \ + apt-get -y install cuda-toolkit-${AF_CUDA_MAJOR_VERSION}-${AF_CUDA_MINOR_VERSION} && \ + apt-get -y install cudnn9-cuda-${AF_CUDA_MAJOR_VERSION}-${AF_CUDA_MINOR_VERSION} && \ apt-get clean -y && rm -rf cuda-keyring_1.1-1_all.deb # Create Nvidia's ICD and missing standard simlink for CUDA stub library RUN mkdir -p /etc/OpenCL/vendors && \ echo "/usr/local/cuda/targets/x86_64-linux/lib/libOpenCL.so" > /etc/OpenCL/vendors/nvidia.icd && \ ldconfig && \ - ln -s /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so \ - /usr/local/cuda-12.8/targets/x86_64-linux/lib/stubs/libcuda.so.1 + ln -s /usr/local/cuda-${AF_CUDA_MAJOR_VERSION}.${AF_CUDA_MINOR_VERSION}/targets/x86_64-linux/lib/stubs/libcuda.so \ + /usr/local/cuda-${AF_CUDA_MAJOR_VERSION}.${AF_CUDA_MINOR_VERSION}/targets/x86_64-linux/lib/stubs/libcuda.so.1 -ENV PATH /usr/local/cuda/bin:${PATH} -ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:${LD_LIBRARY_PATH} +ENV PATH=/usr/local/cuda/bin:${PATH} +ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH} diff --git a/arrayfire/ubuntu/dev_base/Dockerfile b/arrayfire/ubuntu/dev_base/Dockerfile index 9206181..0efb4b6 100644 --- a/arrayfire/ubuntu/dev_base/Dockerfile +++ b/arrayfire/ubuntu/dev_base/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update -y && \ libfreeimage-dev libglu1-mesa-dev # Set location for OpenCL library -ENV OCL_ROOT /usr +ENV OCL_ROOT=/usr # CMake RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \ diff --git a/docker-compose.yml b/docker-compose.yml index 29b9ff3..2bdefad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,8 @@ services: build: context: ./arrayfire/manylinux/cuda_deps args: - AF_CUDA_VERSION: 12-8 + AF_CUDA_MAJOR_VERSION: 12 + AF_CUDA_MINOR_VERSION: 8 image: af/manylinux/cuda:12.8 depends_on: - af_manylinux_2_28_deps @@ -64,7 +65,8 @@ services: build: context: ./arrayfire/ubuntu/cuda_deps args: - AF_CUDA_VERSION: 12-8 + AF_CUDA_MAJOR_VERSION: 12 + AF_CUDA_MINOR_VERSION: 8 image: af/ubuntu/cuda:12.8 depends_on: - af_ubuntu_22_04_deps From 4a9fb4ff21c33d8e392410a0aa91c2a082b15bb6 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Wed, 30 Apr 2025 18:55:34 -0700 Subject: [PATCH 07/14] Fix library installation so that symlinks are not followed. Fixes so that Intel compiler specific flags are not included --- arrayfire/scripts/build_arrayfire.sh | 21 ++++++++++++++------- docker-compose.yml | 6 ++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index 57f5ae7..a9f1099 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -1,8 +1,8 @@ #!/bin/bash function getLibrary { - find $1 -name $2.so* -exec cp "{}" /tmp \; - find /tmp -name $2.so* -exec patchelf --set-rpath '$ORIGIN' "{}" \; + find $1 -name $2.so* -exec cp -P "{}" /tmp \; + find /tmp -type f -name $2.so* -exec patchelf --set-rpath '$ORIGIN' "{}" \; echo "`find /tmp -name $2.so* | xargs | awk '{ gsub(\" \",\";\",$0); print $0 }'`;" } @@ -21,13 +21,14 @@ build_oneapi=ON build_opencl=ON build_type="RelWithDebInfo" compute_library_cmake_flag="-DAF_COMPUTE_LIBRARY=Intel-MKL" +sycl_compiler_cmake_flags="" distro=$(paste -d "_" <(cat /etc/*release | grep "^NAME=" | head -n 1 | cut -d '"' -f 2) <(cat /etc/*release | grep "^VERSION_ID=" | head -n 1 | cut -d '"' -f 2)) build_dir=build_$distro AF_CUDA_arch_build_targets="5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX" -LONGOPTIONS=no-gl,build-type:,no-mkl,no-cpu,no-cuda,no-oneapi,no-opencl,package-type:,cuda-arch: +LONGOPTIONS=no-gl,build-type:,no-mkl,no-cpu,no-cuda,no-oneapi,no-opencl,package-type:,cuda-arch:,intel-compiler: PARSED=$(getopt --options="" --longoptions=$LONGOPTIONS --name "$0" -- "$@") if [[ $? -ne 0 ]]; then # e.g. $? == 1 @@ -77,6 +78,10 @@ while true; do AF_CUDA_arch_build_targets="$2" shift 2 ;; + --intel-compiler) + intel_cmplr_root="$2" + shift 2 + ;; --) shift break @@ -97,6 +102,7 @@ if [[ ! -d arrayfire/ ]]; then git config user.name "Installer Builder" git merge -m "add_mkl_install_libs" origin/add_mkl_install_libs git merge -m "update_af_deps" origin/update_af_deps + git merge -m "windows_installer_fixes" origin/windows_installer_fixes else cd arrayfire git pull @@ -107,7 +113,7 @@ cd "$build_dir" if [ "$use_oneapi" = "ON" ]; then set +x - source /opt/intel/oneapi/setvars.sh + source ${intel_cmplr_root}/oneapi/setvars.sh set -x compute_library_cmake_flag+=" -DAF_ADDITIONAL_MKL_LIBRARIES:FILEPATHS=" compute_library_cmake_flag+=$(getLibrary $TBBROOT libtbb) @@ -127,6 +133,8 @@ if [ "$use_oneapi" = "ON" ]; then compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libintelocl) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libocl_svml_*) compute_library_cmake_flag+=$(getLibrary $UMF_ROOT/lib libumf) + + sycl_compiler_cmake_flags+=" -DCMAKE_SYCL_COMPILER=icpx \'-DCMAKE_SYCL_FLAGS=-fsycl -D_GLIBCXX_USE_CXX11_ABI=1\'" fi # Look for correct OpenCL library and headers, location depends on the distro @@ -154,8 +162,7 @@ cmake -G Ninja -DAF_BUILD_CUDA:BOOL="$build_cuda" \ -DAF_BUILD_OPENCL:BOOL="$build_opencl" \ -DAF_BUILD_FORGE:BOOL=$with_graphics \ - -DCMAKE_SYCL_COMPILER=icpx \ - -DCMAKE_SYCL_FLAGS="-fsycl -D_GLIBCXX_USE_CXX11_ABI=1" \ + $sycl_compiler_cmake_flags \ -DAF_WITH_IMAGEIO:BOOL=ON \ -DAF_WITH_LOGGING:BOOL=ON \ -DAF_INSTALL_STANDALONE:BOOL=ON \ @@ -170,7 +177,7 @@ cmake -G Ninja # This may need to be adjusted depending on how much memory your system has. # oneAPI backend compilation uses a lot. #cmake --build . -- -v -cmake --build . -j 4 -- -v +cmake --build . -j 8 -- -v cpack -G "$package_type" diff --git a/docker-compose.yml b/docker-compose.yml index 2bdefad..314bc4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,8 @@ services: stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo - --package-type STGZ --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\"" + --package-type STGZ --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\" + --intel-compiler \"/opt/intel\"" af_manylinux_2_28_arrayfire_openblas: image: af/manylinux/cuda:12.8 @@ -81,7 +82,8 @@ services: stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo - --package-type DEB --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\"" + --package-type DEB --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\" + --intel-compiler \"/opt/intel\"" af_ubuntu_22_04_openblas_cuda_12.8: image: af/ubuntu/cuda:12.8 From 60697c4711a91c82e4d7e8655661dc718798a6d9 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Mon, 9 Jun 2025 14:56:49 -0400 Subject: [PATCH 08/14] Remove branch merges from build script. --- arrayfire/scripts/build_arrayfire.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index a9f1099..9e60cbe 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -100,9 +100,6 @@ if [[ ! -d arrayfire/ ]]; then cd arrayfire git config user.email "installer@docker.xyz" git config user.name "Installer Builder" - git merge -m "add_mkl_install_libs" origin/add_mkl_install_libs - git merge -m "update_af_deps" origin/update_af_deps - git merge -m "windows_installer_fixes" origin/windows_installer_fixes else cd arrayfire git pull From 27ece3d4d6abf049736bbde87818bdce50893d9c Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Tue, 24 Jun 2025 08:37:38 -0700 Subject: [PATCH 09/14] Remove unnecessary oneAPI libraries from installer script. --- arrayfire/scripts/build_arrayfire.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index 9e60cbe..1a2f0fe 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -121,14 +121,8 @@ if [ "$use_oneapi" = "ON" ]; then compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libintlc) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libur_loader) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libur_adapter_opencl) - compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib cl.cfg) - compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib clbltfn*.rtl) - compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib cllibrary.rtl) - compute_library_cmake_flag+=$(getFile $CMPLR_ROOT/lib cllibrary*.o) - compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libcommon_clang) compute_library_cmake_flag+=$(getLibrary $TCM_ROOT/lib libhwloc) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libintelocl) - compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libocl_svml_*) compute_library_cmake_flag+=$(getLibrary $UMF_ROOT/lib libumf) sycl_compiler_cmake_flags+=" -DCMAKE_SYCL_COMPILER=icpx \'-DCMAKE_SYCL_FLAGS=-fsycl -D_GLIBCXX_USE_CXX11_ABI=1\'" From a661096aa29d1195c16c189400cc9a24cf2f7759 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Tue, 22 Jul 2025 10:25:12 -0700 Subject: [PATCH 10/14] Update test Docker to CUDA 12.9 --- test_dockers/STGZ/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_dockers/STGZ/Dockerfile b/test_dockers/STGZ/Dockerfile index b67718a..768fbdd 100644 --- a/test_dockers/STGZ/Dockerfile +++ b/test_dockers/STGZ/Dockerfile @@ -1,6 +1,6 @@ -FROM nvidia/cuda:12.8.1-base-ubuntu22.04 +FROM nvidia/cuda:12.9.0-base-ubuntu22.04 -RUN apt update && apt-get -y install nvidia-compute-utils-570 wget clinfo build-essential cmake +RUN apt update && apt-get -y install nvidia-compute-utils-575 wget clinfo build-essential cmake RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \ From 15d4b5a8fbab23af3b76783ef62de3d881444d20 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Wed, 30 Jul 2025 13:30:20 -0400 Subject: [PATCH 11/14] Downgrade to CUDA 12.6 for better PTX compatibility. --- arrayfire/manylinux/cuda_deps/Dockerfile | 8 ++++ arrayfire/scripts/build_arrayfire.sh | 9 +++++ docker-compose.yml | 50 +++++++++++++++--------- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/arrayfire/manylinux/cuda_deps/Dockerfile b/arrayfire/manylinux/cuda_deps/Dockerfile index ba53a8b..518b534 100644 --- a/arrayfire/manylinux/cuda_deps/Dockerfile +++ b/arrayfire/manylinux/cuda_deps/Dockerfile @@ -4,6 +4,14 @@ MAINTAINER Christophe Murphy ARG AF_CUDA_MAJOR_VERSION ARG AF_CUDA_MINOR_VERSION +RUN if [ ${AF_CUDA_MAJOR_VERSION} -eq 12 ]; then \ + if [ ${AF_CUDA_MINOR_VERSION} -lt 4 ]; then \ + dnf install -y gcc-toolset-12; \ + elif [ ${AF_CUDA_MINOR_VERSION} -lt 8 ]; then \ + dnf install -y gcc-toolset-13; \ + fi; \ + fi + RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && \ dnf clean all && \ dnf -y install cuda-toolkit-${AF_CUDA_MAJOR_VERSION}-${AF_CUDA_MINOR_VERSION} && \ diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index 1a2f0fe..7107538 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -1,5 +1,14 @@ #!/bin/bash +if [ ${AF_CUDA_MAJOR_VERSION} -eq 12 ]; then + if [ ${AF_CUDA_MINOR_VERSION} -lt 4 ]; then + source /opt/rh/gcc-toolset-12/enable + elif [ ${AF_CUDA_MINOR_VERSION} -lt 8 ]; then + source /opt/rh/gcc-toolset-13/enable + fi +fi + + function getLibrary { find $1 -name $2.so* -exec cp -P "{}" /tmp \; find /tmp -type f -name $2.so* -exec patchelf --set-rpath '$ORIGIN' "{}" \; diff --git a/docker-compose.yml b/docker-compose.yml index 314bc4c..a876e77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,23 +13,26 @@ services: depends_on: - af_manylinux_2_28_base - af_manylinux_2_28_cuda_12.8: + af_manylinux_2_28_cuda_12.6: build: context: ./arrayfire/manylinux/cuda_deps args: AF_CUDA_MAJOR_VERSION: 12 - AF_CUDA_MINOR_VERSION: 8 - image: af/manylinux/cuda:12.8 + AF_CUDA_MINOR_VERSION: 6 + image: af/manylinux/cuda:12.6 depends_on: - af_manylinux_2_28_deps af_manylinux_2_28_arrayfire_mkl: - image: af/manylinux/cuda:12.8 + image: af/manylinux/cuda:12.6 depends_on: - - af_manylinux_2_28_cuda_12.8 + - af_manylinux_2_28_cuda_12.6 + environment: + - AF_CUDA_MAJOR_VERSION=12 + - AF_CUDA_MINOR_VERSION=6 volumes: - ./arrayfire/scripts:/scripts - - ./build_manylinux_arrayfire_mkl_2025_cuda_12_8:/usr/src + - ./build_manylinux_arrayfire_mkl_2025_cuda_12_6:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo @@ -37,12 +40,15 @@ services: --intel-compiler \"/opt/intel\"" af_manylinux_2_28_arrayfire_openblas: - image: af/manylinux/cuda:12.8 + image: af/manylinux/cuda:12.6 depends_on: - - af_manylinux_2_28_cuda_12.8 + - af_manylinux_2_28_cuda_12.6 + environment: + - AF_CUDA_MAJOR_VERSION=12 + - AF_CUDA_MINOR_VERSION=6 volumes: - ./arrayfire/scripts:/scripts - - ./build_manylinux_arrayfire_openblas_cuda_12_8:/usr/src + - ./build_manylinux_arrayfire_openblas_cuda_12_6:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo @@ -62,36 +68,42 @@ services: depends_on: - af_ubuntu_22_04_base - af_ubuntu_22_04_cuda_12.8: + af_ubuntu_22_04_cuda_12.6: build: context: ./arrayfire/ubuntu/cuda_deps args: AF_CUDA_MAJOR_VERSION: 12 - AF_CUDA_MINOR_VERSION: 8 - image: af/ubuntu/cuda:12.8 + AF_CUDA_MINOR_VERSION: 6 + image: af/ubuntu/cuda:12.6 depends_on: - af_ubuntu_22_04_deps af_ubuntu_22_04_arryfire_mkl: - image: af/ubuntu/cuda:12.8 + image: af/ubuntu/cuda:12.6 depends_on: - - af_ubuntu_22_04_cuda_12.8 + - af_ubuntu_22_04_cuda_12.6 + environment: + - AF_CUDA_MAJOR_VERSION=12 + - AF_CUDA_MINOR_VERSION=6 volumes: - ./arrayfire/scripts:/scripts - - ./build_ubuntu_arrayfire_mkl_2025_cuda_12_8:/usr/src + - ./build_ubuntu_arrayfire_mkl_2025_cuda_12_6:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo --package-type DEB --cuda-arch \"5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;9.0+PTX\" --intel-compiler \"/opt/intel\"" - af_ubuntu_22_04_openblas_cuda_12.8: - image: af/ubuntu/cuda:12.8 + af_ubuntu_22_04_openblas_cuda_12.6: + image: af/ubuntu/cuda:12.6 depends_on: - - af_ubuntu_22_04_cuda_12.8 + - af_ubuntu_22_04_cuda_12.6 + environment: + - AF_CUDA_MAJOR_VERSION=12 + - AF_CUDA_MINOR_VERSION=6 volumes: - ./arrayfire/scripts:/scripts - - ./build_ubuntu_arrayfire_openblas_cuda_12_8:/usr/src + - ./build_ubuntu_arrayfire_openblas_cuda_12_6:/usr/src stdin_open: true tty: true command: "/scripts/build_arrayfire.sh --build-type RelWithDebInfo From 6039bb65cc89956ce0e93e7872bf1dead1ee1787 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Wed, 30 Jul 2025 13:31:16 -0400 Subject: [PATCH 12/14] Checkout v3.10 release branch. --- arrayfire/scripts/build_arrayfire.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index 7107538..50981f2 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -105,7 +105,7 @@ done cd /usr/src if [[ ! -d arrayfire/ ]]; then - git clone --recursive https://github.com/arrayfire/arrayfire + git clone --recursive -b v3.10 https://github.com/arrayfire/arrayfire cd arrayfire git config user.email "installer@docker.xyz" git config user.name "Installer Builder" From ed0e5065a4c5e466f8c068f5bd2254c236b012ac Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Thu, 31 Jul 2025 18:31:30 -0400 Subject: [PATCH 13/14] Switch to Intel oneAPI sh installer. --- arrayfire/manylinux/dependencies/Dockerfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arrayfire/manylinux/dependencies/Dockerfile b/arrayfire/manylinux/dependencies/Dockerfile index 8e79498..a983051 100644 --- a/arrayfire/manylinux/dependencies/Dockerfile +++ b/arrayfire/manylinux/dependencies/Dockerfile @@ -29,13 +29,7 @@ COPY --from=boost /artifact /usr # Doxgyen COPY --from=doxygen /artifact /usr -# oneAPI -RUN echo $'[oneAPI]\n\ -name=IntelĀ® oneAPI repository\n\ -baseurl=https://yum.repos.intel.com/oneapi\n\ -enabled=1\n\ -gpgcheck=1\n\ -repo_gpgcheck=1\n\ -gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB' > /etc/yum.repos.d/oneAPI.repo && \ -cat /etc/yum.repos.d/oneAPI.repo && \ -dnf -y update && dnf -y install intel-oneapi-base-toolkit && dnf clean all +## oneAPI (sh installer) +RUN wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/bd1d0273-a931-4f7e-ab76-6a2a67d646c7/intel-oneapi-base-toolkit-2025.2.0.592.sh && \ + sh ./intel-oneapi-base-toolkit-2025.2.0.592.sh -a --silent --cli --eula accept && \ + rm intel-oneapi-base-toolkit-2025.2.0.592.sh From 5f378707fe575faee65890f643a444de77a4b735 Mon Sep 17 00:00:00 2001 From: Christophe Murphy Date: Mon, 4 Aug 2025 15:34:31 -0400 Subject: [PATCH 14/14] Add symlink from libtbb.so to libtbb.so.2 which seems to be needed by the mkl library on the cpu back end. --- arrayfire/scripts/build_arrayfire.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arrayfire/scripts/build_arrayfire.sh b/arrayfire/scripts/build_arrayfire.sh index 50981f2..e89f0e1 100755 --- a/arrayfire/scripts/build_arrayfire.sh +++ b/arrayfire/scripts/build_arrayfire.sh @@ -123,6 +123,10 @@ if [ "$use_oneapi" = "ON" ]; then set -x compute_library_cmake_flag+=" -DAF_ADDITIONAL_MKL_LIBRARIES:FILEPATHS=" compute_library_cmake_flag+=$(getLibrary $TBBROOT libtbb) + #This symlink is needed for oneMKL to work with tbb on the CPU back end + pushd /tmp; ln -fsn libtbb.so libtbb.so.2; popd + compute_library_cmake_flag+='/tmp/libtbb.so.2;' + # compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libimf) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libsycl) compute_library_cmake_flag+=$(getLibrary $CMPLR_ROOT/lib libsvml)