Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b6e4c98
Add warmup and remove useless 10x multiplier
mconcas Jul 26, 2021
eada03c
Reduce operation performed on GPU kernels
mconcas Jul 26, 2021
13daad5
Fix initialization bug
mconcas Jul 27, 2021
08d7c75
Improve macro + improve measurement
mconcas Jul 28, 2021
c9dc62d
Update reading kernels
mconcas Jul 29, 2021
bc33bab
Use one block for Single Block tests
mconcas Sep 1, 2021
3fe7fd9
Rename chunk data type
mconcas Sep 22, 2021
b043b36
Remove excess of streams, un-needed
mconcas Sep 23, 2021
29643bc
Fix missing header in macro
mconcas Sep 24, 2021
b61b50a
Improve copy kernel
mconcas Sep 30, 2021
9b167b6
Various minor improvements
mconcas Oct 1, 2021
4360457
Improve read test, fixes
mconcas Oct 4, 2021
909b694
Improve concurrent test
mconcas Oct 4, 2021
f342aa6
Fix macro
mconcas Oct 4, 2021
6e8611b
Improve interface
mconcas Oct 5, 2021
dcec171
Improve read test
mconcas Oct 5, 2021
bc7e03a
Use size_t as type for loops
mconcas Oct 6, 2021
afa8b77
Start debugging TP
mconcas Oct 7, 2021
06c0ddf
Major refactoring of benchmark structure
mconcas Oct 7, 2021
2aedb24
Fix wrong kernel picking
mconcas Oct 7, 2021
0ddf176
Minor improvements
mconcas Oct 7, 2021
4a4ac96
Add extra option to cli
mconcas Oct 7, 2021
b885bd3
Add linear random generator and cleanup
mconcas Oct 7, 2021
7c66514
Add -p all mode
mconcas Oct 8, 2021
2f31cbd
Add int4 test, fix read test
mconcas Oct 8, 2021
15d715d
Add fractional threadpool option
mconcas Oct 8, 2021
8748e93
Fix += missing operator for CUDA
mconcas Oct 8, 2021
a1583a7
Add int4 += custom implementation for CUDA completeness
mconcas Oct 8, 2021
40c211e
Improve HIP from CUDA generation
mconcas Oct 11, 2021
c4ee919
Add arbitrary chunks run (1/2)
mconcas Oct 11, 2021
c73e080
Compiles, to test
mconcas Oct 12, 2021
1226f47
Fixing... backup
mconcas Oct 13, 2021
bb628c2
Add arbitrary chunks run (2/2)
mconcas Oct 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 3 additions & 40 deletions GPU/GPUbenchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,12 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

set(HDRS_INSTALL ../Shared/Kernels.h)

if(CUDA_ENABLED)
o2_add_executable(gpu-memory-benchmark-cuda
SOURCES benchmark.cxx
cuda/Kernels.cu
PUBLIC_LINK_LIBRARIES Boost::program_options
ROOT::Tree
TARGETVARNAME targetName)
add_subdirectory(cuda)
endif()

if(HIP_ENABLED)
# Hipify-perl
set(HIPIFY_EXECUTABLE "/opt/rocm/bin/hipify-perl")

set(HIP_KERNEL "Kernels.hip.cxx")
set(CU_KERNEL ${CMAKE_CURRENT_SOURCE_DIR}/cuda/Kernels.cu)
set(HIP_KERNEL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/hip/${HIP_KERNEL}")

if(EXISTS ${HIPIFY_EXECUTABLE})
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CU_KERNEL})
add_custom_command(
OUTPUT ${HIP_KERNEL_PATH}
COMMAND ${HIPIFY_EXECUTABLE} --quiet-warnings ${CU_KERNEL} | sed '1{/\#include \"hip\\/hip_runtime.h\"/d}' > ${HIP_KERNEL_PATH}
)
set(CMAKE_CXX_COMPILER ${HIP_HIPCC_EXECUTABLE})
set(CMAKE_CXX_LINKER ${HIP_HIPCC_EXECUTABLE})
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${O2_HIP_CMAKE_CXX_FLAGS} -fgpu-rdc")

o2_add_executable(gpu-memory-benchmark-hip
SOURCES benchmark.cxx
hip/Kernels.hip.cxx
PUBLIC_LINK_LIBRARIES hip::host
Boost::program_options
ROOT::Tree
TARGETVARNAME targetName)

if(HIP_AMDGPUTARGET)
# Need to add gpu target also to link flags due to gpu-rdc option
target_link_options(${targetName} PUBLIC --amdgpu-target=${HIP_AMDGPUTARGET})
endif()
endif()
add_subdirectory(hip)
endif()

o2_add_test_root_macro(macro/showBenchmarks.C)
o2_add_test_root_macro(macro/showBenchmarks.C)
42 changes: 19 additions & 23 deletions GPU/GPUbenchmark/Shared/Kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace o2
namespace benchmark
{

template <class chunk_type>
template <class chunk_t>
class GPUbenchmark final
{
public:
Expand All @@ -41,13 +41,22 @@ class GPUbenchmark final

// Single stream synchronous (sequential kernels) execution
template <typename... T>
float benchmarkSync(void (*kernel)(T...),
int nLaunches, int blocks, int threads, T&... args);
float runSequential(void (*kernel)(chunk_t*, size_t, T...),
std::pair<int, int>& chunkRanges,
int nLaunches,
int dimGrid,
int dimBlock,
T&... args);

// Multi-streams asynchronous executions on whole memory
template <typename... T>
std::vector<float> benchmarkAsync(void (*kernel)(int, T...),
int nStreams, int nLaunches, int blocks, int threads, T&... args);
std::vector<float> runConcurrent(void (*kernel)(chunk_t*, size_t, T...),
std::vector<std::pair<int, int>>& chunkRanges,
int nLaunches,
int dimStreams,
int nBlocks,
int nThreads,
T&... args);

// Main interface
void globalInit(); // Allocate scratch buffers and compute runtime parameters
Expand All @@ -56,27 +65,14 @@ class GPUbenchmark final
void printDevices(); // Dump info

// Initializations/Finalizations of tests. Not to be measured, in principle used for report
void readInit();
void readFinalize();
void initTest(Test);
void finalizeTest(Test);

void writeInit();
void writeFinalize();

void copyInit();
void copyFinalize();

// Kernel calling wrappers
void readSequential(SplitLevel sl);
void readConcurrent(SplitLevel sl, int nRegions = 2);

void writeSequential(SplitLevel sl);
void writeConcurrent(SplitLevel sl, int nRegions = 2);

void copySequential(SplitLevel sl);
void copyConcurrent(SplitLevel sl, int nRegions = 2);
// Kernel calling wrapper
void runTest(Test, Mode, KernelConfig);

private:
gpuState<chunk_type> mState;
gpuState<chunk_t> mState;
std::shared_ptr<ResultWriter> mResultWriter;
benchmarkOpts mOptions;
};
Expand Down
Loading