Skip to content

Commit cfbb366

Browse files
committed
Nonblocking implementation fix
1 parent a9555bc commit cfbb366

File tree

1 file changed

+39
-59
lines changed

1 file changed

+39
-59
lines changed

include/graphblas/nonblocking/blas3.hpp

Lines changed: 39 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -416,56 +416,6 @@ namespace grb {
416416
);
417417
}
418418

419-
namespace internal {
420-
421-
template<
422-
bool allow_void,
423-
Descriptor descr,
424-
class MulMonoid, class Operator,
425-
typename OutputType, typename InputType1, typename InputType2,
426-
typename RIT1, typename CIT1, typename NIT1,
427-
typename RIT2, typename CIT2, typename NIT2,
428-
typename RIT3, typename CIT3, typename NIT3
429-
>
430-
RC eWiseApply_matrix_generic(
431-
Matrix< OutputType, nonblocking, RIT1, CIT1, NIT1 > &C,
432-
const Matrix< InputType1, nonblocking, RIT2, CIT2, NIT2 > &A,
433-
const Matrix< InputType2, nonblocking, RIT3, CIT3, NIT3 > &B,
434-
const Operator &oper,
435-
const MulMonoid &mulMonoid,
436-
const Phase &phase,
437-
const typename std::enable_if<
438-
!grb::is_object< OutputType >::value &&
439-
!grb::is_object< InputType1 >::value &&
440-
!grb::is_object< InputType2 >::value &&
441-
grb::is_operator< Operator >::value,
442-
void >::type * const = nullptr
443-
) {
444-
if( internal::NONBLOCKING::warn_if_not_native &&
445-
config::PIPELINE::warn_if_not_native
446-
) {
447-
std::cerr << "Warning: eWiseApply (nonblocking) currently delegates to a "
448-
<< "blocking implementation.\n"
449-
<< " Further similar such warnings will be suppressed.\n";
450-
internal::NONBLOCKING::warn_if_not_native = false;
451-
}
452-
453-
// nonblocking execution is not supported
454-
// first, execute any computation that is not completed
455-
le.execution();
456-
457-
// second, delegate to the reference backend
458-
return eWiseApply_matrix_generic<
459-
allow_void, descr,
460-
MulMonoid, Operator
461-
>(
462-
getRefMatrix( C ), getRefMatrix( A ), getRefMatrix( B ),
463-
oper, mulMonoid, phase
464-
);
465-
}
466-
467-
} // namespace internal
468-
469419
template<
470420
Descriptor descr = descriptors::no_operation,
471421
class MulMonoid,
@@ -507,11 +457,26 @@ namespace grb {
507457
);
508458

509459
#ifdef _DEBUG
510-
std::cout << "In grb::eWiseApply_matrix_generic (nonblocking, monoid)\n";
460+
std::cout << "In grb::eWiseApply (nonblocking, monoid)\n";
511461
#endif
462+
if( internal::NONBLOCKING::warn_if_not_native && config::PIPELINE::warn_if_not_native ) {
463+
std::cerr << "Warning: eWiseApply (nonblocking) currently delegates to a "
464+
<< "blocking implementation.\n"
465+
<< " Further similar such warnings will be suppressed.\n";
466+
internal::NONBLOCKING::warn_if_not_native = false;
467+
}
468+
469+
// nonblocking execution is not supported
470+
// first, execute any computation that is not completed
471+
internal::le.execution();
512472

513-
return internal::eWiseApply_matrix_generic< true, descr >(
514-
C, A, B, mulmono.getOperator(), mulmono, phase
473+
// second, delegate to the reference backend
474+
return eWiseApply< descr >(
475+
internal::getRefMatrix( C ),
476+
internal::getRefMatrix( A ),
477+
internal::getRefMatrix( B ),
478+
mulmono,
479+
phase
515480
);
516481
}
517482

@@ -561,13 +526,28 @@ namespace grb {
561526
"the operator version of eWiseApply cannot be used if either of the "
562527
"input matrices is a pattern matrix (of type void)"
563528
);
529+
if( internal::NONBLOCKING::warn_if_not_native && config::PIPELINE::warn_if_not_native ) {
530+
std::cerr << "Warning: eWiseApply (nonblocking) currently delegates to a "
531+
<< "blocking implementation.\n"
532+
<< " Further similar such warnings will be suppressed.\n";
533+
internal::NONBLOCKING::warn_if_not_native = false;
534+
}
564535

565-
typename grb::Monoid<
566-
grb::operators::mul< double >,
567-
grb::identities::one
568-
> dummyMonoid;
569-
return internal::eWiseApply_matrix_generic< false, descr >(
570-
C, A, B, mulOp, dummyMonoid, phase
536+
#ifdef _DEBUG
537+
std::cout << "In grb::eWiseApply (nonblocking, op)\n";
538+
#endif
539+
540+
// nonblocking execution is not supported
541+
// first, execute any computation that is not completed
542+
internal::le.execution();
543+
544+
// second, delegate to the reference backend
545+
return eWiseApply< descr >(
546+
internal::getRefMatrix( C ),
547+
internal::getRefMatrix( A ),
548+
internal::getRefMatrix( B ),
549+
mulOp,
550+
phase
571551
);
572552
}
573553

0 commit comments

Comments
 (0)