28#include "heffte_config.h"
36template<
class T,
class U = T>
117template<
typename vector_like>
121 for(
auto i :
x) std::cout <<
i <<
" ";
122 std::cout << std::endl;
177 throw std::runtime_error(
"Could not free a communicator.");
193 static_assert(!std::is_same<scalar, scalar>::value,
"The C++ type has unknown MPI equivalent.");
252template<
typename scalar_type>
struct is_ccomplex : std::false_type{};
270template<
typename scalar_type>
struct is_zcomplex : std::false_type{};
340 using type = std::complex<float>;
348 using type = std::complex<double>;
354template<
typename scalar_type>
362template<
typename scalar_type>
380template<
typename some_
class>
391template<
typename some_
class>
402template<
typename some_
class>
404 size_t max_size = (executors[0]) ? executors[0]->box_size() : 0;
405 max_size = std::max(max_size, (executors[1]) ? executors[1]->box_size() :
static_cast<size_t>(0));
406 return std::max(max_size, (executors[2]) ? executors[2]->box_size() :
static_cast<size_t>(0));
413template<
typename some_
class>
415 size_t max_size = (executors[0]) ? executors[0]->complex_size() : 0;
416 max_size = std::max(max_size, (executors[1]) ? executors[1]->box_size() :
static_cast<size_t>(0));
417 return std::max(max_size, (executors[2]) ? executors[2]->box_size() :
static_cast<size_t>(0));
423template<
typename some_
class>
425 size_t max_size = (executors[0]) ? executors[0]->workspace_size() : 0;
426 max_size = std::max(max_size, (executors[1]) ? executors[1]->workspace_size() :
static_cast<size_t>(0));
427 return std::max(max_size, (executors[2]) ? executors[2]->workspace_size() :
static_cast<size_t>(0));
434template<
typename some_
class_r2c,
typename some_
class>
436 return std::max(
executors_r2c->workspace_size(), std::max(executors[0]->workspace_size(), executors[1]->workspace_size()));
T c11_exchange(T &obj, U &&new_value)
Replace with the C++ 2014 std::exchange later.
Definition heffte_utils.h:37
int get_last_active(std::array< std::unique_ptr< some_class >, 4 > const &shaper)
Return the index of the last active (non-null) unique_ptr.
Definition heffte_utils.h:381
size_t get_max_box_size_r2c(std::array< some_class, 3 > const &executors)
Returns the max of the box_size() for each of the executors.
Definition heffte_utils.h:414
size_t get_max_box_size(std::array< some_class, 3 > const &executors)
Returns the max of the box_size() for each of the executors.
Definition heffte_utils.h:403
int count_active(std::array< std::unique_ptr< some_class >, 4 > const &shaper)
Return the number of active (non-null) unique_ptr.
Definition heffte_utils.h:392
size_t get_max_work_size(std::array< some_class, 3 > const &executors)
Returns the max of the workspace_size() for each of the executors.
Definition heffte_utils.h:424
MPI_Datatype type_from< float >()
Specialization to hand the float type.
Definition heffte_utils.h:205
MPI_Datatype type_from< int >()
Specialization to hand the int type.
Definition heffte_utils.h:200
int comm_rank(MPI_Comm const comm)
Returns the rank of this process within the specified comm.
Definition heffte_utils.h:79
void comm_free(MPI_Comm const comm)
Calls free on the MPI comm.
Definition heffte_utils.h:175
int comm_size(MPI_Comm const comm)
Returns the size of the specified communicator.
Definition heffte_utils.h:136
MPI_Datatype type_from< double >()
Specialization to hand the double type.
Definition heffte_utils.h:210
void dump(int me, vector_like const &x, std::string const &message)
Write the message and the data from the vector-like x, performed only on rank me (if positive),...
Definition heffte_utils.h:118
MPI_Datatype type_from()
Returns the MPI equivalent of the scalar C++ type.
Definition heffte_utils.h:190
MPI_Comm new_comm_from_group(std::vector< int > const &ranks, MPI_Comm const comm)
Creates a new sub-communicator from the provided processes in comm.
Definition heffte_utils.h:152
int world_rank()
Returns the rank of this process within the MPI_COMM_WORLD (useful for debugging).
Definition heffte_utils.h:105
Namespace containing all HeFFTe methods and classes.
Definition heffte_backend_cuda.h:38
define_standard_type< scalar_type >::type * convert_to_standard(scalar_type input[])
Converts an array of some type to an array of the C++ equivalent type.
Definition heffte_utils.h:355
std::complex< double > type
If heffte::is_ccomplex is true_type, then the type is equivalent to std::complex<double>.
Definition heffte_utils.h:348
std::complex< float > type
If heffte::is_ccomplex is true_type, then the type is equivalent to std::complex<float>.
Definition heffte_utils.h:340
Struct to specialize that returns the C++ equivalent of each type.
Definition heffte_utils.h:315
Struct to specialize to allow HeFFTe to recognize custom single precision complex types.
Definition heffte_utils.h:252
Struct to specialize to allow HeFFTe to recognize custom double precision complex types.
Definition heffte_utils.h:270
Wrapper around cufftHandle plans, set for float or double complex.
Definition heffte_backend_cuda.h:346