Skip to content

Commit 160b8d6

Browse files
authored
Merge pull request #278 from mfem/improve-install
Cleanup install is merged
2 parents 8401bbd + 61f403d commit 160b8d6

24 files changed

+2044
-1820
lines changed

.github/workflows/build-and-test-callable.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ on:
4949
phases:
5050
description: 'When true, run each build step individually (mfem, swig, pymfem)'
5151
type: boolean
52-
default: true
52+
default: false
5353

5454
jobs:
5555
build-and-test:
@@ -67,11 +67,11 @@ jobs:
6767
CUDA_HOME: '/usr/local/cuda'
6868
# These are all passed to setup.py as one concatenated string
6969
build-flags: >-
70-
${{ inputs.parallel && '--with-parallel' || '' }}
71-
${{ inputs.cuda && '--with-cuda' || '' }}
72-
${{ inputs.libceed && '--with-libceed' || '' }}
73-
${{ inputs.gslib && '--with-gslib' || '' }}
74-
${{ (!(inputs.mfem-branch == 'default') && format('--mfem-branch=''{0}''', inputs.mfem-branch)) || '' }}
70+
${{ inputs.parallel && '-C"with-parallel=Yes"' || '' }}
71+
${{ inputs.cuda && '-C"with-cuda=Yes"' || '' }}
72+
${{ inputs.libceed && '-C"with-libceed=Yes"' || '' }}
73+
${{ inputs.gslib && '-C"with-gslib=Yes"' || '' }}
74+
${{ (!(inputs.mfem-branch == 'default') && format('-C"mfem-branch=''{0}''"', inputs.mfem-branch)) || '' }}
7575
7676
# -------------------------------------------------------------------------------------------------
7777
# Begin workflow
@@ -90,8 +90,15 @@ jobs:
9090
# -------------------------------------------------------------------------------------------------
9191
- name: Install core dependencies via requirements.txt
9292
run: |
93-
pip install setuptools
94-
pip install -r requirements.txt --verbose
93+
pip install -U setuptools>=79.0.1
94+
pip install -U numpy>=2.0.0
95+
pip install -U cmake>=4.0.0
96+
pip install -U swig>=4.3
97+
98+
#- name: Install chrpath on ubuntu
99+
# if: inputs.os == 'ubuntu-latest'
100+
# run: |
101+
# sudo apt-get install chrpath
95102

96103
- name: Install MPI
97104
if: inputs.parallel
@@ -137,21 +144,26 @@ jobs:
137144
# -------------------------------------------------------------------------------------------------
138145
# Build MFEM + SWIG Bindings + PyMFEM
139146
# -------------------------------------------------------------------------------------------------
140-
- name: Build MFEM (step 1)
141-
if: inputs.phases
142-
run: python setup.py install --ext-only --vv ${{ env.build-flags }}
147+
# - name: Build MFEM (step 1)
148+
# if: inputs.phases
149+
# run: pip install -e . -C"--build-option=--ext-only" -C"--build-option=--vv" ${{ env.build-flags }}
150+
# run: python setup.py install --ext-only --vv ${{ env.build-flags }}
151+
152+
# - name: Build SWIG wrappers (step 2)
153+
# if: inputs.phases
154+
# run: python setup.py install --swig --vv ${{ env.build-flags }}
143155

144-
- name: Build SWIG wrappers (step 2)
145-
if: inputs.phases
146-
run: python setup.py install --swig --vv ${{ env.build-flags }}
156+
# - name: Build PyMFEM (step 3)
157+
# if: inputs.phases
158+
# run: python setup.py install --skip-ext --skip-swig --vv ${{ env.build-flags }}
147159

148-
- name: Build PyMFEM (step 3)
149-
if: inputs.phases
150-
run: python setup.py install --skip-ext --skip-swig --vv ${{ env.build-flags }}
160+
#- name: Build all (steps 1-3)
161+
# if: inputs.phases == false
162+
# run: pip install -e . -C"--build-option=--vv" ${{ env.build-flags }}
151163

