Skip to content

Latest commit

 

History

History
79 lines (62 loc) · 5.16 KB

3.7-opensycl(based boost).md

File metadata and controls

79 lines (62 loc) · 5.16 KB

OpenSYCL(for ROCm/CUDA/NVHPC-nvc++)

Dependencies: Boost C++ libs, cmake, Python3(conda), (ROCm)/(NVHPC)/(CUDA+LLVM)

1. install latest conda and activate base environment.

2. Build boost C++ libs: linux-version-1.83.0

  • boost.context(higher than 1.73) and boost.fiber needed
  • compile passed on Ubuntu 20.04(2023.9.27, gcc 9.4.0, conda 23.7.4(base)) latest version.
$ tar -xvf boost_1_83_0.tar.gz && cd ./boost_1_83_0 && ./bootstrap.sh --prefix=/home/ljl/Apps/boost
$ b2 -q install
  • compile passed on KS-supercomputer center environment, list modules:
$ module list
1) apps/anaconda3/5.2.0        2) compiler/cmake/3.22.0-rc1   3) compiler/rocm/dtk-23.04
$ tar -xvf boost_1_83_0.tar.gz && cd ./boost_1_83_0 && ./bootstrap.sh --prefix=/public/home/ljlnwpu/OpenSYCL/boost
$ b2 -q install
  • errors on NFS of SUMA g++ version 8.3.1 by default, use g++ 9.4.0 instead.

Build OpenSYCL with NVHPC support

  • compile for nvc++ of nvidia hpc_sdk 22.2

    $ cd build && rm -rf ./* && cmake -DCMAKE_INSTALL_PREFIX=/home/ljl/Apps/OpenSYCL -DNVCXX_COMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/nvc++ -DCUDA_TOOLKIT_ROOT_DIR=/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/cuda/11.8 -DWITH_CPU_BACKEND=ON -DWITH_CUDA_BACKEND=ON -DWITH_CUDA_NVCXX_ONLY=ON -DWITH_ROCM_BACKEND=OFF -DWITH_OPENCL_BACKEND=OFF .. && make -j8 install
    $ cd build && rm -rf ./* && cmake -DCMAKE_INSTALL_PREFIX=/home/ljl/Apps/OpenSYCL -DNVCXX_COMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/compilers/bin/nvc++ -DCUDA_TOOLKIT_ROOT_DIR=/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/cuda/12.0 -DWITH_CPU_BACKEND=ON -DWITH_CUDA_BACKEND=ON -DWITH_CUDA_NVCXX_ONLY=ON -DWITH_ROCM_BACKEND=OFF -DWITH_OPENCL_BACKEND=OFF .. && make -j8 install

Build OpenSYCL with LLVM-CUDA support

  • compile for llvm-16 and nvcc of CUDA-12.0

    cd build && rm -rf ./* && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/ljl/Apps/OpenSYCL -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -DWITH_CPU_BACKEND=ON -DWITH_CUDA_BACKEND=ON -DWITH_CUDA_NVCXX_ONLY=OFF -DWITH_ROCM_BACKEND=OFF -DWITH_OPENCL_BACKEND=OFF .. && make -j8 install

Build OpenSYCL with ROCm support

  • compile for AMD rocm-5.4.1(clang15): compiling and test successfully

    $ export CC=clang # clang of .../rocm/llvm/bin or add -DCMAKE_C_COMPILER=clang
    $ export CXX=clang++ # clang++ of .../rocm/llvm/bin or add -DCMAKE_CXX_COMPILER=clang++
    $ cd build && rm -rf ./* && cmake -DCMAKE_INSTALL_PREFIX=/home/ljl/Apps/OpenSYCL -DROCM_PATH=/opt/rocm -DWITH_ROCM_BACKEND=ON -DWITH_CUDA_BACKEND=OFF -DHIPSYCL_NO_DEVICE_MANGLER=ON -DWITH_ACCELERATED_CPU=OFF -DWITH_SSCP_COMPILER=OFF .. && make -j8 install
  • compile for KS-supercomputer center dtk-23.04: compiling and test successfully

    $ export CC=clang # clang of .../rocm/llvm/bin or add -DCMAKE_C_COMPILER=clang
    $ export CXX=clang++ # clang++ of .../rocm/llvm/bin or add -DCMAKE_CXX_COMPILER=clang++
    $ cd build && rm -rf ./* && cmake -DCMAKE_INSTALL_PREFIX=/public/home/ljlnwpu/OpenSYCL/AdaptiveCpp -DROCM_PATH=/public/software/compiler/rocm/dtk-23.04 -DBOOST_ROOT=/public/home/ljlnwpu/OpenSYCL/boost -DWITH_CPU_BACKEND=ON -DWITH_ROCM_BACKEND=ON -DWITH_CUDA_BACKEND=OFF -DHIPSYCL_NO_DEVICE_MANGLER=ON -DWITH_ACCELERATED_CPU=OFF -DWITH_SSCP_COMPILER=OFF .. && make -j8 install
    • add cmake option -DWITH_SSCP_COMPILER=OFF for preventing "/usr/bin/ld: can't find -lLLVM"
    • capture a compile bug of OpenSYCL because aligned_alloc() is pulled into std namespace after C++17:(this is for OMP)
    OpenSYCL-build/src/runtime/omp/omp_allocator.cpp:57:10: error: no member named 'aligned_alloc' in namespace 'std'; did you mean simply 'aligned_alloc'?
    mv "return std::aligned_alloc(min_alignment, size_bytes);" -> "return aligned_alloc(min_alignment, size_bytes)"
    • need higher version glib: link higher version glib from gnu/9.3.0 module file path to OpenSYCL path
    $ ls -l ./OpenSYCL/lib/libstdc++.so 
      ./OpenSYCL/lib/libstdc++.so -> /public/software/compiler/gcc-9.3.0/lib64/libstdc++.so
  • compile for suma dtk-23.04(clang15), dtk-22.10(clang14) compiling failed: need higher version compiler and suitable cxx lib

    $ export CC=clang # clang of .../rocm/llvm/bin or add -DCMAKE_C_COMPILER=clang
    $ export CXX=clang++ # clang++ of .../rocm/llvm/bin or add -DCMAKE_CXX_COMPILER=clang++
    $ cd build && rm -rf ./* && cmake -DCMAKE_INSTALL_PREFIX=/home/ljl/Apps/OpenSYCL -DROCM_PATH=/opt/rocm -DWITH_ROCM_BACKEND=ON -DWITH_CUDA_BACKEND=OFF -DHIPSYCL_NO_DEVICE_MANGLER=ON -DWITH_ACCELERATED_CPU=OFF -DWITH_SSCP_COMPILER=OFF .. && make -j8 install
    • without cmake option -DWITH_ACCELERATED_CPU=OFF compile pass, running std::bad_alloc(), seems related to bad g++