parapack MPI: messages over 2 GiB fail without a clear error; CHANGELOG note missing

Open
#315 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@skilledwolf is already working on this.

Since Nov 5, 2026.

  • #324 by @skilledwolf — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
57/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Start with src/alps/parapack/include/alps/parapack/mpi.h, especially the MPI_Send and gather size conversions called out in the issue; check how size limits and error handling are covered nearby. Also review the #284 CHANGELOG entry for the MPI error behavior. Done means oversized messages are rejected clearly and the CHANGELOG explains the fatal MPI error behavior.

Written by the indexing model from the issue text.

Description

area:parapack compatibility-change enhancement

Two small items in src/alps/parapack/include/alps/parapack/mpi.h:

  1. A serialized message of 2 GiB or more is sent with its size cast to int, so the count wraps and the receiver gets garbage or an archive_exception instead of a clear error. Not a regression (Boost.MPI had the same limit). Fix: a size check in send and gather, a few lines.
  2. MPI errors now abort the job instead of throwing a catchable exception. Probably better, but user-visible, and the CHANGELOG does not mention it. Suggest one sentence there.

1. Size check

Unchecked casts:

  • line 138: MPI_Send(..., static_cast<int>(buffer.size()), MPI_BYTE, ...) for every serialized value (clone info, parameters, observable sets);
  • lines 188 and 206: int size = static_cast<int>(value.size()); in gather.

A wrapped count either fails with an MPI count error (fatal, see 2) or silently sends a prefix. Suggested guard, in both places:

if (buffer.size() > static_cast<std::size_t>(std::numeric_limits<int>::max()))
  throw std::length_error("alps::mpi::send: message exceeds the MPI count limit");

Large observable sets gathered from clones are the one place this could plausibly happen.

2. CHANGELOG: MPI errors abort

Boost.MPI's environment installed MPI_ERRORS_RETURN on MPI_COMM_WORLD (all four constructors in libs/mpi/src/environment.cpp) and turned failing calls into boost::mpi::exception, which parapack's catch (std::exception&) → comm_exit(true) handled. alps::mpi::environment keeps the default MPI_ERRORS_ARE_FATAL, and neither utilities/mpi.hpp nor parapack/mpi.h checks return codes, so any MPI error now ends the job with the MPI runtime's message.

This is arguably the safer behaviour: every raw MPI_* call in ALPS (accumulators, gf, utilities/mpi.hpp) ignores return codes and would have continued after an error under the old handler. One sentence in the #284 CHANGELOG entry would cover it.

Dominant language
C++
Stars
32
Forks
10
Avg merge
4d 3h
Merged PRs (30d)
54

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ALPSim/ALPS

All issues in ALPSim/ALPS

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.