Skip to content

Commit

Permalink
Update docs and scripts to make arm64 a synonym for aarch64 (chap…
Browse files Browse the repository at this point in the history
…el-lang#22049)

[reviewed and curated by @ronawho and @mppf]

This updates the description of the `CHPL_HOST_ARCH` options to include
`arm64`, which is what we infer it to be on Mac M1/M2 platforms, and a
string that other UNIX instances reportedly use as well.

It also updates our `chplenv` scripts that look for `aarch64` to make
them recognize `arm64` as follows:
* updates a check in `chpl_platform.py` to treat `arm64` similarly to
`aarch64`
* generalizes a check in `chpl_cpu.py` to look for `arm` as a prefix
rather than `arm-` since this would handle the `arm64` case
* updates a comment in `chpl_cpu.py` to name `arm64` as a possible
`uname[4]` output as well

I chose not to update a final `aarch64` check in `chpl_cpu.py` because
it seemed to assume that it was a valid platform value, which I'm not
aware that it is, so didn't feel confident that it should be updated
(and also didn't feel confident enough that it's dead code to remove
it).
  • Loading branch information
bradcray authored Sep 18, 2023
2 parents b1d9477 + d985f63 commit 18bac7f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/rst/usingchapel/chplenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ CHPL_HOST_ARCH
======== =============================================================
x86_64 64-bit AMD and Intel processors
aarch64 64-bit ARM processors
arm64 an alternative name for 'aarch64'
======== =============================================================

If unset, the default will be computed. The command ``uname -m``
Expand Down
4 changes: 2 additions & 2 deletions util/chplenv/chpl_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'x86-trento': 'znver3',
}

# This gets the generic machine type, e.g. x86_64, i686, aarch64.
# This gets the generic machine type, e.g. x86_64, i686, aarch64, arm64.
# Since uname returns the host machine type, we currently assume that
# cross-compilation is limited to different subarchitectures of the
# generic machine type. For example, we can cross compile from
Expand All @@ -40,7 +40,7 @@ def get_native_machine():

@memoize
def is_known_arm(cpu):
if cpu.startswith("arm-") or ('aarch64' in cpu) or ('thunderx' in cpu):
if cpu.startswith("arm") or ('aarch64' in cpu) or ('thunderx' in cpu):
return True
else:
return False
Expand Down
2 changes: 1 addition & 1 deletion util/chplenv/chpl_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get(flag='host'):
platform_val = "linux64_32"
else:
platform_val = "linux64"
elif machine == 'aarch64':
elif machine == 'aarch64' or machine == 'arm64':
platform_val = "linux64"
else:
platform_val = "linux32"
Expand Down

0 comments on commit 18bac7f

Please sign in to comment.