152164
- name: Build all (steps 1-3)
153165
if: inputs.phases == false
154-
run: python setup.py install --vv ${{ env.build-flags }}
166+
run: pip install . ${{ env.build-flags }} --verbose
155167

156168
# -------------------------------------------------------------------------------------------------
157169
# Run tests

.github/workflows/build-and-test-dispatch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
mfem-branch: [master, default] # 'default' uses a specific commit hash defined in setup.py:repos_sha
33-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # 3.12 is not supported by scipy
33+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
3434
parallel: [false]
3535
name: test-linux | ${{ matrix.mfem-branch }} | ${{ matrix.python-version }} | ${{ matrix.parallel && 'parallel' || 'serial' }}
3636
uses: ./.github/workflows/build-and-test-callable.yml
@@ -46,7 +46,7 @@ jobs:
4646
fail-fast: false
4747
matrix:
4848
mfem-branch: [master, default] # 'default' uses a specific commit hash defined in setup.py:repos_sha
49-
python-version: ['3.9', '3.10', '3.11', '3.12'] # 3.12 is not supported by scipy
49+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
5050
parallel: [true]
5151
name: test-linux | ${{ matrix.mfem-branch }} | ${{ matrix.python-version }} | ${{ matrix.parallel && 'parallel' || 'serial' }}
5252
uses: ./.github/workflows/build-and-test-callable.yml

.github/workflows/release_binary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
7171
CWD=$PWD
7272
yum install -y zlib-devel
73-
yum install -y chrpath
73+
#yum install -y chrpath
7474
7575
mkdir dist
7676

.github/workflows/testrelease_binary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
7070
CWD=$PWD
7171
yum install -y zlib-devel
72-
yum install -y chrpath
72+
#yum install -y chrpath
7373
7474
mkdir dist
7575

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,16 @@ $ pip download mfem --no-binary mfem (expand tar.gz file and move to the downloa
2929
or clone this repository
3030
$ git clone https://github.com/mfem/PyMFEM.git
3131

32-
# Then, build it from local source
33-
$ python -m pip install ./ --install-option="--with-parallel" --install-option="--mfem-branch=master"
34-
or
35-
$ python setup.py install --with-parallel # it download and build metis/hypre/mfem
36-
37-
# Verbose output
38-
$ python setup.py install --verbose # SWIG output and CMAKE_VERBOSE_MAKEFILE is on
32+
# Build it from local source with MPI
33+
$ pip install ./ -C"with-parallel=Yes" --verbose
3934

4035
# Cleaning
4136
$ python setup.py clean --all # clean external dependencies + wrapper code
4237

43-
# Choosing compiler
44-
$ python setup.py install --with-parallel --CC=icc --CXX=icpc --MPICC=mpiicc --MPICXX=mpiicpc
45-
4638
# Run test
4739
cd test
4840
python test_examples.py -serial
4941

50-
# For other configurations, see docs/install.txt or help
51-
$ python setup.py install --help
52-
5342
```
5443

5544
## Usage

_build_system/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
k

_build_system/backend.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from setuptools import build_meta as _orig
2+
from setuptools.build_meta import *
3+
4+
import build_globals as bglb
5+
6+
7+
def get_requires_for_build_wheel(config_settings=None):
8+
ret = _orig.get_requires_for_build_wheel(config_settings)
9+
10+
need_mpi = False
11+
if config_settings is not None:
12+
for flag in ("with-parallel", ):
13+
value = config_settings.pop(flag, "No")
14+
if value.upper() in ("YES", "TRUE", "1"):
15+
need_mpi = True
16+
break
17+
18+
if need_mpi:
19+
ret = ret + ['mpi4py']
20+
return ret
21+
22+
23+
def get_requires_for_build_sdist(config_settings=None):
24+
return _orig.get_requires_for_build_sdist(config_settings)
25+
26+
27+
def build_wheel(*args, **kwargs):
28+
bglb.cfs = args[1]
29+
if bglb.cfs is None:
30+
bglb.cfs = {}
31+
return _orig.build_wheel(*args, **kwargs)

0 commit comments

Comments
 (0)