[Chapel Merge] Deprecate ChapelEnv in favor of ChplConfig

Branch: refs/heads/main
Revision: bf9f12a
Author: bradcray
Link: Unavailable
Log Message:

Merge pull request #19162 from bradcray/chplconfig

Deprecate ChapelEnv in favor of ChplConfig

[reviewed by @ben-albrecht graciously on his way out the door]

In this PR, I'm taking the first step towards replacing the auto-used
ChapelEnv module with a manually-used module, ChplConfig. These
changes are motivated by:

  • a sense that these variables aren't ones we expect most programs
    to use, so not worthy of being always-available
  • a sense that 'ChapelEnv' is a poor name for the module since it's less
    about the environment per se, and more about how 'chpl' is
    configured, similar to the 'chplconfig' files that can be used to store
    such information

As possible future steps, we are considering replacing specific variables
with more first-class user-facing functions. E.g., rather than testing
against CHPL_COMM==none a user should be making a call like
compiledForSingleLocale() (OK, that's a terrible name).

The main work here was to move the contents of ChapelEnv.chpl to
ChplConfig.chpl and to replace the variables in ChapelEnv.chpl with
functions that printed a warning about the change and returned the
values of the variables in ChplConfig.chpl.

From there, all that remained was adding a test to lock in the warning
in test/deprecated to remind us to remove it in the future, and
updating the code to avoid relying on the auto-used ChapelEnv.chpl:

  • updated the internal modules that rely on CHPL_* settings by having
    them use ChplConfig in as local a scope as possible
  • made similar transformations to package and standard modules:
    • modules/packages/AtomicObjects.chpl: relies on CHPL_TARGET_ARCH
      because it relies on x86
    • modules/packages/MPI.chpl: relies on CHPL_COMM because special
      effort was required to initialize on that platform
    • modules/packages/UnorderedAtomics.chpl: relies on
      CHPL_NETWORK_ATOMICS to fence appropriately when they're not available
    • modules/standard/Barriers.chpl: relies on CHPL_NETWORK_ATOMICS to
      determine whether processor atomics are used or not
    • modules/standard/DateTime.chpl: relies on CHPL_TARGET_PLATFORM to
      determine how to represent a char* (not sure what makes this module
      more susceptible to this than any other code...)
    • modules/standard/GMP.chpl: generates a compiler error if CHPL_GMP == none
    • modules/standard/Regex.chpl: similar, but for CHPL_RE2
    • modules/standard/Subprocess.chpl: checks CHPL_COMM for 'ugni' to issue
      a useful error message
  • changed mason as follows:
    • tools/mason/MasonTest.chpl: checks CHPL_HOME
    • tools/mason/SpecParser.chpl: checks CHPL_TARGET_COMPILER
  • updated release examples as follows:
    • release examples that rely on CHPL_COMM in choosing algorithm/distribution:
      • test/release/examples/benchmarks/hpcc/ra.chpl
      • test/release/examples/benchmarks/hpcc/variants/ra-cleanloop.chpl
      • test/release/examples/benchmarks/lulesh/lulesh.chpl
      • test/release/examples/benchmarks/lulesh/test3DLulesh.good
      • test/release/examples/benchmarks/miniMD/helpers/initMD.chpl
  • updated other tests as follows:
    • tests relying on CHPL_HOME:
      • test/c2chapel/c2chapel-tester.chpl
      • test/chplenv/autocomplete/autocomplete.chpl
      • test/performance/compiler/elliot/updateDatFiles.chpl
    • tests relying on whether or not CHPL_COMM is none:
      • test/distributions/robust/arithmetic/driver.chpl
      • test/exercises/c-ray/old/c-ray.chpl
      • test/parallel/bundles/bundles.chpl
      • test/parallel/forall/reduce-intents/ri-4-arrdom.chpl
      • test/parallel/forall/vass/reduce/array-reduce-intents1.chpl
      • test/reductions/vass/reductions-perf.chpl
      • test/scan/scanPerf.chpl
      • test/studies/lulesh/bradc/lulesh-dense.chpl
      • test/studies/lulesh/bradc/xyztuple/lulesh-dense-3tuple.chpl
      • test/types/string/StringImpl/common/memTrackSupport.chpl
    • tests relying on whether or not CHPL_COMM is ugni:
      • test/chplvis/benchmarks-hpcc/ra-vdb.chpl
      • test/runtime/configMatters/comm/misalignedComm.chpl
      • test/runtime/configMatters/comm/task-overload.chpl
    • tests relying on CHPL_NETWORK_ATOMICS:
      • test/performance/ferguson/array-assign-block.chpl
      • test/performance/ferguson/cyclic-id-queries.chpl
      • test/runtime/configMatters/comm/atomic-stress.chpl
      • test/studies/ssca2/rachels/SSCA2_kernels.chpl
      • test/types/atomic/sungeun/atomic_vars.chpl
    • tests relying on CHPL_REGEXP (deprecated):
      • test/deprecated/ChapelEnv-CHPL_REGEXP.chpl
    • tests relying on multiple things:
      • test/chplenv/badcomp/badcomp.chpl
      • test/chplenv/printchplenv/printchplenv.chpl
      • test/compflags/albrecht/chplenv/chplenv.chpl
      • test/io/ferguson/stdin-is-directory/stdin-is-directory.chpl
      • test/library/standard/Path/verma-varsha/test_expandVars.chpl
    • tests whose output is sensitive to new modules:
      • test/compflags/ferguson/print-module-resolution.good
      • test/modules/bradc/printModStuff/foo.good
      • test/optimizations/deadCodeElimination/elliot/countDeadModules.good

Resolves: #18879

Modified Files:
A modules/standard/ChplConfig.chpl

A test/deprecated/chapelEnv-warning.chpl
A test/deprecated/chapelEnv-warning.good
M modules/internal/Atomics.chpl
M modules/internal/ChapelAutoAggregation.chpl
M modules/internal/ChapelBase.chpl
M modules/internal/ChapelSyncvar.chpl
M modules/internal/LocaleModelHelpSetup.chpl
M modules/packages/AtomicObjects.chpl
M modules/packages/MPI.chpl
M modules/packages/UnorderedAtomics.chpl
M modules/standard/Barriers.chpl
M modules/standard/ChapelEnv.chpl
M modules/standard/DateTime.chpl
M modules/standard/GMP.chpl
M modules/standard/Regex.chpl
M modules/standard/Subprocess.chpl
M test/c2chapel/c2chapel-tester.chpl
M test/chplenv/autocomplete/autocomplete.chpl
M test/chplenv/badcomp/badcomp.chpl
M test/chplenv/printchplenv/printchplenv.chpl
M test/chplvis/benchmarks-hpcc/ra-vdb.chpl
M test/compflags/albrecht/chplenv/chplenv.chpl
M test/compflags/ferguson/print-module-resolution.good
M test/deprecated/ChapelEnv-CHPL_REGEXP.chpl
M test/distributions/robust/arithmetic/driver.chpl
M test/exercises/c-ray/old/c-ray.chpl
M test/io/ferguson/stdin-is-directory/stdin-is-directory.chpl
M test/library/standard/Path/verma-varsha/test_expandVars.chpl
M test/modules/bradc/printModStuff/foo.good
M test/optimizations/deadCodeElimination/elliot/countDeadModules.good
M test/parallel/bundles/bundles.chpl
M test/parallel/forall/reduce-intents/ri-4-arrdom.chpl
M test/parallel/forall/vass/reduce/array-reduce-intents1.chpl
M test/performance/compiler/elliot/updateDatFiles.chpl
M test/performance/ferguson/array-assign-block.chpl
M test/performance/ferguson/cyclic-id-queries.chpl
M test/reductions/vass/reductions-perf.chpl
M test/release/examples/benchmarks/hpcc/ra.chpl
M test/release/examples/benchmarks/hpcc/variants/ra-cleanloop.chpl
M test/release/examples/benchmarks/lulesh/lulesh.chpl
M test/release/examples/benchmarks/lulesh/test3DLulesh.good
M test/release/examples/benchmarks/miniMD/helpers/initMD.chpl
M test/runtime/configMatters/comm/atomic-stress.chpl
M test/runtime/configMatters/comm/misalignedComm.chpl
M test/runtime/configMatters/comm/task-overload.chpl
M test/scan/scanPerf.chpl
M test/studies/lulesh/bradc/lulesh-dense.chpl
M test/studies/lulesh/bradc/xyztuple/lulesh-dense-3tuple.chpl
M test/studies/ssca2/rachels/SSCA2_kernels.chpl
M test/types/atomic/sungeun/atomic_vars.chpl
M test/types/string/StringImpl/common/memTrackSupport.chpl
M tools/mason/MasonTest.chpl
M tools/mason/SpecParser.chpl

Compare: https://github.com/chapel-lang/chapel/compare/908f24e970e8...bf9f12a25b15