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

Cluster Gauss-Seidel and SGS #455

Merged
merged 31 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e0395c2
Implemented cluster Gauss-Seidel
brian-kelley Jul 25, 2018
a4305da
(WIP): Gauss-Seidel perf test (standard and cluster)
brian-kelley Sep 27, 2019
f1936c4
Partitioning compiles, tested, produces valid reordering
brian-kelley Sep 30, 2019
3a4d4d0
WIP: faster graph clustering
brian-kelley Oct 3, 2019
86c0838
Implemented fast cluster graph construction
brian-kelley Oct 15, 2019
985e50d
Debugging cluster graph construction.
brian-kelley Oct 15, 2019
37aada8
Rewrote cluster graph construction, fixed RCM cluster formation
brian-kelley Oct 18, 2019
f5bc0bb
Have decent clustering
brian-kelley Oct 22, 2019
d238ad7
Cleanup; DEFAULT clustering algo chooses intelligently
brian-kelley Oct 23, 2019
91db7de
Implemented balloon clustering (best so far)
brian-kelley Oct 24, 2019
36a89f6
Balloon partitioning performs very well
brian-kelley Oct 25, 2019
f300fd6
WIP: implementing new clusterGS apply
brian-kelley Oct 25, 2019
b99c31d
WIP: Refactoring
brian-kelley Oct 31, 2019
5a33ede
Working on GS refactor
brian-kelley Nov 6, 2019
6715aaf
GS refactor compiles
brian-kelley Nov 8, 2019
13430c5
Cleaned up files
brian-kelley Nov 8, 2019
4967403
Fixed warnings
brian-kelley Nov 8, 2019
9c1aa1b
Changed balloon stopping condition
brian-kelley Nov 8, 2019
10560e2
Cluster-SGS unit test tests all cluster algos
brian-kelley Nov 8, 2019
17f85be
Cleanup, fixed SGS test: set update_y_vector=true
brian-kelley Nov 11, 2019
eb6df8c
ClusterGS works in preconditioned CG perf test
brian-kelley Nov 12, 2019
e547e48
PCG has sequential SOR (--seq-gs) as an option
brian-kelley Nov 13, 2019
22b6ef7
Cleanup
brian-kelley Nov 13, 2019
f58b0e4
Disabled WIP graph partition example from CMake/make
brian-kelley Nov 13, 2019
3e7ab5d
Merge branch 'develop' into ClusterGS
brian-kelley Nov 13, 2019
73dc833
Fixed type mismatch error
brian-kelley Nov 13, 2019
50131c3
Fixed wrong template args in sequential GS
brian-kelley Nov 13, 2019
67330ea
Added block PCG to CMake, since it's in make
brian-kelley Nov 13, 2019
240a2db
Removed assert
brian-kelley Nov 14, 2019
f754e33
Fixed warnings, removed assert()
brian-kelley Nov 14, 2019
351944e
Added missing initialization for color_adj
brian-kelley Nov 15, 2019
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
1 change: 1 addition & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ADD_SUBDIRECTORY(fenl)
#ADD_SUBDIRECTORY(graph)
4 changes: 1 addition & 3 deletions example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ TARGETS =
TEST_HEADERS += $(wildcard $(KOKKOSKERNELS_SRC_PATH)/example/hashmap_accumulator/*.hpp)
EXECUTABLES += $(wildcard ${KOKKOSKERNELS_SRC_PATH}/example/hashmap_accumulator/*.cpp)

TEST_HEADERS += $(wildcard $(KOKKOSKERNELS_SRC_PATH)/example/graph/*.hpp)
EXECUTABLES += $(wildcard ${KOKKOSKERNELS_SRC_PATH}/example/graph/*.cpp)

#EXECUTABLES += $(wildcard ${KOKKOSKERNELS_SRC_PATH}/example/graph/PartitioningExample.cpp)

#=======================================================================
#========================== TARGETS ====================================
Expand Down
10 changes: 10 additions & 0 deletions example/graph/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR})

SET(SOURCES "PartitioningExample.cpp")

TRIBITS_ADD_EXECUTABLE(
PartitioningExample
SOURCES ${SOURCES}
COMM serial
)
Binary file added example/graph/PartitioningExample
Binary file not shown.
148 changes: 148 additions & 0 deletions example/graph/PartitioningExample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 2.0
// Copyright (2014) Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// 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 SANDIA CORPORATION "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 SANDIA CORPORATION 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: William McLendon (wcmclen@sandia.gov) or
// Siva Rajamanickam (srajama@sandia.gov)
//
// ************************************************************************
//@HEADER
*/

#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using std::cout;
using std::vector;

//#include "../../src/sparse/impl/KokkosSparse_partitioning_impl.hpp"

int main(int argc, char *argv[])
{
/*
const int device_id = 0;

Kokkos::initialize(Kokkos::InitArguments(1, -1, device_id));

if(params.verbose)
{
Kokkos::print_configuration(std::cout);
}
*/

//Generate a square 2D mesh in serial, with edges in both diagonals
const int xy = 31;
const int nnodes = (xy + 1) * (xy + 1);
vector<bool> adjMat(nnodes * nnodes, false);
//Number of nodes is (n+1)^2
for(int cellX = 0; cellX < xy; cellX++)
{
for(int cellY = 0; cellY < xy; cellY++)
{
int upLeft = cellX + (xy + 1) * cellY;
int upRight = cellX + 1 + (xy + 1) * cellY;
int downLeft = cellX + (xy + 1) * (cellY + 1);
int downRight = cellX + 1 + (xy + 1) * (cellY + 1);
#define CONNECT(n1, n2) \
adjMat[n1 + n2 * nnodes] = true; \
adjMat[n2 + n1 * nnodes] = true;
//Form this pattern in each cell:
//
// +------+
// |\ /|
// | \ / |
// | \/ |
// | /\ |
// | / \ |
// |/ \|
// +------+
//
CONNECT(upLeft, upRight);
CONNECT(upLeft, downLeft);
CONNECT(upLeft, downRight);
CONNECT(upRight, downRight);
CONNECT(downLeft, downRight);
CONNECT(downLeft, upRight);
}
}

//Build a sparse (CRS) graph from the dense adjacency matrix
int numEdges = 0;
for(size_t i = 0; i < adjMat.size(); i++)
numEdges += (adjMat[i] ? 1 : 0);

/*
Kokkos::View<int*, Kokkos::HostSpace> rowmap("Rowmap", nnodes + 1);
Kokkos::View<int*, Kokkos::HostSpace> entries("Entries", numEdges);
int accum = 0;
for(int r = 0; r <= nnodes; r++)
{
rowmap(r) = accum;
if(r == nnodes)
break;
for(int c = 0; c < nnodes; c++)
{
if(adjMat[c + r * nnodes])
entries(accum++) = c;
}
}
*/

//Dump the graph to a graphviz file
FILE* g = fopen("graph.dot", "w");
fprintf(g, "graph {\n");
for(int r = 0; r < nnodes; r++)
{
for(int c = r; c < nnodes; c++)
{
if(adjMat[c + r * nnodes])
fprintf(g, "n%d -- n%d\n", r, c);
}
}
fprintf(g, "}\n");
fclose(g);
//Kokkos::finalize();
return 0;
}

12 changes: 11 additions & 1 deletion perf_test/sparse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ TRIBITS_ADD_EXECUTABLE(
SOURCES KokkosSparse_pcg.cpp
)

TRIBITS_ADD_EXECUTABLE(
sparse_block_pcg
SOURCES KokkosSparse_block_pcg.cpp
)

TRIBITS_ADD_EXECUTABLE(
sparse_spgemm
SOURCES KokkosSparse_spgemm.cpp
Expand All @@ -28,7 +33,12 @@ TRIBITS_ADD_EXECUTABLE(
SOURCES KokkosSparse_sptrsv.cpp
)

TRIBITS_ADD_EXECUTABLE(
sparse_gs
SOURCES KokkosSparse_gs.cpp
)

TRIBITS_ADD_EXECUTABLE(
sparse_spiluk
SOURCES KokkosSparse_spiluk.cpp
)
)
Loading