-
Notifications
You must be signed in to change notification settings - Fork 120
Improvements to main.cpp #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
07028f6
Require C++14 for main
gonzalobg 0186185
Sort headers
gonzalobg fe25ecd
Move Stream model construction to separate file
gonzalobg fff626e
Refactor timing; fix bug in initElpased
gonzalobg c67fce3
Refactor units
gonzalobg 96ab029
Refactor formatting
gonzalobg 8ef342c
Refactor output
gonzalobg e08a7d0
--only option allows specifying which kernel
gonzalobg b858c4c
Support customizable units in output
gonzalobg fd952e5
Revert default to only Classic benchmarks
gonzalobg 028c254
Add option to silence errors
gonzalobg 7149a55
Update
gonzalobg 02e06d6
Cleanup
gonzalobg 28c8cc3
Fix OpenMP model.cmake flags
gonzalobg eede871
Update src/cuda/CUDAStream.cu
tomdeakin 4f17b80
Update src/Unit.h
tomdeakin ca1c817
Update src/Unit.h
tomdeakin 1f63bd5
Update src/Unit.h
tomdeakin b7ec8c3
Update src/main.cpp
tomdeakin 610bdab
Update src/main.cpp
tomdeakin e737d01
Implement support for choosing order and set default to classic
gonzalobg 63c92b7
Add comment about Dot answer
gonzalobg dbb79c9
Fix white space
gonzalobg cc083d8
Fix typo gigibytes to gibibytes
gonzalobg 3667347
Missing std:: and whitespace
gonzalobg b635718
Whitespace
gonzalobg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,33 @@ | ||
#pragma once | ||
#include <iostream> | ||
|
||
// Units for output: | ||
struct Unit { | ||
enum class Kind { MegaByte, GigaByte, TeraByte, MibiByte, GibiByte, TebiByte }; | ||
Kind value; | ||
tomdeakin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
explicit Unit(Kind v) : value(v) {} | ||
|
||
double fmt(double bytes) const { | ||
tomdeakin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 { | ||
tomdeakin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.