Merge branch 'upstream-diy' into diy_conditional_serialization

* upstream-diy:
  diy 2019-02-08 (72a201e1)
This commit is contained in:
Robert Maynard 2019-02-08 14:25:51 -05:00
commit 7d307b96ce
53 changed files with 198 additions and 194 deletions

@ -1,5 +1,5 @@
#ifndef DIY_ALGORITHMS_HPP
#define DIY_ALGORITHMS_HPP
#ifndef VTKMDIY_ALGORITHMS_HPP
#define VTKMDIY_ALGORITHMS_HPP
#include <vector>

@ -1,5 +1,5 @@
#ifndef DIY_ASSIGNER_HPP
#define DIY_ASSIGNER_HPP
#ifndef VTKMDIY_ASSIGNER_HPP
#define VTKMDIY_ASSIGNER_HPP
#include <vector>
#include <tuple>

@ -1,5 +1,5 @@
#ifndef DIY_COLLECTION_HPP
#define DIY_COLLECTION_HPP
#ifndef VTKMDIY_COLLECTION_HPP
#define VTKMDIY_COLLECTION_HPP
#include <vector>

@ -1,5 +1,5 @@
#ifndef DIY_COMMUNICATOR_HPP
#define DIY_COMMUNICATOR_HPP
#ifndef VTKMDIY_COMMUNICATOR_HPP
#define VTKMDIY_COMMUNICATOR_HPP
#warning "diy::Communicator (in diy/communicator.hpp) is deprecated, use diy::mpi::communicator directly"

@ -1,5 +1,5 @@
#ifndef DIY_CONSTANTS_H
#define DIY_CONSTANTS_H
#ifndef VTKMDIY_CONSTANTS_H
#define VTKMDIY_CONSTANTS_H
// Default DIY_MAX_DIM to 4, unless provided by the user
// (used for static min/max size in various Bounds)
@ -19,6 +19,8 @@ enum
DIY_T1 = 0x80 /* maximum-side t (later) neighbor */
};
#ifndef DIY_UNUSED
#define DIY_UNUSED(expr) do { (void)(expr); } while (0)
#endif
#endif

