diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 0d6b736..9b7489b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -55,6 +55,7 @@ jobs: - uses: actions/checkout@v2 - name: Cache compiler + if: ${{ !env.ACT }} id: prepare-compilers uses: actions/cache@v2 with: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81fa78b..760bbd6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,21 @@ project(BabelStream VERSION 3.5 LANGUAGES CXX) # some nicer defaults for standard C++ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) +include(FetchContent) +FetchContent_Declare( + opencl_header + URL https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2021.06.30.zip + URL_HASH MD5=af7ab7918a6a11c60370c8651a9f0192 +) + +macro(setup_opencl_header_includes) + FetchContent_GetProperties(opencl_header) + if (NOT opencl_header_POPULATED) + FetchContent_Populate(opencl_header) + set(OpenCL_INCLUDE_DIR ${opencl_header_SOURCE_DIR}) + endif () +endmacro() #set(MODEL SYCL) #set(SYCL_COMPILER COMPUTECPP) @@ -149,7 +163,7 @@ message(STATUS "Default ${CMAKE_BUILD_TYPE} flags are `${DEFAULT_${BUILD_TYPE}_F # setup common build flag defaults if there are no overrides if (NOT DEFINED ${BUILD_TYPE}_FLAGS) set(ACTUAL_${BUILD_TYPE}_FLAGS ${DEFAULT_${BUILD_TYPE}_FLAGS}) - elseif() +elseif () set(ACTUAL_${BUILD_TYPE}_FLAGS ${${BUILD_TYPE}_FLAGS}) endif () @@ -192,4 +206,4 @@ if (COMMAND setup_target) setup_target(${EXE_NAME}) endif () -install (TARGETS ${EXE_NAME} DESTINATION bin) \ No newline at end of file +install(TARGETS ${EXE_NAME} DESTINATION bin) \ No newline at end of file diff --git a/src/ci-prepare-bionic.sh b/src/ci-prepare-bionic.sh index 7294905..b77f404 100755 --- a/src/ci-prepare-bionic.sh +++ b/src/ci-prepare-bionic.sh @@ -225,10 +225,7 @@ setup_tbb() { setup_clang_gcc() { - echo "deb http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list - - sudo apt-get update -qq - sudo apt-get install -y -qq gcc-10-offload-nvptx gcc-10-offload-amdgcn libtbb2 libtbb-dev g++-10 + sudo apt-get install -y -qq gcc-10-offload-nvptx gcc-10-offload-amdgcn libtbb2 libtbb-dev g++-10 clang export_var GCC_CXX "$(which g++-10)" verify_bin_exists "$GCC_CXX" @@ -251,9 +248,6 @@ setup_clang_gcc() { } setup_rocm() { - wget -q -O - "https://repo.radeon.com/rocm/rocm.gpg.key" | sudo apt-key add - - echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/4.5 ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list - sudo apt-get update -qq sudo apt-get install -y -qq rocm-dev rocthrust-dev export_var ROCM_PATH "/opt/rocm" export_var PATH "$ROCM_PATH/bin:$PATH" # ROCm needs this for many of their libraries' CMake build to work @@ -320,9 +314,21 @@ if [ "${GITHUB_ACTIONS:-false}" = true ]; then echo "Running in GitHub Actions, defaulting to special export" TERM=xterm export TERM=xterm + + # drop the lock in case we got one from a failed run + rm /var/lib/dpkg/lock-frontend || true + rm /var/cache/apt/archives/lock || true + + wget -q -O - "https://repo.radeon.com/rocm/rocm.gpg.key" | sudo apt-key add - + echo "deb http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list + echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/4.5 ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list + + sudo apt-get update -qq + sudo apt-get install -y -qq cmake + if [ "$SETUP" = true ]; then - echo "Deleting extra packages for space in 5 seconds..." - sleep 5 + echo "Deleting extra packages for space in 2 seconds..." + sleep 2 echo "Starting apt-get remove:" sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel sudo apt-get autoremove -y diff --git a/src/ocl/model.cmake b/src/ocl/model.cmake index 2be3981..acefe71 100644 --- a/src/ocl/model.cmake +++ b/src/ocl/model.cmake @@ -9,8 +9,7 @@ register_flag_optional(OpenCL_LIBRARY macro(setup) - # don't point to the CL dir as the imports already have the CL prefix - set(OpenCL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}") + setup_opencl_header_includes() find_package(OpenCL REQUIRED) register_link_library(OpenCL::OpenCL) endmacro() diff --git a/src/sycl/SYCLStream.h b/src/sycl/SYCLStream.h index dd13387..d3fa18d 100644 --- a/src/sycl/SYCLStream.h +++ b/src/sycl/SYCLStream.h @@ -10,16 +10,6 @@ #include #include "Stream.h" - -#include "CL/opencl.h" - -// XXX Intel's SYCL impl. needs CL_MEM_CHANNEL_INTEL which is provided in dpcpp's include dir -// however, depending the system configuration, the system CL header sometimes takes precedence -// we only really need this macro to refer to the extension so this is probably OK -#ifndef CL_MEM_CHANNEL_INTEL -#define CL_MEM_CHANNEL_INTEL 0x4213 -#endif - #include "CL/sycl.hpp" #define IMPLEMENTATION_STRING "SYCL" diff --git a/src/sycl/model.cmake b/src/sycl/model.cmake index c0c6c3f..e7b5a1c 100644 --- a/src/sycl/model.cmake +++ b/src/sycl/model.cmake @@ -47,8 +47,7 @@ macro(setup) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) set(ComputeCpp_DIR ${SYCL_COMPILER_DIR}) - # don't point to the CL dir as the imports already have the CL prefix - set(OpenCL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}") + setup_opencl_header_includes() register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0) # ComputeCpp needs OpenCL diff --git a/src/tbb/TBB.cmake b/src/tbb/model.cmake similarity index 100% rename from src/tbb/TBB.cmake rename to src/tbb/model.cmake diff --git a/src/thrust/THRUST.cmake b/src/thrust/model.cmake similarity index 100% rename from src/thrust/THRUST.cmake rename to src/thrust/model.cmake