-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[alpaka] Support all alpaka backends at the same time (#357)
Update the develop branch to 2022.04.27 / 879b95ffce2 . Use new pinned host memory functionality. Add forward declaration for alpaka templates and types. Support serial, TBB, CUDA and ROCm at the same time, with static splitting of event streams across multiple backends. Autogenerate plugins.txt.
- Loading branch information
Showing
30 changed files
with
788 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <iostream> | ||
|
||
#include <alpaka/alpaka.hpp> | ||
|
||
#include "AlpakaCore/alpakaConfig.h" | ||
#include "AlpakaCore/alpakaDevices.h" | ||
#include "AlpakaCore/initialise.h" | ||
#include "Framework/demangle.h" | ||
|
||
namespace cms::alpakatools { | ||
|
||
template <typename TPlatform> | ||
void initialise() { | ||
constexpr const char* suffix[] = {"devices.", "device:", "devices:"}; | ||
|
||
if (devices<TPlatform>.empty()) { | ||
devices<TPlatform> = enumerate<TPlatform>(); | ||
auto size = devices<TPlatform>.size(); | ||
//std::cout << edm::demangle<TPlatform> << " platform succesfully initialised." << std::endl; | ||
std::cout << "Found " << size << " " << suffix[size < 2 ? size : 2] << std::endl; | ||
for (auto const& device : devices<TPlatform>) { | ||
std::cout << " - " << alpaka::getName(device) << std::endl; | ||
} | ||
} else { | ||
//std::cout << edm::demangle<TPlatform> << " platform already initialised." << std::endl; | ||
} | ||
} | ||
|
||
// explicit template instantiation definition | ||
template void initialise<ALPAKA_ACCELERATOR_NAMESPACE::Platform>(); | ||
|
||
} // namespace cms::alpakatools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#ifndef AlpakaCore_alpakaFwd_h | ||
#define AlpakaCore_alpakaFwd_h | ||
|
||
#include <cstddef> | ||
#include <cstdint> | ||
#include <type_traits> | ||
|
||
/** | ||
* This file forward declares specific types defined in Alpaka | ||
* (depending on the backend-enabling macros) so that these types | ||
* would be available throughout CMSSW without a direct dependence on | ||
* Alpaka in order to avoid the constraints that would impose | ||
* (primarily the device compiler) | ||
* | ||
* This is a little bit brittle, but let's see how it goes. | ||
*/ | ||
namespace alpaka { | ||
|
||
// miscellanea | ||
template <std::size_t N> | ||
using DimInt = std::integral_constant<std::size_t, N>; | ||
|
||
template <typename TDim, typename TVal> | ||
class Vec; | ||
|
||
template <typename TDim, typename TIdx> | ||
class WorkDivMembers; | ||
|
||
// API | ||
struct ApiCudaRt; | ||
struct ApiHipRt; | ||
|
||
// Platforms | ||
class PltfCpu; | ||
template <typename TApi> | ||
class PltfUniformCudaHipRt; | ||
using PltfCudaRt = PltfUniformCudaHipRt<ApiCudaRt>; | ||
using PltfHipRt = PltfUniformCudaHipRt<ApiHipRt>; | ||
|
||
// Devices | ||
class DevCpu; | ||
template <typename TApi> | ||
class DevUniformCudaHipRt; | ||
using DevCudaRt = DevUniformCudaHipRt<ApiCudaRt>; | ||
using DevHipRt = DevUniformCudaHipRt<ApiHipRt>; | ||
|
||
// Queues | ||
template <typename TDev> | ||
class QueueGenericThreadsBlocking; | ||
using QueueCpuBlocking = QueueGenericThreadsBlocking<DevCpu>; | ||
|
||
template <typename TDev> | ||
class QueueGenericThreadsNonBlocking; | ||
using QueueCpuNonBlocking = QueueGenericThreadsNonBlocking<DevCpu>; | ||
|
||
namespace uniform_cuda_hip::detail { | ||
template <typename TApi, bool TBlocking> | ||
class QueueUniformCudaHipRt; | ||
} | ||
using QueueCudaRtBlocking = uniform_cuda_hip::detail::QueueUniformCudaHipRt<ApiCudaRt, true>; | ||
using QueueCudaRtNonBlocking = uniform_cuda_hip::detail::QueueUniformCudaHipRt<ApiCudaRt, false>; | ||
using QueueHipRtBlocking = uniform_cuda_hip::detail::QueueUniformCudaHipRt<ApiHipRt, true>; | ||
using QueueHipRtNonBlocking = uniform_cuda_hip::detail::QueueUniformCudaHipRt<ApiHipRt, false>; | ||
|
||
// Events | ||
template <typename TDev> | ||
class EventGenericThreads; | ||
using EventCpu = EventGenericThreads<DevCpu>; | ||
|
||
template <typename TApi> | ||
class EventUniformCudaHipRt; | ||
using EventCudaRt = EventUniformCudaHipRt<ApiCudaRt>; | ||
using EventHipRt = EventUniformCudaHipRt<ApiHipRt>; | ||
|
||
// Accelerators | ||
template <typename TApi, typename TDim, typename TIdx> | ||
class AccGpuUniformCudaHipRt; | ||
|
||
template <typename TDim, typename TIdx> | ||
using AccGpuCudaRt = AccGpuUniformCudaHipRt<ApiCudaRt, TDim, TIdx>; | ||
|
||
template <typename TDim, typename TIdx> | ||
using AccGpuHipRt = AccGpuUniformCudaHipRt<ApiHipRt, TDim, TIdx>; | ||
|
||
template <typename TDim, typename TIdx> | ||
class AccCpuSerial; | ||
|
||
template <typename TDim, typename TIdx> | ||
class AccCpuTbbBlocks; | ||
|
||
template <typename TDim, typename TIdx> | ||
class AccCpuOmp2Blocks; | ||
|
||
} // namespace alpaka | ||
|
||
#endif // AlpakaCore_alpakaFwd_h |
Oops, something went wrong.