Skip to content

Commit

Permalink
Squashed 'thirdParty/cupla/' changes from 98dd7f2f6..22dfdf457
Browse files Browse the repository at this point in the history
22dfdf457 Merge pull request ComputationalRadiationPhysics#194 from psychocoderHPC/topic-updateAlpakaTo0.6.0rc4
c598470d3 Merge pull request ComputationalRadiationPhysics#193 from psychocoderHPC/topic-CILatestContainer
c54d1dec3 Merge commit 'b7ec15f0c9bbbcf983277bb119cb551ce7d2d2d2' into topic-updateAlpakaTo0.6.0rc4
b7ec15f0c Squashed 'alpaka/' changes from 01f22779da..daf599b113
e8f8952c1 CUDA 9.2 use GCC 6
0384a58c5 CI: update container to v1.1

git-subtree-dir: thirdParty/cupla
git-subtree-split: 22dfdf4574d529b26523ce66368aaf2caea16566
  • Loading branch information
Third Party authored and psychocoderHPC committed Dec 16, 2020
1 parent d218b26 commit 7284556
Show file tree
Hide file tree
Showing 25 changed files with 847 additions and 92 deletions.
17 changes: 9 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@ include:
- local: '/script/compiler_base.yml'

cuda92:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:cuda9.2
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda92-gcc:1.1
variables:
CUPLA_CXX: "g++-6"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda

cuda100:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:cuda10.0
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda100-gcc:1.1
variables:
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda

cuda101:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:cuda10.1
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda101-gcc:1.1
variables:
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda

cuda102:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:cuda10.2
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda102-gcc:1.1
variables:
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda
Expand Down Expand Up @@ -57,28 +58,28 @@ clang:
extends: .base_clang

cudaClang92:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:cuda9.2Clang
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda92-clang:1.1
variables:
CUPLA_CXX: "clang++-8 clang++-10 clang++-11"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda_clang

cudaClang100:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:cuda10.0Clang
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda100-clang:1.1
variables:
CUPLA_CXX: "clang++-8 clang++-9 clang++-10 clang++-11"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda_clang

cudaClang101:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:cuda10.1Clang
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda101-clang:1.1
variables:
CUPLA_CXX: "clang++-9 clang++-10 clang++-11"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda_clang

hip38:
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci:rocm3.8
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-rocm3.8:1.1
variables:
CMAKE_MODULE_PATH: "/opt/rocm-3.8.0/hip/cmake"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
Expand Down
32 changes: 13 additions & 19 deletions alpaka/.github/workflows/ci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion alpaka/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ git clang-format-11 develop
```
To format all code in your working copy, you can run this command in bash:
```
find -iname *.cpp -o -iname *.hpp | xargs clang-format-11 -i
find -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format-11 -i
```
2 changes: 1 addition & 1 deletion alpaka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ This library uses C++14 (or newer when available).
| std::thread |:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|
| Boost.Fiber |:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:x:|:white_check_mark:|:white_check_mark:|
|TBB|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:white_check_mark:|:x:|:x:|
|CUDA (nvcc)|:white_check_mark: <br/> (CUDA 9.0-11.1)|:white_check_mark: <br/> (CUDA 9.2-11.1) |:white_check_mark: <br/> (CUDA 10.1-11.1) |:white_check_mark: <br/> (CUDA 11.0-11.1)|:white_check_mark: <br/> (CUDA 11.1)|:white_check_mark: <br/> (CUDA 9.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 11.0-11.1)|:white_check_mark: <br/> (CUDA 11.1)|:x:|:white_check_mark: <br/> (CUDA 10.0-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|
|CUDA (nvcc)|:white_check_mark: <br/> (CUDA 9.0-11.1)|:white_check_mark: <br/> (CUDA 9.2-11.1) |:white_check_mark: <br/> (CUDA 10.1-11.1) |:white_check_mark: <br/> (CUDA 11.0-11.1)|:white_check_mark: <br/> (CUDA 11.1)|:white_check_mark: <br/> (CUDA 9.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 10.1-11.1)|:white_check_mark: <br/> (CUDA 11.0-11.1)|:white_check_mark: <br/> (CUDA 11.1)|:x:|:white_check_mark: <br/> (CUDA 10.0-11.1)|:white_check_mark: <br/> (CUDA 10.1-10.2 + 11.1)|
|CUDA (clang) | - | - | - | - | - | - | - | :white_check_mark: <br/> (CUDA 9.0) | :white_check_mark: <br/> (CUDA 9.0-9.2) | :white_check_mark: <br/> (CUDA 9.0-10.0) | :white_check_mark: <br/> (CUDA 9.2-10.1) | :white_check_mark: <br/> (CUDA 9.2-10.1) | - | - | - |
|[HIP](https://alpaka.readthedocs.io/en/latest/install/HIP.html) (clang)|:white_check_mark: |:x:|:x:|:x:|:x:|:x:|:x:|:x:|:x:|:x:|:x:|:x:|:x:|:x:|

Expand Down
4 changes: 2 additions & 2 deletions alpaka/docs/source/dev/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ whitespace and braces automatically. Usage:

.. code-block:: bash
clang-format-11 -i --style=file <sourcefile>
clang-format-11 -i <sourcefile>
* If you want to format the entire code base execute the following command from alpaka's top-level directory:

.. code-block:: bash
find example include test -name '*.hpp' -o -name '*.cpp' | xargs clang-format-11 -i --style=file
find example include test -name '*.hpp' -o -name '*.cpp' | xargs clang-format-11 -i
Windows users should use `Visual Studio's native clang-format integration
<https://devblogs.microsoft.com/cppblog/clangformat-support-in-visual-studio-2017-15-7-preview-1/>`.
Expand Down
1 change: 1 addition & 0 deletions alpaka/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ add_subdirectory("heatEquation/")
add_subdirectory("helloWorld/")
add_subdirectory("helloWorldLambda/")
add_subdirectory("monteCarloIntegration/")
add_subdirectory("openMPSchedule/")
add_subdirectory("reduce/")
add_subdirectory("vectorAdd/")
60 changes: 60 additions & 0 deletions alpaka/example/openMPSchedule/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#
# Copyright 2014-2020 Erik Zenker, Benjamin Worpitz, Jan Stephan, Sergei Bastrakov
#
# This file exemplifies usage of alpaka.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED “AS IS” AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.15)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

