Skip to content

Commit 78b3eca

Browse files
mayantaylorritvikraomatthiasdiener
authored
mac arm build and CI addition (#259)
* resolving arch flag issues for mac * adding mac build to test suite * adding macos-12 to actions * x86 test name * cleanup and python venv setup * venv update * build matrix * adding venv source to test block * lower numpy version for testing * setup-python action * pip3 additions * numpy version for x86 build * typo * python 3.11 for x86 * numpy version reduction * disable fork safety for test on x86 * set python_requires just a guess, but the code uses f-strings, which were introduced in 3.6 * update URLs * restructure as matrix * install cython * disable configs that can not work, install filelock package for ray test * macos-13 build fixes --------- Co-authored-by: ritvikrao <rsrao2@illinois.edu> Co-authored-by: Matthias Diener <mdiener@illinois.edu>
1 parent 51a5f1e commit 78b3eca

File tree

5 files changed

+64
-38
lines changed

5 files changed

+64
-38
lines changed

.github/workflows/charm4py.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,49 @@ on:
66
- master
77
pull_request:
88
schedule:
9-
- cron: '5 0 * * *' # Runs at 00:05 UTC every day.
9+
- cron: "5 0 * * *" # Runs at 00:05 UTC every day.
1010

1111
jobs:
12-
build:
13-
runs-on: ubuntu-latest
12+
auto_test:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
python-version: ["3.7", "3.12"]
17+
# macos-13 is x86_64, macos-14 is arm64
18+
os: [ubuntu-latest, macos-13, macos-14]
19+
exclude:
20+
- os: macos-14 # Python 3.7 does not exist for macos-14
21+
python-version: "3.7"
22+
fail-fast: false
1423

1524
steps:
16-
- uses: actions/checkout@v3
17-
- name: build-charm4py
18-
run: |
19-
git fetch --unshallow # Need full repo for 'git describe' used by setup.py
20-
pip3 install setuptools cython cffi greenlet numpy torch torchvision
21-
git clone https://github.com/UIUC-PPL/charm charm_src/charm
22-
export CHARM_EXTRA_BUILD_OPTS="--enable-error-checking"
23-
export CHARM_BUILD_PROCESSES=2
24-
export CHARM4PY_BUILD_CFFI=1
25-
python3 setup.py build_ext --inplace
26-
- name: test-charm4py
27-
run: |
28-
export PYTHONPATH="$PWD"
29-
export CHARM4PY_TEST_NUM_PROCESSES=2
30-
python3 auto_test.py
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0 # Need full repo for 'git describe' used by setup.py
28+
- name: setup-python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
- name: Install dependencies
33+
run: |
34+
pip install setuptools cython cffi greenlet numpy torch torchvision filelock
35+
if [ ${{ matrix.os }} == 'macos-13' ]; then
36+
# pypi only distributes torch packages w/ numpy v1 for macos-x86_64
37+
pip install 'numpy<2'
38+
fi
39+
- name: Build Charm++/Charm4py
40+
run: |
41+
git clone https://github.com/charmplusplus/charm charm_src/charm
42+
export CHARM_EXTRA_BUILD_OPTS="--enable-error-checking"
43+
export CHARM_BUILD_PROCESSES=2
44+
export CHARM4PY_BUILD_CFFI=1
45+
python setup.py build_ext --inplace
46+
- name: Run auto_test.py
47+
run: |
48+
export PYTHONPATH="$PWD"
49+
export CHARM4PY_TEST_NUM_PROCESSES=2
50+
if [ ${{ matrix.os }} == 'macos-13' ]; then
51+
# Crashes in ray test otherwise
52+
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
53+
fi
54+
python auto_test.py

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Charm4py
33
========
44

55

6-
.. image:: https://github.com/UIUC-PPL/charm4py/actions/workflows/charm4py.yml/badge.svg?event=push
7-
:target: https://github.com/UIUC-PPL/charm4py/actions/workflows/charm4py.yml
6+
.. image:: https://github.com/charmplusplus/charm4py/actions/workflows/charm4py.yml/badge.svg?event=push
7+
:target: https://github.com/charmplusplus/charm4py/actions/workflows/charm4py.yml
88

99
.. image:: http://readthedocs.org/projects/charm4py/badge/?version=latest
1010
:target: https://charm4py.readthedocs.io/
@@ -83,8 +83,8 @@ or email us at <charm@cs.illinois.edu>.
8383
Main author at <jjgalvez@illinois.edu>
8484

8585

86-
.. _Charm++: https://github.com/UIUC-PPL/charm
86+
.. _Charm++: https://github.com/charmplusplus/charm
8787

8888
.. _Documentation: https://charm4py.readthedocs.io
8989

90-
.. _discussion page: https://github.com/UIUC-PPL/charm4py/discussions
90+
.. _discussion page: https://github.com/charmplusplus/charm4py/discussions

docs/contact.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Contact
55
You can contact us on the `discussion page`_ for discussion of any topics related to
66
Charm4py or Charm++, or in our mailing list at <charm@cs.illinois.edu>
77

8-
.. _discussion page: https://github.com/UIUC-PPL/charm4py/discussions
8+
.. _discussion page: https://github.com/charmplusplus/charm4py/discussions
99

1010

11-
Please use the GitHub page to report and track issues (https://github.com/UIUC-PPL/charm4py)
11+
Please use the GitHub page to report and track issues (https://github.com/charmplusplus/charm4py)

docs/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Examples
33
========
44

55
There are several examples in the source code repository, with documentation
6-
and comments: https://github.com/UIUC-PPL/charm4py/tree/master/examples
6+
and comments: https://github.com/charmplusplus/charm4py/tree/master/examples
77

88
These include:
99

setup.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
def get_build_machine():
2424
machine = platform.machine()
2525
if machine == 'arm64' or machine == 'aarch64':
26-
return 'arm64'
26+
return 'arm8'
2727
return machine
2828

29+
def get_archflag_machine():
30+
machine = platform.machine()
31+
if machine == 'arm64' or machine == 'aarch64':
32+
return 'arm64'
33+
return machine
2934

3035
def get_build_os():
3136
os = platform.system()
@@ -53,7 +58,7 @@ def get_build_triple(build_mpi):
5358
libcharm_filename2 = 'charm.lib'
5459
charmrun_filename = 'charmrun.exe'
5560
elif system == 'darwin':
56-
os.environ['ARCHFLAGS'] = f'-arch {machine}'
61+
os.environ['ARCHFLAGS'] = f'-arch {get_archflag_machine()}'
5762
libcharm_filename = 'libcharm.dylib'
5863
charmrun_filename = 'charmrun'
5964
if 'CPPFLAGS' in os.environ:
@@ -169,7 +174,7 @@ def build_libcharm(charm_src_dir, build_dir):
169174
raise DistutilsSetupError('An error occured while building charm library')
170175

171176
if system == 'darwin':
172-
old_file_path = os.path.join(charm_src_dir, 'charm', 'lib', 'libcharm.so')
177+
old_file_path = os.path.join(charm_src_dir, 'charm', 'lib', 'libcharm.dylib')
173178
new_file_path = os.path.join(charm_src_dir, 'charm', 'lib', libcharm_filename)
174179
shutil.move(old_file_path, new_file_path)
175180
cmd = ['install_name_tool', '-id', '@rpath/../.libs/' + libcharm_filename, new_file_path]
@@ -192,7 +197,7 @@ def build_libcharm(charm_src_dir, build_dir):
192197
for output_dir in lib_output_dirs:
193198
log.info('copying ' + os.path.relpath(lib_src_path) + ' to ' + os.path.relpath(output_dir))
194199
shutil.copy(lib_src_path, output_dir)
195-
200+
196201

197202
# ---- copy charmrun ----
198203
charmrun_src_path = os.path.join(charm_src_dir, 'charm', 'bin', charmrun_filename)
@@ -268,7 +273,7 @@ def run(self):
268273
class _renameInstalled(_install_lib):
269274
def __init__(self, *args, **kwargs):
270275
_install_lib.__init__(self, *args, **kwargs)
271-
276+
272277
def install(self):
273278
log.info("Renaming libraries")
274279
outfiles = _install_lib.install(self)
@@ -324,7 +329,7 @@ def install(self):
324329
extra_link_args=["-Wl,-rpath,@loader_path/../.libs"]
325330
else:
326331
extra_link_args=["-Wl,-rpath,$ORIGIN/../.libs"]
327-
332+
328333
cobject_extra_args = []
329334
log.info("Extra object args for object store")
330335
if os.name != 'nt':
@@ -341,7 +346,7 @@ def install(self):
341346
extra_compile_args=['-g0', '-O3'],
342347
extra_link_args=extra_link_args,
343348
), compile_time_env={'HAVE_NUMPY': haveNumpy}))
344-
349+
345350
extensions.extend(cythonize(setuptools.Extension('charm4py.c_object_store',
346351
sources=['charm4py/c_object_store.pyx'],
347352
include_dirs=['charm_src/charm/include'] + my_include_dirs,
@@ -375,7 +380,7 @@ def install(self):
375380
author_email='jjgalvez@illinois.edu',
376381
description='Charm4py Parallel Programming Framework',
377382
long_description=long_description,
378-
url='https://github.com/UIUC-PPL/charm4py',
383+
url='https://github.com/charmplusplus/charm4py',
379384
keywords='parallel parallel-programming distributed distributed-computing hpc HPC runtime',
380385
packages=setuptools.find_packages(),
381386
package_data={
@@ -387,7 +392,7 @@ def install(self):
387392
],
388393
},
389394
install_requires=['numpy>=1.10.0', 'greenlet>=3.0.0', 'cython>=3.0.0', 'cmake'],
390-
#python_requires='>=2.7, ~=3.4',
395+
python_requires='~=3.6',
391396
classifiers=[
392397
'Intended Audience :: Developers',
393398
'License :: Free for non-commercial use',
@@ -396,10 +401,7 @@ def install(self):
396401
'Operating System :: POSIX :: Linux',
397402
'Operating System :: Microsoft :: Windows',
398403
'Programming Language :: Python',
399-
'Programming Language :: Python :: 3.4',
400-
'Programming Language :: Python :: 3.5',
401-
'Programming Language :: Python :: 3.6',
402-
'Programming Language :: Python :: 3.7',
404+
'Programming Language :: Python :: 3',
403405
'Topic :: System :: Distributed Computing',
404406
'Topic :: System :: Clustering',
405407
],

0 commit comments

Comments
 (0)