-
Notifications
You must be signed in to change notification settings - Fork 3
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
Compare TUV-X Tridiagonal Solver Code with LAPACKE's implementation #97
Merged
Merged
Changes from 44 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
0700222
added BLAS library specification in build script
6fee119
merged local branch with main
0db8fa3
Merge branch 'main' of github.com:NCAR/tuv-x
42d8147
lapacke added in cmake
c2d6472
added google benchmark
c74f3f2
run each tridiagonal solver test multiple times and take average of t…
bdcb3a0
modified plots generated in numerical_analysis
b1b5ff4
include the correct LAPACK package based on the compiler used
dee5d7b
Apply suggestions from code review
AdityaDendukuri 830184d
seperated tests and benchmark (used google benchmark)
5e63955
benchmarking code changes
3cbb75a
only use diagonally dominant matrices for unit test
2077a2d
Merge branch 'main' into lapacke_debug
sjsprecious 3acc6e4
update docker files to use lapacke for tridiagonal tests
sjsprecious e035ad9
Update ubuntu.yml with lapacke
sjsprecious cc3403b
maybe this will work?
sjsprecious 6433ed0
revert changes to ubuntu.yml
sjsprecious 004a55d
Update Dockerfile for CI test
sjsprecious 7e7f02b
add missing new line
sjsprecious ec88760
allowing benchmark folder to be copied by dockerg
K20shores 63f1e8c
Update cmake/test_util.cmake
AdityaDendukuri 7c7c4ed
adding lapacke to ubuntu workflow
K20shores 21b65ca
Merge branch 'lapacke_debug' of https://github.com/NCAR/tuv-x into la…
K20shores feb883f
spelling
K20shores ab61424
serial build
K20shores 6fc7973
undoing cmake formatting changes
K20shores 783b494
using find lapacke from other open source libraries
K20shores 4dc105f
correcting working directory
K20shores 6621164
adding benchmark cmake variable
K20shores 26fd879
dash
K20shores 874e970
fixing path
K20shores 4994013
removing language thing
K20shores 0e909a0
ignore gtest when running clang tidy
K20shores 9239c15
unit tests operate on one size (1000); formatting changes; use same r…
a6299bc
re-adding benchmark variable
K20shores 510c956
fixed bug in test_error_function unit test; updated documentation
9820583
Merge branch 'lapacke_debug' of github.com:NCAR/tuv-x into lapacke_debug
9f54f5a
uncommented findLAPACKE
9f983b3
added some more documentation
c22d41d
fixed a bug that caused the memcheck to fail
eda38a6
Apply suggestions from code review
AdityaDendukuri d3b66f7
switched to std::abs instead of ::abs
9f256bd
Merge branch 'lapacke_debug' of github.com:NCAR/tuv-x into lapacke_debug
bb1c227
reverted formatting changes in cmake file
05e2827
re-added lapacke dependency in test_util
04a9b0f
linked LAPACKE libraries to unit tests
20e73de
removed typedefs in test_error_function.cpp
34b529b
updated code documentation
AdityaDendukuri 88fa5a6
documentaion changes
AdityaDendukuri 302fc37
documentation changes
AdityaDendukuri 73ac682
documentation changes
1d165a8
switched back to version 0.9.0
23b358e
Documentation Changes
a572368
Update src/CMakeLists.txt
AdityaDendukuri 38e9903
Update src/CMakeLists.txt
AdityaDendukuri b6a10f8
rolled back format changes
766ecf8
Merge branch 'lapacke_debug' of github.com:NCAR/tuv-x into lapacke_debug
98d29f6
Update src/CMakeLists.txt
AdityaDendukuri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ | |
!packaging/ | ||
!test/ | ||
!tool/ | ||
!CMakeLists.txt | ||
!CMakeLists.txt | ||
!benchmark |
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
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,12 @@ | ||
add_executable(benchmark_tridiagonal_solver benchmark_tridiagonal_solver.cpp) | ||
target_include_directories( | ||
benchmark_tridiagonal_solver PUBLIC ${OpenBLAS_INCLUDE_DIRS} | ||
${LAPACK_INCLUDE_DIRS}) | ||
|
||
target_link_libraries(benchmark_tridiagonal_solver | ||
PUBLIC | ||
LAPACK::LAPACK | ||
${LAPACKE_LIBRARIES} | ||
benchmark::benchmark | ||
musica::tuvx | ||
) |
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,122 @@ | ||
|
||
#include <tuvx/linear_algebra/linear_algebra.hpp> | ||
|
||
#include <benchmark/benchmark.h> | ||
|
||
#include <random> | ||
#include <vector> | ||
|
||
#ifdef TUVX_COMPILE_WITH_INTEL | ||
#include <mkl_lapacke.h> | ||
#elif TUVX_COMPILE_WITH_GCC | ||
#include <lapacke.h> | ||
#endif | ||
|
||
const std::size_t SYSTEM_SIZE = 1e6; | ||
|
||
const bool MAKE_DIAGONALLY_DOMINANT = true; | ||
|
||
const unsigned RANDOM_NUMBER_SEED = 1; | ||
|
||
/// @brief This function benchmarks the lapacke tridiagonal matrix solver for single precision | ||
static void BM_LAPACKE_SINGLE_PRECISISON(benchmark::State& state) | ||
{ | ||
std::vector<float> x(SYSTEM_SIZE); | ||
std::vector<float> b(SYSTEM_SIZE); | ||
tuvx::TridiagonalMatrix<float> A(SYSTEM_SIZE); | ||
std::mt19937 random_device(RANDOM_NUMBER_SEED); | ||
for (auto _ : state) | ||
{ | ||
state.PauseTiming(); | ||
tuvx::FillRandom<float>(A, RANDOM_NUMBER_SEED, MAKE_DIAGONALLY_DOMINANT); | ||
tuvx::FillRandom<float>(x, RANDOM_NUMBER_SEED); | ||
b = tuvx::Dot<float>(A, x); | ||
state.ResumeTiming(); | ||
|
||
LAPACKE_sgtsv( | ||
LAPACK_ROW_MAJOR, | ||
SYSTEM_SIZE, | ||
1, | ||
A.lower_diagonal_.data(), | ||
A.main_diagonal_.data(), | ||
A.upper_diagonal_.data(), | ||
b.data(), | ||
1); | ||
} | ||
} | ||
|
||
/// @brief This function benchmarks the lapacke tridiagonal matrix solver for double precision | ||
static void BM_LAPACKE_DOUBLE_PRECISISON(benchmark::State& state) | ||
{ | ||
std::vector<double> x(SYSTEM_SIZE); | ||
std::vector<double> b(SYSTEM_SIZE); | ||
tuvx::TridiagonalMatrix<double> A(SYSTEM_SIZE); | ||
|
||
std::mt19937 random_device(RANDOM_NUMBER_SEED); | ||
// Perform setup here | ||
for (auto _ : state) | ||
{ | ||
state.PauseTiming(); | ||
tuvx::FillRandom<double>(A, RANDOM_NUMBER_SEED, MAKE_DIAGONALLY_DOMINANT); | ||
tuvx::FillRandom<double>(x, RANDOM_NUMBER_SEED); | ||
b = tuvx::Dot<double>(A, x); | ||
state.ResumeTiming(); | ||
|
||
LAPACKE_dgtsv( | ||
LAPACK_ROW_MAJOR, | ||
SYSTEM_SIZE, | ||
1, | ||
A.lower_diagonal_.data(), | ||
A.main_diagonal_.data(), | ||
A.upper_diagonal_.data(), | ||
b.data(), | ||
1); | ||
} | ||
} | ||
|
||
/// @brief This function benchmarks the tuvx tridiagonal matrix solver for single precision | ||
static void BM_TUVX_DOUBLE_PRECISISON(benchmark::State& state) | ||
{ | ||
std::vector<double> x(SYSTEM_SIZE); | ||
std::vector<double> b(SYSTEM_SIZE); | ||
tuvx::TridiagonalMatrix<double> A(SYSTEM_SIZE); | ||
std::vector<double> x_approx(SYSTEM_SIZE); | ||
|
||
for (auto _ : state) | ||
{ | ||
state.PauseTiming(); | ||
tuvx::FillRandom<double>(A, RANDOM_NUMBER_SEED, MAKE_DIAGONALLY_DOMINANT); | ||
tuvx::FillRandom<double>(x, RANDOM_NUMBER_SEED); | ||
state.ResumeTiming(); | ||
tuvx::Solve<double>(A, b); | ||
} | ||
} | ||
|
||
/// @brief This function benchmarks the tuvx tridiagonal matrix solver for double precision | ||
static void BM_TUVX_SINGLE_PRECISISON(benchmark::State& state) | ||
{ | ||
std::vector<float> x(SYSTEM_SIZE); | ||
std::vector<float> b(SYSTEM_SIZE); | ||
tuvx::TridiagonalMatrix<float> A(SYSTEM_SIZE); | ||
std::vector<float> x_approx(SYSTEM_SIZE); | ||
|
||
// Perform setup here | ||
for (auto _ : state) | ||
{ | ||
state.PauseTiming(); | ||
tuvx::FillRandom<float>(A, RANDOM_NUMBER_SEED, MAKE_DIAGONALLY_DOMINANT); | ||
tuvx::FillRandom<float>(x, RANDOM_NUMBER_SEED); | ||
b = tuvx::Dot<float>(A, x); | ||
state.ResumeTiming(); | ||
tuvx::Solve<float>(A, b); | ||
} | ||
} | ||
|
||
/// @brief Register the functions defined above as a benchmark | ||
BENCHMARK(BM_LAPACKE_DOUBLE_PRECISISON); | ||
BENCHMARK(BM_LAPACKE_SINGLE_PRECISISON); | ||
BENCHMARK(BM_TUVX_DOUBLE_PRECISISON); | ||
BENCHMARK(BM_TUVX_SINGLE_PRECISISON); | ||
|
||
/// @brief run all benchmarks | ||
BENCHMARK_MAIN(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have missed this part of the conversation so my apologies in advanced but is
--parallel
not possible to use withlapacke