################################################################################
# Project.

set(_TARGET_NAME openMPSchedule)

project(${_TARGET_NAME})

#-------------------------------------------------------------------------------
# Find alpaka.

if(NOT TARGET alpaka::alpaka)
option(USE_ALPAKA_SOURCE_TREE "Use alpaka's source tree instead of an alpaka installation" OFF)

if(USE_ALPAKA_SOURCE_TREE)
# Don't build the examples recursively
set(alpaka_BUILD_EXAMPLES OFF)
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../.." "${CMAKE_BINARY_DIR}/alpaka")
else()
find_package(alpaka REQUIRED)
endif()
endif()

#-------------------------------------------------------------------------------
# Add executable.

alpaka_add_executable(
${_TARGET_NAME}
src/openMPSchedule.cpp)
target_link_libraries(
${_TARGET_NAME}
PUBLIC alpaka::alpaka)

set_target_properties(${_TARGET_NAME} PROPERTIES FOLDER example)

add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME})
164 changes: 164 additions & 0 deletions alpaka/example/openMPSchedule/src/openMPSchedule.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/* Copyright 2019-2020 Benjamin Worpitz, Erik Zenker, Sergei Bastrakov
*
* This file exemplifies usage of alpaka.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED “AS IS” AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include <alpaka/alpaka.hpp>
#include <alpaka/example/ExampleDefaultAcc.hpp>

#include <cstdint>
#include <iostream>

// This example only makes sense with alpaka AccCpuOmp2Blocks backend enabled
// and OpenMP runtime supporting at least 3.0. Disable it for other cases.
#if defined _OPENMP && _OPENMP >= 200805 && ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLED

//#############################################################################
//! OpenMP schedule demonstration kernel
//!
//! Prints distribution of alpaka thread indices between OpenMP threads.
//! Its operator() is reused in other kernels of this example.
//! Sets no schedule explicitly, so the default is used, controlled by the OMP_SCHEDULE environment variable.
struct OpenMPScheduleDefaultKernel
{
//-----------------------------------------------------------------------------
template<typename TAcc>
ALPAKA_FN_ACC auto operator()(TAcc const& acc) const -> void
{
// For simplicity assume 1d index space throughout this example
using Idx = alpaka::Idx<TAcc>;
Idx const globalThreadIdx = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc)[0];

// Print work distribution between threads for illustration
printf(
"alpaka global thread index %u is processed by OpenMP thread %d\n",
static_cast<std::uint32_t>(globalThreadIdx),
omp_get_thread_num());
}
};

//#############################################################################
//! Kernel that sets the schedule via a static member.
//! We inherit OpenMPScheduleDefaultKernel just to reuse its operator().
struct OpenMPScheduleMemberKernel : public OpenMPScheduleDefaultKernel
{
//! Static member to set OpenMP schedule to be used by the AccCpuOmp2Blocks accelerator.
//! This member is only checked for when the OmpSchedule trait is not specialized for this kernel type.
//! Note that constexpr is not required, however otherwise there has to be an external definition.
static constexpr auto ompSchedule = alpaka::omp::Schedule{alpaka::omp::Schedule::Static, 1};
};

//#############################################################################
//! Kernel that sets the schedule via trait specialization.
//! We inherit OpenMPScheduleDefaultKernel just to reuse its operator().
//! The schedule trait specialization is given underneath this struct.
//! It has a higher priority than the internal static member.
struct OpenMPScheduleTraitKernel : public OpenMPScheduleDefaultKernel
{
};

namespace alpaka
{
namespace traits
{
//! Schedule trait specialization for OpenMPScheduleTraitKernel.
//! This is the most general way to define a schedule.
//! In case neither the trait nor the member are provided, alpaka does not set any runtime schedule and the
//! schedule used is defined by omp_set_schedule() called on the user side, or otherwise by the OMP_SCHEDULE
//! environment variable.
template<typename TAcc>
struct OmpSchedule<OpenMPScheduleTraitKernel, TAcc>
{
template<typename TDim, typename... TArgs>
ALPAKA_FN_HOST static auto getOmpSchedule(
OpenMPScheduleTraitKernel const& kernelFnObj,
Vec<TDim, Idx<TAcc>> const& blockThreadExtent,
Vec<TDim, Idx<TAcc>> const& threadElemExtent,
TArgs const&... args) -> alpaka::omp::Schedule
{
// Determine schedule at runtime for the given kernel and run parameters.
// For this particular example kernel, TArgs is an empty pack and can be removed.
alpaka::ignore_unused(kernelFnObj);
alpaka::ignore_unused(blockThreadExtent);
alpaka::ignore_unused(threadElemExtent);
alpaka::ignore_unused(args...);

return alpaka::omp::Schedule{alpaka::omp::Schedule::Dynamic, 2};
}
};
} // namespace traits
} // namespace alpaka

auto main() -> int
{
// Fallback for the CI with disabled sequential backend
# if defined(ALPAKA_CI) && !defined(ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED)
return EXIT_SUCCESS;
# else
using Idx = std::size_t;

// OpenMP schedule illustrated by this example only has effect with
// with the AccCpuOmp2Blocks accelerator.
// This example also assumes 1d for simplicity.
using Acc = alpaka::AccCpuOmp2Blocks<alpaka::DimInt<1>, Idx>;
std::cout << "Using alpaka accelerator: " << alpaka::getAccName<Acc>() << std::endl;

// Defines the synchronization behavior of a queue
using QueueProperty = alpaka::Blocking;
using Queue = alpaka::Queue<Acc, QueueProperty>;

// Select a device
auto const devAcc = alpaka::getDevByIdx<Acc>(0u);

// Create a queue on the device
Queue queue(devAcc);

// Define the work division
Idx const threadsPerGrid = 16u;
Idx const elementsPerThread = 1u;
auto const workDiv = alpaka::getValidWorkDiv<Acc>(
devAcc,
threadsPerGrid,
elementsPerThread,
false,
alpaka::GridBlockExtentSubDivRestrictions::Unrestricted);

// Run the kernel setting no schedule explicitly.
// In this case the schedule is controlled by the OMP_SCHEDULE environment variable.
std::cout << "OpenMPScheduleDefaultKernel setting no schedule explicitly:\n";
alpaka::exec<Acc>(queue, workDiv, OpenMPScheduleDefaultKernel{});
alpaka::wait(queue);

// Run the kernel setting the schedule via a trait
std::cout << "\n\nOpenMPScheduleMemberKernel setting the schedule via a static member:\n";
alpaka::exec<Acc>(queue, workDiv, OpenMPScheduleMemberKernel{});
alpaka::wait(queue);

// Run the kernel setting the schedule via a trait
std::cout << "\n\nOpenMPScheduleTraitKernel setting the schedule via trait:\n";
alpaka::exec<Acc>(queue, workDiv, OpenMPScheduleTraitKernel{});
alpaka::wait(queue);

return EXIT_SUCCESS;
# endif
}
#else
auto main() -> int
{
std::cout << "This example is disabled, as it requires OpenMP runtime version >= 3.0 and alpaka accelerator"
<< " AccCpuOmp2Blocks\n";
return EXIT_SUCCESS;
}
#endif
2 changes: 2 additions & 0 deletions alpaka/include/alpaka/alpaka.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#include <alpaka/core/Debug.hpp>
#include <alpaka/core/Fibers.hpp>
#include <alpaka/core/Hip.hpp>
#include <alpaka/core/OmpSchedule.hpp>
#include <alpaka/core/Positioning.hpp>
#include <alpaka/core/Unroll.hpp>
#include <alpaka/core/Unused.hpp>
Expand Down Expand Up @@ -167,6 +168,7 @@
#include <alpaka/meta/NdLoop.hpp>
#include <alpaka/meta/Set.hpp>
#include <alpaka/meta/Transform.hpp>
#include <alpaka/meta/Void.hpp>
//-----------------------------------------------------------------------------
// offset
#include <alpaka/offset/Traits.hpp>
Expand Down
2 changes: 1 addition & 1 deletion alpaka/include/alpaka/core/Omp5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace alpaka
namespace detail
{
//-----------------------------------------------------------------------------
//! CUDA runtime API error checking with log and exception, ignoring specific error values
//! OMP5 runtime API error checking with log and exception, ignoring specific error values
ALPAKA_FN_HOST inline auto omp5Check(int const& error, char const* desc, char const* file, int const& line)
-> void
{
Expand Down
Loading

0 comments on commit 7284556

Please sign in to comment.