Skip to content

Update_htool #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 67 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
634634d
update CI
PierreMarchand20 Jun 12, 2023
03ab7e7
update with new htool interface
PierreMarchand20 Jul 13, 2023
73f29ac
update
PierreMarchand20 Sep 7, 2023
8511c37
test CI
PierreMarchand20 Sep 8, 2023
5653623
update
PierreMarchand20 Sep 8, 2023
9550c37
update
PierreMarchand20 Sep 8, 2023
a7bf0b4
update
PierreMarchand20 Sep 8, 2023
0b0effe
update
PierreMarchand20 Sep 8, 2023
c2244a1
formatting
PierreMarchand20 Sep 8, 2023
8f12867
update CI
PierreMarchand20 Sep 8, 2023
2f528bb
update
PierreMarchand20 Sep 10, 2023
b7cc753
add local_to_global_numbering
PierreMarchand20 Sep 12, 2023
d3ad7f1
fix type for DDM solver builder
cgcgcg Sep 12, 2023
854c700
fix segfault from htool
PierreMarchand20 Sep 15, 2023
beaf08b
update
PierreMarchand20 Sep 15, 2023
958fea9
change output functions for hmatrix
PierreMarchand20 Nov 14, 2023
a8faa59
improve test for solvers
PierreMarchand20 Nov 14, 2023
9121a5a
update
PierreMarchand20 Nov 14, 2023
e7f50e6
fixup
PierreMarchand20 Nov 15, 2023
fc946fa
update with get_submat_hmatrix
PierreMarchand20 Nov 16, 2023
cd4ee5c
update with ddm utility
PierreMarchand20 Nov 29, 2023
65a5847
add coarse_space interface
PierreMarchand20 Jan 29, 2024
071789b
fixup
PierreMarchand20 Jan 30, 2024
48212c7
fixup format
PierreMarchand20 Jan 30, 2024
97d37cb
fixup format
PierreMarchand20 Jan 30, 2024
30b6fe7
fixup
PierreMarchand20 Jan 30, 2024
d010a5a
fixup
PierreMarchand20 Jan 30, 2024
b9ad2c5
fixup
PierreMarchand20 Jan 30, 2024
c1e66d6
fixup...
PierreMarchand20 Jan 30, 2024
82272b9
...
PierreMarchand20 Jan 30, 2024
f5276c5
update htool
PierreMarchand20 Jan 30, 2024
ca3f58b
fixup
PierreMarchand20 Jan 31, 2024
2207e6c
update htool 0.9.0
PierreMarchand20 Aug 7, 2024
2067be8
fixup
PierreMarchand20 Aug 7, 2024
738da88
fixup
PierreMarchand20 Aug 7, 2024
140adb5
improve coverage
PierreMarchand20 Aug 8, 2024
948d7ed
fix coverage
PierreMarchand20 Aug 9, 2024
213a00d
fix dense block generator
PierreMarchand20 Aug 9, 2024
d2eb4f8
improve coverage
PierreMarchand20 Aug 9, 2024
4707f97
update
PierreMarchand20 Sep 24, 2024
18517a3
update
PierreMarchand20 Oct 15, 2024
eb6c05d
update
PierreMarchand20 Oct 16, 2024
04eb014
fixup format
PierreMarchand20 Oct 16, 2024
cf3ae63
update gitignore
PierreMarchand20 Oct 16, 2024
fb6f9aa
fixup
PierreMarchand20 Oct 17, 2024
5828fbf
update
PierreMarchand20 Oct 28, 2024
eac2611
fixup
PierreMarchand20 Oct 28, 2024
cd764b9
fixup
PierreMarchand20 Oct 28, 2024
3c57c3d
fix spurious copy
PierreMarchand20 Oct 30, 2024
c250626
fixup
PierreMarchand20 Nov 5, 2024
03c57b1
bump fix from htool and add clear_data to virtual lrmat generator
PierreMarchand20 Nov 9, 2024
6056731
fixup
PierreMarchand20 Nov 9, 2024
2d22db3
small fixes + improve mpi4py cmake search
PierreMarchand20 Feb 3, 2025
1097860
Allow to capture HPDDM output from Python
cgcgcg Jan 30, 2025
87c527b
bring back dense preconditioner
PierreMarchand20 Feb 3, 2025
5675a46
add option to disable copy in VirtualLowRankGeneratorPython
PierreMarchand20 Feb 3, 2025
c628921
fixup
PierreMarchand20 Feb 3, 2025
130f774
bump hpddm fix
PierreMarchand20 Feb 4, 2025
1dde4ed
fix cpp format
PierreMarchand20 Feb 4, 2025
29ef962
expand cluster_builder and hmatrix interface.
PierreMarchand20 Feb 12, 2025
775b7fb
fix new create_cluster_tree API
PierreMarchand20 Feb 12, 2025
173ed96
change cluster tree to cluster tree builder, and hmatrix builder to h…
PierreMarchand20 Mar 5, 2025
a843c2c
add VirtualGeneoCoarseSpaceBuilder
PierreMarchand20 Mar 17, 2025
91cfc5d
bump fixup
PierreMarchand20 Mar 17, 2025
8c5023a
update clustering and fix initialization error in local gevp
PierreMarchand20 May 19, 2025
cf31c73
update htool
PierreMarchand20 May 20, 2025
6fd95a0
bump fix for non-uniform coarse spaces
PierreMarchand20 May 26, 2025
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
103 changes: 67 additions & 36 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ jobs:
- name: "Ubuntu OpenMPI g++"
CC_COMPILER: gcc
CXX_COMPILER: g++
container: "ubuntu_openmpi"
container: "ubuntu_gcc_openmpi"
MPIEXEC_PREFLAGS: "--allow-run-as-root --oversubscribe"
USE_SANITIZER: ""
CMAKE_BUILD_TYPE: Release
DOCKER_OPTIONS: " "
DOCKER_OPTIONS: "--cap-add SYS_PTRACE"
CODE_COVERAGE: "OFF"

