[Chapel Merge] Add Communication module

Branch: refs/heads/main
Revision: fb8c75d
Author: e-kayrakli
Link: Add Communication module by e-kayrakli · Pull Request #20309 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #20309 from e-kayrakli/comm-module

Add Communication module

We use bool in the GPU layer, but we don't include stdbool.h. It looks like
This PR adds a new Communication standard module, as designed in
[Proposal] Add a low-level `Communication` module · Issue #17657 · chapel-lang/chapel · GitHub.

To be able to use c_void_ptrs in these functions/primitives, it modifies the
codegens of those primitives, to handle c_void_ptr similar to c_ptr. In an
earlier attempt, I tried to add FLAG_DATA_CLASS to c_void_ptr type, but
struggled a bit.

In terms of the existing uses of primitives, this PR:

  • Updates the CopyAggregation, GMP and `ByteBufferHelpers
  • Doesn't update Sort see below

Future directions for this module:

  • Wide pointer construction/manipulation (currently, primitives can be used with
    refs, but not the functions in this module)
  • Strided communication (we use this internally)
  • Non-blocking communication (we can expose, but afaik different comm layers
    behave differently)

All of these require some design discussion.

Future directions for its uses:

  • chpl_comm_get_array is used in DR code. The only difference it has is that
    it takes number of elements and not bytes. I don't think we want to add
    get/put to this module that does that. Instead, I think we can adjust the
    DR code to calculate number of bytes itself. Probably a trivial change, but
    this PR doesn't do that.
  • The Sort module still calls primitives itself because it operates with refs
    and not c_ptrs. Probably, that one relates to a higher level proc copy
    idea we were discussing in the beginning of this discussion. However, the
    current direction for this module is to keep it lower level than that. All
    that being said, I think the Sort module can use this module when it has
    functions that can create pointers from potentially wide references.

[Reviewed by @benharsh]


  • gasnet in library/ and optimizations/autoAggregation

  • full gasnet

    Modified Files:
    A modules/standard/Communication.chpl
    A test/library/standard/Communication/NUMLOCALES
    A test/library/standard/Communication/basic.chpl
    A test/library/standard/Communication/basic.good
    A test/library/standard/Communication/errors.chpl
    A test/library/standard/Communication/errors.execopts
    A test/library/standard/Communication/errors.getHiLoc.good
    A test/library/standard/Communication/errors.getNegLoc.good
    A test/library/standard/Communication/errors.getNegSize.good
    A test/library/standard/Communication/errors.prediff
    A test/library/standard/Communication/errors.putHiLoc.good
    A test/library/standard/Communication/errors.putNegLoc.good
    A test/library/standard/Communication/errors.putNegSize.good
    M doc/rst/meta/modules/standard.rst
    M modules/Makefile
    M modules/internal/ByteBufferHelpers.chpl
    M modules/packages/CopyAggregation.chpl
    M modules/standard/GMP.chpl
    M test/compflags/ferguson/print-module-resolution.good
    M test/modules/bradc/printModStuff/foo.good
    M test/optimizations/deadCodeElimination/elliot/countDeadModules.good

    Compare: Comparing 9c35e581c64a...fb8c75df9d89 · chapel-lang/chapel · GitHub