Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 20 additions & 31 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@

## Basic serial install

Most users (on Linux and Mac) will be fine using the binary bundled in the default `pip` install:
For serial version, most users (on Linux and Mac) will be fine using the binary bundled in the default `pip` install:

```shell
pip install mfem
```
The above installation will download and install a *serial* version of `MFEM`.

## Environmental variables
Build script checks the following environmental variables
- CC : c compiler for parallel build
- CXX : c++ compiler for serial build
- MPICC : c compiler for parallel build
- MPICXX : c++ compiler for parallel build
- CXX11FLAG : C++11 flag for C++ compiler
- MPIINC : the location of MPI.h (if this variable is set, the parallle PyMFEM is build with CXX, not MPICXX)


## Building from source
To build it from source, clone the repository and use pip command

```shell
git clone git@github:mfem/PyMFEM.git
cd PyMFEM
pip install . --user
```

PyMFEM has many options for installation, when building from source, including:
- Serial and parallel (MPI) wrappers
- Using pre-built local dependencies
Expand All @@ -28,32 +27,28 @@ PyMFEM has many options for installation, when building from source, including:
- `gslib`
- `libceed`
- `metis`

Most of the options for PyMFEM can be used directly when installing via `pip install . or python setup.py install`, e.g.
```shell
git clone git@github:mfem/PyMFEM.git
cd PyMFEM
pip install . --user

or

python setup.py install --user
```

Build script checks the following environmental variables
- CC : c compiler for parallel build
- CXX : c++ compiler for serial build
- MPICC : c compiler for parallel build
- MPICXX : c++ compiler for parallel build
- CXX11FLAG : C++11 flag for C++ compiler
- MPIINC : the location of MPI.h (if this variable is set, the parallle PyMFEM is build with CXX, not MPICXX)

Note that `python setup.py install` is deprecated and will be removed soon in favor of `pip`.
When installing via `pip`, options are specified using the `-C` flag using the syntax `-C"name=value"`; e.g. the `--with-parallel` option is now specified as `-C"with-parallel=Yes`.
The name and value of each option should be written explicitly with a dedicated -C flag.

For example, parallel (MPI) support and GSlib support is built with `--with-parallel`
and `--with-gslib' flags as follows.
and `--with-gslib` flags as follows.

```shell
python setup.py install --with-parallel --with-gslib
or
pip install . -C"with-parallel=Yes" -C"with-gslib=Yes"
```

Note: this option turns on building `metis` and `Hypre`
(Warning) The migration to `pip install . ` is on-going effort and Some of the example commands are not tested yet, which are indicated by using old conversion of "python setup.py install XXXX"


## Commonly used flags

Expand All @@ -63,12 +58,6 @@ Note: this option turns on building `metis` and `Hypre`
| `--mfem-branch=<reference>` | Download/install MFEM using a specific reference (`git` `branch`, `hash`, or `tag`) |
| `--user` | Install in user's site-package |

In order to see the full list of options, use

```shell
python setup.py install --help
```

## Advanced options

### Suitesparse
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,25 @@ pip install mfem # binary install is available only on linux platform

### Build with additional features (MPI, GPU, GPU-Hypre, GSLIB, SuiteSparse, libCEED, LAPACK)

The setup script accept various options. Download the package manually and run the script. Examples below downloads and build parallel version of MFEM library (linked with Metis and Hypre) and installs under <prefix>/mfem. See INSTALL.md for various other options
The setup script accept various options. Download the package manually and run the script. Examples below downloads and build parallel version of MFEM library (linked with Metis and Hypre) and installs under <prefix>/mfem. See [INSTALL](INSTALL.md) for various other options

#### Download source and build
```shell
# Download source and build
$ git clone https://github.com/mfem/PyMFEM.git

# Build it from local source with MPI
$ pip install ./ -C"with-parallel=Yes" --verbose
```


# Cleaning
#### Cleaning
```shell
$ python setup.py clean --all # clean external dependencies + wrapper code

# Run test
```
#### Run test
```shell
cd test
python test_examples.py -serial

