Skip to content

Commit

Permalink
include the correct LAPACK package based on the compiler used
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Dendukuri committed Jun 26, 2024
1 parent bdcb3a0 commit b1b5ff4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 12 deletions.
21 changes: 21 additions & 0 deletions include/tuvx/linear_algebra/banded_matrix.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <vector>

namespace tuvx
{

template<typename T>
struct BandedMatrix
{
// data fields
std::size_t size_;
std::size_t bandwidth_up_;
std::size_t bandwidth_down_;
std::vector<std::vector<T>> band;
// constructor
BandedMatrix<T>(std::size_t size, std::size_t up, std::size_t down);
};

template<typename T>
std::vector<T> Dot(const BandedMatrix<T>& A, const std::vector<T>&);

} // namespace tuvx
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ message(STATUS "lapack libraries: ${LAPACK_LIBRARIES}")
target_link_libraries(tuvx_object PRIVATE PkgConfig::netcdff PkgConfig::netcdfc
yaml-cpp::yaml-cpp)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")
target_compile_definitions(tuvx_object PUBLIC TUVX_COMPILE_WITH_INTEL)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_definitions(tuvx_object PUBLIC TUVX_COMPILE_WITH_GCC)
endif()

if(BLAS_LIBRARIES)
target_link_libraries(tuvx_object PRIVATE ${BLAS_LIBRARIES})
else()
Expand All @@ -44,7 +50,7 @@ set_target_properties(
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR})

target_link_libraries(tuvx PRIVATE tuvx_object)
target_link_libraries(tuvx PUBLIC tuvx_object)

message(
STATUS
Expand Down
7 changes: 6 additions & 1 deletion test/unit/linear_algebra/test_lapacke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
#include <cstring>
#include <ctime>
#include <fstream>
#include <lapacke.h>
#include <limits>
#include <vector>

#ifdef TUVX_COMPILE_WITH_INTEL
#include <mkl_lapacke.h>
#elif TUVX_COMPILE_WITH_GCC
#include <lapacke.h>
#endif

using namespace tuvx;
using std::chrono::duration;
using std::chrono::duration_cast;
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
3.29913e-17 0.0176367
3.30137e-17 0.175568
3.29986e-17 1.73411
3.29744e-17 17.864
3.29784e-17 188.188
0 0.0312956
0 0.229959
0 2.2255
0 22.7488
0 240.375
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1.63141e-08 0.0319062
1.62981e-08 0.315242
1.63017e-08 3.15343
1.62755e-08 18.4041
1.63076e-08 166.735
0 3.46066
0 0.295798
0 3.97411
0 25.0105
0 238.504

0 comments on commit b1b5ff4

Please sign in to comment.