Skip to content

Commit

Permalink
Merge branch 'main' into runtime-no-filename-max
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Rift <[email protected]>
  • Loading branch information
riftEmber committed Dec 16, 2024
2 parents 2344862 + d707108 commit bb5b8a4
Show file tree
Hide file tree
Showing 70 changed files with 244 additions and 142 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,15 @@ jobs:
baseSHA=${{github.event.pull_request.base.sha}}
headSHA=${{github.event.pull_request.head.sha}}
echo "Base SHA: $baseSHA"
echo "Head SHA: $headSHA"
echo "${{github.event.pull_request.commits}} commits in PR"
# Loop backward through commits added in the PR, starting from the
# latest.
commitIdx=0
for commit in $(git rev-list $baseSHA..$headSHA)
do
if [ "$commit" = "$baseSHA" ]; then
break
fi
echo "Checking commit: $commit"
git checkout -q $commit
Expand All @@ -180,4 +181,11 @@ jobs:
exit 1
fi
done <<< "$newFiles"
# Stop after going through the number of commits this PR has.
commitIdx=$((commitIdx+1))
if [ "$commitIdx" = "${{github.event.pull_request.commits}}" ]; then
echo "Stopping after $commitIdx commits, on commit $commit"
break
fi
done
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The Chapel implementation is composed of two categories of code:
gasnet only used when CHPL_COMM is 'gasnet'
gmp only used when CHPL_GMP is 'gmp'
hwloc only used when CHPL_HWLOC is 'hwloc'
jemalloc only used when CHPL_MEM is 'jemalloc'
jemalloc only used when CHPL_TARGET_MEM/CHPL_HOST_MEM is 'jemalloc'
libfabric only used when CHPL_COMM is 'ofi'
libunwind only used when CHPL_UNWIND is 'libunwind'
llvm only used when CHPL_LLVM is 'llvm'
Expand Down
2 changes: 1 addition & 1 deletion compiler/include/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ extern const char* CHPL_COMM_OFI_OOB;
extern const char* CHPL_TASKS;
extern const char* CHPL_LAUNCHER;
extern const char* CHPL_TIMERS;
extern const char* CHPL_MEM;
extern const char* CHPL_TARGET_MEM;
extern const char* CHPL_MAKE;
extern const char* CHPL_ATOMICS;
extern const char* CHPL_NETWORK_ATOMICS;
Expand Down
6 changes: 3 additions & 3 deletions compiler/main/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const char* CHPL_COMM_OFI_OOB = NULL;
const char* CHPL_TASKS = NULL;
const char* CHPL_LAUNCHER = NULL;
const char* CHPL_TIMERS = NULL;
const char* CHPL_MEM = NULL;
const char* CHPL_TARGET_MEM = NULL;
const char* CHPL_MAKE = NULL;
const char* CHPL_ATOMICS = NULL;
const char* CHPL_NETWORK_ATOMICS = NULL;
Expand Down Expand Up @@ -1363,7 +1363,7 @@ static ArgumentDescription arg_desc[] = {
{"lib-pic", ' ', "<pic>", "Specify whether to use position-dependent or position-independent code", "S", NULL, "_CHPL_LIB_PIC", setChplEnv},
{"locale-model", ' ', "<locale-model>", "Specify locale model to use", "S", NULL, "_CHPL_LOCALE_MODEL", setChplEnv},
{"make", ' ', "<make utility>", "Make utility for generated code", "S", NULL, "_CHPL_MAKE", setChplEnv},
{"mem", ' ', "<mem-impl>", "Specify the memory manager", "S", NULL, "_CHPL_MEM", setChplEnv},
{"target-mem", ' ', "<mem-impl>", "Specify the memory manager", "S", NULL, "_CHPL_TARGET_MEM", setChplEnv},
{"re2", ' ', "<re2-version>", "Specify RE2 library", "S", NULL, "_CHPL_RE2", setChplEnv},
{"target-arch", ' ', "<architecture>", "Target architecture / machine type", "S", NULL, "_CHPL_TARGET_ARCH", setChplEnv},
{"target-compiler", ' ', "<compiler>", "Compiler for generated code", "S", NULL, "_CHPL_TARGET_COMPILER", setChplEnv},
Expand Down Expand Up @@ -1802,7 +1802,7 @@ static void setChapelEnvs() {
CHPL_TASKS = envMap["CHPL_TASKS"];
CHPL_LAUNCHER = envMap["CHPL_LAUNCHER"];
CHPL_TIMERS = envMap["CHPL_TIMERS"];
CHPL_MEM = envMap["CHPL_MEM"];
CHPL_TARGET_MEM = envMap["CHPL_TARGET_MEM"];
CHPL_MAKE = envMap["CHPL_MAKE"];
CHPL_ATOMICS = envMap["CHPL_ATOMICS"];
CHPL_NETWORK_ATOMICS = envMap["CHPL_NETWORK_ATOMICS"];
Expand Down
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CONFIGURED=""
if [ "$DEST_DIR_SET" -ne 0 ]
then
case $DEST_DIR in
(/*) pathchk -- "$1";;
(/*) pathchk "$DEST_DIR" || { echo "error: invalid directory name for --chpl-home: $DEST_DIR"; exit -1; };;
(*)
echo "error: expected an absolute directory name for --chpl-home: $DEST_DIR"
exit -1
Expand All @@ -94,7 +94,7 @@ then
CONFIGURED=configured-chpl-home
else
case $PREFIX in
(/*) pathchk -- "$1";;
(/*) pathchk "$PREFIX" || { echo "error: invalid directory name for --prefix: $PREFIX"; exit -1; };;
(*)
echo "error: expected an absolute directory name for --prefix: $PREFIX"
exit -1
Expand Down
4 changes: 2 additions & 2 deletions doc/rst/developer/bestPractices/Sanitizers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To use AddressSanitizer with Chapel-generated executables only:

.. code-block:: bash
export CHPL_MEM=cstdlib
export CHPL_TARGET_MEM=cstdlib
export CHPL_TASKS=fifo
export CHPL_LLVM=none # or set CHPL_TARGET_COMPILER to gnu, clang, etc.
export CHPL_SANITIZE_EXE=address
Expand All @@ -34,7 +34,7 @@ To use it with both the Chapel compiler and its generated executables:

.. code-block:: bash
export CHPL_MEM=cstdlib
export CHPL_TARGET_MEM=cstdlib
export CHPL_TASKS=fifo
export CHPL_LLVM=none
export CHPL_HOST_MEM=cstdlib
Expand Down
2 changes: 1 addition & 1 deletion doc/rst/developer/bestPractices/Valgrind.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To run ``valgrind`` on an executable generated by the ``chpl`` compiler:

.. code-block:: bash
export CHPL_MEM=cstdlib
export CHPL_TARGET_MEM=cstdlib
export CHPL_TASKS=fifo
export CHPL_RT_NUM_THREADS_PER_LOCALE=450
export CHPL_RE2_VALGRIND_SUPPORT=true
Expand Down
4 changes: 2 additions & 2 deletions doc/rst/developer/chips/inactive/18.rst
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ Current Status
..............

Single-ddata with separate arrays is currently implemented in cases
where ``CHPL_COMM=ugni``, ``CHPL_MEM=jemalloc``, and hugepages are
where ``CHPL_COMM=ugni``, ``CHPL_TARGET_MEM=jemalloc``, and hugepages are
present. This includes the default configurations on Cray XC systems,
where memory needs to be registered with the Aries NIC. Only arrays
that occupy at least 2 hugepages worth of memory are allocated
Expand Down Expand Up @@ -817,7 +817,7 @@ solution in the sense of providing adequate performance in all common
circumstances, or even all desired ones.

Currently Chapel uses single-ddata with separate arrays in
configurations where ``CHPL_COMM=ugni``, ``CHPL_MEM=jemalloc`` and
configurations where ``CHPL_COMM=ugni``, ``CHPL_TARGET_MEM=jemalloc`` and
hugepages are in use (thus memory is registered), which includes the
default configurations on Cray XC systems. It uses plain single-ddata
in all other cases. (More details are available in the `Single-ddata
Expand Down
2 changes: 1 addition & 1 deletion doc/rst/technotes/allocators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Using the Chapel Allocator from C
=================================

The Chapel runtime will select an allocator according to the ``CHPL_MEM``
The Chapel runtime will select an allocator according to the ``CHPL_TARGET_MEM``
environment variable. See :ref:`readme-chplenv` for details on how that
works. The default is usually the system allocator (ie malloc/free as
supported by the C compiler and runtime) but some configurations use a
Expand Down
31 changes: 29 additions & 2 deletions doc/rst/usingchapel/chplenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ CHPL_COMM

CHPL_MEM
~~~~~~~~

.. warning::

``CHPL_MEM`` has been deprecated and renamed to :ref:`readme-chplenv.CHPL_TARGET_MEM`

Optionally, the ``CHPL_MEM`` environment variable can be used to select
a memory management layer. Current options are:

Expand All @@ -501,8 +506,30 @@ CHPL_MEM
If unset, ``CHPL_MEM`` defaults to ``jemalloc`` for most configurations.
If the target platform is ``cygwin*`` it defaults to ``cstdlib``

``CHPL_TARGET_MEM`` will be replacing ``CHPL_MEM`` in the
future. ``CHPL_TARGET_MEM`` takes precedence over ``CHPL_MEM``.
.. note::
Certain ``CHPL_COMM`` settings (e.g. ugni, gasnet segment fast/large,
ofi with the gni provider) register the heap to improve communication
performance. Registering the heap requires special allocator support
that not all allocators provide. Currently only ``jemalloc`` is capable
of supporting configurations that require a registered heap.

.. _readme-chplenv.CHPL_TARGET_MEM:

CHPL_TARGET_MEM
~~~~~~~~~~~~~~~

Optionally, the ``CHPL_TARGET_MEM`` environment variable can be used to select
a memory management layer. Current options are:

========= =======================================================
Value Description
========= =======================================================
cstdlib use the standard C malloc/free commands
jemalloc use Jason Evan's memory allocator
========= =======================================================

If unset, ``CHPL_TARGET_MEM`` defaults to ``jemalloc`` for most configurations.
If the target platform is ``cygwin*`` it defaults to ``cstdlib``

.. note::
Certain ``CHPL_COMM`` settings (e.g. ugni, gasnet segment fast/large,
Expand Down
2 changes: 1 addition & 1 deletion frontend/include/chpl/types/CompositeType.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class CompositeType : public Type {

bool compositeTypeContentsMatchInner(const CompositeType* other) const {
return id_ == other->id_ &&
name_ != other->name_ &&
name_ == other->name_ &&
instantiatedFrom_ == other->instantiatedFrom_ &&
subs_ == other->subs_;
}
Expand Down
2 changes: 1 addition & 1 deletion make/compiler/Makefile.sanitizers
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ifneq ($(CHPL_MAKE_SANITIZE), none)
endif
endif
ifneq ($(CHPL_MAKE_TARGET_MEM), cstdlib)
$(error CHPL_MEM=cstdlib is required for sanitizers)
$(error CHPL_TARGET_MEM=cstdlib is required for sanitizers)
endif
ifeq ($(strip $(CHPL_MAKE_HOST_TARGET)),--host)
ifneq ($(CHPL_MAKE_HOST_MEM), cstdlib)
Expand Down
7 changes: 4 additions & 3 deletions man/chpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -977,13 +977,14 @@ doc/rst/usingchapel/chplenv.rst in your Chapel installation.
overrides the $CHPL\_MAKE environment variable (defaults to a best guess
based on $CHPL\_HOST\_PLATFORM).

.. _man-target-mem:
.. _man-mem:

**\--mem <mem-impl>**
**\--target-mem <mem-impl>**

Specify the memory allocator used for dynamic memory management. This
flag corresponds with and overrides the $CHPL\_MEM environment variable
(defaults to a best guess based on $CHPL\_COMM).
flag corresponds with and overrides the $CHPL\_TARGET\_MEM environment
variable (defaults to a best guess based on $CHPL\_COMM).

.. _man-re2:

Expand Down
7 changes: 0 additions & 7 deletions modules/packages/Python.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@ module Python {
PyConfig_InitIsolatedConfig(cfgPtr);
defer PyConfig_Clear(cfgPtr);

// set program name
const wideChapel = "chapel".c_wstr();
checkPyStatus(
PyConfig_SetString(
cfgPtr, c_ptrTo(config_.program_name), wideChapel));
deallocate(wideChapel);

// check VIRTUAL_ENV, if its set, make it the executable
var venv = getenv("VIRTUAL_ENV".c_str());
if venv != nil {
Expand Down
18 changes: 11 additions & 7 deletions modules/standard/ChplConfig.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,14 @@ module ChplConfig {
param CHPL_UNWIND:string;
CHPL_UNWIND = __primitive("get compiler variable", "CHPL_UNWIND");

/* See :ref:`readme-chplenv.CHPL_TARGET_MEM` for more information. */
@unstable("'ChplConfig.CHPL_TARGET_MEM' is unstable and may be replaced with a different way to access this information in the future")
param CHPL_TARGET_MEM:string;
CHPL_TARGET_MEM = __primitive("get compiler variable", "CHPL_TARGET_MEM");

/* See :ref:`readme-chplenv.CHPL_MEM` for more information. */
@unstable("'ChplConfig.CHPL_MEM' is unstable and may be replaced with a different way to access this information in the future")
param CHPL_MEM:string;
CHPL_MEM = __primitive("get compiler variable", "CHPL_MEM");
@deprecated("'ChplConfig.CHPL_MEM' is deprecated, please use :param:`ChplConfig.CHPL_MEM`")
param CHPL_MEM:string = CHPL_TARGET_MEM;

/* See :ref:`readme-chplenv.CHPL_MAKE` for more information. */
@unstable("'ChplConfig.CHPL_MAKE' is unstable and may be replaced with a different way to access this information in the future")
Expand Down Expand Up @@ -164,10 +168,10 @@ module ChplConfig {
CHPL_HWLOC_PCI = __primitive("get compiler variable", "CHPL_HWLOC_PCI");

@chpldoc.nodoc
@unstable("'ChplConfig.CHPL_JEMALLOC' is unstable and may be replaced with a different way to access this information in the future")
/* See :ref:`readme-chplenv.CHPL_JEMALLOC` for more information. */
param CHPL_JEMALLOC:string;
CHPL_JEMALLOC = __primitive("get compiler variable", "CHPL_TARGET_JEMALLOC");
@unstable("'ChplConfig.CHPL_TARGET_JEMALLOC' is unstable and may be replaced with a different way to access this information in the future")
/* See :ref:`readme-chplenv.CHPL_TARGET_JEMALLOC` for more information. */
param CHPL_TARGET_JEMALLOC:string;
CHPL_TARGET_JEMALLOC = __primitive("get compiler variable", "CHPL_TARGET_JEMALLOC");

/* See :ref:`readme-chplenv.CHPL_RE2` for more information. */
@unstable("'ChplConfig.CHPL_RE2' is unstable and may be replaced with a different way to access this information in the future")
Expand Down
2 changes: 1 addition & 1 deletion runtime/include/chplcgfns.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extern const char* CHPL_COMM_OFI_OOB;
extern const char* CHPL_TASKS;
extern const char* CHPL_LAUNCHER;
extern const char* CHPL_TIMERS;
extern const char* CHPL_MEM;
extern const char* CHPL_TARGET_MEM;
extern const char* CHPL_MAKE;
extern const char* CHPL_ATOMICS;
extern const char* CHPL_NETWORK_ATOMICS;
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/comm/ugni/comm-ugni-heap-pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void set_hps(void)
// hugepages, then the heap page size is the hugepage size.
//
char* ev;
if (strcmp(CHPL_MEM, "jemalloc") == 0
if (strcmp(CHPL_TARGET_MEM, "jemalloc") == 0
&& chpl_env_rt_get("MAX_HEAP_SIZE", NULL) == NULL
&& (ev = getenv("HUGETLB_DEFAULT_PAGE_SIZE")) != NULL) {
hps = chpl_env_str_to_size("HUGETLB_DEFAULT_PAGE_SIZE", ev, hps);
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/comm/ugni/comm-ugni.c
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ void chpl_comm_post_task_init(void)
0, 0);
}

if (strcmp(CHPL_MEM, "jemalloc") == 0
if (strcmp(CHPL_TARGET_MEM, "jemalloc") == 0
&& getenv(chpl_comm_ugni_jemalloc_conf_ev_name()) == NULL) {
char buf[200];
(void) snprintf(buf, sizeof(buf),
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/mem/cstdlib/mem-cstdlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void chpl_mem_layerInit(void) {

chpl_comm_regMemHeapInfo(&start, &size);
if (start || size) {
chpl_error("Your CHPL_MEM setting doesn't support the registered heap "
chpl_error("Your CHPL_TARGET_MEM setting doesn't support the registered heap "
"required by your CHPL_COMM setting. You'll need to change one "
"of these configurations.", 0, 0);
}
Expand Down
Loading

0 comments on commit bb5b8a4

Please sign in to comment.