mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
parent
6b3f60ee86
commit
ad98d818ce
11
docs/changelog/vtkm-mangle-diy.md
Normal file
11
docs/changelog/vtkm-mangle-diy.md
Normal file
@ -0,0 +1,11 @@
|
||||
# VTK-m thirdparty diy now can coexist with external diy
|
||||
|
||||
Previously VTK-m would leak macros that would cause an
|
||||
external diy to be incorrectly mangled breaking consumers
|
||||
of VTK-m that used diy.
|
||||
|
||||
Going forward to use `diy` from VTK-m all calls must use the
|
||||
`vtkmdiy` namespace instead of the `diy` namespace. This
|
||||
allows for VTK-m to properly forward calls to either
|
||||
the external or internal version correctly.
|
||||
|
@ -696,14 +696,14 @@ namespace internal
|
||||
{
|
||||
|
||||
template <typename T, typename S>
|
||||
void VTKM_CONT ArrayHandleDefaultSerialization(diy::BinaryBuffer& bb,
|
||||
void VTKM_CONT ArrayHandleDefaultSerialization(vtkmdiy::BinaryBuffer& bb,
|
||||
const vtkm::cont::ArrayHandle<T, S>& obj);
|
||||
|
||||
} // internal
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
|
@ -357,36 +357,36 @@ namespace internal
|
||||
namespace detail
|
||||
{
|
||||
template <typename ArrayHandle>
|
||||
inline void VTKM_CONT StorageSerialization(diy::BinaryBuffer& bb,
|
||||
inline void VTKM_CONT StorageSerialization(vtkmdiy::BinaryBuffer& bb,
|
||||
const ArrayHandle& obj,
|
||||
std::false_type)
|
||||
{
|
||||
vtkm::Id count = obj.GetNumberOfValues();
|
||||
diy::save(bb, count);
|
||||
vtkmdiy::save(bb, count);
|
||||
|
||||
diy::save(bb, vtkm::Id(0)); //not a basic storage
|
||||
vtkmdiy::save(bb, vtkm::Id(0)); //not a basic storage
|
||||
auto portal = obj.GetPortalConstControl();
|
||||
for (vtkm::Id i = 0; i < count; ++i)
|
||||
{
|
||||
diy::save(bb, portal.Get(i));
|
||||
vtkmdiy::save(bb, portal.Get(i));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename ArrayHandle>
|
||||
inline void VTKM_CONT StorageSerialization(diy::BinaryBuffer& bb,
|
||||
inline void VTKM_CONT StorageSerialization(vtkmdiy::BinaryBuffer& bb,
|
||||
const ArrayHandle& obj,
|
||||
std::true_type)
|
||||
{
|
||||
vtkm::Id count = obj.GetNumberOfValues();
|
||||
diy::save(bb, count);
|
||||
vtkmdiy::save(bb, count);
|
||||
|
||||
diy::save(bb, vtkm::Id(1)); //is basic storage
|
||||
diy::save(bb, obj.GetStorage().GetArray(), static_cast<std::size_t>(count));
|
||||
vtkmdiy::save(bb, vtkm::Id(1)); //is basic storage
|
||||
vtkmdiy::save(bb, obj.GetStorage().GetArray(), static_cast<std::size_t>(count));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
inline void VTKM_CONT ArrayHandleDefaultSerialization(diy::BinaryBuffer& bb,
|
||||
inline void VTKM_CONT ArrayHandleDefaultSerialization(vtkmdiy::BinaryBuffer& bb,
|
||||
const vtkm::cont::ArrayHandle<T, S>& obj)
|
||||
{
|
||||
using is_basic = typename std::is_same<S, vtkm::cont::StorageTagBasic>::type;
|
||||
@ -396,7 +396,7 @@ inline void VTKM_CONT ArrayHandleDefaultSerialization(diy::BinaryBuffer& bb,
|
||||
}
|
||||
} // vtkm::cont::internal
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
@ -404,14 +404,14 @@ VTKM_CONT void Serialization<vtkm::cont::ArrayHandle<T>>::load(BinaryBuffer& bb,
|
||||
vtkm::cont::ArrayHandle<T>& obj)
|
||||
{
|
||||
vtkm::Id count = 0;
|
||||
diy::load(bb, count);
|
||||
vtkmdiy::load(bb, count);
|
||||
obj.Allocate(count);
|
||||
|
||||
vtkm::Id input_was_basic_storage = 0;
|
||||
diy::load(bb, input_was_basic_storage);
|
||||
vtkmdiy::load(bb, input_was_basic_storage);
|
||||
if (input_was_basic_storage)
|
||||
{
|
||||
diy::load(bb, obj.GetStorage().GetArray(), static_cast<std::size_t>(count));
|
||||
vtkmdiy::load(bb, obj.GetStorage().GetArray(), static_cast<std::size_t>(count));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -419,7 +419,7 @@ VTKM_CONT void Serialization<vtkm::cont::ArrayHandle<T>>::load(BinaryBuffer& bb,
|
||||
for (vtkm::Id i = 0; i < count; ++i)
|
||||
{
|
||||
T val{};
|
||||
diy::load(bb, val);
|
||||
vtkmdiy::load(bb, val);
|
||||
portal.Set(i, val);
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ struct TypeString<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH1, typename AH2, typename AH3>
|
||||
@ -472,9 +472,9 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetFirstArray());
|
||||
diy::save(bb, storage.GetSecondArray());
|
||||
diy::save(bb, storage.GetThirdArray());
|
||||
vtkmdiy::save(bb, storage.GetFirstArray());
|
||||
vtkmdiy::save(bb, storage.GetSecondArray());
|
||||
vtkmdiy::save(bb, storage.GetThirdArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
@ -483,9 +483,9 @@ public:
|
||||
AH2 array2;
|
||||
AH3 array3;
|
||||
|
||||
diy::load(bb, array1);
|
||||
diy::load(bb, array2);
|
||||
diy::load(bb, array3);
|
||||
vtkmdiy::load(bb, array1);
|
||||
vtkmdiy::load(bb, array2);
|
||||
vtkmdiy::load(bb, array3);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleCartesianProduct(array1, array2, array3);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ struct TypeString<vtkm::cont::ArrayHandleCast<T, AH>>
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T1, typename T2>
|
||||
|
@ -752,7 +752,7 @@ struct TypeString<vtkm::cont::ArrayHandle<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
namespace internal
|
||||
@ -804,7 +804,7 @@ private:
|
||||
template <typename AH>
|
||||
void operator()(const AH& ah, BinaryBuffer& bb) const
|
||||
{
|
||||
diy::save(bb, ah);
|
||||
vtkmdiy::save(bb, ah);
|
||||
}
|
||||
};
|
||||
|
||||
@ -813,7 +813,7 @@ private:
|
||||
template <typename AH>
|
||||
void operator()(AH& ah, BinaryBuffer& bb) const
|
||||
{
|
||||
diy::load(bb, ah);
|
||||
vtkmdiy::load(bb, ah);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -351,7 +351,7 @@ struct TypeString<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH1, typename AH2>
|
||||
@ -365,8 +365,8 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetArray1());
|
||||
diy::save(bb, storage.GetArray2());
|
||||
vtkmdiy::save(bb, storage.GetArray1());
|
||||
vtkmdiy::save(bb, storage.GetArray2());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
@ -374,8 +374,8 @@ public:
|
||||
AH1 array1;
|
||||
AH2 array2;
|
||||
|
||||
diy::load(bb, array1);
|
||||
diy::load(bb, array2);
|
||||
vtkmdiy::load(bb, array1);
|
||||
vtkmdiy::load(bb, array2);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleConcatenate(array1, array2);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ struct TypeString<vtkm::cont::ArrayHandleConstant<T>>
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
|
@ -174,7 +174,7 @@ struct TypeString<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
@ -188,9 +188,9 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto portal = obj.GetPortalConstControl();
|
||||
diy::save(bb, portal.GetStart());
|
||||
diy::save(bb, portal.GetStep());
|
||||
diy::save(bb, portal.GetNumberOfValues());
|
||||
vtkmdiy::save(bb, portal.GetStart());
|
||||
vtkmdiy::save(bb, portal.GetStep());
|
||||
vtkmdiy::save(bb, portal.GetNumberOfValues());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
@ -198,9 +198,9 @@ public:
|
||||
T start{}, step{};
|
||||
vtkm::Id count = 0;
|
||||
|
||||
diy::load(bb, start);
|
||||
diy::load(bb, step);
|
||||
diy::load(bb, count);
|
||||
vtkmdiy::load(bb, start);
|
||||
vtkmdiy::load(bb, step);
|
||||
vtkmdiy::load(bb, count);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleCounting(start, step, count);
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ struct TypeString<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH>
|
||||
@ -351,16 +351,16 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetComponent());
|
||||
diy::save(bb, storage.GetArray());
|
||||
vtkmdiy::save(bb, storage.GetComponent());
|
||||
vtkmdiy::save(bb, storage.GetArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
vtkm::IdComponent component = 0;
|
||||
AH array;
|
||||
diy::load(bb, component);
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, component);
|
||||
vtkmdiy::load(bb, array);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleExtractComponent(array, component);
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ struct TypeString<vtkm::cont::ArrayHandle<vtkm::Vec<typename AH::ValueType, NUM_
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH, vtkm::IdComponent NUM_COMPS>
|
||||
@ -406,13 +406,13 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
diy::save(bb, obj.GetStorage().GetSourceArray());
|
||||
vtkmdiy::save(bb, obj.GetStorage().GetSourceArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
AH array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleGroupVec<NUM_COMPS>(array);
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ struct TypeString<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename SAH, typename OAH>
|
||||
@ -547,8 +547,8 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
diy::save(bb, obj.GetStorage().GetSourceArray());
|
||||
diy::save(bb, obj.GetStorage().GetOffsetsArray());
|
||||
vtkmdiy::save(bb, obj.GetStorage().GetSourceArray());
|
||||
vtkmdiy::save(bb, obj.GetStorage().GetOffsetsArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
@ -556,8 +556,8 @@ public:
|
||||
SAH src;
|
||||
OAH off;
|
||||
|
||||
diy::load(bb, src);
|
||||
diy::load(bb, off);
|
||||
vtkmdiy::load(bb, src);
|
||||
vtkmdiy::load(bb, off);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleGroupVecVariable(src, off);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ struct TypeString<vtkm::cont::ArrayHandle<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename Functor>
|
||||
@ -186,17 +186,17 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
diy::save(bb, obj.GetNumberOfValues());
|
||||
diy::save(bb, obj.GetPortalConstControl().GetFunctor());
|
||||
vtkmdiy::save(bb, obj.GetNumberOfValues());
|
||||
vtkmdiy::save(bb, obj.GetPortalConstControl().GetFunctor());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
vtkm::Id count = 0;
|
||||
diy::load(bb, count);
|
||||
vtkmdiy::load(bb, count);
|
||||
|
||||
Functor functor;
|
||||
diy::load(bb, functor);
|
||||
vtkmdiy::load(bb, functor);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleImplicit(functor, count);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ struct TypeString<vtkm::cont::ArrayHandleIndex>
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <>
|
||||
|
@ -400,7 +400,7 @@ struct TypeString<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename IdxAH, typename ValAH>
|
||||
@ -414,8 +414,8 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetIndexArray());
|
||||
diy::save(bb, storage.GetValueArray());
|
||||
vtkmdiy::save(bb, storage.GetIndexArray());
|
||||
vtkmdiy::save(bb, storage.GetValueArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
@ -423,8 +423,8 @@ public:
|
||||
IdxAH indices;
|
||||
ValAH values;
|
||||
|
||||
diy::load(bb, indices);
|
||||
diy::load(bb, values);
|
||||
vtkmdiy::load(bb, indices);
|
||||
vtkmdiy::load(bb, values);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandlePermutation(indices, values);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ struct TypeString<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH>
|
||||
@ -282,13 +282,13 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
diy::save(bb, obj.GetStorage().GetArray());
|
||||
vtkmdiy::save(bb, obj.GetStorage().GetArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
AH array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = vtkm::cont::make_ArrayHandleReverse(array);
|
||||
}
|
||||
};
|
||||
|
@ -426,7 +426,7 @@ struct TypeString<vtkm::cont::ArrayHandle<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH, vtkm::IdComponent NComps>
|
||||
@ -440,16 +440,16 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetArray());
|
||||
diy::save(bb, storage.GetMap());
|
||||
vtkmdiy::save(bb, storage.GetArray());
|
||||
vtkmdiy::save(bb, storage.GetMap());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
AH array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
vtkm::Vec<vtkm::IdComponent, NComps> map;
|
||||
diy::load(bb, map);
|
||||
vtkmdiy::load(bb, map);
|
||||
obj = vtkm::cont::make_ArrayHandleSwizzle(array, map);
|
||||
}
|
||||
};
|
||||
|
@ -778,7 +778,7 @@ struct TypeString<vtkm::cont::ArrayHandle<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH, typename Functor>
|
||||
@ -792,16 +792,16 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetArray());
|
||||
diy::save(bb, storage.GetFunctor());
|
||||
vtkmdiy::save(bb, storage.GetArray());
|
||||
vtkmdiy::save(bb, storage.GetFunctor());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
AH array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
Functor functor;
|
||||
diy::load(bb, functor);
|
||||
vtkmdiy::load(bb, functor);
|
||||
obj = vtkm::cont::make_ArrayHandleTransform(array, functor);
|
||||
}
|
||||
};
|
||||
@ -817,19 +817,19 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetArray());
|
||||
diy::save(bb, storage.GetFunctor());
|
||||
diy::save(bb, storage.GetInverseFunctor());
|
||||
vtkmdiy::save(bb, storage.GetArray());
|
||||
vtkmdiy::save(bb, storage.GetFunctor());
|
||||
vtkmdiy::save(bb, storage.GetInverseFunctor());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
AH array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
Functor functor;
|
||||
diy::load(bb, functor);
|
||||
vtkmdiy::load(bb, functor);
|
||||
InvFunctor invFunctor;
|
||||
diy::load(bb, invFunctor);
|
||||
vtkmdiy::load(bb, invFunctor);
|
||||
obj = vtkm::cont::make_ArrayHandleTransform(array, functor, invFunctor);
|
||||
}
|
||||
};
|
||||
|
@ -85,7 +85,7 @@ struct TypeString<vtkm::cont::ArrayHandle<
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <>
|
||||
@ -99,9 +99,9 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto portal = obj.GetPortalConstControl();
|
||||
diy::save(bb, portal.GetDimensions());
|
||||
diy::save(bb, portal.GetOrigin());
|
||||
diy::save(bb, portal.GetSpacing());
|
||||
vtkmdiy::save(bb, portal.GetDimensions());
|
||||
vtkmdiy::save(bb, portal.GetOrigin());
|
||||
vtkmdiy::save(bb, portal.GetSpacing());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
@ -109,9 +109,9 @@ public:
|
||||
vtkm::Id3 dims;
|
||||
typename BaseType::ValueType origin, spacing;
|
||||
|
||||
diy::load(bb, dims);
|
||||
diy::load(bb, origin);
|
||||
diy::load(bb, spacing);
|
||||
vtkmdiy::load(bb, dims);
|
||||
vtkmdiy::load(bb, origin);
|
||||
vtkmdiy::load(bb, spacing);
|
||||
|
||||
obj = vtkm::cont::ArrayHandleUniformPointCoordinates(dims, origin, spacing);
|
||||
}
|
||||
|
@ -53,14 +53,15 @@ ArrayHandleType inline ArrayHandle<T, StorageTagVirtual>::CastToType(
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Serialization<vtkm::cont::ArrayHandleVirtual<T>>
|
||||
{
|
||||
|
||||
static VTKM_CONT void save(diy::BinaryBuffer& bb, const vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
static VTKM_CONT void save(vtkmdiy::BinaryBuffer& bb,
|
||||
const vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
{
|
||||
vtkm::cont::internal::ArrayHandleDefaultSerialization(bb, obj);
|
||||
}
|
||||
@ -68,7 +69,7 @@ struct Serialization<vtkm::cont::ArrayHandleVirtual<T>>
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
};
|
||||
@ -80,29 +81,30 @@ struct IntAnySerializer
|
||||
using ConstantType = vtkm::cont::ArrayHandleConstant<T>;
|
||||
using BasicType = vtkm::cont::ArrayHandle<T>;
|
||||
|
||||
static VTKM_CONT void save(diy::BinaryBuffer& bb, const vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
static VTKM_CONT void save(vtkmdiy::BinaryBuffer& bb,
|
||||
const vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
{
|
||||
if (obj.template IsType<CountingType>())
|
||||
{
|
||||
diy::save(bb, vtkm::cont::TypeString<CountingType>::Get());
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<CountingType>::Get());
|
||||
|
||||
using S = typename CountingType::StorageTag;
|
||||
const vtkm::cont::StorageVirtual* storage = obj.GetStorage();
|
||||
auto* any = storage->Cast<vtkm::cont::StorageAny<T, S>>();
|
||||
diy::save(bb, any->GetHandle());
|
||||
vtkmdiy::save(bb, any->GetHandle());
|
||||
}
|
||||
else if (obj.template IsType<ConstantType>())
|
||||
{
|
||||
diy::save(bb, vtkm::cont::TypeString<ConstantType>::Get());
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<ConstantType>::Get());
|
||||
|
||||
using S = typename ConstantType::StorageTag;
|
||||
const vtkm::cont::StorageVirtual* storage = obj.GetStorage();
|
||||
auto* any = storage->Cast<vtkm::cont::StorageAny<T, S>>();
|
||||
diy::save(bb, any->GetHandle());
|
||||
vtkmdiy::save(bb, any->GetHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
diy::save(bb, vtkm::cont::TypeString<BasicType>::Get());
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<BasicType>::Get());
|
||||
vtkm::cont::internal::ArrayHandleDefaultSerialization(bb, obj);
|
||||
}
|
||||
}
|
||||
@ -110,24 +112,24 @@ struct IntAnySerializer
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::ArrayHandleVirtual<T>& obj)
|
||||
{
|
||||
std::string typeString;
|
||||
diy::load(bb, typeString);
|
||||
vtkmdiy::load(bb, typeString);
|
||||
|
||||
if (typeString == vtkm::cont::TypeString<CountingType>::Get())
|
||||
{
|
||||
CountingType array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
else if (typeString == vtkm::cont::TypeString<ConstantType>::Get())
|
||||
{
|
||||
ConstantType array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = std::move(vtkm::cont::ArrayHandleVirtual<T>{ array });
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ struct TypeString<vtkm::cont::ArrayHandleVirtualCoordinates>
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <>
|
||||
@ -132,8 +132,8 @@ public:
|
||||
using T = typename HandleType::ValueType;
|
||||
using S = typename HandleType::StorageTag;
|
||||
auto array = storage->Cast<vtkm::cont::StorageAny<T, S>>();
|
||||
diy::save(bb, vtkm::cont::TypeString<HandleType>::Get());
|
||||
diy::save(bb, array->GetHandle());
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<HandleType>::Get());
|
||||
vtkmdiy::save(bb, array->GetHandle());
|
||||
}
|
||||
else if (obj.IsType<RectilinearCoordsArrayType>())
|
||||
{
|
||||
@ -141,12 +141,12 @@ public:
|
||||
using T = typename HandleType::ValueType;
|
||||
using S = typename HandleType::StorageTag;
|
||||
auto array = storage->Cast<vtkm::cont::StorageAny<T, S>>();
|
||||
diy::save(bb, vtkm::cont::TypeString<HandleType>::Get());
|
||||
diy::save(bb, array->GetHandle());
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<HandleType>::Get());
|
||||
vtkmdiy::save(bb, array->GetHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
diy::save(bb, vtkm::cont::TypeString<BasicCoordsType>::Get());
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<BasicCoordsType>::Get());
|
||||
vtkm::cont::internal::ArrayHandleDefaultSerialization(bb, obj);
|
||||
}
|
||||
}
|
||||
@ -154,24 +154,24 @@ public:
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
{
|
||||
std::string typeString;
|
||||
diy::load(bb, typeString);
|
||||
vtkmdiy::load(bb, typeString);
|
||||
|
||||
if (typeString == vtkm::cont::TypeString<vtkm::cont::ArrayHandleUniformPointCoordinates>::Get())
|
||||
{
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
||||
}
|
||||
else if (typeString == vtkm::cont::TypeString<RectilinearCoordsArrayType>::Get())
|
||||
{
|
||||
RectilinearCoordsArrayType array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
||||
}
|
||||
else if (typeString == vtkm::cont::TypeString<BasicCoordsType>::Get())
|
||||
{
|
||||
BasicCoordsType array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
obj = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
||||
}
|
||||
else
|
||||
|
@ -412,7 +412,7 @@ struct TypeString<
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename AH1, typename AH2>
|
||||
@ -426,8 +426,8 @@ public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
auto storage = obj.GetStorage();
|
||||
diy::save(bb, storage.GetFirstArray());
|
||||
diy::save(bb, storage.GetSecondArray());
|
||||
vtkmdiy::save(bb, storage.GetFirstArray());
|
||||
vtkmdiy::save(bb, storage.GetSecondArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
|
||||
@ -435,8 +435,8 @@ public:
|
||||
AH1 a1;
|
||||
AH2 a2;
|
||||
|
||||
diy::load(bb, a1);
|
||||
diy::load(bb, a2);
|
||||
vtkmdiy::load(bb, a1);
|
||||
vtkmdiy::load(bb, a2);
|
||||
|
||||
obj = vtkm::cont::make_ArrayHandleZip(a1, a2);
|
||||
}
|
||||
|
@ -22,11 +22,8 @@
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
#include <vtkm/cont/MultiBlock.h>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include VTKM_DIY(diy/mpi.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
#include <algorithm> // std::lower_bound
|
||||
#include <numeric> // std::iota
|
||||
@ -44,15 +41,15 @@ AssignerMultiBlock::AssignerMultiBlock(const vtkm::cont::MultiBlock& mb)
|
||||
|
||||
VTKM_CONT
|
||||
AssignerMultiBlock::AssignerMultiBlock(vtkm::Id num_blocks)
|
||||
: diy::StaticAssigner(vtkm::cont::EnvironmentTracker::GetCommunicator().size(), 1)
|
||||
: vtkmdiy::StaticAssigner(vtkm::cont::EnvironmentTracker::GetCommunicator().size(), 1)
|
||||
, IScanBlockCounts()
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
if (comm.size() > 1)
|
||||
{
|
||||
vtkm::Id iscan;
|
||||
diy::mpi::scan(comm, num_blocks, iscan, std::plus<vtkm::Id>());
|
||||
diy::mpi::all_gather(comm, iscan, this->IScanBlockCounts);
|
||||
vtkmdiy::mpi::scan(comm, num_blocks, iscan, std::plus<vtkm::Id>());
|
||||
vtkmdiy::mpi::all_gather(comm, iscan, this->IScanBlockCounts);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,11 +28,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include VTKM_DIY(diy/assigner.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
#ifdef VTKM_MSVC
|
||||
#pragma warning(push)
|
||||
@ -49,7 +45,7 @@ class MultiBlock;
|
||||
|
||||
/// \brief Assigner for `MultiBlock` blocks.
|
||||
///
|
||||
/// `AssignerMultiBlock` is a `diy::StaticAssigner` implementation that uses
|
||||
/// `AssignerMultiBlock` is a `vtkmdiy::StaticAssigner` implementation that uses
|
||||
/// `MultiBlock`'s block distribution to build global-id/rank associations
|
||||
/// needed for several `diy` operations.
|
||||
/// It uses a contiguous assignment strategy to map blocks to global ids i.e.
|
||||
@ -59,7 +55,7 @@ class MultiBlock;
|
||||
/// essential it gets created on all ranks irrespective of whether the rank has
|
||||
/// any blocks.
|
||||
///
|
||||
class VTKM_CONT_EXPORT AssignerMultiBlock : public diy::StaticAssigner
|
||||
class VTKM_CONT_EXPORT AssignerMultiBlock : public vtkmdiy::StaticAssigner
|
||||
{
|
||||
public:
|
||||
/// Initialize the assigner using a multiblock dataset.
|
||||
@ -72,7 +68,7 @@ public:
|
||||
AssignerMultiBlock(vtkm::Id num_blocks);
|
||||
|
||||
///@{
|
||||
/// diy::Assigner API implementation.
|
||||
/// vtkmdiy::Assigner API implementation.
|
||||
VTKM_CONT
|
||||
void local_gids(int rank, std::vector<int>& gids) const override;
|
||||
|
||||
|
@ -366,7 +366,7 @@ struct TypeString<vtkm::cont::CellSetExplicit<ShapeST, CountST, ConnectivityST,
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename ShapeST, typename CountST, typename ConnectivityST, typename OffsetST>
|
||||
@ -378,32 +378,32 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& cs)
|
||||
{
|
||||
diy::save(bb, cs.GetName());
|
||||
diy::save(bb, cs.GetNumberOfPoints());
|
||||
diy::save(bb,
|
||||
cs.GetShapesArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{}));
|
||||
diy::save(
|
||||
vtkmdiy::save(bb, cs.GetName());
|
||||
vtkmdiy::save(bb, cs.GetNumberOfPoints());
|
||||
vtkmdiy::save(
|
||||
bb, cs.GetShapesArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{}));
|
||||
vtkmdiy::save(
|
||||
bb, cs.GetNumIndicesArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{}));
|
||||
diy::save(
|
||||
vtkmdiy::save(
|
||||
bb, cs.GetConnectivityArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{}));
|
||||
diy::save(
|
||||
vtkmdiy::save(
|
||||
bb, cs.GetIndexOffsetArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{}));
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& cs)
|
||||
{
|
||||
std::string name;
|
||||
diy::load(bb, name);
|
||||
vtkmdiy::load(bb, name);
|
||||
vtkm::Id numberOfPoints = 0;
|
||||
diy::load(bb, numberOfPoints);
|
||||
vtkmdiy::load(bb, numberOfPoints);
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt8, ShapeST> shapes;
|
||||
diy::load(bb, shapes);
|
||||
vtkmdiy::load(bb, shapes);
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent, CountST> counts;
|
||||
diy::load(bb, counts);
|
||||
vtkmdiy::load(bb, counts);
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, ConnectivityST> connectivity;
|
||||
diy::load(bb, connectivity);
|
||||
vtkmdiy::load(bb, connectivity);
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, OffsetST> offsets;
|
||||
diy::load(bb, offsets);
|
||||
vtkmdiy::load(bb, offsets);
|
||||
|
||||
cs = Type(name);
|
||||
cs.Fill(numberOfPoints, shapes, counts, connectivity, offsets);
|
||||
|
@ -414,7 +414,7 @@ struct TypeString<vtkm::cont::CellSetPermutation<CSType, AHValidCellIds>>
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename CSType, typename AHValidCellIds>
|
||||
@ -426,19 +426,19 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& cs)
|
||||
{
|
||||
diy::save(bb, cs.GetName());
|
||||
diy::save(bb, cs.GetFullCellSet());
|
||||
diy::save(bb, cs.GetValidCellIds());
|
||||
vtkmdiy::save(bb, cs.GetName());
|
||||
vtkmdiy::save(bb, cs.GetFullCellSet());
|
||||
vtkmdiy::save(bb, cs.GetValidCellIds());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& cs)
|
||||
{
|
||||
std::string name;
|
||||
diy::load(bb, name);
|
||||
vtkmdiy::load(bb, name);
|
||||
CSType fullCS;
|
||||
diy::load(bb, fullCS);
|
||||
vtkmdiy::load(bb, fullCS);
|
||||
AHValidCellIds validCellIds;
|
||||
diy::load(bb, validCellIds);
|
||||
vtkmdiy::load(bb, validCellIds);
|
||||
|
||||
cs = make_CellSetPermutation(validCellIds, fullCS, name);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ struct TypeString<vtkm::cont::CellSetSingleType<ConnectivityST>>
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename ConnectivityST>
|
||||
@ -294,26 +294,26 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& cs)
|
||||
{
|
||||
diy::save(bb, cs.GetName());
|
||||
diy::save(bb, cs.GetNumberOfPoints());
|
||||
diy::save(bb, cs.GetCellShape(0));
|
||||
diy::save(bb, cs.GetNumberOfPointsInCell(0));
|
||||
diy::save(
|
||||
vtkmdiy::save(bb, cs.GetName());
|
||||
vtkmdiy::save(bb, cs.GetNumberOfPoints());
|
||||
vtkmdiy::save(bb, cs.GetCellShape(0));
|
||||
vtkmdiy::save(bb, cs.GetNumberOfPointsInCell(0));
|
||||
vtkmdiy::save(
|
||||
bb, cs.GetConnectivityArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{}));
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& cs)
|
||||
{
|
||||
std::string name;
|
||||
diy::load(bb, name);
|
||||
vtkmdiy::load(bb, name);
|
||||
vtkm::Id numberOfPoints = 0;
|
||||
diy::load(bb, numberOfPoints);
|
||||
vtkmdiy::load(bb, numberOfPoints);
|
||||
vtkm::UInt8 shape;
|
||||
diy::load(bb, shape);
|
||||
vtkmdiy::load(bb, shape);
|
||||
vtkm::IdComponent count;
|
||||
diy::load(bb, count);
|
||||
vtkmdiy::load(bb, count);
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, ConnectivityST> connectivity;
|
||||
diy::load(bb, connectivity);
|
||||
vtkmdiy::load(bb, connectivity);
|
||||
|
||||
cs = Type(name);
|
||||
cs.Fill(numberOfPoints, shape, count, connectivity);
|
||||
|
@ -143,7 +143,7 @@ struct TypeString<vtkm::cont::CellSetStructured<DIMENSION>>
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <vtkm::IdComponent DIMENSION>
|
||||
@ -155,18 +155,18 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& cs)
|
||||
{
|
||||
diy::save(bb, cs.GetName());
|
||||
diy::save(bb, cs.GetPointDimensions());
|
||||
diy::save(bb, cs.GetGlobalPointIndexStart());
|
||||
vtkmdiy::save(bb, cs.GetName());
|
||||
vtkmdiy::save(bb, cs.GetPointDimensions());
|
||||
vtkmdiy::save(bb, cs.GetGlobalPointIndexStart());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& cs)
|
||||
{
|
||||
std::string name;
|
||||
diy::load(bb, name);
|
||||
vtkmdiy::load(bb, name);
|
||||
typename Type::SchedulingRangeType dims, start;
|
||||
diy::load(bb, dims);
|
||||
diy::load(bb, start);
|
||||
vtkmdiy::load(bb, dims);
|
||||
vtkmdiy::load(bb, start);
|
||||
|
||||
cs = Type(name);
|
||||
cs.SetPointDimensions(dims);
|
||||
|
@ -143,7 +143,7 @@ struct DynamicTransformTraits<vtkm::cont::CoordinateSystem>
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <>
|
||||
@ -151,16 +151,16 @@ struct Serialization<vtkm::cont::CoordinateSystem>
|
||||
{
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const vtkm::cont::CoordinateSystem& cs)
|
||||
{
|
||||
diy::save(bb, cs.GetName());
|
||||
diy::save(bb, cs.GetData());
|
||||
vtkmdiy::save(bb, cs.GetName());
|
||||
vtkmdiy::save(bb, cs.GetData());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::CoordinateSystem& cs)
|
||||
{
|
||||
std::string name;
|
||||
diy::load(bb, name);
|
||||
vtkmdiy::load(bb, name);
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates array;
|
||||
diy::load(bb, array);
|
||||
vtkmdiy::load(bb, array);
|
||||
cs = vtkm::cont::CoordinateSystem(name, array);
|
||||
}
|
||||
};
|
||||
|
@ -208,7 +208,7 @@ struct SerializableDataSet
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename FieldTypeList, typename CellSetTypesList>
|
||||
@ -223,24 +223,24 @@ public:
|
||||
const auto& dataset = serializable.DataSet;
|
||||
|
||||
vtkm::IdComponent numberOfCoordinateSystems = dataset.GetNumberOfCoordinateSystems();
|
||||
diy::save(bb, numberOfCoordinateSystems);
|
||||
vtkmdiy::save(bb, numberOfCoordinateSystems);
|
||||
for (vtkm::IdComponent i = 0; i < numberOfCoordinateSystems; ++i)
|
||||
{
|
||||
diy::save(bb, dataset.GetCoordinateSystem(i));
|
||||
vtkmdiy::save(bb, dataset.GetCoordinateSystem(i));
|
||||
}
|
||||
|
||||
vtkm::IdComponent numberOfCellSets = dataset.GetNumberOfCellSets();
|
||||
diy::save(bb, numberOfCellSets);
|
||||
vtkmdiy::save(bb, numberOfCellSets);
|
||||
for (vtkm::IdComponent i = 0; i < numberOfCellSets; ++i)
|
||||
{
|
||||
diy::save(bb, dataset.GetCellSet(i).ResetCellSetList(CellSetTypesList{}));
|
||||
vtkmdiy::save(bb, dataset.GetCellSet(i).ResetCellSetList(CellSetTypesList{}));
|
||||
}
|
||||
|
||||
vtkm::IdComponent numberOfFields = dataset.GetNumberOfFields();
|
||||
diy::save(bb, numberOfFields);
|
||||
vtkmdiy::save(bb, numberOfFields);
|
||||
for (vtkm::IdComponent i = 0; i < numberOfFields; ++i)
|
||||
{
|
||||
diy::save(bb, vtkm::cont::SerializableField<FieldTypeList>(dataset.GetField(i)));
|
||||
vtkmdiy::save(bb, vtkm::cont::SerializableField<FieldTypeList>(dataset.GetField(i)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,29 +250,29 @@ public:
|
||||
dataset = {}; // clear
|
||||
|
||||
vtkm::IdComponent numberOfCoordinateSystems = 0;
|
||||
diy::load(bb, numberOfCoordinateSystems);
|
||||
vtkmdiy::load(bb, numberOfCoordinateSystems);
|
||||
for (vtkm::IdComponent i = 0; i < numberOfCoordinateSystems; ++i)
|
||||
{
|
||||
vtkm::cont::CoordinateSystem coords;
|
||||
diy::load(bb, coords);
|
||||
vtkmdiy::load(bb, coords);
|
||||
dataset.AddCoordinateSystem(coords);
|
||||
}
|
||||
|
||||
vtkm::IdComponent numberOfCellSets = 0;
|
||||
diy::load(bb, numberOfCellSets);
|
||||
vtkmdiy::load(bb, numberOfCellSets);
|
||||
for (vtkm::IdComponent i = 0; i < numberOfCellSets; ++i)
|
||||
{
|
||||
vtkm::cont::DynamicCellSetBase<CellSetTypesList> cells;
|
||||
diy::load(bb, cells);
|
||||
vtkmdiy::load(bb, cells);
|
||||
dataset.AddCellSet(vtkm::cont::DynamicCellSet(cells));
|
||||
}
|
||||
|
||||
vtkm::IdComponent numberOfFields = 0;
|
||||
diy::load(bb, numberOfFields);
|
||||
vtkmdiy::load(bb, numberOfFields);
|
||||
for (vtkm::IdComponent i = 0; i < numberOfFields; ++i)
|
||||
{
|
||||
vtkm::cont::SerializableField<FieldTypeList> field;
|
||||
diy::load(bb, field);
|
||||
vtkmdiy::load(bb, field);
|
||||
dataset.AddField(field.Field);
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ struct DynamicCellSetCheck<vtkm::cont::DynamicCellSetBase<CellSetList>>
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
namespace internal
|
||||
@ -375,8 +375,8 @@ struct DynamicCellSetSerializeFunctor
|
||||
template <typename CellSetType>
|
||||
void operator()(const CellSetType& cs, BinaryBuffer& bb) const
|
||||
{
|
||||
diy::save(bb, vtkm::cont::TypeString<CellSetType>::Get());
|
||||
diy::save(bb, cs);
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<CellSetType>::Get());
|
||||
vtkmdiy::save(bb, cs);
|
||||
}
|
||||
};
|
||||
|
||||
@ -393,7 +393,7 @@ struct DynamicCellSetDeserializeFunctor
|
||||
if (!success && (typeString == vtkm::cont::TypeString<CellSetType>::Get()))
|
||||
{
|
||||
CellSetType cs;
|
||||
diy::load(bb, cs);
|
||||
vtkmdiy::load(bb, cs);
|
||||
dh = vtkm::cont::DynamicCellSetBase<CellSetTypes>(cs);
|
||||
success = true;
|
||||
}
|
||||
@ -417,7 +417,7 @@ public:
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& obj)
|
||||
{
|
||||
std::string typeString;
|
||||
diy::load(bb, typeString);
|
||||
vtkmdiy::load(bb, typeString);
|
||||
|
||||
bool success = false;
|
||||
vtkm::ListForEach(internal::DynamicCellSetDeserializeFunctor<CellSetTypes>{},
|
||||
|
@ -19,11 +19,7 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include VTKM_DIY(diy/mpi.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -31,15 +27,15 @@ namespace cont
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
static diy::mpi::communicator GlobalCommuncator(MPI_COMM_NULL);
|
||||
static vtkmdiy::mpi::communicator GlobalCommuncator(MPI_COMM_NULL);
|
||||
}
|
||||
|
||||
void EnvironmentTracker::SetCommunicator(const diy::mpi::communicator& comm)
|
||||
void EnvironmentTracker::SetCommunicator(const vtkmdiy::mpi::communicator& comm)
|
||||
{
|
||||
vtkm::cont::internal::GlobalCommuncator = comm;
|
||||
}
|
||||
|
||||
const diy::mpi::communicator& EnvironmentTracker::GetCommunicator()
|
||||
const vtkmdiy::mpi::communicator& EnvironmentTracker::GetCommunicator()
|
||||
{
|
||||
#ifndef DIY_NO_MPI
|
||||
int flag;
|
||||
@ -49,7 +45,7 @@ const diy::mpi::communicator& EnvironmentTracker::GetCommunicator()
|
||||
int argc = 0;
|
||||
char** argv = nullptr;
|
||||
MPI_Init(&argc, &argv);
|
||||
internal::GlobalCommuncator = diy::mpi::communicator(MPI_COMM_WORLD);
|
||||
internal::GlobalCommuncator = vtkmdiy::mpi::communicator(MPI_COMM_WORLD);
|
||||
}
|
||||
#endif
|
||||
return vtkm::cont::internal::GlobalCommuncator;
|
||||
|
@ -23,15 +23,8 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
|
||||
namespace diy
|
||||
{
|
||||
namespace mpi
|
||||
{
|
||||
class communicator;
|
||||
}
|
||||
}
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -46,10 +39,10 @@ class VTKM_CONT_EXPORT EnvironmentTracker
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
static void SetCommunicator(const diy::mpi::communicator& comm);
|
||||
static void SetCommunicator(const vtkmdiy::mpi::communicator& comm);
|
||||
|
||||
VTKM_CONT
|
||||
static const diy::mpi::communicator& GetCommunicator();
|
||||
static const vtkmdiy::mpi::communicator& GetCommunicator();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ struct SerializableField
|
||||
} // namespace cont
|
||||
} // namespace vtkm
|
||||
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename TypeList>
|
||||
@ -335,17 +335,17 @@ public:
|
||||
{
|
||||
const auto& field = serializable.Field;
|
||||
|
||||
diy::save(bb, field.GetName());
|
||||
diy::save(bb, static_cast<int>(field.GetAssociation()));
|
||||
vtkmdiy::save(bb, field.GetName());
|
||||
vtkmdiy::save(bb, static_cast<int>(field.GetAssociation()));
|
||||
if (field.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
|
||||
{
|
||||
diy::save(bb, field.GetAssocCellSet());
|
||||
vtkmdiy::save(bb, field.GetAssocCellSet());
|
||||
}
|
||||
else if (field.GetAssociation() == vtkm::cont::Field::Association::LOGICAL_DIM)
|
||||
{
|
||||
diy::save(bb, field.GetAssocLogicalDim());
|
||||
vtkmdiy::save(bb, field.GetAssocLogicalDim());
|
||||
}
|
||||
diy::save(bb, field.GetData().ResetTypes(TypeList{}));
|
||||
vtkmdiy::save(bb, field.GetData().ResetTypes(TypeList{}));
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& serializable)
|
||||
@ -353,30 +353,30 @@ public:
|
||||
auto& field = serializable.Field;
|
||||
|
||||
std::string name;
|
||||
diy::load(bb, name);
|
||||
vtkmdiy::load(bb, name);
|
||||
int assocVal = 0;
|
||||
diy::load(bb, assocVal);
|
||||
vtkmdiy::load(bb, assocVal);
|
||||
|
||||
auto assoc = static_cast<vtkm::cont::Field::Association>(assocVal);
|
||||
vtkm::cont::VariantArrayHandleBase<TypeList> data;
|
||||
if (assoc == vtkm::cont::Field::Association::CELL_SET)
|
||||
{
|
||||
std::string assocCellSetName;
|
||||
diy::load(bb, assocCellSetName);
|
||||
diy::load(bb, data);
|
||||
vtkmdiy::load(bb, assocCellSetName);
|
||||
vtkmdiy::load(bb, data);
|
||||
field =
|
||||
vtkm::cont::Field(name, assoc, assocCellSetName, vtkm::cont::VariantArrayHandle(data));
|
||||
}
|
||||
else if (assoc == vtkm::cont::Field::Association::LOGICAL_DIM)
|
||||
{
|
||||
vtkm::IdComponent assocLogicalDim;
|
||||
diy::load(bb, assocLogicalDim);
|
||||
diy::load(bb, data);
|
||||
vtkmdiy::load(bb, assocLogicalDim);
|
||||
vtkmdiy::load(bb, data);
|
||||
field = vtkm::cont::Field(name, assoc, assocLogicalDim, vtkm::cont::VariantArrayHandle(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
diy::load(bb, data);
|
||||
vtkmdiy::load(bb, data);
|
||||
field = vtkm::cont::Field(name, assoc, vtkm::cont::VariantArrayHandle(data));
|
||||
}
|
||||
}
|
||||
|
@ -21,15 +21,7 @@
|
||||
|
||||
#include <vtkm/cont/EnvironmentTracker.h>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
#include VTKM_DIY(diy/decomposition.hpp)
|
||||
#include VTKM_DIY(diy/master.hpp)
|
||||
#include VTKM_DIY(diy/partners/all-reduce.hpp)
|
||||
#include VTKM_DIY(diy/reduce.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
@ -78,56 +70,57 @@ vtkm::cont::ArrayHandle<vtkm::Range> MergeRangesGlobal(
|
||||
|
||||
using VectorOfRangesT = std::vector<vtkm::Range>;
|
||||
|
||||
diy::Master master(comm,
|
||||
1,
|
||||
-1,
|
||||
[]() -> void* { return new VectorOfRangesT(); },
|
||||
[](void* ptr) { delete static_cast<VectorOfRangesT*>(ptr); });
|
||||
vtkmdiy::Master master(comm,
|
||||
1,
|
||||
-1,
|
||||
[]() -> void* { return new VectorOfRangesT(); },
|
||||
[](void* ptr) { delete static_cast<VectorOfRangesT*>(ptr); });
|
||||
|
||||
diy::ContiguousAssigner assigner(/*num ranks*/ comm.size(), /*global-num-blocks*/ comm.size());
|
||||
diy::RegularDecomposer<diy::DiscreteBounds> decomposer(
|
||||
/*dim*/ 1, diy::interval(0, comm.size() - 1), comm.size());
|
||||
vtkmdiy::ContiguousAssigner assigner(/*num ranks*/ comm.size(),
|
||||
/*global-num-blocks*/ comm.size());
|
||||
vtkmdiy::RegularDecomposer<vtkmdiy::DiscreteBounds> decomposer(
|
||||
/*dim*/ 1, vtkmdiy::interval(0, comm.size() - 1), comm.size());
|
||||
decomposer.decompose(comm.rank(), assigner, master);
|
||||
assert(master.size() == 1); // each rank will have exactly 1 block.
|
||||
*master.block<VectorOfRangesT>(0) = v_ranges;
|
||||
|
||||
diy::RegularAllReducePartners all_reduce_partners(decomposer, /*k*/ 2);
|
||||
vtkmdiy::RegularAllReducePartners all_reduce_partners(decomposer, /*k*/ 2);
|
||||
|
||||
auto callback =
|
||||
[](VectorOfRangesT* data, const diy::ReduceProxy& srp, const diy::RegularMergePartners&) {
|
||||
const auto selfid = srp.gid();
|
||||
// 1. dequeue.
|
||||
std::vector<int> incoming;
|
||||
srp.incoming(incoming);
|
||||
for (const int gid : incoming)
|
||||
auto callback = [](
|
||||
VectorOfRangesT* data, const vtkmdiy::ReduceProxy& srp, const vtkmdiy::RegularMergePartners&) {
|
||||
const auto selfid = srp.gid();
|
||||
// 1. dequeue.
|
||||
std::vector<int> incoming;
|
||||
srp.incoming(incoming);
|
||||
for (const int gid : incoming)
|
||||
{
|
||||
if (gid != selfid)
|
||||
{
|
||||
if (gid != selfid)
|
||||
{
|
||||
VectorOfRangesT message;
|
||||
srp.dequeue(gid, message);
|
||||
VectorOfRangesT message;
|
||||
srp.dequeue(gid, message);
|
||||
|
||||
// if the number of components we've seen so far is less than those
|
||||
// in the received message, resize so we can accommodate all components
|
||||
// in the message. If the message has fewer components, it has no
|
||||
// effect.
|
||||
data->resize(std::max(data->size(), message.size()));
|
||||
// if the number of components we've seen so far is less than those
|
||||
// in the received message, resize so we can accommodate all components
|
||||
// in the message. If the message has fewer components, it has no
|
||||
// effect.
|
||||
data->resize(std::max(data->size(), message.size()));
|
||||
|
||||
std::transform(
|
||||
message.begin(), message.end(), data->begin(), data->begin(), std::plus<vtkm::Range>());
|
||||
}
|
||||
std::transform(
|
||||
message.begin(), message.end(), data->begin(), data->begin(), std::plus<vtkm::Range>());
|
||||
}
|
||||
// 2. enqueue
|
||||
for (int cc = 0; cc < srp.out_link().size(); ++cc)
|
||||
}
|
||||
// 2. enqueue
|
||||
for (int cc = 0; cc < srp.out_link().size(); ++cc)
|
||||
{
|
||||
auto target = srp.out_link().target(cc);
|
||||
if (target.gid != selfid)
|
||||
{
|
||||
auto target = srp.out_link().target(cc);
|
||||
if (target.gid != selfid)
|
||||
{
|
||||
srp.enqueue(target, *data);
|
||||
}
|
||||
srp.enqueue(target, *data);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
diy::reduce(master, assigner, all_reduce_partners, callback);
|
||||
vtkmdiy::reduce(master, assigner, all_reduce_partners, callback);
|
||||
assert(master.size() == 1); // each rank will have exactly 1 block.
|
||||
|
||||
return vtkm::cont::make_ArrayHandle(*master.block<VectorOfRangesT>(0), vtkm::CopyFlag::On);
|
||||
|
@ -22,10 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/TypeString.h>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
#include VTKM_DIY(diy/serialization.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
#endif // vtk_m_cont_Serialization_h
|
||||
|
@ -434,7 +434,7 @@ struct DynamicTransformTraits<vtkm::cont::VariantArrayHandleBase<TypeList>>
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
namespace diy
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
namespace internal
|
||||
@ -445,8 +445,8 @@ struct VariantArrayHandleSerializeFunctor
|
||||
template <typename ArrayHandleType>
|
||||
void operator()(const ArrayHandleType& ah, BinaryBuffer& bb) const
|
||||
{
|
||||
diy::save(bb, vtkm::cont::TypeString<ArrayHandleType>::Get());
|
||||
diy::save(bb, ah);
|
||||
vtkmdiy::save(bb, vtkm::cont::TypeString<ArrayHandleType>::Get());
|
||||
vtkmdiy::save(bb, ah);
|
||||
}
|
||||
};
|
||||
|
||||
@ -464,7 +464,7 @@ struct VariantArrayHandleDeserializeFunctor
|
||||
if (!success && (typeString == vtkm::cont::TypeString<ArrayHandleType>::Get()))
|
||||
{
|
||||
ArrayHandleType ah;
|
||||
diy::load(bb, ah);
|
||||
vtkmdiy::load(bb, ah);
|
||||
dh = vtkm::cont::VariantArrayHandleBase<TypeList>(ah);
|
||||
success = true;
|
||||
}
|
||||
@ -488,7 +488,7 @@ public:
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& obj)
|
||||
{
|
||||
std::string typeString;
|
||||
diy::load(bb, typeString);
|
||||
vtkmdiy::load(bb, typeString);
|
||||
|
||||
bool success = false;
|
||||
vtkm::ListForEach(
|
||||
|
@ -33,11 +33,7 @@
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include VTKM_DIY(diy/mpi.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -49,7 +45,6 @@ namespace testing
|
||||
struct Testing
|
||||
{
|
||||
public:
|
||||
|
||||
template <class Func>
|
||||
static VTKM_CONT int Run(Func function, int argc, char* argv[])
|
||||
{
|
||||
@ -127,11 +122,11 @@ struct Environment
|
||||
MPI_Init_thread(argc, argv, MPI_THREAD_FUNNELED, &provided_threading);
|
||||
|
||||
// set the global communicator to use in VTKm.
|
||||
diy::mpi::communicator comm(MPI_COMM_WORLD);
|
||||
vtkmdiy::mpi::communicator comm(MPI_COMM_WORLD);
|
||||
vtkm::cont::EnvironmentTracker::SetCommunicator(comm);
|
||||
#else
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -147,20 +142,14 @@ struct Environment
|
||||
class TestEqualResult
|
||||
{
|
||||
public:
|
||||
void PushMessage(const std::string& msg)
|
||||
{
|
||||
this->Messages.push_back(msg);
|
||||
}
|
||||
void PushMessage(const std::string& msg) { this->Messages.push_back(msg); }
|
||||
|
||||
const std::vector<std::string>& GetMessages() const
|
||||
{
|
||||
return this->Messages;
|
||||
}
|
||||
const std::vector<std::string>& GetMessages() const { return this->Messages; }
|
||||
|
||||
std::string GetMergedMessage() const
|
||||
{
|
||||
std::string msg;
|
||||
std::for_each(this->Messages.rbegin(), this->Messages.rend(), [&](const std::string& next){
|
||||
std::for_each(this->Messages.rbegin(), this->Messages.rend(), [&](const std::string& next) {
|
||||
msg += (msg.empty() ? "" : ": ");
|
||||
msg += next;
|
||||
});
|
||||
@ -168,10 +157,7 @@ public:
|
||||
return msg;
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return this->Messages.empty();
|
||||
}
|
||||
operator bool() const { return this->Messages.empty(); }
|
||||
|
||||
private:
|
||||
std::vector<std::string> Messages;
|
||||
@ -183,20 +169,18 @@ namespace detail
|
||||
struct TestEqualArrayHandle
|
||||
{
|
||||
template <typename T1, typename T2, typename StorageTag1, typename StorageTag2>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandle<T1, StorageTag1>&,
|
||||
const vtkm::cont::ArrayHandle<T2, StorageTag2>&,
|
||||
TestEqualResult& result) const
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<T1, StorageTag1>&,
|
||||
const vtkm::cont::ArrayHandle<T2, StorageTag2>&,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
result.PushMessage("types don't match");
|
||||
return;
|
||||
}
|
||||
|
||||
template <typename T, typename StorageTag1, typename StorageTag2>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag1>& array1,
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag2>& array2,
|
||||
TestEqualResult& result) const
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<T, StorageTag1>& array1,
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag2>& array2,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
if (array1.GetNumberOfValues() != array2.GetNumberOfValues())
|
||||
{
|
||||
@ -209,36 +193,32 @@ struct TestEqualArrayHandle
|
||||
{
|
||||
if (!test_equal(portal1.Get(i), portal2.Get(i)))
|
||||
{
|
||||
result.PushMessage(
|
||||
std::string("values don't match at index ") + std::to_string(i));
|
||||
result.PushMessage(std::string("values don't match at index ") + std::to_string(i));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename StorageTag, typename TypeList>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag>& array1,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& array2,
|
||||
TestEqualResult& result) const
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<T, StorageTag>& array1,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& array2,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
array2.CastAndCall(*this, array1, result);
|
||||
}
|
||||
|
||||
template <typename T, typename StorageTag, typename TypeList>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& array1,
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag>& array2,
|
||||
TestEqualResult& result) const
|
||||
VTKM_CONT void operator()(const vtkm::cont::VariantArrayHandleBase<TypeList>& array1,
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag>& array2,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
array1.CastAndCall(*this, array2, result);
|
||||
}
|
||||
|
||||
template <typename TypeList1, typename TypeList2>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList1>& array1,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList2>& array2,
|
||||
TestEqualResult& result) const
|
||||
VTKM_CONT void operator()(const vtkm::cont::VariantArrayHandleBase<TypeList1>& array1,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList2>& array2,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
array2.CastAndCall(*this, array1, result);
|
||||
}
|
||||
@ -395,8 +375,8 @@ inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1,
|
||||
}
|
||||
}
|
||||
|
||||
result = test_equal_ArrayHandles(f1.GetData().ResetTypes(fTtypes),
|
||||
f2.GetData().ResetTypes(fTtypes));
|
||||
result =
|
||||
test_equal_ArrayHandles(f1.GetData().ResetTypes(fTtypes), f2.GetData().ResetTypes(fTtypes));
|
||||
if (!result)
|
||||
{
|
||||
result.PushMessage("data doesn't match");
|
||||
@ -424,8 +404,8 @@ inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet&
|
||||
ds2.GetCoordinateSystem(i).GetData());
|
||||
if (!result)
|
||||
{
|
||||
result.PushMessage(
|
||||
std::string("coordinate systems don't match at index ") + std::to_string(i));
|
||||
result.PushMessage(std::string("coordinate systems don't match at index ") +
|
||||
std::to_string(i));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -441,8 +421,7 @@ inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet&
|
||||
ds2.GetCellSet(i).ResetCellSetList(ctypes));
|
||||
if (!result)
|
||||
{
|
||||
result.PushMessage(
|
||||
std::string("cellsets don't match at index ") + std::to_string(i));
|
||||
result.PushMessage(std::string("cellsets don't match at index ") + std::to_string(i));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -457,15 +436,13 @@ inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet&
|
||||
result = test_equal_Fields(ds1.GetField(i), ds2.GetField(i), fTtypes);
|
||||
if (!result)
|
||||
{
|
||||
result.PushMessage(
|
||||
std::string("fields don't match at index ") + std::to_string(i));
|
||||
result.PushMessage(std::string("fields don't match at index ") + std::to_string(i));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont::testing
|
||||
|
@ -24,13 +24,7 @@
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
#include VTKM_DIY(diy/master.hpp)
|
||||
#include VTKM_DIY(diy/mpi.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
#include <random>
|
||||
|
||||
@ -174,10 +168,10 @@ template <typename T, typename TestEqualFunctor>
|
||||
void TestSerialization(const T& obj, const TestEqualFunctor& test)
|
||||
{
|
||||
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
diy::Master master(comm);
|
||||
vtkmdiy::Master master(comm);
|
||||
|
||||
auto nblocks = comm.size();
|
||||
diy::RoundRobinAssigner assigner(comm.size(), nblocks);
|
||||
vtkmdiy::RoundRobinAssigner assigner(comm.size(), nblocks);
|
||||
|
||||
std::vector<int> gids;
|
||||
assigner.local_gids(comm.rank(), gids);
|
||||
@ -187,8 +181,8 @@ void TestSerialization(const T& obj, const TestEqualFunctor& test)
|
||||
Block<T> block;
|
||||
block.send = obj;
|
||||
|
||||
diy::Link* link = new diy::Link;
|
||||
diy::BlockID neighbor;
|
||||
vtkmdiy::Link* link = new vtkmdiy::Link;
|
||||
vtkmdiy::BlockID neighbor;
|
||||
|
||||
// send neighbor
|
||||
neighbor.gid = (gid < (nblocks - 1)) ? (gid + 1) : 0;
|
||||
@ -203,11 +197,11 @@ void TestSerialization(const T& obj, const TestEqualFunctor& test)
|
||||
master.add(gid, &block, link);
|
||||
|
||||
// compute, exchange, compute
|
||||
master.foreach ([](Block<T>* b, const diy::Master::ProxyWithLink& cp) {
|
||||
master.foreach ([](Block<T>* b, const vtkmdiy::Master::ProxyWithLink& cp) {
|
||||
cp.enqueue(cp.link()->target(0), b->send);
|
||||
});
|
||||
master.exchange();
|
||||
master.foreach ([](Block<T>* b, const diy::Master::ProxyWithLink& cp) {
|
||||
master.foreach ([](Block<T>* b, const vtkmdiy::Master::ProxyWithLink& cp) {
|
||||
cp.dequeue(cp.link()->target(1).gid, b->received);
|
||||
});
|
||||
|
||||
|
@ -93,7 +93,7 @@ void Validate(const vtkm::cont::ArrayHandle<vtkm::Range>& ranges,
|
||||
const ValueType& min,
|
||||
const ValueType& max)
|
||||
{
|
||||
diy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
vtkmdiy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
VTKM_TEST_ASSERT(ranges.GetNumberOfValues() == 1, "Wrong number of ranges");
|
||||
|
||||
auto portal = ranges.GetPortalConstControl();
|
||||
@ -111,7 +111,7 @@ void Validate(const vtkm::cont::ArrayHandle<vtkm::Range>& ranges,
|
||||
const vtkm::Vec<T, size>& min,
|
||||
const vtkm::Vec<T, size>& max)
|
||||
{
|
||||
diy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
vtkmdiy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
VTKM_TEST_ASSERT(ranges.GetNumberOfValues() == size, "Wrong number of ranges");
|
||||
|
||||
auto portal = ranges.GetPortalConstControl();
|
||||
@ -132,7 +132,7 @@ void Validate(const vtkm::cont::ArrayHandle<vtkm::Range>& ranges,
|
||||
template <typename ValueType>
|
||||
void DecomposeRange(ValueType& min, ValueType& max)
|
||||
{
|
||||
diy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
vtkmdiy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
auto delta = (max - min) / static_cast<ValueType>(comm.size());
|
||||
min = min + static_cast<ValueType>(comm.rank()) * delta;
|
||||
max = (comm.rank() == comm.size() - 1) ? max : min + delta;
|
||||
@ -150,7 +150,7 @@ void DecomposeRange(vtkm::Vec<T, size>& min, vtkm::Vec<T, size>& max)
|
||||
template <typename ValueType>
|
||||
void TryRangeGlobalComputeDS(const ValueType& min, const ValueType& max)
|
||||
{
|
||||
diy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
vtkmdiy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
PRINT_INFO_0("Trying type (dataset): " << vtkm::testing::TypeName<ValueType>::Name());
|
||||
|
||||
// distribute range among all ranks, so we can confirm reduction works.
|
||||
@ -174,7 +174,7 @@ void TryRangeGlobalComputeDS(const ValueType& min, const ValueType& max)
|
||||
template <typename ValueType>
|
||||
void TryRangeGlobalComputeMB(const ValueType& min, const ValueType& max)
|
||||
{
|
||||
diy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
vtkmdiy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
PRINT_INFO("Trying type (multiblock): " << vtkm::testing::TypeName<ValueType>::Name());
|
||||
|
||||
vtkm::cont::MultiBlock mb;
|
||||
@ -195,7 +195,7 @@ void TryRangeGlobalComputeMB(const ValueType& min, const ValueType& max)
|
||||
|
||||
static void TestFieldRangeGlobalCompute()
|
||||
{
|
||||
diy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
vtkmdiy::mpi::communicator comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
PRINT_INFO_0("Running on " << comm.size() << " ranks.");
|
||||
|
||||
// init random seed.
|
||||
|
@ -35,11 +35,7 @@
|
||||
#include <vtkm/exec/ConnectivityStructured.h>
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include VTKM_DIY(diy/master.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
void DataSet_Compare(vtkm::cont::DataSet& LeftDateSet, vtkm::cont::DataSet& RightDateSet);
|
||||
static void MultiBlockTest()
|
||||
|
@ -522,7 +522,7 @@ int UnitTestSerializationArrayHandle(int argc, char* argv[])
|
||||
seed = static_cast<decltype(seed)>(std::time(nullptr));
|
||||
std::cout << "using seed: " << seed << "\n";
|
||||
}
|
||||
diy::mpi::broadcast(comm, seed, 0);
|
||||
vtkmdiy::mpi::broadcast(comm, seed, 0);
|
||||
generator.seed(seed);
|
||||
|
||||
return vtkm::cont::testing::Testing::Run(TestArrayHandleSerialization, argc, argv);
|
||||
|
@ -30,16 +30,7 @@
|
||||
#include <vtkm/cont/Serialization.h>
|
||||
#include <vtkm/filter/internal/CreateResult.h>
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
#include VTKM_DIY(diy/decomposition.hpp)
|
||||
#include VTKM_DIY(diy/master.hpp)
|
||||
#include VTKM_DIY(diy/partners/broadcast.hpp)
|
||||
#include VTKM_DIY(diy/partners/swap.hpp)
|
||||
#include VTKM_DIY(diy/reduce.hpp)
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
#include <vtkm/thirdparty/diy/diy.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -53,8 +44,8 @@ class DistributedHistogram
|
||||
{
|
||||
public:
|
||||
void operator()(vtkm::cont::ArrayHandle<vtkm::Id>* result,
|
||||
const diy::ReduceProxy& srp,
|
||||
const diy::RegularMergePartners&) const
|
||||
const vtkmdiy::ReduceProxy& srp,
|
||||
const vtkmdiy::RegularMergePartners&) const
|
||||
{
|
||||
const auto selfid = srp.gid();
|
||||
// 1. dequeue.
|
||||
@ -119,7 +110,7 @@ public:
|
||||
return numLocalBlocks == 0 ? ArrayType() : this->LocalBlocks[0];
|
||||
}
|
||||
|
||||
diy::Master master(
|
||||
vtkmdiy::Master master(
|
||||
comm,
|
||||
/*threads*/ 1,
|
||||
/*limit*/ -1,
|
||||
@ -127,8 +118,8 @@ public:
|
||||
[](void* ptr) { delete static_cast<vtkm::cont::ArrayHandle<vtkm::Id>*>(ptr); });
|
||||
|
||||
vtkm::cont::AssignerMultiBlock assigner(numLocalBlocks);
|
||||
diy::RegularDecomposer<diy::DiscreteBounds> decomposer(
|
||||
/*dims*/ 1, diy::interval(0, assigner.nblocks() - 1), assigner.nblocks());
|
||||
vtkmdiy::RegularDecomposer<vtkmdiy::DiscreteBounds> decomposer(
|
||||
/*dims*/ 1, vtkmdiy::interval(0, assigner.nblocks() - 1), assigner.nblocks());
|
||||
decomposer.decompose(comm.rank(), assigner, master);
|
||||
|
||||
assert(static_cast<vtkm::Id>(master.size()) == numLocalBlocks);
|
||||
@ -137,9 +128,9 @@ public:
|
||||
*master.block<ArrayType>(static_cast<int>(cc)) = this->LocalBlocks[static_cast<size_t>(cc)];
|
||||
}
|
||||
|
||||
diy::RegularMergePartners partners(decomposer, /*k=*/2);
|
||||
vtkmdiy::RegularMergePartners partners(decomposer, /*k=*/2);
|
||||
// reduce to block-0.
|
||||
diy::reduce(master, assigner, partners, Reducer());
|
||||
vtkmdiy::reduce(master, assigner, partners, Reducer());
|
||||
|
||||
ArrayType result;
|
||||
if (master.local(0))
|
||||
@ -159,21 +150,21 @@ private:
|
||||
if (comm.size() > 1)
|
||||
{
|
||||
using ArrayType = vtkm::cont::ArrayHandle<vtkm::Id>;
|
||||
diy::Master master(
|
||||
vtkmdiy::Master master(
|
||||
comm,
|
||||
/*threads*/ 1,
|
||||
/*limit*/ -1,
|
||||
[]() -> void* { return new vtkm::cont::ArrayHandle<vtkm::Id>(); },
|
||||
[](void* ptr) { delete static_cast<vtkm::cont::ArrayHandle<vtkm::Id>*>(ptr); });
|
||||
|
||||
diy::ContiguousAssigner assigner(comm.size(), comm.size());
|
||||
diy::RegularDecomposer<diy::DiscreteBounds> decomposer(
|
||||
1, diy::interval(0, comm.size() - 1), comm.size());
|
||||
vtkmdiy::ContiguousAssigner assigner(comm.size(), comm.size());
|
||||
vtkmdiy::RegularDecomposer<vtkmdiy::DiscreteBounds> decomposer(
|
||||
1, vtkmdiy::interval(0, comm.size() - 1), comm.size());
|
||||
decomposer.decompose(comm.rank(), assigner, master);
|
||||
assert(master.size() == 1); // number of local blocks should be 1 per rank.
|
||||
*master.block<ArrayType>(0) = data;
|
||||
diy::RegularBroadcastPartners partners(decomposer, /*k=*/2);
|
||||
diy::reduce(master, assigner, partners, Reducer());
|
||||
vtkmdiy::RegularBroadcastPartners partners(decomposer, /*k=*/2);
|
||||
vtkmdiy::reduce(master, assigner, partners, Reducer());
|
||||
data = *master.block<ArrayType>(0);
|
||||
}
|
||||
}
|
||||
|
4
vtkm/thirdparty/diy/CMakeLists.txt
vendored
4
vtkm/thirdparty/diy/CMakeLists.txt
vendored
@ -63,6 +63,8 @@ install(TARGETS vtkm_diy
|
||||
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
||||
install(DIRECTORY vtkmdiy
|
||||
DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${kit_dir}/)
|
||||
install(FILES ${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h
|
||||
install(FILES
|
||||
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/diy.h
|
||||
DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${kit_dir}/)
|
||||
endif()
|
||||
|
13
vtkm/thirdparty/diy/Configure.h.in
vendored
13
vtkm/thirdparty/diy/Configure.h.in
vendored
@ -42,11 +42,16 @@
|
||||
* we will make this configurable.*/
|
||||
#define DIY_NO_THREADS
|
||||
|
||||
#if VTKM_USE_EXTERNAL_DIY
|
||||
# define VTKM_DIY(header) <header>
|
||||
/* Need to provide a way to for Serialziation
|
||||
* specializations to be injected into the correct
|
||||
* namespace. This solves the issue while allowing
|
||||
* for VTK-m to support an internal and external diy
|
||||
* existing at the same time. */
|
||||
#if(VTKM_USE_EXTERNAL_DIY)
|
||||
# define mangled_diy_namespace diy
|
||||
#else
|
||||
# define VTKM_DIY(header) <vtkmdiy/include/header>
|
||||
# define diy vtkmdiy // mangle namespace diy
|
||||
# define mangled_diy_namespace vtkmdiy
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
64
vtkm/thirdparty/diy/diy.h
vendored
Normal file
64
vtkm/thirdparty/diy/diy.h
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-NA0003525 with NTESS,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_thirdparty_diy_diy_h
|
||||
#define vtk_m_thirdparty_diy_diy_h
|
||||
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
|
||||
#if VTKM_USE_EXTERNAL_DIY
|
||||
#define VTKM_DIY_INCLUDE(header) <diy/header>
|
||||
#else
|
||||
#define VTKM_DIY_INCLUDE(header) <vtkmdiy/include/vtkmdiy/header>
|
||||
#define diy vtkmdiy // mangle namespace diy (see below comments)
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include VTKM_DIY_INCLUDE(assigner.hpp)
|
||||
#include VTKM_DIY_INCLUDE(decomposition.hpp)
|
||||
#include VTKM_DIY_INCLUDE(master.hpp)
|
||||
#include VTKM_DIY_INCLUDE(partners/all-reduce.hpp)
|
||||
#include VTKM_DIY_INCLUDE(partners/broadcast.hpp)
|
||||
#include VTKM_DIY_INCLUDE(partners/swap.hpp)
|
||||
#include VTKM_DIY_INCLUDE(reduce.hpp)
|
||||
#include VTKM_DIY_INCLUDE(serialization.hpp)
|
||||
#include VTKM_DIY_INCLUDE(mpi.hpp)
|
||||
#undef VTKM_DIY_INCLUDE
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
// clang-format on
|
||||
|
||||
// When using an external DIY
|
||||
// We need to alias the diy namespace to
|
||||
// vtkmdiy so that VTK-m uses it properly
|
||||
#if VTKM_USE_EXTERNAL_DIY
|
||||
namespace vtkmdiy = ::diy;
|
||||
|
||||
#else
|
||||
// The aliasing approach fails for when we
|
||||
// want to us an internal version since
|
||||
// the diy namespace already points to the
|
||||
// external version. Instead we use macro
|
||||
// replacement to make sure all diy classes
|
||||
// are placed in vtkmdiy placed
|
||||
#undef diy // mangle namespace diy
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user