-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add benchmark #41
Add benchmark #41
Changes from 12 commits
80efe33
9f4f8e3
131eca1
f312ba4
928fd3d
e31d49b
a752862
8d30799
5f3c2d6
8c190f9
d67ac55
df08e96
079689a
151a10f
be2f301
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,21 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | |
|
||
# Options | ||
option(BUILD_EXAMPLES "Build KokkosFFT examples" ON) | ||
option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable FFT on both host and device") | ||
option(KokkosFFT_INTERNAL_Kokkos "Build internal Kokkos instead of relying on external one") | ||
option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable FFT on both host and device" OFF) | ||
option(KokkosFFT_INTERNAL_Kokkos "Build internal Kokkos instead of relying on external one" OFF) | ||
option(KokkosFFT_ENABLE_BENCHMARK "Build benchmarks for KokkosFFT" OFF) | ||
|
||
# Version information | ||
set(KokkosFFT_VERSION_MAJOR 0) | ||
set(KokkosFFT_VERSION_MINOR 0) | ||
set(KokkosFFT_VERSION_PATCH 00) | ||
set(KokkosFFT_VERSION "${KokkosFFT_VERSION_MAJOR}.${KokkosFFT_VERSION_MINOR}.${KokkosFFT_VERSION_PATCH}") | ||
|
||
#Set variables for config file | ||
math(EXPR KOKKOSFFT_VERSION "${KokkosFFT_VERSION_MAJOR} * 10000 + ${KokkosFFT_VERSION_MINOR} * 100 + ${KokkosFFT_VERSION_PATCH}") | ||
math(EXPR KOKKOSFFT_VERSION_MAJOR "${KOKKOSFFT_VERSION} / 10000") | ||
math(EXPR KOKKOSFFT_VERSION_MINOR "${KOKKOSFFT_VERSION} / 100 % 100") | ||
math(EXPR KOKKOSFFT_VERSION_PATCH "${KOKKOSFFT_VERSION} % 100") | ||
Comment on lines
+20
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the use of the KOKKOSFFT_VERSION variable. Could you be a little more explicit please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is it OK for you? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As commented, this will be done in the fix of #32 |
||
|
||
if (NOT KokkosFFT_INTERNAL_Kokkos) | ||
# First check, Kokkos is added as subdirectory or not | ||
|
@@ -27,6 +40,33 @@ if(BUILD_TESTING) | |
endif() | ||
endif() | ||
|
||
# Benchmark | ||
if(KokkosFFT_ENABLE_BENCHMARK) | ||
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." OFF) | ||
add_subdirectory(tpls/benchmark) | ||
|
||
# [TO DO] Fix this, it detects benchmark not a googlebench | ||
#find_package(benchmark QUIET) | ||
#if(NOT benchmark_FOUND) | ||
# add_subdirectory(tpls/benchmark) | ||
#endif() | ||
endif() | ||
|
||
# Configure files to display configuration | ||
# Configure the library | ||
set( | ||
PACKAGE_NAME_CONFIG_FILES | ||
KokkosFFT_config.h | ||
KokkosFFT_Version_Info.hpp | ||
) | ||
|
||
foreach(CONFIG_FILE ${PACKAGE_NAME_CONFIG_FILES}) | ||
configure_file( | ||
cmake/${CONFIG_FILE}.in | ||
${CMAKE_BINARY_DIR}/${CONFIG_FILE} | ||
) | ||
endforeach() | ||
|
||
# Set directories used for install | ||
include(GNUInstallDirs) | ||
set(LIBDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) | ||
|
@@ -71,12 +111,12 @@ configure_package_config_file(cmake/KokkosFFTConfig.cmake.in | |
|
||
write_basic_package_version_file( | ||
${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfigVersion.cmake | ||
VERSION 0.0.0 | ||
VERSION ${KokkosFFT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
install( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfig.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/KokkosFFTConfigVersion.cmake | ||
DESTINATION ${INSTALL_LIBDIR} | ||
) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// Kokkos v. 4.0 | ||
// Copyright (2022) National Technology & Engineering | ||
// Solutions of Sandia, LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, | ||
// the U.S. Government retains certain rights in this software. | ||
// | ||
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://kokkos.org/LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//@HEADER | ||
|
||
#ifndef KOKKOSFFT_VERSION_INFO_HPP | ||
#define KOKKOSFFT_VERSION_INFO_HPP | ||
|
||
#include <string_view> | ||
|
||
namespace KokkosFFT { | ||
namespace Impl { | ||
|
||
constexpr std::string_view GIT_BRANCH = R"branch(@GIT_BRANCH@)branch"; | ||
constexpr std::string_view GIT_COMMIT_HASH = "@GIT_COMMIT_HASH@"; | ||
constexpr std::string_view GIT_CLEAN_STATUS = "@GIT_CLEAN_STATUS@"; | ||
constexpr std::string_view GIT_COMMIT_DESCRIPTION = | ||
R"message(@GIT_COMMIT_DESCRIPTION@)message"; | ||
constexpr std::string_view GIT_COMMIT_DATE = "@GIT_COMMIT_DATE@"; | ||
constexpr std::string_view BENCHMARK_VERSION = "@BENCHMARK_VERSION@"; | ||
|
||
} // namespace Impl | ||
} // namespace KokkosFFT | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef KOKKOSFFT_CONFIG_H | ||
#define KOKKOSFFT_CONFIG_H | ||
|
||
/* Define the current version of Kokkos Kernels */ | ||
#define KOKKOSFFT_VERSION @KOKKOSFFT_VERSION@ | ||
#define KOKKOSFFT_VERSION_MAJOR @KOKKOSFFT_VERSION_MAJOR@ | ||
#define KOKKOSFFT_VERSION_MINOR @KOKKOSFFT_VERSION_MINOR@ | ||
#define KOKKOSFFT_VERSION_PATCH @KOKKOSFFT_VERSION_PATCH@ | ||
|
||
/* Define if building in debug mode */ | ||
#cmakedefine HAVE_KOKKOSFFT_DEBUG | ||
|
||
#cmakedefine KOKKOSFFT_ENABLE_BENCHMARK | ||
|
||
/* Define this macro if experimental features of KokkosFFT are enabled */ | ||
#cmakedefine HAVE_KOKKOSFFT_EXPERIMENTAL | ||
|
||
/* FFTW */ | ||
#cmakedefine KOKKOSFFT_ENABLE_TPL_FFTW | ||
|
||
/* CUFFT */ | ||
#cmakedefine KOKKOSFFT_ENABLE_TPL_CUFFT | ||
|
||
/* HIPFFT */ | ||
#cmakedefine KOKKOSFFT_ENABLE_TPL_HIPFFT | ||
|
||
/* ONEMKL */ | ||
#cmakedefine KOKKOSFFT_ENABLE_TPL_ONEMKL | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
add_subdirectory(src) | ||
if(BUILD_TESTING) | ||
add_subdirectory(unit_test) | ||
endif() | ||
|
||
if(KokkosFFT_ENABLE_BENCHMARK) | ||
add_subdirectory(perf_test) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// Kokkos v. 4.0 | ||
// Copyright (2022) National Technology & Engineering | ||
// Solutions of Sandia, LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, | ||
// the U.S. Government retains certain rights in this software. | ||
// | ||
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://kokkos.org/LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//@HEADER | ||
*/ | ||
|
||
#include <benchmark/benchmark.h> | ||
|
||
#include "Benchmark_Context.hpp" | ||
#include <Kokkos_Core.hpp> | ||
|
||
int main(int argc, char** argv) { | ||
Kokkos::initialize(argc, argv); | ||
{ | ||
benchmark::Initialize(&argc, argv); | ||
benchmark::SetDefaultTimeUnit(benchmark::kSecond); | ||
KokkosFFTBenchmark::add_benchmark_context(true); | ||
|
||
benchmark::RunSpecifiedBenchmarks(); | ||
|
||
benchmark::Shutdown(); | ||
} | ||
Kokkos::finalize(); | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're set to release a beta, you should probably put a 0.1.0 or something I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. As well as DDC, I am planning to begin with 0.0.00.