- name: "Ubuntu OpenMPI clang++"
CC_COMPILER: clang
CXX_COMPILER: clang++
container: "ubuntu_openmpi"
container: "ubuntu_clang_openmpi"
MPIEXEC_PREFLAGS: "--allow-run-as-root --oversubscribe"
USE_SANITIZER: ""
CMAKE_BUILD_TYPE: Release
DOCKER_OPTIONS: " "
DOCKER_OPTIONS: "--cap-add SYS_PTRACE"
CODE_COVERAGE: "OFF"

- name: "Ubuntu MPICH g++"
CC_COMPILER: gcc
CXX_COMPILER: g++
container: "ubuntu_mpich"
container: "ubuntu_gcc_mpich"
MPIEXEC_PREFLAGS: ""
CMAKE_BUILD_TYPE: Debug
DOCKER_OPTIONS: " "
Expand All @@ -58,35 +58,37 @@ jobs:
- name: "Ubuntu MPICH clang++"
CC_COMPILER: clang
CXX_COMPILER: clang++
container: "ubuntu_mpich"
container: "ubuntu_clang_mpich"
MPIEXEC_PREFLAGS: ""
CMAKE_BUILD_TYPE: Release
DOCKER_OPTIONS: " "
CODE_COVERAGE: "OFF"

# Hangs on github
# - name: "Debian OpenMPI g++"
# CC_COMPILER: gcc
# CXX_COMPILER: g++
# container: "debian_openmpi"
# MPIEXEC_PREFLAGS: "--allow-run-as-root --oversubscribe --mca btl_vader_single_copy_mechanism none"
# USE_SANITIZER: ""
# CMAKE_BUILD_TYPE: Debug
# DOCKER_OPTIONS: "--cap-add SYS_PTRACE"

