Skip to content

Commit

Permalink
Make test_install actually run some tests.
Browse files Browse the repository at this point in the history
+ Check most SpMV.
+ Check most Solvers.
  • Loading branch information
tcojean committed Mar 17, 2021
1 parent 255b818 commit b267a65
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 40 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ add_custom_target(test_install
-DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX}/${GINKGO_INSTALL_CONFIG_DIR}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CUDA_COMPILER=${CMAKE_CUDA_COMPILER}
WORKING_DIRECTORY ${Ginkgo_BINARY_DIR}/test_install
# `--config cfg` is ignored by single-configuration generator.
# `$<CONFIG>` is always be the same as `CMAKE_BUILD_TYPE` in
# single-configuration generator.
Expand Down
12 changes: 11 additions & 1 deletion test_install/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ find_package(Ginkgo REQUIRED
# Alternatively, use `cmake -DCMAKE_PREFIX_PATH=<ginkgo_install_dir>` to specify the install directory
)

# Copy the data to the build 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)

if(MSVC)
if(GINKGO_BUILD_SHARED_LIBS)
ginkgo_switch_to_windows_dynamic("CXX")
Expand All @@ -20,8 +25,13 @@ endif()
include(CheckLanguage)
check_language(CUDA)

set(HAS_REFERENCE 0)
if (GINKGO_BUILD_REFERENCE)
set(HAS_REFERENCE 1)
endif()
add_executable(test_install test_install.cpp)
target_compile_features(test_install PUBLIC cxx_std_14)
target_compile_definitions(test_install_cuda PRIVATE HAS_REFERENCE=${HAS_REFERENCE})
target_link_libraries(test_install PRIVATE Ginkgo::ginkgo)

if(GINKGO_BUILD_CUDA)
Expand All @@ -33,7 +43,7 @@ if(GINKGO_BUILD_CUDA)
ginkgo_switch_to_windows_static("CUDA")
endif()
endif()
set_source_file_properties(test_install.cpp PROPERTIES LANGUAGE CUDA)
set_source_files_properties(test_install.cpp PROPERTIES LANGUAGE CUDA)
add_executable(test_install_cuda test_install.cpp)
target_compile_definitions(test_install_cuda PRIVATE HAS_CUDA=1)
target_link_libraries(test_install_cuda PRIVATE Ginkgo::ginkgo)
Expand Down
114 changes: 114 additions & 0 deletions test_install/data/A.mtx
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
21 changes: 21 additions & 0 deletions test_install/data/b.mtx
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
21 changes: 21 additions & 0 deletions test_install/data/x0.mtx
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
Loading

0 comments on commit b267a65

Please sign in to comment.