2323
2424namespace gko {
2525namespace log {
26- namespace {
27-
28-
29- std::string check_vector_type (const LinOp* linop)
30- {
31- #define GKO_CHECK_TYPE (_class, _type ) \
32- if (dynamic_cast <const _class<_type>*>(linop)) { \
33- return #_class " <" #_type " >" ; \
34- } else if (dynamic_cast <const _class<std::complex <_type>>*>(linop)) { \
35- return #_class " <complex<" #_type " >>" ; \
36- } \
37- static_assert (true , \
38- " This assert is used to counter the false positive extra " \
39- " semi-colon warnings" )
40-
41- using gko::matrix::Dense;
42- GKO_CHECK_TYPE (Dense, double );
43- GKO_CHECK_TYPE (Dense, float );
44- #if GINKGO_ENABLE_HALF
45- GKO_CHECK_TYPE (Dense, half);
46- #endif
47- #if GINKGO_ENABLE_BFLOAT16
48- GKO_CHECK_TYPE (Dense, bfloat16);
49- #endif
50-
51- #if GINKGO_BUILD_MPI
52- using gko::experimental::distributed::Vector;
53- GKO_CHECK_TYPE (Vector, double );
54- GKO_CHECK_TYPE (Vector, float );
55- #if GINKGO_ENABLE_HALF
56- GKO_CHECK_TYPE (Vector, half);
57- #endif
58- #if GINKGO_ENABLE_BFLOAT16
59- GKO_CHECK_TYPE (Vector, bfloat16);
60- #endif
61- #endif
62-
63- #undef GKO_CHECK_TYPE
64-
65- return " linop" ;
66- }
67-
68-
69- } // namespace
7026
7127
7228void ProfilerHook::on_allocation_started (const gko::Executor* exec,
@@ -188,8 +144,8 @@ void ProfilerHook::on_linop_apply_started(const LinOp* A, const LinOp* b,
188144 const LinOp* x) const
189145{
190146 std::stringstream ss;
191- ss << " apply(" << stringify_object (A) << " * " << check_vector_type (b) << " = "
192- << check_vector_type (x) << " )" ;
147+ ss << " apply(" << stringify_object (A) << " * " << stringify_object (b)
148+ << " = " << stringify_object (x) << " )" ;
193149 this ->begin_hook_ (ss.str ().c_str (), profile_event_category::linop);
194150 if (dynamic_cast <const solver::IterativeBase*>(A)) {
195151 this ->begin_hook_ (" iteration" , profile_event_category::solver);
@@ -201,8 +157,8 @@ void ProfilerHook::on_linop_apply_completed(const LinOp* A, const LinOp* b,
201157 const LinOp* x) const
202158{
203159 std::stringstream ss;
204- ss << " apply(" << stringify_object (A) << " * " << check_vector_type (b) << " = "
205- << check_vector_type (x) << " )" ;
160+ ss << " apply(" << stringify_object (A) << " * " << stringify_object (b)
161+ << " = " << stringify_object (x) << " )" ;
206162 if (dynamic_cast <const solver::IterativeBase*>(A)) {
207163 this ->end_hook_ (" iteration" , profile_event_category::solver);
208164 }
@@ -217,9 +173,9 @@ void ProfilerHook::on_linop_advanced_apply_started(const LinOp* A,
217173 const LinOp* x) const
218174{
219175 std::stringstream ss;
220- ss << " advanced_apply(" << check_vector_type (alpha) << " * "
221- << stringify_object (A) << " * " << check_vector_type (b) << " + "
222- << check_vector_type (beta) << " * " << check_vector_type (x) << " )" ;
176+ ss << " advanced_apply(" << stringify_object (alpha) << " * "
177+ << stringify_object (A) << " * " << stringify_object (b) << " + "
178+ << stringify_object (beta) << " * " << stringify_object (x) << " )" ;
223179 this ->begin_hook_ (ss.str ().c_str (), profile_event_category::linop);
224180 if (dynamic_cast <const solver::IterativeBase*>(A)) {
225181 this ->begin_hook_ (" iteration" , profile_event_category::solver);
@@ -234,9 +190,9 @@ void ProfilerHook::on_linop_advanced_apply_completed(const LinOp* A,
234190 const LinOp* x) const
235191{
236192 std::stringstream ss;
237- ss << " advanced_apply(" << check_vector_type (alpha) << " * "
238- << stringify_object (A) << " * " << check_vector_type (b) << " + "
239- << check_vector_type (beta) << " * " << check_vector_type (x) << " )" ;
193+ ss << " advanced_apply(" << stringify_object (alpha) << " * "
194+ << stringify_object (A) << " * " << stringify_object (b) << " + "
195+ << stringify_object (beta) << " * " << stringify_object (x) << " )" ;
240196 if (dynamic_cast <const solver::IterativeBase*>(A)) {
241197 this ->end_hook_ (" iteration" , profile_event_category::solver);
242198 }
0 commit comments