# For other configurations, see INSTALL.md
```

## Usage
This example (modified from `ex1.cpp`) solves the Poisson equation,
Expand Down Expand Up @@ -118,7 +119,9 @@ plt.show()


## License
PyMFEM is licensed under BSD-3.
PyMFEM is licensed under BSD-3 license. All new contributions
must be made under this license. See [License](LICENSE) for details.

Please refer the developers' web sites for the external libraries
* MFEM: https://mfem.org/
* Hypre: https://computing.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods
Expand Down
29 changes: 16 additions & 13 deletions docs/development_memo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ $ twine check dist/* # check syntax
$ python3 -m twine upload --repository testpypi dist/* # upload at testpypi
$ python3 -m twine upload dist/* # uploade to the official

### building step-by-step
pip download -i https://test.pypi.org/simple/ mfem
python3 setup.py install --prefix=~/sandbox --verbose --with-parallel

### test inside virtualenv
virtualenv env
source env/bin/activate
### check test PyPI distribution
pip3 install -i https://test.pypi.org/simple mfem==4.8.0rc10 -verbose

### test verious pip combinations
pip3 install -i https://test.pypi.org/simple mfem --no-binary mfem --verbose
pip3 install -i https://test.pypi.org/simple mfem --no-binary mfem --verbose --prefix=~/sandbox

virtualenv env
source env/bin/activate
pip3 install -i https://test.pypi.org/simple mfem --no-binary mfem --verbose
### building step-by-step
git clone https://github.com/mfem/PyMFEM.git
cd PyMFEM

1) build external libraries
pip install . -C"ext-only=Yes" --verbose
pip install . -C"with-parallel=Yes" -C"ext-only=Yes" --verbose

2) generate wrapper codes
pip install . -C"skip-ext=Yes" -C"swig=Yes" --verbose
pip install . -C"with-parallel=Yes" -C"skip-ext=Yes" -C"swig=Yes" --verbose

3) compile wrapper
pip install . -C"skip-ext=Yes" -C"skip-swig=Yes" --verbose
pip install . -C"with-parallel=Yes" -C"skip-ext=Yes" -C"skip-swig=Yes" --verbose

### Test linux binary build locally using docker (1) for Python <= 3.9

Expand Down
2 changes: 1 addition & 1 deletion mfem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ def debug_print(message):

print(message)

__version__ = '4.8.0rc10'
__version__ = '4.8.0'

3 changes: 3 additions & 0 deletions mfem/_par/array.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") array
%feature("autodoc", "1");

Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/arrays_by_name.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") arrays_by_name
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/attribute_sets.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") attribute_sets
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/auxiliary.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module (package="mfem._par") auxiliary

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/bilinearform.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par", directors="1") bilinearform
%{
#include "fem/bilinearform.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/bilininteg.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par", directors="1") bilininteg
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/blockmatrix.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") blockmatrix

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/blockoperator.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") blockoperator

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/blockvector.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") blockvector

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/bounds.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") bounds

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/coefficient.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
/*
coefficient.i
SWIG interface file for coefficient.hpp
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/common_functions.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") common_functions

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/communication.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") communication
%feature("autodoc", "1");

Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/complex_fem.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
/*

complex_fem.i
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/complex_operator.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
/*

complex_operator.i
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/constraints.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
/*

constraints.i
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/cpointers.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") cpointers

%include "../common/cpointers.i"
3 changes: 3 additions & 0 deletions mfem/_par/datacollection.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") datacollection
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/densemat.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
/*

densemat.i
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/device.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") device
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/dist_solver.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") dist_solver
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/doftrans.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") doftrans
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/element.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") element

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/eltrans.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module (package="mfem._par") eltrans

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/enzyme.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") enzyme
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/error.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") error
%{
#include <exception>
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/estimators.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") estimators
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/fe.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module (package="mfem._par") fe

%{
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/fe_base.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") fe_base
%{
#include "mfem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/fe_coll.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") fe_coll
%{
#include <iostream>
Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/fe_fixed_order.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//
// Copyright (c) 2020-2025, Princeton Plasma Physics Laboratory, All rights reserved.
//
%module(package="mfem._par") fe_fixed_order
%{
#include "mfem.hpp"
Expand Down
Loading