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

Move override-ld to printchplenv #20385

Merged
merged 13 commits into from
Aug 11, 2022

Conversation

mppf
Copy link
Member

@mppf mppf commented Aug 4, 2022

This PR addresses a future work item left by PR #18880. In particular, historically we have saved the linker to use in a file override-ld and then the LLVM backend reads this file and uses the selected linker in order to link the binary. We recently observed some problems with this strategy in the context of Homebrew. The Homebrew Chapel package had this override-ld file referring to clang in a particular location; but the Homebrew clang package was upgraded and clang was no longer available at that location. (See also Homebrew/homebrew-core#107405 ).

So, this PR moves the override-ld logic to something supported by the chplenv Python scripts. One wrinkle with that is that the Makefile logic was using GASNET_LD_REQUIRES_MPI but that variable is not stored in the Gasnet .pc file that is used by the chplenv scripts in LLVM compilation. So, this PR uses the approximation of determining GASNET_LD_REQUIRES_MPI by searching for mpi in the GASNET_LD command name.

Additionally, while debugging the issue, I noticed some odd things about the error handling within executeAndWait, so this PR cleans that function up a bit as well. It also removes some arguments to that function that aren't really necessary. It adds a C++ dyno test of this function to make sure the return value of the function is 0 when the command runs and something other than 0 when the command does not exist.

The chpl-env-gen.h needed some adjustment to work with this change so I tidied it up to stop filtering out environment variables that often have characters that can't be in a #define and instead to use a more comprehensive pattern when replacing such characters with _.

Future Work:

Reviewed by @arezaii

  • full local testing
  • XC gasnet+aries testing
  • XC ugni testing
  • XC mpi testing
  • Mac OS X testing
  • testing Hello world on a real ibv system

@mppf mppf changed the title Move override ld printchplenv Move override-ld to printchplenv Aug 4, 2022
@mppf

This comment was marked as resolved.

@mppf mppf requested a review from arezaii August 9, 2022 21:17
@mppf mppf marked this pull request as ready for review August 9, 2022 21:19
@mppf mppf force-pushed the move-override-ld-printchplenv branch from 4361598 to c33c5a0 Compare August 11, 2022 15:25
mppf added 9 commits August 11, 2022 13:14
To avoid running 'mv' if the link command failed

---
Signed-off-by: Michael Ferguson <[email protected]>
---
Signed-off-by: Michael Ferguson <[email protected]>
Only gasnet configurations set it to something other than
CHPL_TARGET_CXX.

---
Signed-off-by: Michael Ferguson <[email protected]>
At least include those from printchplenv --all --no-tidy

---
Signed-off-by: Michael Ferguson <[email protected]>
Use a more comprehensive solution to get to characters
that can be in a #define and use the same strategy
in the test code as well as the Makefile generating it.

---
Signed-off-by: Michael Ferguson <[email protected]>
---
Signed-off-by: Michael Ferguson <[email protected]>
---
Signed-off-by: Michael Ferguson <[email protected]>
to allow it to be set in a chplconfig

---
Signed-off-by: Michael Ferguson <[email protected]>
@mppf mppf force-pushed the move-override-ld-printchplenv branch from 6b98355 to 91b32f4 Compare August 11, 2022 17:18
---
Signed-off-by: Michael Ferguson <[email protected]>
mppf added 3 commits August 11, 2022 14:25
---
Signed-off-by: Michael Ferguson <[email protected]>
---
Signed-off-by: Michael Ferguson <[email protected]>
@mppf mppf merged commit 9f68b2b into chapel-lang:main Aug 11, 2022
@mppf mppf deleted the move-override-ld-printchplenv branch August 11, 2022 18:38
mppf added a commit that referenced this pull request Aug 12, 2022
Fix problems after LLVM configuration PRs

Follow-up to PRs #20396 and #20385 to address issues raised by nightly testing.

* build failures in cron-xc-wb-host-prgenv-cray-failure and
  xc-wb.prgenv-cray configurations: don't default to
  CHPL_LLVM_SUPPORT=system if all the LLVM dependencies are not
  installed. These configurations have just `llvm-config` but not the
  required headers.
* networking-packages failure with curl tests: update
  `common-quickstart.bash` to set `CHPL_LLVM=none`. The quickstart setup
  script can provide `CHPL_LLVM=none` or `CHPL_LLVM=system` but since we
  test `CHPL_LLVM=system` in most configurations, in the quickstart
  testing configuration, we want to test `CHPL_LLVM=none`. At the moment,
  the curl tests do not all work with the LLVM backend.
* darwin-m1 or other Mac OS testing failure with chpl-env-gen: fixed a
  sed portability issue between linux and Mac OS X.

Reviewed by @arezaii - thanks!

- [x] On Ubuntu, if llvm-14 is installed but not llvm-14-dev
  * default is CHPL_LLVM=unset and CHPL_LLVM_SUPPORT=bundled
  * setting CHPL_LLVM=system produces an error from printchplenv about a
    missing header
- [x] On Ubuntu, if we have the needed LLVM dependencies
  * default is CHPL_LLVM=system and CHPL_LLVM_SUPPORT=system
- [x] `make` functions on XC with PrgEnv-cray and GCC as the host
  compiler
- [x] `make` functions on XC with PrgEnv-cray and cray-prgenv-cray as the
  host compiler
- [x] full local testing
ronawho added a commit that referenced this pull request Aug 24, 2022
Bring in upstream gasnet patch for checking if LD requires MPI

[reviewed by @mppf]

Bring in https://bitbucket.org/berkeleylab/gasnet/pull-requests/554 and
some related work to enable getting `GASNET_LD_REQUIRES_MPI` out of
gasnet's pkg-config file. This is a follow up to #20385, which has
additional motivation for the change.
mppf added a commit that referenced this pull request Aug 31, 2022
Use GASNET_LD_REQUIRES_MPI from .pc file



Completes a Future Work item from #20385 now that #20471 is merged.

- [x] works on a Cray CS with openmpi and CHPL_COMM_SUBSTRATE=mpi

Reviewed by @ronawho - thanks!
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.

2 participants