Skip to content

Commit

Permalink
Updates on Trilinos CMAKE for trilinos integration.
Browse files Browse the repository at this point in the history
1- Added compilation and test of sparse, graph, common unit tests.
2- Added compilation of perf_test executables.
   There are no tests associated with them.
  • Loading branch information
mndevec committed Aug 4, 2017
1 parent c268cac commit f9b1559
Show file tree
Hide file tree
Showing 21 changed files with 255 additions and 202 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -298,7 +298,7 @@ MESSAGE("")

ADD_SUBDIRECTORY(src)

#TRIBITS_ADD_TEST_DIRECTORIES(perf_test)
TRIBITS_ADD_TEST_DIRECTORIES(perf_test)
TRIBITS_ADD_TEST_DIRECTORIES(unit_test)
#TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)

Expand Down
15 changes: 4 additions & 11 deletions perf_test/CMakeLists.txt
@@ -1,6 +1,8 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common)

# At some point, we may wish to make this into real "performance
# tests," in the sense that they can pass or fail. At that point, use
# "CATEGORIES PERFORMANCE" to mark them as such. For now, we just
Expand All @@ -9,15 +11,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
# MPI process.

ADD_SUBDIRECTORIES(graph)
ADD_SUBDIRECTORIES(sparse)
ADD_SUBDIRECTORIES(common)

TRIBITS_ADD_EXECUTABLE(
blas1
SOURCES blas1.cpp
COMM serial mpi
)

TRIBITS_ADD_EXECUTABLE(
blas1_MV
SOURCES blas1_MV.cpp
COMM serial mpi
)
8 changes: 8 additions & 0 deletions perf_test/common/CMakeLists.txt
@@ -0,0 +1,8 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})


