Fetch CL headers on-demand for ComputeCpp and OCL build

Minor CI adjustments for act
Fix TBB and Thrust cmake builds
This commit is contained in:
Tom Lin 2021-12-01 16:19:50 +00:00
parent 565c8c7f95
commit 53f3b7b8a4
8 changed files with 34 additions and 25 deletions

View File

@ -55,6 +55,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Cache compiler - name: Cache compiler
if: ${{ !env.ACT }}
id: prepare-compilers id: prepare-compilers
uses: actions/cache@v2 uses: actions/cache@v2
with: with:

View File

@ -7,7 +7,21 @@ project(BabelStream VERSION 3.5 LANGUAGES CXX)
# some nicer defaults for standard C++ # some nicer defaults for standard C++
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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(MODEL SYCL)
#set(SYCL_COMPILER COMPUTECPP) #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 # setup common build flag defaults if there are no overrides
if (NOT DEFINED ${BUILD_TYPE}_FLAGS) if (NOT DEFINED ${BUILD_TYPE}_FLAGS)
set(ACTUAL_${BUILD_TYPE}_FLAGS ${DEFAULT_${BUILD_TYPE}_FLAGS}) set(ACTUAL_${BUILD_TYPE}_FLAGS ${DEFAULT_${BUILD_TYPE}_FLAGS})
elseif() elseif ()
set(ACTUAL_${BUILD_TYPE}_FLAGS ${${BUILD_TYPE}_FLAGS}) set(ACTUAL_${BUILD_TYPE}_FLAGS ${${BUILD_TYPE}_FLAGS})
endif () endif ()
@ -192,4 +206,4 @@ if (COMMAND setup_target)
setup_target(${EXE_NAME}) setup_target(${EXE_NAME})
endif () endif ()
install (TARGETS ${EXE_NAME} DESTINATION bin) install(TARGETS ${EXE_NAME} DESTINATION bin)

View File

@ -225,10 +225,7 @@ setup_tbb() {
setup_clang_gcc() { setup_clang_gcc() {
echo "deb http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list sudo apt-get install -y -qq gcc-10-offload-nvptx gcc-10-offload-amdgcn libtbb2 libtbb-dev g++-10 clang
sudo apt-get update -qq
sudo apt-get install -y -qq gcc-10-offload-nvptx gcc-10-offload-amdgcn libtbb2 libtbb-dev g++-10
export_var GCC_CXX "$(which g++-10)" export_var GCC_CXX "$(which g++-10)"
verify_bin_exists "$GCC_CXX" verify_bin_exists "$GCC_CXX"
@ -251,9 +248,6 @@ setup_clang_gcc() {
} }
setup_rocm() { 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 sudo apt-get install -y -qq rocm-dev rocthrust-dev
export_var ROCM_PATH "/opt/rocm" 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 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" echo "Running in GitHub Actions, defaulting to special export"
TERM=xterm TERM=xterm
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 if [ "$SETUP" = true ]; then
echo "Deleting extra packages for space in 5 seconds..." echo "Deleting extra packages for space in 2 seconds..."
sleep 5 sleep 2
echo "Starting apt-get remove:" 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 remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y sudo apt-get autoremove -y

View File

@ -9,8 +9,7 @@ register_flag_optional(OpenCL_LIBRARY
macro(setup) macro(setup)
# don't point to the CL dir as the imports already have the CL prefix setup_opencl_header_includes()
set(OpenCL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}")
find_package(OpenCL REQUIRED) find_package(OpenCL REQUIRED)
register_link_library(OpenCL::OpenCL) register_link_library(OpenCL::OpenCL)
endmacro() endmacro()

View File

@ -10,16 +10,6 @@
#include <sstream> #include <sstream>
#include "Stream.h" #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" #include "CL/sycl.hpp"
#define IMPLEMENTATION_STRING "SYCL" #define IMPLEMENTATION_STRING "SYCL"

View File

@ -47,8 +47,7 @@ macro(setup)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
set(ComputeCpp_DIR ${SYCL_COMPILER_DIR}) set(ComputeCpp_DIR ${SYCL_COMPILER_DIR})
# don't point to the CL dir as the imports already have the CL prefix setup_opencl_header_includes()
set(OpenCL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}")
register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0) register_definitions(CL_TARGET_OPENCL_VERSION=220 _GLIBCXX_USE_CXX11_ABI=0)
# ComputeCpp needs OpenCL # ComputeCpp needs OpenCL