Skip to content

Commit

Permalink
Try to fix Windows issues with the new gtest.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcojean committed Oct 15, 2020
1 parent 66ca1bf commit e8873b9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
43 changes: 25 additions & 18 deletions core/test/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <type_traits>


#include <gtest/gtest.h>


#include <ginkgo/core/base/math.hpp>
#include <ginkgo/core/base/types.hpp>

Expand All @@ -51,46 +54,50 @@ namespace gko {
namespace test {


using ValueTypes =
::testing::Types<float, double, std::complex<float>, std::complex<double>>;
typedef ::testing::Types<float, double, std::complex<float>,
std::complex<double>>
ValueTypes;


using ComplexValueTypes =
::testing::Types<std::complex<float>, std::complex<double>>;
typedef ::testing::Types<std::complex<float>, std::complex<double>>
ComplexValueTypes;


using IndexTypes = ::testing::Types<gko::int32, gko::int64>;
typedef ::testing::Types<gko::int32, gko::int64> IndexTypes;


using ValueAndIndexTypes =
::testing::Types<float, double, std::complex<float>, std::complex<double>,
gko::int32, gko::int64, gko::size_type>;
typedef ::testing::Types<float, double, std::complex<float>,
std::complex<double>, gko::int32, gko::int64,
gko::size_type>
ValueAndIndexTypes;


using ValueIndexTypes = ::testing::Types<
typedef ::testing::Types<
std::tuple<float, gko::int32>, std::tuple<double, gko::int32>,
std::tuple<std::complex<float>, gko::int32>,
std::tuple<std::complex<double>, gko::int32>, std::tuple<float, gko::int64>,
std::tuple<double, gko::int64>, std::tuple<std::complex<float>, gko::int64>,
std::tuple<std::complex<double>, gko::int64>>;
std::tuple<std::complex<double>, gko::int64>>
ValueIndexTypes;


using RealValueIndexTypes = ::testing::Types<
typedef ::testing::Types<
std::tuple<float, gko::int32>, std::tuple<double, gko::int32>,
std::tuple<float, gko::int64>, std::tuple<double, gko::int64>>;
std::tuple<float, gko::int64>, std::tuple<double, gko::int64>>
RealValueIndexTypes;


using ComplexValueIndexTypes =
::testing::Types<std::tuple<std::complex<float>, gko::int32>,
std::tuple<std::complex<double>, gko::int32>,
std::tuple<std::complex<float>, gko::int64>,
std::tuple<std::complex<double>, gko::int64>>;
typedef ::testing::Types<std::tuple<std::complex<float>, gko::int32>,
std::tuple<std::complex<double>, gko::int32>,
std::tuple<std::complex<float>, gko::int64>,
std::tuple<std::complex<double>, gko::int64>>
ComplexValueIndexTypes;


template <typename T>
struct reduction_factor {
static constexpr gko::remove_complex<T> value =
std::is_same<gko::remove_complex<T>, float>::value ? 1.0e-7 : 1.0e-14;
std::is_same<gko::remove_complex<T>, float>::value ? 1.0e-7f : 1.0e-14;
};


Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/base/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class Executor : public log::EnableLogging<Executor> {
try {
this->raw_copy_from(src_exec, num_elems * sizeof(T), src_ptr,
dest_ptr);
} catch (NotSupported &err) {
} catch (NotSupported &) {
// Unoptimized copy. Try to go through the masters.
auto src_master = src_exec->get_master().get();
if (num_elems > 0 && src_master != src_exec) {
Expand Down
12 changes: 6 additions & 6 deletions include/ginkgo/core/base/lin_op.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,12 +810,12 @@ using EnableDefaultLinOpFactory =
*
* @ingroup LinOp
*/
#define GKO_CREATE_FACTORY_PARAMETERS(_parameters_name, _factory_name) \
public: \
class _factory_name; \
struct _parameters_name##_type \
: ::gko::enable_parameters_type<_parameters_name##_type, \
_factory_name>
#define GKO_CREATE_FACTORY_PARAMETERS(_parameters_name, _factory_name) \
public: \
class _factory_name; \
class _parameters_name##_type \
: public ::gko::enable_parameters_type<_parameters_name##_type, \
_factory_name>


/**
Expand Down
4 changes: 2 additions & 2 deletions include/ginkgo/core/matrix/csr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,13 @@ class Csr : public EnableLinOp<Csr<ValueType, IndexType>>,
const index_type nvidia_row_len_limit = 1024;
/* Use imbalance strategy when the matrix has more more than 1e6 on
* NVIDIA hardware */
const index_type nvidia_nnz_limit = 1e6;
const index_type nvidia_nnz_limit{1e6};
/* Use imbalance strategy when the maximum number of nonzero per row is
* more than 768 on AMD hardware */
const index_type amd_row_len_limit = 768;
/* Use imbalance strategy when the matrix has more more than 1e8 on AMD
* hardware */
const index_type amd_nnz_limit = 1e8;
const index_type amd_nnz_limit{1e8};

/**
* Creates an automatical strategy.
Expand Down
4 changes: 2 additions & 2 deletions third_party/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ if(MSVC)
# Force using shared runtime library when MSVC builds shared libraries
ginkgo_load_git_package(gtest_external
"https://github.com/google/googletest.git"
"ee3aa831172090fd5442820f215cb04ab6062756"
"6a7ed316a5cdc07b6d26362c90770787513822d4"
# Work around the linking errors when compiling gtest with CUDA
"-Dgtest_disable_pthreads=ON" "-Dgtest_force_shared_crt=${BUILD_SHARED_LIBS}")
else()
ginkgo_load_git_package(gtest_external
"https://github.com/google/googletest.git"
"ee3aa831172090fd5442820f215cb04ab6062756"
"6a7ed316a5cdc07b6d26362c90770787513822d4"
# Work around the linking errors when compiling gtest with CUDA
"-Dgtest_disable_pthreads=ON"
"-DCMAKE_CXX_FLAGS=-fPIC")
Expand Down

0 comments on commit e8873b9

Please sign in to comment.