# - name: "Debian OpenMPI clang++"
# CC_COMPILER: clang
# CXX_COMPILER: clang++
# container: "debian_openmpi"
# MPIEXEC_PREFLAGS: "--allow-run-as-root --oversubscribe --mca btl_vader_single_copy_mechanism none"
# USE_SANITIZER: ""
# CMAKE_BUILD_TYPE: Debug
# DOCKER_OPTIONS: "--cap-add SYS_PTRACE"
- name: "Debian OpenMPI g++"
CC_COMPILER: gcc
CXX_COMPILER: g++
container: "debian_gcc_openmpi"
MPIEXEC_PREFLAGS: "--allow-run-as-root --oversubscribe"
USE_SANITIZER: ""
CMAKE_BUILD_TYPE: Release
DOCKER_OPTIONS: "--cap-add SYS_PTRACE"
CODE_COVERAGE: "OFF"

- name: "Debian OpenMPI clang++"
CC_COMPILER: clang
CXX_COMPILER: clang++
container: "debian_clang_openmpi"
MPIEXEC_PREFLAGS: "--allow-run-as-root --oversubscribe"
USE_SANITIZER: ""
CMAKE_BUILD_TYPE: Release
DOCKER_OPTIONS: "--cap-add SYS_PTRACE"
CODE_COVERAGE: "OFF"

- name: "Debian MPICH g++"
CC_COMPILER: gcc
CXX_COMPILER: g++
container: "debian_mpich"
container: "debian_gcc_mpich"
MPIEXEC_PREFLAGS: ""
CMAKE_BUILD_TYPE: Release
DOCKER_OPTIONS: " "
Expand All @@ -95,7 +97,7 @@ jobs:
- name: "Debian MPICH clang++"
CC_COMPILER: clang
CXX_COMPILER: clang++
container: "debian_mpich"
container: "debian_clang_mpich"
MPIEXEC_PREFLAGS: ""
CMAKE_BUILD_TYPE: Release
DOCKER_OPTIONS: " "
Expand All @@ -115,46 +117,75 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checkout htool-python
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: "true"

- name: Activate virtualenv
run: |
. /usr/local/share/venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV

- name: Build package in release
if: matrix.CODE_COVERAGE == 'OFF'
run: |
pip3 install . --user
python3 -m pip install .[dev]

- name: Build package in debug for coverage
if: matrix.CODE_COVERAGE == 'ON'
run: |
mkdir build && cd build
pip3 install numpy scipy matplotlib
python3 -m pip install numpy matplotlib ruff pytest mpi4py scipy
CC=${{ matrix.CC_COMPILER }} CXX=${{ matrix.CXX_COMPILER }} cmake -DUSE_SANITIZER=${{ matrix.USE_SANITIZER }} -DCMAKE_BUILD_TYPE=${{ matrix.CMAKE_BUILD_TYPE }} -DCODE_COVERAGE=${{ matrix.CODE_COVERAGE }} ../
make

- name: Run tests
run: |
export PYTHONPATH="$PWD/build"
mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} pytest tests
mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} pytest tests
mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} pytest tests
mpirun -np 1 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests
mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests
mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests
mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests

- name: Check format
if: matrix.CODE_COVERAGE == 'ON'
# https://github.com/actions/checkout/pull/762
run: |
git config --global --add safe.directory `pwd`
cd build
make format
make cmake-format
git diff --exit-code

- name: Check with ruff
run: |
ruff check example/ tests/

