Skip to content

Conversation

@eisenhauer
Copy link
Member

This fixes BP5 files written on big-endian architectures (like s390x) to be readable on little-endian architectures (like x86) and vice versa.

Tested with BP5 files written on s390x (big-endian) and read on x86 (little-endian).

@eisenhauer eisenhauer force-pushed the fix-bp5-cross-endian branch 4 times, most recently from 269938b to ba73f6e Compare January 14, 2026 21:21
@eisenhauer eisenhauer requested review from a team and caitlinross as code owners January 14, 2026 21:21
@eisenhauer eisenhauer force-pushed the fix-bp5-cross-endian branch from ba73f6e to ca8b388 Compare January 14, 2026 21:23
@eisenhauer eisenhauer requested a review from pnorbert January 15, 2026 12:46
@eisenhauer eisenhauer force-pushed the fix-bp5-cross-endian branch 2 times, most recently from 9b3c678 to 3a6c125 Compare January 15, 2026 13:12
@eisenhauer eisenhauer enabled auto-merge (squash) January 15, 2026 13:52
@eisenhauer
Copy link
Member Author

This should be ready for review after tests pass...

pnorbert
pnorbert previously approved these changes Jan 19, 2026
@eisenhauer
Copy link
Member Author

@vicentebolea This PR is waiting for an infrastructure review, which I think has to be you or Scott as I can't review my own.

@vicentebolea
Copy link
Collaborator

vicentebolea commented Jan 29, 2026 via email

This commit fixes cross-endian file reading for big-endian architectures
(s390x) and removes the ADIOS2_USE_Endian_Reverse CMake option. Cross-endian
file interoperability is now always enabled, allowing files written on
big-endian systems to be read on little-endian systems and vice versa
without any special build configuration.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@eisenhauer eisenhauer force-pushed the fix-bp5-cross-endian branch from f73ef21 to 5c5c300 Compare January 29, 2026 14:19
outMemStart[DimCount - 1] *= 2;
if (outMemCount.size() > 0)
outMemCount[DimCount - 1] *= 2;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this logic, is it a transformation of little to big endian representation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The deal is that NdCopy (which we call with these inputs) has the byteswapping functionality built into it. It takes the element size as one of its inputs, and as it copies the data it needs from its input to its output it does any byteswapping that's necessary. But this doesn't work quite right with complex types. You don't want to byteswap the whole 16-byte type (for doubles) because that would swap the real and imaginary parts. Instead you want to do each 8-byte half separately. We make that happen here with a little trick. If it's a complex type and we're byteswapping, we halve the element size and double the count in the smallest dimension. That makes everything come out right.

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.

3 participants