Skip to content

Commit 2779deb

Browse files
committed
Add option to build against Bandicoot (by default we build against Bandicoot if found).
1 parent 7784b15 commit 2779deb

3 files changed

Lines changed: 9 additions & 34 deletions

File tree

CMake/FindBandicoot.cmake

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,6 @@ if(EXISTS "${BANDICOOT_INCLUDE_DIR}/bandicoot_bits/config.hpp")
9696
set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${CLBLAS_LIBRARIES}")
9797
set(HAVE_CLBLAS true)
9898
endif ()
99-
100-
# Search for clBlast.
101-
set(CLBLAST_FIND_QUIETLY true)
102-
include(COOT_FindCLBlast)
103-
104-
if (CLBLAST_FOUND)
105-
message(STATUS "clBlast includes: ${CLBLAST_INCLUDE_DIR}")
106-
message(STATUS "clBlast libraries: ${CLBLAST_LIBRARIES}")
107-
108-
set(SUPPORT_INCLUDE_DIRS "${SUPPORT_INCLUDE_DIRS}"
109-
"${CLBLAST_INCLUDE_DIR}")
110-
set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${CLBLAST_LIBRARIES}")
111-
set(HAVE_CLBLAST true)
112-
endif ()
11399
endif ()
114100

115101
# Search for CUDA.

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ project(ensmallen
1010

1111
# Configurable options for CMake.
1212
option(USE_OPENMP "If available, use OpenMP for parallelization." ON)
13+
option(USE_BANDICOOT "If available, build against Bandicoot for GPU support." ON)
1314

1415
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
1516

@@ -59,13 +60,15 @@ if(USE_OPENMP)
5960
target_link_libraries(ensmallen INTERFACE OpenMP::OpenMP_CXX)
6061
endif()
6162

62-
# Find Bandicoot and link it.
63-
find_package(Bandicoot 0.100.0)
64-
if(BANDICOOT_FOUND AND NOT TARGET Bandicoot::Bandicoot)
65-
target_link_libraries(ensmallen INTERFACE Bandicoot::Bandicoot)
66-
target_include_directories(ensmallen INTERFACE ${BANDICOOT_INCLUDE_DIR})
63+
if (USE_BANDICOOT)
64+
# Find Bandicoot and link it.
65+
find_package(Bandicoot 0.100.0)
66+
if(BANDICOOT_FOUND AND NOT TARGET Bandicoot::Bandicoot)
67+
target_link_libraries(ensmallen INTERFACE Bandicoot::Bandicoot)
68+
target_include_directories(ensmallen INTERFACE ${BANDICOOT_INCLUDE_DIR})
6769

68-
add_definitions(-DUSE_COOT)
70+
add_definitions(-DUSE_COOT)
71+
endif()
6972
endif()
7073

7174
# Find Armadillo and link it.

include/ensmallen_bits/utility/arma_traits.hpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,58 +40,48 @@ struct IsArmaType
4040
const static bool value = false;
4141
};
4242

43-
// Commenting out the first template per case, because
44-
// Visual Studio doesn't like this instantiaion pattern (error C2910).
45-
// template<>
4643
template<typename eT>
4744
struct IsArmaType<arma::Col<eT> >
4845
{
4946
const static bool value = true;
5047
};
5148

52-
// template<>
5349
template<typename eT>
5450
struct IsArmaType<arma::SpCol<eT> >
5551
{
5652
const static bool value = true;
5753
};
5854

59-
// template<>
6055
template<typename eT>
6156
struct IsArmaType<arma::Row<eT> >
6257
{
6358
const static bool value = true;
6459
};
6560

66-
// template<>
6761
template<typename eT>
6862
struct IsArmaType<arma::SpRow<eT> >
6963
{
7064
const static bool value = true;
7165
};
7266

73-
// template<>
7467
template<typename eT>
7568
struct IsArmaType<arma::subview<eT> >
7669
{
7770
const static bool value = true;
7871
};
7972

80-
// template<>
8173
template<typename eT>
8274
struct IsArmaType<arma::subview_col<eT> >
8375
{
8476
const static bool value = true;
8577
};
8678

87-
// template<>
8879
template<typename eT>
8980
struct IsArmaType<arma::subview_row<eT> >
9081
{
9182
const static bool value = true;
9283
};
9384

94-
// template<>
9585
template<typename eT>
9686
struct IsArmaType<arma::SpSubview<eT> >
9787
{
@@ -110,28 +100,24 @@ struct IsArmaType<arma::SpSubview_row<eT> >
110100
const static bool value = true;
111101
};
112102

113-
// template<>
114103
template<typename eT>
115104
struct IsArmaType<arma::Mat<eT> >
116105
{
117106
const static bool value = true;
118107
};
119108

120-
// template<>
121109
template<typename eT>
122110
struct IsArmaType<arma::SpMat<eT> >
123111
{
124112
const static bool value = true;
125113
};
126114

127-
// template<>
128115
template<typename eT>
129116
struct IsArmaType<arma::Cube<eT> >
130117
{
131118
const static bool value = true;
132119
};
133120

134-
// template<>
135121
template<typename eT>
136122
struct IsArmaType<arma::subview_cube<eT> >
137123
{

0 commit comments

Comments
 (0)