- name: Generate coverage reports
if: matrix.CODE_COVERAGE == 'ON'
run: |
lcov --capture --base-directory ./ --directory build/ --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/hpddm/*' '*/pybind11/*' '*/lib/htool/*' --output-file coverage.info
lcov --ignore-errors mismatch --capture --base-directory ./ --directory build/ --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/hpddm/*' '*/pybind11/*' '*/lib/htool/*' --output-file ../coverage.info

- name: Upload coverage to Codecov
- uses: actions/upload-artifact@v4
with:
path: coverage.info
if-no-files-found: error
if: matrix.CODE_COVERAGE == 'ON'
uses: codecov/codecov-action@v2

coverage:
runs-on: ubuntu-latest
if: ${{ success() }}
needs: [ linux ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
file: coverage.info
fail_ci_if_error: true
file: ./coverage.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
37 changes: 36 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
build*
__pycache__

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "lib/pybind11"]
path = lib/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "lib/htool_generate_data_test"]
path = lib/htool_generate_data_test
url = https://github.com/PierreMarchand20/htool_generate_data_test.git
34 changes: 25 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ else()
LANGUAGES CXX)
endif()

# To force c++11
# To force c++14
if(${CMAKE_VERSION} VERSION_LESS 3.1)
add_compile_options(-std=c++11)
add_compile_options(-std=c++14)
elseif(${CMAKE_VERSION} VERSION_LESS 3.6.3 AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
add_compile_options(-std=c++11)
add_compile_options(-std=c++14)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

Expand Down Expand Up @@ -54,15 +54,22 @@ find_package(OpenMP)

# BLAS
find_package(BLAS REQUIRED)
message("-- Found Blas implementation:" "${BLAS_LIBRARIES}")
message("-- Blas implementation:" "${BLAS_LIBRARIES}")

# LAPACK
find_package(LAPACK)
message("-- Found Lapack:" "${LAPACK_LIBRARIES}")
message("-- Lapack implementation:" "${LAPACK_LIBRARIES}")

# MPI4PY
find_package(
Python
COMPONENTS Interpreter Development
REQUIRED)
message("-- Python executable:" "${Python_EXECUTABLE}")

# MPI4PY
find_package(MPI4PY REQUIRED)
message("-- Found MPI4PY:" "${MPI4PY_INCLUDE_DIR}")
message("-- MPI4PY include dir:" "${MPI4PY_INCLUDE_DIR}")

add_subdirectory(lib/pybind11)

Expand All @@ -78,11 +85,20 @@ target_include_directories(
${MPI4PY_INCLUDE_DIR})
target_link_libraries(Htool PRIVATE ${MPI_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${ARPACK_LIBRARIES} ${OpenMP_CXX_LIBRARIES})

target_compile_definitions(Htool PRIVATE "-DPYTHON_INTERFACE" "-DWITH_HPDDM")
if("${BLA_VENDOR}" STREQUAL "Intel10_32"
OR "${BLA_VENDOR}" STREQUAL "Intel10_64lp"
OR "${BLA_VENDOR}" STREQUAL "Intel10_64lp_seq"
OR "${BLA_VENDOR}" STREQUAL "Intel10_64ilp"
OR "${BLA_VENDOR}" STREQUAL "Intel10_64ilp_seq"
OR "${BLA_VENDOR}" STREQUAL "Intel10_64_dyn")
target_compile_definitions(htool PRIVATE "-DHPDDM_MKL -DHTOOL_MKL")
endif()

target_compile_definitions(Htool PRIVATE "-DHTOOL_WITH_PYTHON_INTERFACE" "-DHTOOL_WITH_HPDDM")

if(CODE_COVERAGE AND (CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
target_compile_options(Htool PRIVATE -fprofile-arcs -ftest-coverage)
target_link_libraries(Htool PRIVATE gcov)
endif()

# target_compile_features(Htool INTERFACE cxx_std_11)
# target_compile_features(Htool INTERFACE cxx_std_14)
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ In the folder of this repository, do:
pip install .
```

In case you need to pass cmake variables, you can use

```bash
CMAKE_ARGS="-DCMAKE_VAR=VALUE1 -DCMAKE_VAR_2=VALUE2" pip install .
```

### Embedding Htool in your code

We mostly refer to `smallest_example.py` in the `examples` folder to see how to use Htool.
Expand All @@ -51,19 +57,18 @@ A function that generates the coefficients must be provided to Htool. To do so,

## Who is behind Htool?

If you need help or have questions regarding Htool, feel free to contact [Pierre Marchand](https://www.ljll.math.upmc.fr/marchandp/) and Pierre-Henri Tournier.
If you need help or have questions regarding Htool, feel free to contact [Pierre Marchand](https://pmarchand.pages.math.cnrs.fr) and Pierre-Henri Tournier.

## Acknowledgements

[ANR NonlocalDD](https://www.ljll.math.upmc.fr/~claeys/nonlocaldd/index.html), (grant ANR-15-CE23-0017-01), France
ANR NonlocalDD, (grant ANR-15-CE23-0017-01), France
[Inria](http://www.inria.fr/en/) Paris, France
[Laboratoire Jacques-Louis Lions](https://www.ljll.math.upmc.fr/en/) Paris, France
[Laboratoire Jacques-Louis Lions](https://www.ljll.fr) Paris, France

## Collaborators/contributors

[Matthieu Ancellin](https://ancell.in)
[Xavier Claeys](https://www.ljll.math.upmc.fr/~claeys/)
[Pierre Jolivet](http://jolivet.perso.enseeiht.fr/)
[Frédéric Nataf](https://www.ljll.math.upmc.fr/nataf/)
[Xavier Claeys](https://claeys.pages.math.cnrs.fr)
[Pierre Jolivet](https://joliv.et)
[Frédéric Nataf](https://www.ljll.fr/nataf/)

![ANR NonlocalDD](figures/anr_nonlocaldd.png)
52 changes: 29 additions & 23 deletions cmake_modules/FindMPI4PY.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,35 @@

# https://compacc.fnal.gov/projects/repositories/entry/synergia2/CMake/FindMPI4PY.cmake?rev=c147eafb60728606af4fe7b1b161a660df142e9a

if(NOT MPI4PY_INCLUDE_DIR)
execute_process(COMMAND
"python3" "-c" "import mpi4py; print(mpi4py.get_include())"
OUTPUT_VARIABLE MPI4PY_INCLUDE_DIR
RESULT_VARIABLE MPI4PY_COMMAND_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(MPI4PY_COMMAND_RESULT)
message("jfa: mpi4py not found")
if(NOT Python_EXECUTABLE)
find_package(
Python
COMPONENTS Interpreter Development
REQUIRED)
endif(NOT Python_EXECUTABLE)
execute_process(COMMAND "which" "${Python_EXECUTABLE}")
execute_process(
COMMAND "${Python_EXECUTABLE}" "-c" "import mpi4py; print(mpi4py.get_include())"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE MPI4PY_INCLUDE_DIR
RESULT_VARIABLE MPI4PY_COMMAND_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(MPI4PY_COMMAND_RESULT)
message("jfa: mpi4py not found")
set(MPI4PY_FOUND FALSE)
else(MPI4PY_COMMAND_RESULT)
if(MPI4PY_INCLUDE_DIR MATCHES "Traceback")
message("jfa: mpi4py matches traceback")
## Did not successfully include MPI4PY
set(MPI4PY_FOUND FALSE)
else(MPI4PY_COMMAND_RESULT)
if (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
message("jfa: mpi4py matches traceback")
## Did not successfully include MPI4PY
set(MPI4PY_FOUND FALSE)
else (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
## successful
set(MPI4PY_FOUND TRUE)
set(MPI4PY_INCLUDE_DIR ${MPI4PY_INCLUDE_DIR} CACHE STRING "mpi4py include path")
endif (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
endif(MPI4PY_COMMAND_RESULT)
else(NOT MPI4PY_INCLUDE_DIR)
set(MPI4PY_FOUND TRUE)
endif(NOT MPI4PY_INCLUDE_DIR)
else(MPI4PY_INCLUDE_DIR MATCHES "Traceback")
## successful
set(MPI4PY_FOUND TRUE)
set(MPI4PY_INCLUDE_DIR
${MPI4PY_INCLUDE_DIR}
CACHE STRING "mpi4py include path")
endif(MPI4PY_INCLUDE_DIR MATCHES "Traceback")
endif(MPI4PY_COMMAND_RESULT)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPI4PY DEFAULT_MSG MPI4PY_INCLUDE_DIR)
find_package_handle_standard_args(MPI4PY DEFAULT_MSG MPI4PY_INCLUDE_DIR)
Loading