-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an example as an integration test
- Loading branch information
Showing
13 changed files
with
427 additions
and
0 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
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,17 @@ | ||
cmake_minimum_required(VERSION 3.9) | ||
project(mpi-simple-solver) | ||
|
||
# We only need to find Ginkgo if we build this example stand-alone | ||
if (NOT GINKGO_BUILD_EXAMPLES) | ||
find_package(Ginkgo 1.5.0 REQUIRED) | ||
find_package(MPI REQUIRED) | ||
endif() | ||
|
||
add_executable(mpi-simple-solver mpi-simple-solver.cpp) | ||
target_link_libraries(mpi-simple-solver Ginkgo::ginkgo) | ||
target_link_libraries(mpi-simple-solver MPI::MPI_CXX) | ||
|
||
# Copy the data files to the execution directory | ||
configure_file(data/A.mtx data/A.mtx COPYONLY) | ||
configure_file(data/b.mtx data/b.mtx COPYONLY) | ||
configure_file(data/x0.mtx data/x0.mtx COPYONLY) |
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,16 @@ | ||
#!/bin/bash | ||
|
||
# set up script | ||
if [ $# -ne 1 ]; then | ||
echo -e "Usage: $0 GINKGO_BUILD_DIRECTORY" | ||
exit 1 | ||
fi | ||
BUILD_DIR=$1 | ||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" &>/dev/null && pwd ) | ||
|
||
source ${THIS_DIR}/../build-setup.sh | ||
|
||
# build | ||
${CXX} -std=c++14 -o ${THIS_DIR}/mpi-simple-solver ${THIS_DIR}/mpi-simple-solver.cpp \ | ||
-I${THIS_DIR}/../../include -I${BUILD_DIR}/include \ | ||
-L${THIS_DIR} ${LINK_FLAGS} |
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,114 @@ | ||
%%MatrixMarket matrix coordinate integer symmetric | ||
%------------------------------------------------------------------------------- | ||
% UF Sparse Matrix Collection, Tim Davis | ||
% http://www.cise.ufl.edu/research/sparse/matrices/JGD_Trefethen/Trefethen_20b | ||
% name: JGD_Trefethen/Trefethen_20b | ||
% [Diagonal matrices with primes, Nick Trefethen, Oxford Univ.] | ||
% id: 2203 | ||
% date: 2008 | ||
% author: N. Trefethen | ||
% ed: J.-G. Dumas | ||
% fields: name title A id date author ed kind notes | ||
% kind: combinatorial problem | ||
%------------------------------------------------------------------------------- | ||
% notes: | ||
% Diagonal matrices with primes, Nick Trefethen, Oxford Univ. | ||
% From Jean-Guillaume Dumas' Sparse Integer Matrix Collection, | ||
% http://ljk.imag.fr/membres/Jean-Guillaume.Dumas/simc.html | ||
% | ||
% Problem 7 of the Hundred-dollar, Hundred-digit Challenge Problems, | ||
% SIAM News, vol 35, no. 1. | ||
% | ||
% 7. Let A be the 20,000 x 20,000 matrix whose entries are zero | ||
% everywhere except for the primes 2, 3, 5, 7, . . . , 224737 along the | ||
% main diagonal and the number 1 in all the positions A(i,j) with | ||
% |i-j| = 1,2,4,8, . . . ,16384. What is the (1,1) entry of inv(A)? | ||
% | ||
% http://www.siam.org/news/news.php?id=388 | ||
% | ||
% Filename in JGD collection: Trefethen/trefethen_20__19_minor.sms | ||
%------------------------------------------------------------------------------- | ||
19 19 83 | ||
1 1 3 | ||
2 1 1 | ||
3 1 1 | ||
5 1 1 | ||
9 1 1 | ||
17 1 1 | ||
2 2 5 | ||
3 2 1 | ||
4 2 1 | ||
6 2 1 | ||
10 2 1 | ||
18 2 1 | ||
3 3 7 | ||
4 3 1 | ||
5 3 1 | ||
7 3 1 | ||
11 3 1 | ||
19 3 1 | ||
4 4 11 | ||
5 4 1 | ||
6 4 1 | ||
8 4 1 | ||
12 4 1 | ||
5 5 13 | ||
6 5 1 | ||
7 5 1 | ||
9 5 1 | ||
13 5 1 | ||
6 6 17 | ||
7 6 1 | ||
8 6 1 | ||
10 6 1 | ||
14 6 1 | ||
7 7 19 | ||
8 7 1 | ||
9 7 1 | ||
11 7 1 | ||
15 7 1 | ||
8 8 23 | ||
9 8 1 | ||
10 8 1 | ||
12 8 1 | ||
16 8 1 | ||
9 9 29 | ||
10 9 1 | ||
11 9 1 | ||
13 9 1 | ||
17 9 1 | ||
10 10 31 | ||
11 10 1 | ||
12 10 1 | ||
14 10 1 | ||
18 10 1 | ||
11 11 37 | ||
12 11 1 | ||
13 11 1 | ||
15 11 1 | ||
19 11 1 | ||
12 12 41 | ||
13 12 1 | ||
14 12 1 | ||
16 12 1 | ||
13 13 43 | ||
14 13 1 | ||
15 13 1 | ||
17 13 1 | ||
14 14 47 | ||
15 14 1 | ||
16 14 1 | ||
18 14 1 | ||
15 15 53 | ||
16 15 1 | ||
17 15 1 | ||
19 15 1 | ||
16 16 59 | ||
17 16 1 | ||
18 16 1 | ||
17 17 61 | ||
18 17 1 | ||
19 17 1 | ||
18 18 67 | ||
19 18 1 | ||
19 19 71 |
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,21 @@ | ||
%%MatrixMarket matrix array real general | ||
19 1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 |
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,21 @@ | ||
%%MatrixMarket matrix array real general | ||
19 1 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
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 @@ | ||
|
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,19 @@ | ||
<a name="Intro"></a> | ||
<h1>Introduction</h1> | ||
This simple solver example should help you get started with Ginkgo. This example is meant for you to understand | ||
how Ginkgo works and how you can solve a simple linear system with Ginkgo. We encourage you to play with the code, | ||
change the parameters and see what is best suited for your purposes. | ||
|
||
<h3> About the example </h3> | ||
Each example has the following sections: | ||
<ol> | ||
<li> <b>Introduction:</b>This gives an overview of the example and mentions | ||
any interesting aspects in the example that might help the reader. | ||
<li> <b>The commented program:</b> This section is intended for you to | ||
understand the details of the example so that you can play with it and understand | ||
Ginkgo and its features better. | ||
<li> <b>Results:</b> This section shows the results of the code when run. Though the | ||
results may not be completely the same, you can expect the behaviour to be similar. | ||
<li> <b>The plain program:</b> This is the complete code without any comments to have | ||
an complete overview of the code. | ||
</ol> |
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 @@ | ||
basic |
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,35 @@ | ||
<h1>Results</h1> | ||
The following is the expected result: | ||
|
||
@code{.cpp} | ||
|
||
Solution (x): | ||
%%MatrixMarket matrix array real general | ||
19 1 | ||
0.252218 | ||
0.108645 | ||
0.0662811 | ||
0.0630433 | ||
0.0384088 | ||
0.0396536 | ||
0.0402648 | ||
0.0338935 | ||
0.0193098 | ||
0.0234653 | ||
0.0211499 | ||
0.0196413 | ||
0.0199151 | ||
0.0181674 | ||
0.0162722 | ||
0.0150714 | ||
0.0107016 | ||
0.0121141 | ||
0.0123025 | ||
Residual norm sqrt(r^T r): | ||
%%MatrixMarket matrix array real general | ||
1 1 | ||
2.10788e-15 | ||
|
||
@endcode | ||
|
||
<h3> Comments about programming and debugging </h3> |
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 @@ | ||
The simple solver example. |
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 @@ | ||
Solve a simple linear system with CG. Read a matrix and right hand side from a file. |
Oops, something went wrong.