Skip to content

Commit

Permalink
[batch] fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelKoch committed Nov 19, 2024
1 parent fd87f05 commit bdf51dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
15 changes: 5 additions & 10 deletions core/solver/batch_dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,11 @@ enum class log_type { simple_convergence_completion };
} // namespace log


#define GKO_INDIRECT(...) __VA_ARGS__


#define GKO_BATCH_INSTANTIATE_STOP(macro, ...) \
GKO_INDIRECT( \
macro(__VA_ARGS__, \
::gko::batch::solver::device::batch_stop::SimpleAbsResidual)); \
GKO_INDIRECT( \
macro(__VA_ARGS__, \
::gko::batch::solver::device::batch_stop::SimpleRelResidual))
#define GKO_BATCH_INSTANTIATE_STOP(macro, ...) \
macro(__VA_ARGS__, \
::gko::batch::solver::device::batch_stop::SimpleAbsResidual); \
macro(__VA_ARGS__, \
::gko::batch::solver::device::batch_stop::SimpleRelResidual)

#define GKO_BATCH_INSTANTIATE_PRECONDITIONER(macro, ...) \
GKO_BATCH_INSTANTIATE_STOP( \
Expand Down
22 changes: 14 additions & 8 deletions include/ginkgo/core/base/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x,
#endif


// Helper macro to make Windows builds work
#define GKO_INDIRECT(...) __VA_ARGS__


/**
* Instantiates a template for each non-complex value type compiled by Ginkgo.
*
Expand All @@ -454,13 +458,14 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x,
*/
#if GINKGO_DPCPP_SINGLE_MODE
#define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE_VARGS(_macro, ...) \
template _macro(float, __VA_ARGS__); \
template GKO_INDIRECT(_macro(float, __VA_ARGS__)); \
template <> \
_macro(double, __VA_ARGS__) GKO_NOT_IMPLEMENTED
GKO_INDIRECT(_macro(double, __VA_ARGS__)) \
GKO_NOT_IMPLEMENTED
#else
#define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE_VARGS(_macro, ...) \
template _macro(float, __VA_ARGS__); \
template _macro(double, __VA_ARGS__)
template GKO_INDIRECT(_macro(float, __VA_ARGS__)); \
template GKO_INDIRECT(_macro(double, __VA_ARGS__))
#endif


Expand All @@ -478,15 +483,16 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x,
#define GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_VARGS(_macro, ...) \
GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE_VARGS(_macro, \
__VA_ARGS__); \
template _macro(std::complex<float>, __VA_ARGS__); \
template GKO_INDIRECT(_macro(std::complex<float>, __VA_ARGS__)); \
template <> \
_macro(std::complex<double>, __VA_ARGS__) GKO_NOT_IMPLEMENTED
GKO_INDIRECT(_macro(std::complex<double>, __VA_ARGS__)) \
GKO_NOT_IMPLEMENTED
#else
#define GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_VARGS(_macro, ...) \
GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE_VARGS(_macro, \
__VA_ARGS__); \
template _macro(std::complex<float>, __VA_ARGS__); \
template _macro(std::complex<double>, __VA_ARGS__)
template GKO_INDIRECT(_macro(std::complex<float>, __VA_ARGS__)); \
template GKO_INDIRECT(_macro(std::complex<double>, __VA_ARGS__))
#endif


Expand Down

0 comments on commit bdf51dc

Please sign in to comment.