-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from gonzalobg/prepare_scan
- Loading branch information
Showing
8 changed files
with
565 additions
and
548 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#pragma once | ||
#include <memory> | ||
|
||
#if defined(CUDA) | ||
#include "CUDAStream.h" | ||
#elif defined(STD_DATA) | ||
#include "STDDataStream.h" | ||
#elif defined(STD_INDICES) | ||
#include "STDIndicesStream.h" | ||
#elif defined(STD_RANGES) | ||
#include "STDRangesStream.hpp" | ||
#elif defined(TBB) | ||
#include "TBBStream.hpp" | ||
#elif defined(THRUST) | ||
#include "ThrustStream.h" | ||
#elif defined(HIP) | ||
#include "HIPStream.h" | ||
#elif defined(HC) | ||
#include "HCStream.h" | ||
#elif defined(OCL) | ||
#include "OCLStream.h" | ||
#elif defined(USE_RAJA) | ||
#include "RAJAStream.hpp" | ||
#elif defined(KOKKOS) | ||
#include "KokkosStream.hpp" | ||
#elif defined(ACC) | ||
#include "ACCStream.h" | ||
#elif defined(SYCL) | ||
#include "SYCLStream.h" | ||
#elif defined(SYCL2020) | ||
#include "SYCLStream2020.h" | ||
#elif defined(OMP) | ||
#include "OMPStream.h" | ||
#elif defined(FUTHARK) | ||
#include "FutharkStream.h" | ||
#endif | ||
|
||
template <typename T> | ||
std::unique_ptr<Stream<T>> make_stream(int array_size, int deviceIndex) { | ||
#if defined(CUDA) | ||
// Use the CUDA implementation | ||
return std::make_unique<CUDAStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(HIP) | ||
// Use the HIP implementation | ||
return std::make_unique<HIPStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(HC) | ||
// Use the HC implementation | ||
return std::make_unique<HCStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(OCL) | ||
// Use the OpenCL implementation | ||
return std::make_unique<OCLStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(USE_RAJA) | ||
// Use the RAJA implementation | ||
return std::make_unique<RAJAStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(KOKKOS) | ||
// Use the Kokkos implementation | ||
return std::make_unique<KokkosStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(STD_DATA) | ||
// Use the C++ STD data-oriented implementation | ||
return std::make_unique<STDDataStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(STD_INDICES) | ||
// Use the C++ STD index-oriented implementation | ||
return std::make_unique<STDIndicesStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(STD_RANGES) | ||
// Use the C++ STD ranges implementation | ||
return std::make_unique<STDRangesStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(TBB) | ||
// Use the C++20 implementation | ||
return std::make_unique<TBBStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(THRUST) | ||
// Use the Thrust implementation | ||
return std::make_unique<ThrustStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(ACC) | ||
// Use the OpenACC implementation | ||
return std::make_unique<ACCStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(SYCL) || defined(SYCL2020) | ||
// Use the SYCL implementation | ||
return std::make_unique<SYCLStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(OMP) | ||
// Use the OpenMP implementation | ||
return std::make_unique<OMPStream<T>>(array_size, deviceIndex); | ||
|
||
#elif defined(FUTHARK) | ||
// Use the Futhark implementation | ||
return std::make_unique<FutharkStream<T>>(array_size, deviceIndex); | ||
|
||
#else | ||
|
||
#error unknown benchmark | ||
|
||
#endif | ||
} |
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,35 @@ | ||
#pragma once | ||
#include <iostream> | ||
|
||
// Units for output: | ||
struct Unit { | ||
enum class Kind { MegaByte, GigaByte, TeraByte, MibiByte, GibiByte, TebiByte }; | ||
|
||
Kind value; | ||
|
||
explicit Unit(Kind v) : value(v) {} | ||
|
||
double fmt(double bytes) const { | ||
switch(value) { | ||
case Kind::MibiByte: return std::pow(2.0, -20.0) * bytes; | ||
case Kind::MegaByte: return 1.0E-6 * bytes; | ||
case Kind::GibiByte: return std::pow(2.0, -30.0) * bytes; | ||
case Kind::GigaByte: return 1.0E-9 * bytes; | ||
case Kind::TebiByte: return std::pow(2.0, -40.0) * bytes; | ||
case Kind::TeraByte: return 1.0E-12 * bytes; | ||
default: std::cerr << "Unimplemented!" << std::endl; std::abort(); | ||
} | ||
} | ||
|
||
char const* str() const { | ||
switch(value) { | ||
case Kind::MibiByte: return "MiB"; | ||
case Kind::MegaByte: return "MB"; | ||
case Kind::GibiByte: return "GiB"; | ||
case Kind::GigaByte: return "GB"; | ||
case Kind::TebiByte: return "TiB"; | ||
case Kind::TeraByte: return "TB"; | ||
default: std::cerr << "Unimplemented!" << std::endl; std::abort(); | ||
} | ||
} | ||
}; |
Oops, something went wrong.