roystgnr / MetaPhysicL

Metaprogramming and operator-overloaded classes for numerical simulations
Other
22 stars 12 forks source link

Allow parallel reductions with ADReal #74

Closed andrsd closed 2 years ago

andrsd commented 3 years ago

We need to be able to do parallel reductions like sum, min, max with ADReal type.

Currently, when we try to compile we would see:

/path/to/libmesh/installed/include/timpi/op_function.h:119:3: error: static_assert failed due to requirement 'opfunction_dependent_false<MetaPhysicL::DualNumber<double, MetaPhysicL::SemiDynamicSparseNumberArray<double, unsigned int, MetaPhysicL::NWrapper<50>>, true>>::value' "Only specializations of OpFunction may be used, did you forget to include a header file (e.g. parallel_algebra.h)?"
  static_assert(opfunction_dependent_false<T>::value,
  ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/libmesh/installed/include/timpi/parallel_implementation.h:2534:25: note: in instantiation of template class 'TIMPI::OpFunction<MetaPhysicL::DualNumber<double, MetaPhysicL::SemiDynamicSparseNumberArray<double, unsigned int, MetaPhysicL::NWrapper<50>>, true>>' requested here
                        OpFunction<T>::sum(),
                        ^
/path/to/thm/src/userobjects/ADVolumeJunctionBaseUserObject.C:123:17: note: in instantiation of function template specialization 'TIMPI::Communicator::sum<MetaPhysicL::DualNumber<double, MetaPhysicL::SemiDynamicSparseNumberArray<double, unsigned int, MetaPhysicL::NWrapper<50>>, true>>' requested here
  _communicator.sum(_residual[0]);
                ^

Tagging @roystgnr

roystgnr commented 2 years ago

This was enabled by https://github.com/libMesh/MetaPhysicL/pull/15 and https://github.com/libMesh/MetaPhysicL/pull/16, and the bugs in that were fixed by https://github.com/libMesh/MetaPhysicL/pull/17 and https://github.com/libMesh/TIMPI/pull/95