TRIBITS_ADD_EXECUTABLE(
matrix_converter
SOURCES KokkosKernels_MatrixConverter.cpp
)
21 changes: 11 additions & 10 deletions perf_test/common/KokkosKernels_MatrixConverter.cpp
Expand Up @@ -51,13 +51,14 @@
typedef int size_type;
typedef int idx;
typedef double wt;
typedef Kokkos::OpenMP MyExecSpace;
//typedef Kokkos::OpenMP MyExecSpace;
int main (int argc, char ** argv){

Kokkos::OpenMP::initialize();

Kokkos::initialize();
bool symmetrize = false, remove_diagonal = false, transpose = false;
char *in_mtx = NULL, *out_bin = NULL;
bool create_incidence = false;
//bool create_incidence = false;
for ( int i = 1 ; i < argc ; ++i ) {
if ( 0 == strcasecmp( argv[i] , "symmetrize" ) ) {
symmetrize = true;
Expand Down Expand Up @@ -91,7 +92,7 @@ int main (int argc, char ** argv){

exit(1);
}

typedef Kokkos::DefaultExecutionSpace MyExecSpace;

typedef typename MyKokkosSparse::CrsMatrix<wt, idx, MyExecSpace, void, size_type > crstmat_t;
typedef typename crstmat_t::StaticCrsGraphType graph_t;
Expand All @@ -115,7 +116,7 @@ int main (int argc, char ** argv){
const wt *pvals = ovalues.data();

idx numrows = a_crsmat.numRows();
idx numcols = a_crsmat.numCols();
//idx numcols = a_crsmat.numCols();
idx nnz = ovalues.dimension_0();

//Kokkos::deep_copy(new_rowmap, a_crsmat.graph.row_map);
Expand All @@ -131,7 +132,7 @@ int main (int argc, char ** argv){
size_type end = prm[i+1];
for (size_type j = begin; j < end; ++ j){
idx col = pentries[j];
wt val = pvals[j];
//wt val = pvals[j];

if (i == col){
nrm[i] = 1;
Expand Down Expand Up @@ -206,7 +207,7 @@ int main (int argc, char ** argv){
pvals = ovalues.data();

numrows = a_crsmat.numRows();
numcols = a_crsmat.numCols();
//numcols = a_crsmat.numCols();
nnz = ovalues.dimension_0();
}

Expand Down Expand Up @@ -241,7 +242,7 @@ int main (int argc, char ** argv){
pvals = ovalues.data();

numrows = a_crsmat.numRows();
numcols = a_crsmat.numCols();
//numcols = a_crsmat.numCols();
nnz = ovalues.dimension_0();
}
if (transpose) {
Expand Down Expand Up @@ -282,14 +283,14 @@ int main (int argc, char ** argv){
pvals = ovalues.data();

numrows = a_crsmat.numRows();
numcols = a_crsmat.numCols();
//numcols = a_crsmat.numCols();
nnz = ovalues.dimension_0();
}


KokkosKernels::Impl::write_kokkos_crst_matrix (a_crsmat, out_bin);


Kokkos::OpenMP::finalize();
Kokkos::finalize();

}
84 changes: 5 additions & 79 deletions perf_test/graph/CMakeLists.txt
@@ -1,88 +1,14 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
TRIBITS_ADD_EXECUTABLE(
coloring_test
SOURCES KokkosKernels_GraphColoringTest.cpp
)

TRIBITS_ADD_EXECUTABLE(
PCG_TEST
SOURCES KokkosKernels_PCG_GS_TEST.cpp KokkosKernels_PCG.hpp
graph_color
SOURCES KokkosGraph_color.cpp
)

TRIBITS_ADD_EXECUTABLE(
conMTX2BIN
SOURCES KokkosKernels_WriteBinaryFromMTX.cpp
)

TRIBITS_ADD_EXECUTABLE(
contSRCDST2Bin
SOURCES KokkosKernels_WriteBinaryFromBinSrcDst.cpp
)


#
# Disabled temporarily per #980
#
TRIBITS_ADD_EXECUTABLE(
spgemm
SOURCES KokkosKernels_SPMM_KK.cpp
)

TRIBITS_ADD_EXECUTABLE(
triangle
SOURCES KokkosKernels_Triangle.cpp
)

TRIBITS_ADD_EXECUTABLE(
StandAloneTriangle
SOURCES KokkosKernels_StandaloneTriangle.cpp
)

#Below will probably fail on GPUs.
#TRIBITS_ADD_EXECUTABLE(
# spemm_cuda
# SOURCES KokkosKernels_SPMM_cuda.cpp
# graph_triangle
# SOURCES KokkosGraph_triangle.cpp
# )

#TRIBITS_ADD_EXECUTABLE(
# symmetrize
# SOURCES KokkosKernels_SymmetrizeTest.cpp experiment_space.hpp
# )

#TRIBITS_ADD_EXECUTABLE(
# view_test
# SOURCES view_test.cpp
#)

#TRIBITS_ADD_EXECUTABLE(
# simple_test
# SOURCES mytest.cpp
#)

#TRIBITS_ADD_EXECUTABLE(
# mp_test
# SOURCES memory_pool_test.cpp
#)

#TRIBITS_ADD_EXECUTABLE(
# reduce_test
# SOURCES myReduceTest.cpp
#)

#TRIBITS_ADD_EXECUTABLE(
# pool_test
# SOURCES pooltest.cpp
#)

#TRIBITS_ADD_EXECUTABLE(
# myMemoryPoolTest
# SOURCES myMemoryPoolTest.cpp
#)

#
# Make a trivial change here if you add a file either to this
# directory, or to the impl/ subdirectory. Keep making changes
# whenever you add or remove a .cpp or .hpp file, and everything will
# be OK.
#

24 changes: 24 additions & 0 deletions perf_test/sparse/CMakeLists.txt
@@ -0,0 +1,24 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

TRIBITS_ADD_EXECUTABLE(
sparse_pcg
SOURCES KokkosSparse_pcg.cpp
)

TRIBITS_ADD_EXECUTABLE(
sparse_spgemm
SOURCES KokkosSparse_spgemm.cpp
)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/spmv)

TRIBITS_ADD_EXECUTABLE(
sparse_spmv
SOURCES KokkosSparse_spmv.cpp
)





8 changes: 4 additions & 4 deletions perf_test/sparse/KokkosSparse_multimem_spgemm.hpp
Expand Up @@ -56,17 +56,17 @@ namespace Experiment{
typedef Kokkos::Device<exec_space, sbm_mem_space> mySlowExecSpace;

typedef typename MyKokkosSparse::CrsMatrix<scalar_t, lno_t, myFastDevice, void, size_type > fast_crstmat_t;
typedef typename fast_crstmat_t::StaticCrsGraphType fast_graph_t;
typedef typename fast_crstmat_t::row_map_type::non_const_type fast_row_map_view_t;
//typedef typename fast_crstmat_t::StaticCrsGraphType fast_graph_t;
//typedef typename fast_crstmat_t::row_map_type::non_const_type fast_row_map_view_t;
typedef typename fast_crstmat_t::index_type::non_const_type fast_cols_view_t;
typedef typename fast_crstmat_t::values_type::non_const_type fast_values_view_t;
typedef typename fast_crstmat_t::row_map_type::const_type const_fast_row_map_view_t;
typedef typename fast_crstmat_t::index_type::const_type const_fast_cols_view_t;
typedef typename fast_crstmat_t::values_type::const_type const_fast_values_view_t;

typedef typename MyKokkosSparse::CrsMatrix<scalar_t, lno_t, mySlowExecSpace, void, size_type > slow_crstmat_t;
typedef typename slow_crstmat_t::StaticCrsGraphType slow_graph_t;
typedef typename slow_crstmat_t::row_map_type::non_const_type slow_row_map_view_t;
//typedef typename slow_crstmat_t::StaticCrsGraphType slow_graph_t;
//typedef typename slow_crstmat_t::row_map_type::non_const_type slow_row_map_view_t;
typedef typename slow_crstmat_t::index_type::non_const_type slow_cols_view_t;
typedef typename slow_crstmat_t::values_type::non_const_type slow_values_view_t;
typedef typename slow_crstmat_t::row_map_type::const_type const_slow_row_map_view_t;
Expand Down
4 changes: 2 additions & 2 deletions perf_test/sparse/KokkosSparse_run_spgemm.hpp
Expand Up @@ -411,5 +411,5 @@ crsMat_t3 run_experiment(
}


};
};
}
}
2 changes: 1 addition & 1 deletion perf_test/sparse/spmv/matrix_market.hpp
Expand Up @@ -264,7 +264,7 @@ int SparseMatrix_WriteBinaryFormat(const char* filename, OrdinalType &nrows, Ord
if(colInd[i]>max) max = colInd[i];
}
if(rowPtr[row+1]>rowPtr[row]) {
int span = max-min;
size_t span = max-min;
if(span<min_span) min_span = span;
if(span>max_span) max_span = span;
ave_span += span;
Expand Down
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Expand Up @@ -68,16 +68,16 @@ ENDIF()

IF (KokkosKernels_INST_EXECSPACE_PTHREAD)
IF (KokkosKernels_INST_DOUBLE)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_double_*_Pthread_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_double_*_Threads_*.cpp)
ENDIF()
IF (KokkosKernels_INST_FLOAT)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_float_*_Pthread_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_float_*_Threads_*.cpp)
ENDIF()
IF (KokkosKernels_INST_COMPLEX_DOUBLE)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*_complex_double_*_Pthread_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*_complex_double_*_Threads_*.cpp)
ENDIF()
IF (KokkosKernels_INST_COMPLEX_FLOAT)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*_complex_float_*_Pthread_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*_complex_float_*_Threads_*.cpp)
ENDIF()
ENDIF()

