-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/gemv rps test -- RAJAPerf Suite Version of the BLAS2 GEMV Test (
#1085) Initial RAJAPerf Suite (RPS)-based performance testing. Dot (device-level and team), GEMV, SpMV. Adding RAJAPerf Suite as a git submodule. Enable RPS with -DKokkosKernels_ENABLE_TESTS_AND_PERFSUITE=ON. See PRs #1085 and #1037 for more info. Co-authored-by: David Poliakoff <[email protected]> Co-authored-by: Amy Powell <[email protected]> Co-authored-by: brian-kelley <[email protected]>
- Loading branch information
1 parent
a3f60fe
commit 398f79d
Showing
38 changed files
with
2,107 additions
and
374 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
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 |
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
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,72 @@ | ||
// | ||
// 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 version of BLAS Level-1 Tests | ||
#include "blas/blas1/tracked_testing.hpp" | ||
#include "blas/blas2/tracked_testing.hpp" | ||
int main(int argc, char* argv[]) { | ||
{ | ||
// 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; | ||
} |
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,15 @@ | ||
// | ||
// Created by Poliakoff, David Zoeller on 4/27/21. | ||
// | ||
|
||
#include <string> | ||
|
||
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; } | ||
} // namespace test |
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,118 @@ | ||
// | ||
// Created by Poliakoff, David Zoeller on 4/27/21. | ||
// | ||
|
||
#ifndef KOKKOSKERNELS_PERFTESTUTILITIES_HPP | ||
#define KOKKOSKERNELS_PERFTESTUTILITIES_HPP | ||
#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 { | ||
void set_input_data_path(const std::string &path_to_data); | ||
|
||
std::string get_input_data_path(); | ||
|
||
} // namespace test | ||
|
||
namespace KokkosSparse { | ||
|
||
template <class Scalar, class Ordinal, class ExecutionSpace, class, | ||
class Offset> | ||
class CrsMatrix; | ||
} | ||
|
||
// helper function for get_directories | ||
inline bool isDirectory(std::string path) { | ||
DIR *dirp; // Pointer to a directory | ||
dirp = opendir(path.c_str()); | ||
// bool var indicating that dirp is not NULL, i.e., a true statement | ||
bool isDir = dirp != NULL; | ||
if (dirp != NULL) closedir(dirp); | ||
return isDir; | ||
} | ||
|
||
/** TODO: fix in C++17 */ | ||
inline std::vector<std::string> get_directories(std::string path) { | ||
DIR *d; | ||
std::vector<std::string> paths; | ||
struct dirent *dir; | ||
d = opendir(path.c_str()); | ||
if (d) { | ||
while ((dir = readdir(d)) != NULL) { | ||
std::string nname = std::string(dir->d_name); | ||
// Check to see if item is a directory | ||
//if (isDirectory(path + '/' + nname)) | ||
if(nname != "." && nname != ".." && isDirectory(path + '/' + dir->d_name)) | ||
// std::vector::emplace_back: insert a new element to the end of vector | ||
paths.emplace_back(dir->d_name); | ||
} | ||
closedir(d); | ||
} | ||
return paths; | ||
} | ||
|
||
namespace readers { | ||
|
||
template <class Scalar, class Ordinal, class ExecutionSpace, class Offset> | ||
using matrix_type = | ||
KokkosSparse::CrsMatrix<Scalar, Ordinal, ExecutionSpace, void, Offset>; | ||
|
||
template <class> | ||
struct test_reader; | ||
|
||
template <class Scalar, class Ordinal, class ExecutionSpace, class Offset> | ||
struct test_reader<matrix_type<Scalar, Ordinal, ExecutionSpace, Offset>> { | ||
static matrix_type<Scalar, Ordinal, ExecutionSpace, Offset> read( | ||
const std::string &filename) { | ||
return KokkosKernels::Impl::read_kokkos_crst_matrix< | ||
matrix_type<Scalar, Ordinal, ExecutionSpace, Offset>>(filename.c_str()); | ||
} | ||
}; | ||
|
||
} // namespace readers | ||
template <class... SubComponents> | ||
struct data_retriever { | ||
std::string root_path; | ||
std::string sub_path; | ||
struct test_case { | ||
std::string filename; | ||
std::tuple<SubComponents...> test_data; | ||
}; | ||
std::vector<test_case> test_cases; | ||
std::string make_full_path_to_data_file(std::string repo, | ||
std::string path_to_data, | ||
std::string dataset, | ||
std::string filename) { | ||
return root_path + "/" + repo + "/" + path_to_data + dataset + "/" + | ||
filename; | ||
} | ||
template <class... Locations> | ||
data_retriever(std::string path_to_data, Locations... locations) | ||
: sub_path(path_to_data) { | ||
root_path = test::get_input_data_path(); | ||
|
||
// TODO: way to list the directories in the root path | ||
std::vector<std::string> data_repos = get_directories(root_path + "/"); | ||
// TODO: list directories in subpaths | ||
for (auto repo : data_repos) { | ||
std::vector<std::string> datasets = | ||
get_directories(root_path + "/" + repo + "/" + path_to_data + "/"); | ||
for (auto dataset : datasets) { | ||
test_cases.push_back( | ||
test_case{repo + "/" + dataset, | ||
std::make_tuple(readers::test_reader<SubComponents>::read( | ||
make_full_path_to_data_file( | ||
repo, path_to_data, dataset, locations))...)}); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
using test_list = std::vector<rajaperf::KernelBase *>; | ||
|
||
#endif // KOKKOSKERNELS_PERFTESTUTILITIES_HPP |
Oops, something went wrong.