-
Notifications
You must be signed in to change notification settings - Fork 99
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
feature/gemv rps test -- RAJAPerf Suite Version of the BLAS2 GEMV Test #1085
Changes from 53 commits
9d23ea2
29d2961
309cd93
bc142c9
f553052
2d427f7
64f288d
509a277
a7beb1f
afdaf6f
4611f0d
fe5ceb7
d102d59
1af92b3
d4c726c
b9e2331
0c53bbb
8c3e8ee
f8646f8
6999e5f
bda505a
992f7b4
e108091
ed6066e
73e8f9f
4ccc8a4
0efed22
4352774
1004515
9cf99e7
732a85d
edd1864
855927a
be5dedd
c84c844
6514f1e
e1da00c
c308d6c
f27118e
d987a56
7c47cd9
6d72a44
94a7caf
3deaa4b
9b61f83
6ca1f1f
8497983
105fb60
5ca7b0c
1944d9d
94d9231
c23543d
c30969d
ea683ed
26bee15
40a7855
c0fd6af
bccdb41
f076426
3d5c518
3a6c1fc
a6347d6
4b648e9
d4e1d53
e7e2541
9e2b168
d62332e
06f0ddb
4bb27c5
bf48607
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tpls/rajaperf"] | ||
path = tpls/rajaperf | ||
url = https://github.com/ajpowelsnl/RAJAPerf.git |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/* | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// Kokkos v. 3.0 | ||
// Copyright (2020) 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. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the Corporation nor the names of the | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY | ||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE | ||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Siva Rajamanickam ([email protected]) | ||
// | ||
// ************************************************************************ | ||
//@HEADER | ||
*/ | ||
#include <cstdio> | ||
|
||
#include <ctime> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <limits> | ||
#include <limits.h> | ||
#include <cmath> | ||
#include <unordered_map> | ||
#include <Kokkos_Core.hpp> | ||
#include <KokkosSparse_CrsMatrix.hpp> | ||
#include <KokkosKernels_IOUtils.hpp> | ||
#include "KokkosKernels_default_types.hpp" | ||
#include <common/RunParams.hpp> | ||
#include <common/QuickKernelBase.hpp> | ||
#include <PerfTestUtilities.hpp> | ||
|
||
#ifdef HAVE_CUSPARSE | ||
#include <CuSparse_SPMV.hpp> | ||
#endif | ||
|
||
#ifdef HAVE_MKL | ||
#include <MKL_SPMV.hpp> | ||
#endif | ||
|
||
#ifdef KOKKOS_ENABLE_OPENMP | ||
#include <OpenMPStatic_SPMV.hpp> | ||
#include <OpenMPDynamic_SPMV.hpp> | ||
#include <OpenMPSmartStatic_SPMV.hpp> | ||
#endif | ||
|
||
/////////////////////////////////////////////////////////////// | ||
// RAJAPerf Suite interface for Kokkos, Kokkos-Kernels | ||
#include <common/Executor.hpp> | ||
|
||
// Headers from dot test prog | ||
|
||
#include <iostream> | ||
#include "KokkosBlas1_dot.hpp" | ||
#include "KokkosKernels_Utils.hpp" | ||
// in test_common | ||
//#include "KokkosKernels_TestUtils.hpp" | ||
|
||
|
||
//FUNCTION THAT IS PART OF KK for generating test matrices | ||
//create_random_x_vector and create_random_y_vector can be used together to generate a random | ||
//linear system Ax = y. | ||
template<typename vec_t> | ||
vec_t create_random_x_vector(vec_t& kok_x, double max_value = 10.0) { | ||
typedef typename vec_t::value_type scalar_t; | ||
auto h_x = Kokkos::create_mirror_view (kok_x); | ||
for (size_t j = 0; j < h_x.extent(1); ++j){ | ||
for (size_t i = 0; i < h_x.extent(0); ++i){ | ||
scalar_t r = | ||
static_cast <scalar_t> (rand()) / | ||
static_cast <scalar_t> (RAND_MAX / max_value); | ||
h_x.access(i, j) = r; | ||
} | ||
} | ||
Kokkos::deep_copy (kok_x, h_x); | ||
return kok_x; | ||
} | ||
|
||
|
||
DotTestData setup_test(DotTestData::matrix_type A_matrix, DotTestData::matrix_type B_matrix) { | ||
DotTestData test_data; | ||
using matrix_type = DotTestData::matrix_type; | ||
test_data.A_matrix = create_random_x_vector(A_matrix); | ||
// rm line 113 if build is good | ||
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. Should be removed? |
||
//test.B_matrix = create_random_x_vector(B_matrix); | ||
test_data.B_matrix = create_random_x_vector(B_matrix); | ||
|
||
return test_data; | ||
} | ||
|
||
|
||
|
||
void run_benchmark(DotTestData& test_data) { | ||
|
||
Kokkos::Timer timer; | ||
Kokkos::fence(); | ||
timer.reset(); | ||
double result_1D = KokkosBlas::dot(test_data.A_matrix, test_data.B_matrix); | ||
double elapsed = timer.seconds(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// Created by Poliakoff, David Zoeller on 4/26/21. | ||
// | ||
#include <common/RAJAPerfSuite.hpp> | ||
#include <common/Executor.hpp> | ||
#include "sparse/tracked_testing.hpp" | ||
#include <iostream> | ||
#include <Kokkos_Core.hpp> | ||
// For RPS implementation of BLAS Level-1 Tests | ||
#include "blas/blas1/tracked_testing.hpp" | ||
|
||
#include "blas/blas2/tracked_testing.hpp" | ||
|
||
|
||
int main(int argc, char* argv[]) { | ||
{ | ||
|
||
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 is some odd spacing or tabs here. 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. @Siva -- I ran the clang-formatting tool on this file, so hopefully, it's now more in line with the standard |
||
// argument parsing for setting input data at runtime | ||
|
||
std::string inputDataPath; | ||
if (argc == 1) { | ||
// print_help(); | ||
std::cout << "Please provide input data directory: --input-data /PATH/TO/KOKKOS-KERNELS/INPUT/DATA" << std::endl; | ||
return 0; | ||
} | ||
|
||
for (int i = 0; i < argc; i++) { | ||
// if((strcmp(argv[i],"-v")==0)) {numVecs=atoi(argv[++i]); continue;} | ||
if ((strcmp(argv[i], "--input-data") == 0)) { | ||
i++; | ||
|
||
if (i == argc) { | ||
std::cerr << "Must pass desired input data after '--input-data'"; | ||
exit(1); | ||
} | ||
inputDataPath = std::string(argv[i]); | ||
continue; | ||
} | ||
} | ||
|
||
|
||
test::set_input_data_path(inputDataPath); | ||
|
||
// set up Executor | ||
rajaperf::Executor exec(0, argv); | ||
//rajaperf::Executor exec(argc, argv); | ||
rajaperf::RunParams run_params(0, argv); | ||
// Initialize Kokkos | ||
Kokkos::initialize(argc, argv); | ||
|
||
Kokkos::print_configuration(std::cout); | ||
|
||
// sparse , spmv | ||
test::sparse::build_executor(exec, argc, argv, run_params); | ||
|
||
// All BLAS tests (Dot, Team Dot) | ||
test::blas::build_blas_executor(exec, argc, argv, run_params); | ||
|
||
test::blas2::build_blas2_executor(exec, argc, argv, run_params); | ||
|
||
exec.setupSuite(); | ||
|
||
// STEP 3: Report suite run summary | ||
// (enable users to catch errors before entire suite is run) | ||
exec.reportRunSummary(std::cout); | ||
|
||
// STEP 4: Execute suite | ||
exec.runSuite(); | ||
|
||
// STEP 5: Generate suite execution reports | ||
exec.outputRunData(); | ||
} | ||
Kokkos::finalize(); | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Created by Poliakoff, David Zoeller on 4/27/21. | ||
// | ||
|
||
#include "KokkosKernels_default_types.hpp" | ||
#include "KokkosKernels_config.h" | ||
#include "KokkosKernels_IOUtils.hpp" | ||
#include <common/RunParams.hpp> | ||
#include <common/QuickKernelBase.hpp> | ||
#include <common/KernelBase.hpp> | ||
#include <dirent.h> | ||
|
||
|
||
namespace test { | ||
|
||
std::string inputDataPath; | ||
|
||
void set_input_data_path(const std::string& path_to_data){ | ||
inputDataPath = path_to_data; | ||
|
||
}; | ||
std::string get_input_data_path(){ | ||
|
||
return inputDataPath; | ||
|
||
}; | ||
} |
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.
Just a suggestion. This is already in perf_test directory. Does every file need rps in its name? I would name the file KokkosBlas2_gemv.cpp
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.
@srajama1 - I understand your point about this, but I would also argue that we need a way to easily distinguish the "KK standard" version of perf testing, and that for RPS. Would you be OK with my substituting "tracked_test" into the name of the source file, vs. "rps", such that a file would have this type of name:
KokkosBlas2_gemv_perf_test_tracked_test.cpp
This name change would also align with the built executable name.
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.
Sure, I like that. It says exactly what it does.
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.
KokkosBlas2_gemv_tracked_perf_test.cpp , may be?
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.
@srajama1 -- that sounds good; I'll go with this naming convention: "KokkosBlas2_gemv_tracked_perf_test.cpp"