Skip to content

Creating a struct datatype for use in collective? #21

Description

@thvasilo

Hello,

I'm wondering what's the correct way to define a custom struct datatype to be later used in a collective.

I'm my case I have structs defined as:

MyStruct{
float a;
float b;
int c;
};

that I would like to collect to the root using gatherv.

I know how to do this using plain MPI, but I'm wondering what's the process for mxx in order to avoid the error

static assertion failed: Type `T` is not a `trivial` type and is thus not supported for mxx send/recv operations. This type needs one of the following to be supported as trivial datatype: specialized build_datatype<T>, a member function `datatype`, or global function `make_datatype(Layout& l, T&)`

The error describes my options but I haven't been able to find examples of how to make mxx aware of custom datatypes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions