Skip to content

Commit

Permalink
implement concept alpaka::concepts::Tag
Browse files Browse the repository at this point in the history
- remove support for Clang 10 until 12 because the C++20 Concepts are not fully supported
  • Loading branch information
SimeonEhrig committed Oct 8, 2024
1 parent f778f87 commit 6526078
Show file tree
Hide file tree
Showing 42 changed files with 214 additions and 139 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
# Therefore we aim to have each value been set in at lest one job.
# ALPAKA_CI_CXX : {g++, clang++}
# [g++] ALPAKA_CI_GCC_VER : {10, 11, 12, 13}
# [clang++] ALPAKA_CI_CLANG_VER : {10, 11, 12, 13, 14}
# [clang++] ALPAKA_CI_CLANG_VER : {13, 14, 15, 16, 17, 18, 19}
# [cl.exe] ALPAKA_CI_CL_VER : {2022}
# ALPAKA_CI_STDLIB : {libstdc++, [ALPAKA_CI_CXX==clang++]:libc++}
# CMAKE_BUILD_TYPE : {Debug, Release}
Expand Down Expand Up @@ -173,18 +173,18 @@ jobs:
# - libc++
# - sanitizer jobs
# clang++
- name: linux_clang-10_release
- name: linux_clang-13_release
os: ubuntu-20.04
env: {ALPAKA_CI_CXX: clang++, ALPAKA_CI_CLANG_VER: 10, ALPAKA_CI_STDLIB: libc++, CMAKE_BUILD_TYPE: Release, ALPAKA_BOOST_VERSION: 1.75.0, ALPAKA_CI_CMAKE_VER: 3.25.3, OMP_NUM_THREADS: 4, alpaka_ACC_CPU_B_TBB_T_SEQ_ENABLE: OFF, CMAKE_CXX_EXTENSIONS: OFF}
env: {ALPAKA_CI_CXX: clang++, ALPAKA_CI_CLANG_VER: 13, ALPAKA_CI_STDLIB: libc++, CMAKE_BUILD_TYPE: Release, ALPAKA_BOOST_VERSION: 1.75.0, ALPAKA_CI_CMAKE_VER: 3.25.3, OMP_NUM_THREADS: 4, alpaka_ACC_CPU_B_TBB_T_SEQ_ENABLE: OFF, CMAKE_CXX_EXTENSIONS: OFF}
container: ubuntu:20.04
# clang-11 tested in GitLab CI
- name: linux_clang-12_release
- name: linux_clang-14_release
os: ubuntu-20.04
env: {ALPAKA_CI_CXX: clang++, ALPAKA_CI_CLANG_VER: 12, ALPAKA_CI_STDLIB: libc++, CMAKE_BUILD_TYPE: Release, ALPAKA_BOOST_VERSION: 1.77.0, ALPAKA_CI_CMAKE_VER: 3.25.3, OMP_NUM_THREADS: 4, alpaka_ACC_CPU_B_TBB_T_SEQ_ENABLE: OFF, CMAKE_CXX_EXTENSIONS: OFF}
env: {ALPAKA_CI_CXX: clang++, ALPAKA_CI_CLANG_VER: 14, ALPAKA_CI_STDLIB: libc++, CMAKE_BUILD_TYPE: Release, ALPAKA_BOOST_VERSION: 1.77.0, ALPAKA_CI_CMAKE_VER: 3.25.3, OMP_NUM_THREADS: 4, alpaka_ACC_CPU_B_TBB_T_SEQ_ENABLE: OFF, CMAKE_CXX_EXTENSIONS: OFF}
container: ubuntu:20.04
- name: linux_clang-13_debug
- name: linux_clang-15_debug
os: ubuntu-22.04
env: {ALPAKA_CI_CXX: clang++, ALPAKA_CI_CLANG_VER: 13, ALPAKA_CI_STDLIB: libstdc++, CMAKE_BUILD_TYPE: Debug, ALPAKA_BOOST_VERSION: 1.79.0, ALPAKA_CI_CMAKE_VER: 3.25.3, OMP_NUM_THREADS: 3, CMAKE_CXX_EXTENSIONS: OFF}
env: {ALPAKA_CI_CXX: clang++, ALPAKA_CI_CLANG_VER: 15, ALPAKA_CI_STDLIB: libstdc++, CMAKE_BUILD_TYPE: Debug, ALPAKA_BOOST_VERSION: 1.79.0, ALPAKA_CI_CMAKE_VER: 3.25.3, OMP_NUM_THREADS: 3, CMAKE_CXX_EXTENSIONS: OFF}
container: ubuntu:22.04
- name: linux_clang-16_debug_ubsan
os: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion example/bufferCopy/src/bufferCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct FillBufferKernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the index domain
Expand Down
2 changes: 1 addition & 1 deletion example/complex/src/complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct ComplexKernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
using Idx = std::size_t;
Expand Down
2 changes: 1 addition & 1 deletion example/conv2DWithMdspan/src/conv2DWithMdspan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ auto FuzzyEqual(float a, float b) -> bool
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the index domain
Expand Down
2 changes: 1 addition & 1 deletion example/convolution1D/src/convolution1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ auto FuzzyEqual(float a, float b) -> bool
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Size of 1D arrays to be used in convolution integral
Expand Down
2 changes: 1 addition & 1 deletion example/convolution2D/src/convolution2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ auto FuzzyEqual(float a, float b) -> bool
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the index domain
Expand Down
2 changes: 1 addition & 1 deletion example/counterBasedRng/src/counterBasedRng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class CounterBasedRngKernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the index domain
Expand Down
2 changes: 1 addition & 1 deletion example/heatEquation/src/heatEquation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ auto exactSolution(double const x, double const t) -> double
//! Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
//! selected accelerator only. If you use the example as the starting point for your project, you can rename the
//! example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Parameters (a user is supposed to change numNodesX, numTimeSteps)
Expand Down
2 changes: 1 addition & 1 deletion example/heatEquation2D/src/heatEquation2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
//! selected accelerator only. If you use the example as the starting point for your project, you can rename the
//! example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Set Dim and Idx type
Expand Down
2 changes: 1 addition & 1 deletion example/helloWorld/src/helloWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct HelloWorldKernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the index domain
Expand Down
2 changes: 1 addition & 1 deletion example/helloWorldLambda/src/helloWorldLambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void ALPAKA_FN_ACC hiWorldFunction(TAcc const& acc, size_t const nExclamationMar
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// It requires support for extended lambdas when using nvcc as CUDA compiler.
Expand Down
2 changes: 1 addition & 1 deletion example/kernelSpecialization/src/kernelSpecialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct Kernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the accelerator
Expand Down
2 changes: 1 addition & 1 deletion example/matrixMulWithMdspan/src/matrixMulMdSpan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ inline void initializeMatrx(TMdSpan& span)
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Set number of dimensions (i.e 2) as a type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct Kernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Defines and setup.
Expand Down
2 changes: 1 addition & 1 deletion example/parallelLoopPatterns/src/parallelLoopPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void openMPSimdStyle(TDev& dev, TQueue& queue, TBufAcc& bufAcc)
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the index domain, this example is only for 1d
Expand Down
2 changes: 1 addition & 1 deletion example/randomCells2D/src/randomCells2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct RunTimestepKernelVector
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
using Dim = alpaka::DimInt<2>;
Expand Down
14 changes: 7 additions & 7 deletions example/randomStrategies/src/randomStrategies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using RandomEngine = alpaka::rand::Philox4x32x10;


/// Parameters to set up the default accelerator, queue, and buffers
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
struct Box
{
// accelerator, queue, and work division typedefs
Expand Down Expand Up @@ -184,7 +184,7 @@ struct FillKernel
*
* File is in TSV format. One line for each "point"; line length is the number of "rolls".
*/
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
void saveDataAndShowAverage(std::string filename, float const* buffer, Box<TAccTag> const& box)
{
std::ofstream output(filename);
Expand All @@ -207,7 +207,7 @@ struct Writer;
template<>
struct Writer<Strategy::seed>
{
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
static void save(float const* buffer, Box<TAccTag> const& box)
{
saveDataAndShowAverage("out_seed.csv", buffer, box);
Expand All @@ -217,7 +217,7 @@ struct Writer<Strategy::seed>
template<>
struct Writer<Strategy::subsequence>
{
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
static void save(float const* buffer, Box<TAccTag> const& box)
{
saveDataAndShowAverage("out_subsequence.csv", buffer, box);
Expand All @@ -227,14 +227,14 @@ struct Writer<Strategy::subsequence>
template<>
struct Writer<Strategy::offset>
{
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
static void save(float const* buffer, Box<TAccTag> const& box)
{
saveDataAndShowAverage("out_offset.csv", buffer, box);
}
};

template<Strategy TStrategy, typename TAccTag>
template<Strategy TStrategy, alpaka::concepts::Tag TAccTag>
void runStrategy(Box<TAccTag>& box)
{
// Set up the pointer to the PRNG states buffer
Expand Down Expand Up @@ -326,7 +326,7 @@ void runStrategy(Box<TAccTag>& box)
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
Box<TAccTag> box; // Initialize the box
Expand Down
4 changes: 2 additions & 2 deletions example/tagSpecialization/src/tagSpecialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ std::string host_function_ver1<alpaka::TagGpuCudaRt>()
}

//! Function specialization via overloading
template<typename TTag>
template<alpaka::concepts::Tag TTag>
std::string host_function_ver2(TTag)
{
return "generic host function v2";
Expand Down Expand Up @@ -80,7 +80,7 @@ struct WrapperKernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the accelerator
Expand Down
2 changes: 1 addition & 1 deletion example/vectorAdd/src/vectorAdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class VectorAddKernel
// Instead, a single accelerator is selected once from the active accelerators and the kernels are executed with the
// selected accelerator only. If you use the example as the starting point for your project, you can rename the
// example() function to main() and move the accelerator tag to the function body.
template<typename TAccTag>
template<alpaka::concepts::Tag TAccTag>
auto example(TAccTag const&) -> int
{
// Define the index domain
Expand Down
36 changes: 24 additions & 12 deletions include/alpaka/acc/AccGenericSycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@

namespace alpaka
{
template<typename TTag, typename TAcc, typename TDim, typename TIdx, typename TKernelFnObj, typename... TArgs>
template<
alpaka::concepts::Tag TTag,
typename TAcc,
typename TDim,
typename TIdx,
typename TKernelFnObj,
typename... TArgs>
class TaskKernelGenericSycl;

//! The SYCL accelerator.
//!
//! This accelerator allows parallel kernel execution on SYCL devices.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
class AccGenericSycl
: public WorkDivGenericSycl<TDim, TIdx>
, public gb::IdxGbGenericSycl<TDim, TIdx>
Expand Down Expand Up @@ -103,26 +109,26 @@ namespace alpaka
namespace alpaka::trait
{
//! The SYCL accelerator type trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct AccType<AccGenericSycl<TTag, TDim, TIdx>>
{
using type = AccGenericSycl<TTag, TDim, TIdx>;
};

//! The SYCL single thread accelerator type trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct IsSingleThreadAcc<AccGenericSycl<TTag, TDim, TIdx>> : std::false_type
{
};

//! The SYCL multi thread accelerator type trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct IsMultiThreadAcc<AccGenericSycl<TTag, TDim, TIdx>> : std::true_type
{
};

//! The SYCL accelerator device properties get trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct GetAccDevProps<AccGenericSycl<TTag, TDim, TIdx>>
{
static auto getAccDevProps(DevGenericSycl<TTag> const& dev) -> AccDevProps<TDim, TIdx>
Expand Down Expand Up @@ -159,7 +165,7 @@ namespace alpaka::trait
};

//! The SYCL accelerator name trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct GetAccName<AccGenericSycl<TTag, TDim, TIdx>>
{
static auto getAccName() -> std::string
Expand All @@ -170,21 +176,27 @@ namespace alpaka::trait
};

//! The SYCL accelerator device type trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct DevType<AccGenericSycl<TTag, TDim, TIdx>>
{
using type = DevGenericSycl<TTag>;
};

//! The SYCL accelerator dimension getter trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct DimType<AccGenericSycl<TTag, TDim, TIdx>>
{
using type = TDim;
};

//! The SYCL accelerator execution task type trait specialization.
template<typename TTag, typename TDim, typename TIdx, typename TWorkDiv, typename TKernelFnObj, typename... TArgs>
template<
alpaka::concepts::Tag TTag,
typename TDim,
typename TIdx,
typename TWorkDiv,
typename TKernelFnObj,
typename... TArgs>
struct CreateTaskKernel<AccGenericSycl<TTag, TDim, TIdx>, TWorkDiv, TKernelFnObj, TArgs...>
{
static auto createTaskKernel(TWorkDiv const& workDiv, TKernelFnObj const& kernelFnObj, TArgs&&... args)
Expand All @@ -197,14 +209,14 @@ namespace alpaka::trait
};

//! The SYCL execution task platform type trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct PlatformType<AccGenericSycl<TTag, TDim, TIdx>>
{
using type = PlatformGenericSycl<TTag>;
};

//! The SYCL accelerator idx type trait specialization.
template<typename TTag, typename TDim, typename TIdx>
template<alpaka::concepts::Tag TTag, typename TDim, typename TIdx>
struct IdxType<AccGenericSycl<TTag, TDim, TIdx>>
{
using type = TIdx;
Expand Down
Loading

0 comments on commit 6526078

Please sign in to comment.