@ -1,5 +1,5 @@
#ifndef DIY_CRITICAL_RESOURCE_HPP
#define DIY_CRITICAL_RESOURCE_HPP
#ifndef VTKMDIY_CRITICAL_RESOURCE_HPP
#define VTKMDIY_CRITICAL_RESOURCE_HPP
namespace diy
{

@ -1,5 +1,5 @@
#ifndef DIY_DECOMPOSITION_HPP
#define DIY_DECOMPOSITION_HPP
#ifndef VTKMDIY_DECOMPOSITION_HPP
#define VTKMDIY_DECOMPOSITION_HPP
#include <vector>
#include <algorithm>

@ -1,5 +1,5 @@
#ifndef DIY_DETAIL_ALGORITHMS_KDTREE_SAMPLING_HPP
#define DIY_DETAIL_ALGORITHMS_KDTREE_SAMPLING_HPP
#ifndef VTKMDIY_DETAIL_ALGORITHMS_KDTREE_SAMPLING_HPP
#define VTKMDIY_DETAIL_ALGORITHMS_KDTREE_SAMPLING_HPP
#include <vector>
#include <cassert>

@ -1,5 +1,5 @@
#ifndef DIY_DETAIL_ALGORITHMS_KDTREE_HPP
#define DIY_DETAIL_ALGORITHMS_KDTREE_HPP
#ifndef VTKMDIY_DETAIL_ALGORITHMS_KDTREE_HPP
#define VTKMDIY_DETAIL_ALGORITHMS_KDTREE_HPP
#include <vector>
#include <cassert>

@ -1,5 +1,5 @@
#ifndef DIY_DETAIL_ALGORITHMS_SORT_HPP
#define DIY_DETAIL_ALGORITHMS_SORT_HPP
#ifndef VTKMDIY_DETAIL_ALGORITHMS_SORT_HPP
#define VTKMDIY_DETAIL_ALGORITHMS_SORT_HPP
#include <functional>
#include <algorithm>

@ -1,5 +1,5 @@
#ifndef DIY_BLOCK_TRAITS_HPP
#define DIY_BLOCK_TRAITS_HPP
#ifndef VTKMDIY_BLOCK_TRAITS_HPP
#define VTKMDIY_BLOCK_TRAITS_HPP
#include "traits.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_DETAIL_ALL_TO_ALL_HPP
#define DIY_DETAIL_ALL_TO_ALL_HPP
#ifndef VTKMDIY_DETAIL_ALL_TO_ALL_HPP
#define VTKMDIY_DETAIL_ALL_TO_ALL_HPP
#include "../block_traits.hpp"

@ -17,8 +17,8 @@ the standard library.
*/
#ifndef DIY_UTILS_TRAITS_HPP
#define DIY_UTILS_TRAITS_HPP
#ifndef VTKMDIY_UTILS_TRAITS_HPP
#define VTKMDIY_UTILS_TRAITS_HPP
#include <cstdlib>
#include <tuple>

@ -1,5 +1,5 @@
#ifndef DIY_GRID_HPP
#define DIY_GRID_HPP
#ifndef VTKMDIY_GRID_HPP
#define VTKMDIY_GRID_HPP
#include "point.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_IO_BLOCK_HPP
#define DIY_IO_BLOCK_HPP
#ifndef VTKMDIY_IO_BLOCK_HPP
#define VTKMDIY_IO_BLOCK_HPP
#include <string>
#include <algorithm>

@ -1,5 +1,5 @@
#ifndef DIY_IO_BOV_HPP
#define DIY_IO_BOV_HPP
#ifndef VTKMDIY_IO_BOV_HPP
#define VTKMDIY_IO_BOV_HPP
#include <vector>
#include <algorithm>
@ -71,7 +71,7 @@ void
diy::io::BOV::
read(const DiscreteBounds& bounds, T* buffer, bool collective, int chunk) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
int dim = shape_.size();
int total = 1;
std::vector<int> subsizes;
@ -130,7 +130,7 @@ void
diy::io::BOV::
write(const DiscreteBounds& bounds, const T* buffer, const DiscreteBounds& core, bool collective, int chunk)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
int dim = shape_.size();
std::vector<int> subsizes;
std::vector<int> buffer_shape, buffer_start;

@ -1,5 +1,5 @@
#ifndef DIY_IO_NMPY_HPP
#define DIY_IO_NMPY_HPP
#ifndef VTKMDIY_IO_NMPY_HPP
#define VTKMDIY_IO_NMPY_HPP
#include <sstream>
#include <complex>

@ -1,5 +1,5 @@
#ifndef DIY_IO_SHARED_HPP
#define DIY_IO_SHARED_HPP
#ifndef VTKMDIY_IO_SHARED_HPP
#define VTKMDIY_IO_SHARED_HPP
#include <sstream>
#include <fstream>

@ -1,5 +1,5 @@
#ifndef DIY_IO_UTILS_HPP
#define DIY_IO_UTILS_HPP
#ifndef VTKMDIY_IO_UTILS_HPP
#define VTKMDIY_IO_UTILS_HPP
#if defined(_WIN32)
#include <direct.h>

@ -1,5 +1,5 @@
#ifndef DIY_COVER_HPP
#define DIY_COVER_HPP
#ifndef VTKMDIY_COVER_HPP
#define VTKMDIY_COVER_HPP
#include <vector>
#include <map>

@ -1,7 +1,7 @@
#ifndef DIY_LOG_HPP
#define DIY_LOG_HPP
#ifndef VTKMDIY_LOG_HPP
#define VTKMDIY_LOG_HPP
#ifndef DIY_USE_SPDLOG
#ifndef VTKMDIY_USE_SPDLOG
#include <memory>
#include "fmt/format.h"

@ -1,5 +1,5 @@
#ifndef DIY_MASTER_HPP
#define DIY_MASTER_HPP
#ifndef VTKMDIY_MASTER_HPP
#define VTKMDIY_MASTER_HPP
#include <vector>
#include <map>
@ -624,7 +624,7 @@ exchange(bool remote)
log->debug("Starting exchange");
#ifdef DIY_NO_MPI
#ifdef VTKM_DIY_NO_MPI
// remote doesn't need to do anything special if there is no mpi, but we also
// can't just use it because of the ibarrier
remote = false;
@ -798,7 +798,7 @@ rcomm_exchange()
{
if (gid_order.empty() && inflight_sends().empty())
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
ibarr_req = comm_.ibarrier();
ibarr_act = true;
#else

@ -1,7 +1,7 @@
#ifndef DIY_MPI_HPP
#define DIY_MPI_HPP
#ifndef VTKMDIY_MPI_HPP
#define VTKMDIY_MPI_HPP
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
#include <mpi.h>
#else
#include "mpi/no-mpi.hpp"
@ -41,7 +41,7 @@ struct environment
diy::mpi::environment::
environment(int threading)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
int argc = 0; char** argv;
MPI_Init_thread(&argc, &argv, threading, &provided_threading);
#else
@ -52,7 +52,7 @@ environment(int threading)
diy::mpi::environment::
environment(int argc, char* argv[], int threading)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Init_thread(&argc, &argv, threading, &provided_threading);
#else
(void) argc; (void) argv;
@ -63,7 +63,7 @@ environment(int argc, char* argv[], int threading)
diy::mpi::environment::
~environment()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Finalize();
#endif
}

@ -15,7 +15,7 @@ namespace mpi
{
static void broadcast(const communicator& comm, T& x, int root)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Bcast(address(x), count(x), datatype(x), root, comm);
#else
DIY_UNUSED(comm);
@ -26,7 +26,7 @@ namespace mpi
static void broadcast(const communicator& comm, std::vector<T>& x, int root)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
size_t sz = x.size();
Collectives<size_t, void*>::broadcast(comm, sz, root);
@ -43,7 +43,7 @@ namespace mpi
static request ibroadcast(const communicator& comm, T& x, int root)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
request r;
MPI_Ibcast(address(x), count(x), datatype(x), root, comm, &r.r);
return r;
@ -58,7 +58,7 @@ namespace mpi
static void gather(const communicator& comm, const T& in, std::vector<T>& out, int root)
{
out.resize(comm.size());
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Gather(address(in), count(in), datatype(in), address(out), count(in), datatype(out), root, comm);
#else
DIY_UNUSED(comm);
@ -69,7 +69,7 @@ namespace mpi
static void gather(const communicator& comm, const std::vector<T>& in, std::vector< std::vector<T> >& out, int root)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
std::vector<int> counts(comm.size());
Collectives<int,void*>::gather(comm, count(in), counts, root);
@ -104,7 +104,7 @@ namespace mpi
static void gather(const communicator& comm, const T& in, int root)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Gather(address(in), count(in), datatype(in), address(in), count(in), datatype(in), root, comm);
#else
DIY_UNUSED(comm);
@ -116,7 +116,7 @@ namespace mpi
static void gather(const communicator& comm, const std::vector<T>& in, int root)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
Collectives<int,void*>::gather(comm, count(in), root);
MPI_Gatherv(address(in), count(in), datatype(in),
@ -134,7 +134,7 @@ namespace mpi
static void all_gather(const communicator& comm, const T& in, std::vector<T>& out)
{
out.resize(comm.size());
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Allgather(address(in), count(in), datatype(in),
address(out), count(in), datatype(in),
comm);
@ -146,7 +146,7 @@ namespace mpi
static void all_gather(const communicator& comm, const std::vector<T>& in, std::vector< std::vector<T> >& out)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
std::vector<int> counts(comm.size());
Collectives<int,void*>::all_gather(comm, count(in), counts);
@ -180,7 +180,7 @@ namespace mpi
static void reduce(const communicator& comm, const T& in, T& out, int root, const Op&)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Reduce(address(in), address(out), count(in), datatype(in),
detail::mpi_op<Op>::get(),
root, comm);
@ -193,7 +193,7 @@ namespace mpi
static void reduce(const communicator& comm, const T& in, int root, const Op&)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Reduce(address(in), address(in), count(in), datatype(in),
detail::mpi_op<Op>::get(),
root, comm);
@ -207,7 +207,7 @@ namespace mpi
static void all_reduce(const communicator& comm, const T& in, T& out, const Op&)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Allreduce(address(in), address(out), count(in), datatype(in),
detail::mpi_op<Op>::get(),
comm);
@ -219,7 +219,7 @@ namespace mpi
static void all_reduce(const communicator& comm, const std::vector<T>& in, std::vector<T>& out, const Op&)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
out.resize(in.size());
MPI_Allreduce(address(in), address(out), count(in),
datatype(in),
@ -233,7 +233,7 @@ namespace mpi
static void scan(const communicator& comm, const T& in, T& out, const Op&)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Scan(address(in), address(out), count(in), datatype(in),
detail::mpi_op<Op>::get(),
comm);
@ -245,7 +245,7 @@ namespace mpi
static void all_to_all(const communicator& comm, const std::vector<T>& in, std::vector<T>& out, int n = 1)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
// n specifies how many elements go to/from every process from every process;
// the sizes of in and out are expected to be n * comm.size()

@ -42,7 +42,7 @@ namespace mpi
template <class T>
status recv(int source, int tag, T &x) const
{
#if defined(DIY_NO_MPI) && defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ < 8 // CUDA 7.5 workaround
#if defined(VTKM_DIY_NO_MPI) && defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ < 8 // CUDA 7.5 workaround
(void) source; (void)tag; (void)x;
DIY_UNSUPPORTED_MPI_CALL(MPI_Recv);
#else
@ -54,7 +54,7 @@ namespace mpi
template <class T>
request isend(int dest, int tag, const T &x) const
{
#if defined(DIY_NO_MPI) && defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ < 8 // CUDA 7.5 workaround
#if defined(VTKM_DIY_NO_MPI) && defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ < 8 // CUDA 7.5 workaround
(void) dest; (void)tag; (void)x;
DIY_UNSUPPORTED_MPI_CALL(MPI_Send);
#else
@ -71,7 +71,7 @@ namespace mpi
template <class T>
request irecv(int source, int tag, T &x) const
{
#if defined(DIY_NO_MPI) && defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ < 8 // CUDA 7.5 workaround
#if defined(VTKM_DIY_NO_MPI) && defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ < 8 // CUDA 7.5 workaround
(void)source; (void)tag; (void)x;
DIY_UNSUPPORTED_MPI_CALL(MPI_Irecv);
#else
@ -125,7 +125,7 @@ diy::mpi::communicator::
communicator(MPI_Comm comm, bool owner):
comm_(comm), rank_(0), size_(1), owner_(owner)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
if (comm != MPI_COMM_NULL)
{
MPI_Comm_rank(comm_, &rank_);
@ -138,7 +138,7 @@ void
diy::mpi::communicator::
destroy()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
if (owner_)
MPI_Comm_free(&comm_);
#endif
@ -151,7 +151,7 @@ probe(int source, int tag) const
(void) source;
(void) tag;
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
MPI_Probe(source, tag, comm_, &s.s);
return s;
@ -166,7 +166,7 @@ iprobe(int source, int tag) const
{
(void) source;
(void) tag;
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
int flag;
MPI_Iprobe(source, tag, comm_, &flag, &s.s);
@ -180,7 +180,7 @@ void
diy::mpi::communicator::
barrier() const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Barrier(comm_);
#endif
}
@ -189,7 +189,7 @@ diy::mpi::communicator
diy::mpi::communicator::
split(int color, int key) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Comm newcomm;
MPI_Comm_split(comm_, color, key, &newcomm);
return communicator(newcomm, true);
@ -202,7 +202,7 @@ diy::mpi::request
diy::mpi::communicator::
ibarrier() const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
request r_;
MPI_Ibarrier(comm_, &r_.r);
return r_;
@ -219,7 +219,7 @@ void
diy::mpi::communicator::
duplicate(const communicator& other)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Comm newcomm;
MPI_Comm_dup(other.comm_, &newcomm);
(*this) = std::move(communicator(newcomm,true));

@ -1,5 +1,5 @@
#ifndef DIY_MPI_CONSTANTS_HPP
#define DIY_MPI_CONSTANTS_HPP
#ifndef VTKMDIY_MPI_CONSTANTS_HPP
#define VTKMDIY_MPI_CONSTANTS_HPP
namespace diy
{

@ -1,5 +1,5 @@
#ifndef DIY_MPI_DATATYPES_HPP
#define DIY_MPI_DATATYPES_HPP
#ifndef VTKMDIY_MPI_DATATYPES_HPP
#define VTKMDIY_MPI_DATATYPES_HPP
#include <vector>
@ -18,22 +18,22 @@ namespace detail
template<class T>
struct is_mpi_datatype { typedef false_type type; };
#define DIY_MPI_DATATYPE_MAP(cpp_type, mpi_type) \
#define VTKMDIY_MPI_DATATYPE_MAP(cpp_type, mpi_type) \
template<> inline MPI_Datatype get_mpi_datatype<cpp_type>() { return mpi_type; } \
template<> struct is_mpi_datatype<cpp_type> { typedef true_type type; }; \
template<> struct is_mpi_datatype< std::vector<cpp_type> > { typedef true_type type; };
DIY_MPI_DATATYPE_MAP(char, MPI_BYTE);
DIY_MPI_DATATYPE_MAP(unsigned char, MPI_BYTE);
DIY_MPI_DATATYPE_MAP(bool, MPI_BYTE);
DIY_MPI_DATATYPE_MAP(int, MPI_INT);
DIY_MPI_DATATYPE_MAP(unsigned, MPI_UNSIGNED);
DIY_MPI_DATATYPE_MAP(long, MPI_LONG);
DIY_MPI_DATATYPE_MAP(unsigned long, MPI_UNSIGNED_LONG);
DIY_MPI_DATATYPE_MAP(long long, MPI_LONG_LONG_INT);
DIY_MPI_DATATYPE_MAP(unsigned long long, MPI_UNSIGNED_LONG_LONG);
DIY_MPI_DATATYPE_MAP(float, MPI_FLOAT);
DIY_MPI_DATATYPE_MAP(double, MPI_DOUBLE);
VTKMDIY_MPI_DATATYPE_MAP(char, MPI_BYTE);
VTKMDIY_MPI_DATATYPE_MAP(unsigned char, MPI_BYTE);
VTKMDIY_MPI_DATATYPE_MAP(bool, MPI_BYTE);
VTKMDIY_MPI_DATATYPE_MAP(int, MPI_INT);
VTKMDIY_MPI_DATATYPE_MAP(unsigned, MPI_UNSIGNED);
VTKMDIY_MPI_DATATYPE_MAP(long, MPI_LONG);
VTKMDIY_MPI_DATATYPE_MAP(unsigned long, MPI_UNSIGNED_LONG);
VTKMDIY_MPI_DATATYPE_MAP(long long, MPI_LONG_LONG_INT);
VTKMDIY_MPI_DATATYPE_MAP(unsigned long long, MPI_UNSIGNED_LONG_LONG);
VTKMDIY_MPI_DATATYPE_MAP(float, MPI_FLOAT);
VTKMDIY_MPI_DATATYPE_MAP(double, MPI_DOUBLE);
/* mpi_datatype: helper routines, specialized for std::vector<...> */
template<class T>

@ -1,5 +1,5 @@
#ifndef DIY_MPI_IO_HPP
#define DIY_MPI_IO_HPP
#ifndef VTKMDIY_MPI_IO_HPP
#define VTKMDIY_MPI_IO_HPP
#include "../constants.h"
@ -73,7 +73,7 @@ diy::mpi::io::file::
file(const communicator& comm__, const std::string& filename, int mode)
: comm_(comm__)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
int ret = MPI_File_open(comm__, const_cast<char*>(filename.c_str()), mode, MPI_INFO_NULL, &fh);
if (ret)
throw std::runtime_error("DIY cannot open file: " + filename);
@ -89,7 +89,7 @@ void
diy::mpi::io::file::
close()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
if (fh != MPI_FILE_NULL)
MPI_File_close(&fh);
#endif
@ -99,7 +99,7 @@ diy::mpi::io::offset
diy::mpi::io::file::
size() const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
offset sz;
MPI_File_get_size(fh, &sz);
return sz;
@ -112,7 +112,7 @@ void
diy::mpi::io::file::
resize(diy::mpi::io::offset size_)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_File_set_size(fh, size_);
#else
DIY_UNUSED(size_);
@ -124,7 +124,7 @@ void
diy::mpi::io::file::
read_at(offset o, char* buffer, size_t size_)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
MPI_File_read_at(fh, o, buffer, static_cast<int>(size_), detail::get_mpi_datatype<char>(), &s.s);
#else
@ -147,7 +147,7 @@ void
diy::mpi::io::file::
read_at_all(offset o, char* buffer, size_t size_)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
MPI_File_read_at_all(fh, o, buffer, static_cast<int>(size_), detail::get_mpi_datatype<char>(), &s.s);
#else
@ -170,7 +170,7 @@ void
diy::mpi::io::file::
write_at(offset o, const char* buffer, size_t size_)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
MPI_File_write_at(fh, o, (void *)buffer, static_cast<int>(size_), detail::get_mpi_datatype<char>(), &s.s);
#else
@ -193,7 +193,7 @@ void
diy::mpi::io::file::
write_at_all(offset o, const char* buffer, size_t size_)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
MPI_File_write_at_all(fh, o, (void *)buffer, static_cast<int>(size_), detail::get_mpi_datatype<char>(), &s.s);
#else

@ -1,5 +1,5 @@
#ifndef DIY_MPI_NO_MPI_HPP
#define DIY_MPI_NO_MPI_HPP
#ifndef VTKMDIY_MPI_NO_MPI_HPP
#define VTKMDIY_MPI_NO_MPI_HPP
#include <stdexcept> // std::runtime_error
@ -22,17 +22,17 @@ static const int MPI_THREAD_MULTIPLE = 3;
/* define datatypes */
using MPI_Datatype = size_t;
#define DIY_NO_MPI_DATATYPE(cpp_type, mpi_type) \
#define VTKM_DIY_NO_MPI_DATATYPE(cpp_type, mpi_type) \
static const MPI_Datatype mpi_type = sizeof(cpp_type);
DIY_NO_MPI_DATATYPE(char, MPI_BYTE);
DIY_NO_MPI_DATATYPE(int, MPI_INT);
DIY_NO_MPI_DATATYPE(unsigned, MPI_UNSIGNED);
DIY_NO_MPI_DATATYPE(long, MPI_LONG);
DIY_NO_MPI_DATATYPE(unsigned long, MPI_UNSIGNED_LONG);
DIY_NO_MPI_DATATYPE(long long, MPI_LONG_LONG_INT);
DIY_NO_MPI_DATATYPE(unsigned long long, MPI_UNSIGNED_LONG_LONG);
DIY_NO_MPI_DATATYPE(float, MPI_FLOAT);
DIY_NO_MPI_DATATYPE(double, MPI_DOUBLE);
VTKM_DIY_NO_MPI_DATATYPE(char, MPI_BYTE);
VTKM_DIY_NO_MPI_DATATYPE(int, MPI_INT);
VTKM_DIY_NO_MPI_DATATYPE(unsigned, MPI_UNSIGNED);
VTKM_DIY_NO_MPI_DATATYPE(long, MPI_LONG);
VTKM_DIY_NO_MPI_DATATYPE(unsigned long, MPI_UNSIGNED_LONG);
VTKM_DIY_NO_MPI_DATATYPE(long long, MPI_LONG_LONG_INT);
VTKM_DIY_NO_MPI_DATATYPE(unsigned long long, MPI_UNSIGNED_LONG_LONG);
VTKM_DIY_NO_MPI_DATATYPE(float, MPI_FLOAT);
VTKM_DIY_NO_MPI_DATATYPE(double, MPI_DOUBLE);
#endif
/* status type */
@ -48,8 +48,10 @@ struct MPI_Status
/* define MPI_Request */
using MPI_Request = int;
#ifndef DIY_UNSUPPORTED_MPI_CALL
#define DIY_UNSUPPORTED_MPI_CALL(name) \
throw std::runtime_error("`" #name "` not supported when DIY_NO_MPI is defined.");
throw std::runtime_error("`" #name "` not supported when VTKM_DIY_NO_MPI is defined.");
#endif
/* define operations */
using MPI_Op = int;

@ -15,7 +15,7 @@ namespace detail
{
void operator()(MPI_Comm comm, int dest, int tag, const T& x) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
typedef mpi_datatype<T> Datatype;
MPI_Send((void*) Datatype::address(x),
Datatype::count(x),
@ -37,7 +37,7 @@ namespace detail
{
status operator()(MPI_Comm comm, int source, int tag, T& x) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
typedef mpi_datatype<T> Datatype;
status s;
MPI_Recv((void*) Datatype::address(x),
@ -57,7 +57,7 @@ namespace detail
{
status operator()(MPI_Comm comm, int source, int tag, std::vector<U>& x) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
MPI_Probe(source, tag, comm, &s.s);
@ -80,7 +80,7 @@ namespace detail
{
request operator()(MPI_Comm comm, int dest, int tag, const T& x) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
request r;
typedef mpi_datatype<T> Datatype;
MPI_Isend((void*) Datatype::address(x),
@ -104,7 +104,7 @@ namespace detail
{
request operator()(MPI_Comm comm, int dest, int tag, const T& x) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
request r;
typedef mpi_datatype<T> Datatype;
MPI_Issend((void*) Datatype::address(x),
@ -128,7 +128,7 @@ namespace detail
{
request operator()(MPI_Comm comm, int source, int tag, T& x) const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
request r;
typedef mpi_datatype<T> Datatype;
MPI_Irecv(Datatype::address(x),

@ -19,7 +19,7 @@ namespace mpi
diy::mpi::status
diy::mpi::request::wait()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
MPI_Wait(&r, &s.s);
return s;
@ -31,7 +31,7 @@ diy::mpi::request::wait()
diy::mpi::optional<diy::mpi::status>
diy::mpi::request::test()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
status s;
int flag;
MPI_Test(&r, &flag, &s.s);
@ -44,7 +44,7 @@ diy::mpi::request::test()
void
diy::mpi::request::cancel()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Cancel(&r);
#endif
}

@ -26,7 +26,7 @@ namespace mpi
bool
diy::mpi::status::cancelled() const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
int flag;
MPI_Test_cancelled(const_cast<MPI_Status*>(&s), &flag);
return flag;
@ -39,7 +39,7 @@ template<class T>
int
diy::mpi::status::count() const
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
int c;
MPI_Get_count(const_cast<MPI_Status*>(&s), detail::get_mpi_datatype<T>(), &c);
return c;

@ -62,7 +62,7 @@ diy::mpi::window<T>::
window(const communicator& comm, unsigned size):
buffer_(size), rank_(comm.rank())
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_create(buffer_.data(), buffer_.size()*sizeof(T), sizeof(T), MPI_INFO_NULL, comm, &window_);
#endif
}
@ -71,7 +71,7 @@ template<class T>
diy::mpi::window<T>::
~window()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_free(&window_);
#endif
}
@ -81,7 +81,7 @@ void
diy::mpi::window<T>::
put(const T& x, int rank, unsigned offset)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Put(address(x), count(x), datatype(x),
rank,
offset,
@ -97,7 +97,7 @@ void
diy::mpi::window<T>::
put(const std::vector<T>& x, int rank, unsigned offset)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Put(address(x), count(x), datatype(x),
rank,
offset,
@ -114,7 +114,7 @@ void
diy::mpi::window<T>::
get(T& x, int rank, unsigned offset)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Get(address(x), count(x), datatype(x),
rank,
offset,
@ -130,7 +130,7 @@ void
diy::mpi::window<T>::
get(std::vector<T>& x, int rank, unsigned offset)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Get(address(x), count(x), datatype(x),
rank,
offset,
@ -147,7 +147,7 @@ void
diy::mpi::window<T>::
fence(int assert)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_fence(assert, window_);
#endif
}
@ -157,7 +157,7 @@ void
diy::mpi::window<T>::
lock(int lock_type, int rank, int assert)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_lock(lock_type, rank, assert, window_);
#endif
}
@ -167,7 +167,7 @@ void
diy::mpi::window<T>::
unlock(int rank)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_unlock(rank, window_);
#endif
}
@ -177,7 +177,7 @@ void
diy::mpi::window<T>::
lock_all(int assert)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_lock_all(assert, window_);
#endif
}
@ -187,7 +187,7 @@ void
diy::mpi::window<T>::
unlock_all()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_unlock_all(window_);
#endif
}
@ -196,7 +196,7 @@ void
diy::mpi::window<T>::
fetch_and_op(const T* origin, T* result, int rank, unsigned offset, MPI_Op op)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Fetch_and_op(origin, result, datatype(*origin), rank, offset, op, window_);
#else
DIY_UNSUPPORTED_MPI_CALL(MPI_Fetch_and_op);
@ -208,7 +208,7 @@ void
diy::mpi::window<T>::
fetch(T& result, int rank, unsigned offset)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
T unused;
fetch_and_op(&unused, &result, rank, offset, MPI_NO_OP);
#else
@ -221,7 +221,7 @@ void
diy::mpi::window<T>::
replace(const T& value, int rank, unsigned offset)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
T unused;
fetch_and_op(&value, &unused, rank, offset, MPI_REPLACE);
#else
@ -234,7 +234,7 @@ void
diy::mpi::window<T>::
sync()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_sync(window_);
#endif
}
@ -244,7 +244,7 @@ void
diy::mpi::window<T>::
flush(int rank)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_flush(rank, window_);
#endif
}
@ -254,7 +254,7 @@ void
diy::mpi::window<T>::
flush_all()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_flush_all(window_);
#endif
}
@ -264,7 +264,7 @@ void
diy::mpi::window<T>::
flush_local(int rank)
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_flush_local(rank, window_);
#endif
}
@ -274,7 +274,7 @@ void
diy::mpi::window<T>::
flush_local_all()
{
#ifndef DIY_NO_MPI
#ifndef VTKM_DIY_NO_MPI
MPI_Win_flush_local_all(window_);
#endif
}

@ -1,5 +1,5 @@
#ifndef DIY_NO_THREAD_HPP
#define DIY_NO_THREAD_HPP
#ifndef VTKMDIY_NO_THREAD_HPP
#define VTKMDIY_NO_THREAD_HPP
#include <utility>
#include <functional>

@ -1,5 +1,5 @@
#ifndef DIY_PARTNERS_ALL_REDUCE_HPP
#define DIY_PARTNERS_ALL_REDUCE_HPP
#ifndef VTKMDIY_PARTNERS_ALL_REDUCE_HPP
#define VTKMDIY_PARTNERS_ALL_REDUCE_HPP
#include "merge.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_PARTNERS_BROADCAST_HPP
#define DIY_PARTNERS_BROADCAST_HPP
#ifndef VTKMDIY_PARTNERS_BROADCAST_HPP
#define VTKMDIY_PARTNERS_BROADCAST_HPP
#include "merge.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_PARTNERS_COMMON_HPP
#define DIY_PARTNERS_COMMON_HPP
#ifndef VTKMDIY_PARTNERS_COMMON_HPP
#define VTKMDIY_PARTNERS_COMMON_HPP
#include "../decomposition.hpp"
#include "../types.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_PARTNERS_MERGE_HPP
#define DIY_PARTNERS_MERGE_HPP
#ifndef VTKMDIY_PARTNERS_MERGE_HPP
#define VTKMDIY_PARTNERS_MERGE_HPP
#include "common.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_PARTNERS_SWAP_HPP
#define DIY_PARTNERS_SWAP_HPP
#ifndef VTKMDIY_PARTNERS_SWAP_HPP
#define VTKMDIY_PARTNERS_SWAP_HPP
#include "common.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_PICK_HPP
#define DIY_PICK_HPP
#ifndef VTKMDIY_PICK_HPP
#define VTKMDIY_PICK_HPP
#include "link.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_POINT_HPP
#define DIY_POINT_HPP
#ifndef VTKMDIY_POINT_HPP
#define VTKMDIY_POINT_HPP
#include <iostream>
#include <vector>

@ -1,5 +1,5 @@
#ifndef DIY_PROXY_HPP
#define DIY_PROXY_HPP
#ifndef VTKMDIY_PROXY_HPP
#define VTKMDIY_PROXY_HPP
namespace diy

@ -1,5 +1,5 @@
#ifndef DIY_REDUCE_OPERATIONS_HPP
#define DIY_REDUCE_OPERATIONS_HPP
#ifndef VTKMDIY_REDUCE_OPERATIONS_HPP
#define VTKMDIY_REDUCE_OPERATIONS_HPP
#include "reduce.hpp"
#include "partners/swap.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_REDUCE_HPP
#define DIY_REDUCE_HPP
#ifndef VTKMDIY_REDUCE_HPP
#define VTKMDIY_REDUCE_HPP
#include <vector>
#include "master.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_RESOLVE_HPP
#define DIY_RESOLVE_HPP
#ifndef VTKMDIY_RESOLVE_HPP
#define VTKMDIY_RESOLVE_HPP
#include "master.hpp"
#include "assigner.hpp"

@ -1,5 +1,5 @@
#ifndef DIY_SERIALIZATION_HPP
#define DIY_SERIALIZATION_HPP
#ifndef VTKMDIY_SERIALIZATION_HPP
#define VTKMDIY_SERIALIZATION_HPP
#include <vector>
#include <valarray>

@ -1,5 +1,5 @@
#ifndef DIY_STATS_HPP
#define DIY_STATS_HPP
#ifndef VTKMDIY_STATS_HPP
#define VTKMDIY_STATS_HPP
#include <chrono>
#include <string>

@ -1,5 +1,5 @@
#ifndef DIY_STORAGE_HPP
#define DIY_STORAGE_HPP
#ifndef VTKMDIY_STORAGE_HPP
#define VTKMDIY_STORAGE_HPP
#include <string>
#include <map>

@ -1,7 +1,7 @@
#ifndef DIY_THREAD_H
#define DIY_THREAD_H
#ifndef VTKMDIY_THREAD_H
#define VTKMDIY_THREAD_H
#ifdef DIY_NO_THREADS
#ifdef VTKM_DIY_NO_THREADS
#include "no-thread.hpp"
#else

@ -1,5 +1,5 @@
#ifndef DIY_TIME_HPP
#define DIY_TIME_HPP
#ifndef VTKMDIY_TIME_HPP
#define VTKMDIY_TIME_HPP
#ifndef _WIN32
#include <sys/time.h>

@ -1,5 +1,5 @@
#ifndef DIY_TYPES_HPP
#define DIY_TYPES_HPP
#ifndef VTKMDIY_TYPES_HPP
#define VTKMDIY_TYPES_HPP
#include <iostream>
#include "constants.h"

@ -1,8 +1,8 @@
#ifndef DIY_VERSION_HPP
#define DIY_VERSION_HPP
#ifndef VTKMDIY_VERSION_HPP
#define VTKMDIY_VERSION_HPP
#define DIY_VERSION_MAJOR 3
#define DIY_VERSION_MINOR 5
#define DIY_VERSION_PATCH dev1
#define VTKMDIY_VERSION_MAJOR 3
#define VTKMDIY_VERSION_MINOR 5
#define VTKMDIY_VERSION_PATCH dev1
#endif

@ -1,5 +1,5 @@
#ifndef DIY_VERTICES_HPP
#define DIY_VERTICES_HPP
#ifndef VTKMDIY_VERTICES_HPP
#define VTKMDIY_VERTICES_HPP
#include <iterator>