Expand Down
6 changes: 3 additions & 3 deletions src/common/KokkosKernels_IOUtils.hpp
Expand Up @@ -114,7 +114,7 @@ void kk_sparseMatrix_generate_lower_upper_triangle(
{
rowPtr = new SizeType[nrows+1];

OrdinalType elements_per_row = nnz/nrows;
//OrdinalType elements_per_row = nnz/nrows;
srand(13721);
rowPtr[0] = 0;
for(int row=0;row<nrows;row++)
Expand Down Expand Up @@ -438,7 +438,7 @@ template <typename idx_array_type>
inline void kk_write_1Dview_to_file(idx_array_type view, const char *filename){

typedef typename idx_array_type::HostMirror host_type;
typedef typename idx_array_type::size_type idx;
//typedef typename idx_array_type::size_type idx;
host_type host_view = Kokkos::create_mirror_view (view);
Kokkos::deep_copy (host_view , view);
Kokkos::fence();
Expand All @@ -453,7 +453,7 @@ template <typename idx_array_type>
inline void kk_read_1Dview_from_file(idx_array_type &view, const char *filename){

typedef typename idx_array_type::HostMirror host_type;
typedef typename idx_array_type::size_type idx;
//typedef typename idx_array_type::size_type idx;
host_type host_view = Kokkos::create_mirror_view (view);
std::ifstream myFile (filename, std::ios::in );

Expand Down

0 comments on commit f9b1559

Please sign in to comment.