Skip to content
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

perf tests cleanup #613

Merged
merged 14 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 24 additions & 26 deletions perf_test/graph/KokkosGraph_color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include <vector>

#include "KokkosKernels_IOUtils.hpp"
#include "KokkosKernels_MyCRSMatrix.hpp"
#include "KokkosSparse_CrsMatrix.hpp"
#include "KokkosKernels_TestParameters.hpp"
#include "KokkosGraph_Distance1Color.hpp"

Expand Down Expand Up @@ -210,7 +210,7 @@ namespace Experiment{

template <typename ExecSpace, typename crsGraph_t, typename crsGraph_t2 , typename crsGraph_t3 , typename TempMemSpace , typename PersistentMemSpace >
void run_experiment(
crsGraph_t crsGraph, Parameters params){
crsGraph_t crsGraph, int num_cols, Parameters params){
//using namespace KokkosSparse;
using namespace KokkosGraph;
using namespace KokkosGraph::Experimental;
Expand All @@ -231,8 +231,6 @@ void run_experiment(
typedef typename crsGraph_t3::row_map_type::non_const_type lno_view_t;
typedef typename crsGraph_t3::entries_type::non_const_type lno_nnz_view_t;



typedef typename lno_view_t::non_const_value_type size_type;
typedef typename lno_nnz_view_t::non_const_value_type lno_t;

Expand Down Expand Up @@ -295,7 +293,7 @@ void run_experiment(

}

graph_color_symbolic(&kh,crsGraph.numRows(), crsGraph.numCols(), crsGraph.row_map, crsGraph.entries);
graph_color_symbolic(&kh,crsGraph.numRows(), num_cols, crsGraph.row_map, crsGraph.entries);

std::cout << std::endl <<
"Time:" << kh.get_graph_coloring_handle()->get_overall_coloring_time() << " "
Expand All @@ -318,15 +316,15 @@ void run_multi_mem_experiment(Parameters params){
typedef Kokkos::Device<exec_space, hbm_mem_space> myFastDevice;
typedef Kokkos::Device<exec_space, sbm_mem_space> mySlowExecSpace;

typedef typename MyKokkosSparse::CrsMatrix<double, lno_t, myFastDevice, void, size_type > fast_crstmat_t;
typedef typename KokkosSparse::CrsMatrix<double, lno_t, myFastDevice, void, size_type > fast_crstmat_t;
typedef typename fast_crstmat_t::StaticCrsGraphType fast_graph_t;
//typedef typename fast_graph_t::row_map_type::non_const_type fast_row_map_view_t;
//typedef typename fast_graph_t::entries_type::non_const_type fast_cols_view_t;

//typedef typename fast_graph_t::row_map_type::const_type const_fast_row_map_view_t;
//typedef typename fast_graph_t::entries_type::const_type const_fast_cols_view_t;

typedef typename MyKokkosSparse::CrsMatrix<double, lno_t, mySlowExecSpace, void, size_type > slow_crstmat_t;
typedef typename KokkosSparse::CrsMatrix<double, lno_t, mySlowExecSpace, void, size_type > slow_crstmat_t;
typedef typename slow_crstmat_t::StaticCrsGraphType slow_graph_t;

//typedef typename slow_graph_t::row_map_type::non_const_type slow_row_map_view_t;
Expand All @@ -341,21 +339,21 @@ void run_multi_mem_experiment(Parameters params){
slow_graph_t a_slow_crsgraph, /*b_slow_crsgraph,*/ c_slow_crsgraph;
fast_graph_t a_fast_crsgraph, /*b_fast_crsgraph,*/ c_fast_crsgraph;


int num_cols = 0;

//read a and b matrices and store them on slow or fast memory.
if (params.a_mem_space == 1){
fast_crstmat_t a_fast_crsmat;
a_fast_crsmat = KokkosKernels::Impl::read_kokkos_crst_matrix<fast_crstmat_t>(a_mat_file);
a_fast_crsgraph = a_fast_crsmat.graph;
a_fast_crsgraph.num_cols = a_fast_crsmat.numCols();
num_cols = a_fast_crsmat.numCols();

}
else {
slow_crstmat_t a_slow_crsmat;
a_slow_crsmat = KokkosKernels::Impl::read_kokkos_crst_matrix<slow_crstmat_t>(a_mat_file);
a_slow_crsgraph = a_slow_crsmat.graph;
a_slow_crsgraph.num_cols = a_slow_crsmat.numCols();
num_cols = a_slow_crsmat.numCols();
}


Expand All @@ -366,13 +364,13 @@ void run_multi_mem_experiment(Parameters params){
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,fast_graph_t,fast_graph_t, hbm_mem_space, hbm_mem_space>
(a_fast_crsgraph, /*b_fast_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}
else {
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,fast_graph_t,fast_graph_t, sbm_mem_space, sbm_mem_space>
(a_fast_crsgraph, /*b_fast_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}

}
Expand All @@ -382,13 +380,13 @@ void run_multi_mem_experiment(Parameters params){
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,fast_graph_t,slow_graph_t, hbm_mem_space, hbm_mem_space>
(a_fast_crsgraph, /*b_fast_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}
else {
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,fast_graph_t,slow_graph_t, sbm_mem_space, sbm_mem_space>
(a_fast_crsgraph, /*b_fast_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}
}
}
Expand All @@ -399,13 +397,13 @@ void run_multi_mem_experiment(Parameters params){
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,slow_graph_t,fast_graph_t, hbm_mem_space, hbm_mem_space>
(a_fast_crsgraph, /*b_slow_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}
else {
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,slow_graph_t,fast_graph_t, sbm_mem_space, sbm_mem_space>
(a_fast_crsgraph, /*b_slow_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}

}
Expand All @@ -415,13 +413,13 @@ void run_multi_mem_experiment(Parameters params){
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,slow_graph_t,slow_graph_t, hbm_mem_space, hbm_mem_space>
(a_fast_crsgraph, /*b_slow_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}
else {
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, fast_graph_t,slow_graph_t,slow_graph_t, sbm_mem_space, sbm_mem_space>
(a_fast_crsgraph, /*b_slow_crsgraph,*/ params);
(a_fast_crsgraph, num_cols, params);
}
}

Expand All @@ -435,13 +433,13 @@ void run_multi_mem_experiment(Parameters params){
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,fast_graph_t,fast_graph_t, hbm_mem_space, hbm_mem_space>
(a_slow_crsgraph, /*b_fast_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}
else {
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,fast_graph_t,fast_graph_t, sbm_mem_space, sbm_mem_space>
(a_slow_crsgraph, /*b_fast_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}

}
Expand All @@ -451,13 +449,13 @@ void run_multi_mem_experiment(Parameters params){
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,fast_graph_t,slow_graph_t, hbm_mem_space, hbm_mem_space>
(a_slow_crsgraph, /*b_fast_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}
else {
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,fast_graph_t,slow_graph_t, sbm_mem_space, sbm_mem_space>
(a_slow_crsgraph, /*b_fast_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}
}
}
Expand All @@ -468,13 +466,13 @@ void run_multi_mem_experiment(Parameters params){
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,slow_graph_t,fast_graph_t, hbm_mem_space, hbm_mem_space>
(a_slow_crsgraph, /*b_slow_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}
else {
/* c_fast_crsgraph = */
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,slow_graph_t,fast_graph_t, sbm_mem_space, sbm_mem_space>
(a_slow_crsgraph, /*b_slow_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}

}
Expand All @@ -484,13 +482,13 @@ void run_multi_mem_experiment(Parameters params){
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,slow_graph_t,slow_graph_t, hbm_mem_space, hbm_mem_space>
(a_slow_crsgraph, /*b_slow_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}
else {
/*c_slow_crsgraph =*/
KokkosKernels::Experiment::run_experiment
<myExecSpace, slow_graph_t,slow_graph_t,slow_graph_t, sbm_mem_space, sbm_mem_space>
(a_slow_crsgraph, /*b_slow_crsgraph,*/ params);
(a_slow_crsgraph, num_cols, params);
}
}

Expand Down
74 changes: 27 additions & 47 deletions perf_test/graph/KokkosGraph_color_d2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#include <Kokkos_Core.hpp>

#include <KokkosKernels_IOUtils.hpp>
#include <KokkosKernels_MyCRSMatrix.hpp>
#include "KokkosSparse_CrsMatrix.hpp"
#include <KokkosKernels_TestParameters.hpp>
#include <KokkosGraph_Distance2Color.hpp>

Expand Down Expand Up @@ -274,12 +274,20 @@ std::string getCurrentDateTimeStr()
}


template<typename ExecSpace, typename crsGraph_t, typename crsGraph_t2, typename crsGraph_t3, typename TempMemSpace, typename PersistentMemSpace>
void run_experiment(crsGraph_t crsGraph, Parameters params)
template<typename crsGraph_t>
void run_experiment(crsGraph_t crsGraph, int num_cols, Parameters params)
{
using namespace KokkosGraph;
using namespace KokkosGraph::Experimental;

using device_t = typename crsGraph_t::device_type;
using exec_space = typename device_t::execution_space;
using mem_space = typename device_t::memory_space;
using lno_view_t = typename crsGraph_t::row_map_type::non_const_type;
using lno_nnz_view_t = typename crsGraph_t::entries_type::non_const_type;
using size_type = typename lno_view_t::non_const_value_type;
using lno_t = typename lno_nnz_view_t::non_const_value_type;

int algorithm = params.algorithm;
int repeat = params.repeat;
int chunk_size = params.chunk_size;
Expand All @@ -289,16 +297,9 @@ void run_experiment(crsGraph_t crsGraph, Parameters params)
int use_dynamic_scheduling = params.use_dynamic_scheduling;
int verbose = params.verbose;

// char spgemm_step = params.spgemm_step;
int vector_size = params.vector_size;

using lno_view_t = typename crsGraph_t3::row_map_type::non_const_type;
using lno_nnz_view_t = typename crsGraph_t3::entries_type::non_const_type;

using size_type = typename lno_view_t::non_const_value_type;
using lno_t = typename lno_nnz_view_t::non_const_value_type;

typedef KokkosKernels::Experimental::KokkosKernelsHandle<size_type, lno_t, kk_scalar_t, ExecSpace, TempMemSpace, PersistentMemSpace> KernelHandle;
typedef KokkosKernels::Experimental::KokkosKernelsHandle<size_type, lno_t, kk_scalar_t, exec_space, mem_space, mem_space> KernelHandle;

// Get Date/Time stamps of start to use later when printing out summary data.
//auto t = std::time(nullptr);
Expand Down Expand Up @@ -366,7 +367,7 @@ void run_experiment(crsGraph_t crsGraph, Parameters params)
// Loop over # of experiments to run
for(int i = 0; i < repeat; ++i)
{
graph_compute_distance2_color(&kh, crsGraph.numRows(), crsGraph.numCols(), crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries);
graph_compute_distance2_color(&kh, crsGraph.numRows(), num_cols, crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries);

total_colors += kh.get_distance2_graph_coloring_handle()->get_num_colors();
total_phases += kh.get_distance2_graph_coloring_handle()->get_num_phases();
Expand All @@ -393,7 +394,7 @@ void run_experiment(crsGraph_t crsGraph, Parameters params)
bool d2_coloring_is_valid = false;
bool d2_coloring_validation_flags[4] = { false };

d2_coloring_is_valid = KokkosGraph::Impl::graph_verify_distance2_color(&kh, crsGraph.numRows(), crsGraph.numCols(), crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries, d2_coloring_validation_flags);
d2_coloring_is_valid = KokkosGraph::Impl::graph_verify_distance2_color(&kh, crsGraph.numRows(), num_cols, crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries, d2_coloring_validation_flags);

// Print out messages based on coloring validation check.
if(d2_coloring_is_valid)
Expand All @@ -419,7 +420,7 @@ void run_experiment(crsGraph_t crsGraph, Parameters params)
// ------------------------------------------
// Print out the colors histogram
// ------------------------------------------
KokkosGraph::Impl::graph_print_distance2_color_histogram(&kh, crsGraph.numRows(), crsGraph.numCols(), crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries, false);
KokkosGraph::Impl::graph_print_distance2_color_histogram(&kh, crsGraph.numRows(), num_cols, crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries, false);

} // for i...

Expand All @@ -438,7 +439,7 @@ void run_experiment(crsGraph_t crsGraph, Parameters params)
non_const_1d_size_type_view_t degree_d2_dist = non_const_1d_size_type_view_t("degree d2", crsGraph.numRows());

size_t degree_d2_max=0;
KokkosGraph::Impl::graph_compute_distance2_degree(&kh, crsGraph.numRows(), crsGraph.numCols(),
KokkosGraph::Impl::graph_compute_distance2_degree(&kh, crsGraph.numRows(), num_cols,
crsGraph.row_map, crsGraph.entries,
crsGraph.row_map, crsGraph.entries,
degree_d2_dist, degree_d2_max);
Expand Down Expand Up @@ -590,46 +591,25 @@ void run_experiment(crsGraph_t crsGraph, Parameters params)
<< "," << label_algorithm
<< "," << Kokkos::DefaultExecutionSpace::concurrency()
<< ",";
KokkosGraph::Impl::graph_print_distance2_color_histogram(&kh, crsGraph.numRows(), crsGraph.numCols(), crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries, true);
KokkosGraph::Impl::graph_print_distance2_color_histogram(&kh, crsGraph.numRows(), num_cols, crsGraph.row_map, crsGraph.entries, crsGraph.row_map, crsGraph.entries, true);
std::cout << std::endl;

// Kokkos::print_configuration(std::cout);
}


template<typename size_type, typename lno_t, typename exec_space, typename hbm_mem_space>
template<typename size_type, typename lno_t, typename exec_space, typename mem_space>
void experiment_driver(Parameters params)
{
using myExecSpace = exec_space;
using myFastDevice = Kokkos::Device<exec_space, hbm_mem_space>;
using fast_crstmat_t = typename MyKokkosSparse::CrsMatrix<double, lno_t, myFastDevice, void, size_type>;
using fast_graph_t = typename fast_crstmat_t::StaticCrsGraphType;

char *a_mat_file = params.a_mtx_bin_file;

fast_graph_t a_fast_crsgraph, /*b_fast_crsgraph,*/ c_fast_crsgraph;

if(params.a_mem_space == 1)
{
fast_crstmat_t a_fast_crsmat;
a_fast_crsmat = KokkosKernels::Impl::read_kokkos_crst_matrix<fast_crstmat_t>(a_mat_file);
a_fast_crsgraph = a_fast_crsmat.graph;
a_fast_crsgraph.num_cols = a_fast_crsmat.numCols();
}

if(params.a_mem_space == 1 && params.b_mem_space==1 && params.c_mem_space==1 && params.work_mem_space==1)
{
KokkosKernels::Experiment::run_experiment<myExecSpace, fast_graph_t, fast_graph_t, fast_graph_t, hbm_mem_space, hbm_mem_space>
(a_fast_crsgraph, /*b_fast_crsgraph,*/ params);
}
else
{
std::cout << ">>> unhandled memspace configuration flags:" << std::endl
<< ">>> a_mem_space = " << params.a_mem_space << std::endl
<< ">>> b_mem_space = " << params.a_mem_space << std::endl
<< ">>> c_mem_space = " << params.a_mem_space << std::endl
<< ">>> work_mem_space = " << params.work_mem_space << std::endl;
}
using device_t = Kokkos::Device<exec_space, mem_space>;
using crsMat_t = typename KokkosSparse::CrsMatrix<double, lno_t, device_t, void, size_type>;
using graph_t = typename crsMat_t::StaticCrsGraphType;

crsMat_t A = KokkosKernels::Impl::read_kokkos_crst_matrix<crsMat_t>(params.a_mtx_bin_file);
graph_t Agraph = A.graph;
int num_cols = A.numCols();

KokkosKernels::Experiment::run_experiment<graph_t>(Agraph, num_cols, params);
}


Expand Down
17 changes: 4 additions & 13 deletions perf_test/graph/KokkosGraph_multimem_triangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
*/

#include "KokkosGraph_run_triangle.hpp"
#include "KokkosKernels_MyCRSMatrix.hpp"
#include "KokkosSparse_CrsMatrix.hpp"

namespace KokkosKernels{

namespace Experiment{
Expand All @@ -55,22 +56,12 @@ namespace Experiment{
typedef Kokkos::Device<exec_space, hbm_mem_space> myFastDevice;
typedef Kokkos::Device<exec_space, sbm_mem_space> mySlowExecSpace;

typedef typename MyKokkosSparse::CrsMatrix<double, lno_t, myFastDevice, void, size_type > fast_crstmat_t;
typedef typename KokkosSparse::CrsMatrix<double, lno_t, myFastDevice, void, size_type > fast_crstmat_t;
typedef typename fast_crstmat_t::StaticCrsGraphType fast_graph_t;
//typedef typename fast_graph_t::row_map_type::non_const_type fast_row_map_view_t;
//typedef typename fast_graph_t::entries_type::non_const_type fast_cols_view_t;

//typedef typename fast_graph_t::row_map_type::const_type const_fast_row_map_view_t;
//typedef typename fast_graph_t::entries_type::const_type const_fast_cols_view_t;

typedef typename MyKokkosSparse::CrsMatrix<double, lno_t, mySlowExecSpace, void, size_type > slow_crstmat_t;
typedef typename KokkosSparse::CrsMatrix<double, lno_t, mySlowExecSpace, void, size_type > slow_crstmat_t;
typedef typename slow_crstmat_t::StaticCrsGraphType slow_graph_t;

//typedef typename slow_graph_t::row_map_type::non_const_type slow_row_map_view_t;
//typedef typename slow_graph_t::entries_type::non_const_type slow_cols_view_t;
//typedef typename slow_graph_t::row_map_type::const_type const_slow_row_map_view_t;
//typedef typename slow_graph_t::entries_type::const_type const_slow_cols_view_t;

char *a_mat_file = params.a_mtx_bin_file;
//char *b_mat_file = params.b_mtx_bin_file;
//char *c_mat_file = params.c_mtx_bin_file;
Expand Down
Loading