Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unsigned int as comm data type #3749

Closed
wants to merge 1 commit into from

Conversation

WeiqunZhang
Copy link
Member

Previously, we had char, unsigned long long and unsigned long long [8] as comm data type. The issue is we cannot use them for floats or ints. So we add unsigned int, which has a size of 4.

This should solve an issue seen in single precision WarpX runs.

Previously, we had char, unsigned long long and unsigned long long [8] as
comm data type. The issue is we cannot use them for floats or ints. So we
add unsigned int, which has a size of 4.
@WeiqunZhang WeiqunZhang changed the title Add unsigned int ad comm data type Add unsigned int as comm data type Feb 9, 2024
@WeiqunZhang WeiqunZhang marked this pull request as draft February 10, 2024 02:39
@WeiqunZhang
Copy link
Member Author

There must be something else going. There should not be any issues with the current development because we add extra padding for the alignment. Unless that somehow did not as expected.

@WeiqunZhang
Copy link
Member Author

Currently we check alignment using

    return (reinterpret_cast<std::size_t>(p) % alignment) == 0;

Technically speaking, that is undefined behavior. We could change it to

inline bool is_aligned (const void* p, std::size_t alignment)
{
    auto* q = const_cast<void*>(p);
    auto space = alignment;
    return std::align(alignment, alignment, q, space) == p;
}

It's more expensive, but it should matter at all before the function is used in MPI communication functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant