Skip to content

Commit

Permalink
Merge branch 'dokken/v0.5.0' into 'master'
Browse files Browse the repository at this point in the history
Bump versions

See merge request wp2/mpc!192
  • Loading branch information
jorgensd committed Aug 12, 2022
2 parents 8abd427 + 886ab85 commit c0cf4a0
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 103 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
container: dolfinx/dev-env
env:
SONAR_SCANNER_VERSION:
4.6.2.2472 # Find the latest version in at:
4.7.0.2747 # Find the latest version in at:
# https://github.com/SonarSource/sonar-scanner-cli/tags
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
Expand Down Expand Up @@ -54,16 +54,16 @@ jobs:
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Install FEniCS Python components
run: |
python3 -m pip install git+https://github.com/FEniCS/ufl.git
python3 -m pip install git+https://github.com/FEniCS/basix.git
python3 -m pip install git+https://github.com/FEniCS/ffcx.git
python3 -m pip install git+https://github.com/FEniCS/ufl.git@2022.2.0
python3 -m pip install git+https://github.com/FEniCS/basix.git@v0.5.0
python3 -m pip install git+https://github.com/FEniCS/ffcx.git@v0.5.0
- name: Get DOLFINx
uses: actions/checkout@v2
with:
path: ./dolfinx
repository: FEniCS/dolfinx
ref: main
ref: v0.5.0

- name: Configure C++ (dolfinx)
run: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test_mpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build:
if: "!(contains(github.event.head_commit.message, '[ci skip]') || contains(github.event.head_commit.message, '[skip ci]'))"
runs-on: ubuntu-20.04
container: dolfinx/dev-env
container: dolfinx/dev-env:v0.5.0

strategy:
matrix:
Expand All @@ -32,11 +32,11 @@ jobs:
OMPI_MCA_mpi_yield_when_idle: 1
OMPI_MCA_hwloc_base_binding_policy: none
HDF5_MPI: "ON"
HDF5_DIR: "/usr/lib/x86_64-linux-gnu/hdf5/mpich/"
HDF5_DIR: "/usr/local/"
MPC_BUILD_MODE: "Debug"
MPC_CMAKE_CXX_FLAGS: "-Wall -Werror -g -pedantic -Ofast -march=native"
PYTHONPATH: "/usr/local/dolfinx-${PETSC_TYPE}/lib/python3.8/dist-packages:/usr/local/lib"
LD_LIBRARY_PATH: "/usr/local/petsc/${PETSC_ARCH}/lib/:/usr/lib/x86_64-linux-gnu/hdf5/mpich/"
PYTHONPATH: "/usr/local/dolfinx-${PETSC_TYPE}/lib/python3.10/dist-packages:/usr/local/lib"
LD_LIBRARY_PATH: "/usr/local/petsc/${PETSC_ARCH}/lib/:/usr/local"

steps:
- uses: actions/checkout@v2
Expand All @@ -59,23 +59,23 @@ jobs:
with:
path: ./basix
repository: FEniCS/basix
ref: main
ref: v0.5.0

- name: Install UFL, Basix, FFCx
run: |
cmake -G Ninja -B build-basix -DCMAKE_BUILD_TYPE="Release" -S ./basix/cpp/
cmake --build build-basix --parallel 3
cmake --install build-basix
BUILD_TYPE="Release" pip3 install ./basix/python
python3 -m pip install git+https://github.com/FEniCS/ufl.git
python3 -m pip install git+https://github.com/FEniCS/ffcx.git
python3 -m pip install git+https://github.com/FEniCS/ufl.git@2022.2.0
python3 -m pip install git+https://github.com/FEniCS/ffcx.git@v0.5.0
- name: Get DOLFINx
uses: actions/checkout@v2
with:
path: ./dolfinx
repository: FEniCS/dolfinx
ref: main
ref: v0.5.0

- name: Configure C++ (dolfinx)
run: |
Expand Down
65 changes: 10 additions & 55 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
# quick-tests:
# stage: test
# tags:
# - docker
# except:
# - master
# - schedules
# image:
# name: dolfinx/dolfinx
# entrypoint: [""]
# parallel:
# matrix:
# - PETSC_TYPE: ["real", "complex"]

# variables:
# PETSC_ARCH: "linux-gnu-${PETSC_TYPE}-32"
# DOLFINX_DIR: "dolfinx-${PETSC_TYPE}"
# PYTHONPATH: "/usr/local/dolfinx-${PETSC_TYPE}/lib/python3.10/dist-packages:/usr/local/lib/"
# LD_LIBRARY_PATH: "/usr/local/petsc/${PETSC_ARCH}/lib/:/usr/local/lib/"
# MPC_CMAKE_CXX_FLAGS: "-Wall -Werror -g -pedantic -Ofast -march=native"
# MPC_CMAKE_BUILD_TYPE: "Release"

# before_script:
# - flake8 .
# - pip3 install mypy
# - cd python
# - python3 -m mypy . --exclude=build
# - cd ..
# - cmake -G Ninja -DCMAKE_BUILD_TYPE=${MPC_CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS="${MPC_CMAKE_CXX_FLAGS}" -B build-dir -S ./cpp
# - cmake --build build-dir --parallel 3
# - cmake --install build-dir
# - BUILD_TYPE=$MPC_CMAKE_BUILD_TYPE CXX_FLAGS="${MPC_CMAKE_CXX_FLAGS}" pip3 install ./python

# script:
# - python3 -m pytest python/tests -v
# - mpirun -n 2 python3 -m pytest python/tests
# - mpirun -n 3 python3 -m pytest python/tests
# - mpirun -n 4 python3 -m pytest python/tests

run-demos:
stage: test
only:
Expand All @@ -46,25 +7,25 @@ run-demos:
tags:
- docker
image:
name: dolfinx/dev-env
name: dolfinx/dev-env:v0.5.0
entrypoint: [""]
parallel:
matrix:
- PETSC_TYPE: ["real", "complex"]
variables:
PETSC_ARCH: "linux-gnu-${PETSC_TYPE}-32"
DOLFINX_DIR: "dolfinx-${PETSC_TYPE}"
BASIX_BRANCH: "main"
FFCX_BRANCH: "main"
UFL_BRANCH: "main"
DOLFINX_BRANCH: "main"
BASIX_BRANCH: "v0.5.0"
FFCX_BRANCH: "v0.5.0"
UFL_BRANCH: "2022.2.0"
DOLFINX_BRANCH: "v0.5.0"
PYTHONPATH: "/usr/local/dolfinx-${PETSC_TYPE}/lib/python3.10/dist-packages:/usr/local/lib/"
LD_LIBRARY_PATH: "/usr/local/petsc/${PETSC_ARCH}/lib/:/usr/local/lib/"
MPC_CMAKE_CXX_FLAGS: "-Wall -Werror -g -pedantic -Ofast -march=native"
MPC_BUILD_MODE: "Debug"
CC: "mpicc"
HDF5_MPI: "ON"
HDF5_DIR: "/usr/lib/x86_64-linux-gnu/hdf5/mpich/"
HDF5_DIR: "/usr/local"

before_script:
- flake8 python/
Expand All @@ -73,24 +34,18 @@ run-demos:
- python3 -m mypy . --exclude=build
- cd ..
- pip3 install --no-cache-dir --no-binary=h5py h5py
- git clone https://github.com/FEniCS/basix.git
- cd basix
- git checkout ${BASIX_BRANCH}
- cd ..
- git clone -b ${BASIX_BRANCH} --single-branch --depth 1 https://github.com/FEniCS/basix.git
- cmake -G Ninja -B build-basix -DCMAKE_BUILD_TYPE="Release" -S ./basix/cpp/
- cmake --build build-basix --parallel 3
- cmake --install build-basix
- BUILD_TYPE="Release" pip3 install ./basix/python
- python3 -m pip install git+https://github.com/FEniCS/ufl.git@${UFL_BRANCH}
- python3 -m pip install git+https://github.com/FEniCS/ffcx.git@${FFCX_BRANCH}
- git clone https://github.com/fenics/dolfinx.git
- cd dolfinx
- git checkout ${DOLFINX_BRANCH}
- cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" -B build-dolfinx -S ./cpp/
- git clone -b ${DOLFINX_BRANCH} --single-branch --depth 1 https://github.com/FEniCS/dolfinx.git && \
- cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" -B build-dolfinx -S ./dolfinx/cpp/
- cmake --build build-dolfinx
- cmake --install build-dolfinx
- BUILD_TYPE="Release" python3 -m pip -v install ./python/
- cd ..
- BUILD_TYPE="Release" python3 -m pip -v install ./dolfinx/python/
- cmake -G Ninja -B build-dir -DCMAKE_BUILD_TYPE=${MPC_BUILD_MODE} -DCMAKE_CXX_FLAGS="${MPC_CMAKE_CXX_FLAGS}" -S cpp/
- cmake --build build-dir --parallel 3
- cmake --install build-dir
Expand Down
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog

## main
- No changes

## v0.5.0 (12.08.2022)
- Minimal C++ standard is now [C++20](https://en.cppreference.com/w/cpp/20)
- Deprecating GMSH IO functions from `dolfinx_mpc.utils`, see: [DOLFINx PR: 2261](https://github.com/FEniCS/dolfinx/pull/2261) for details.
- Various API changes in DOLFINx relating to `dolfinx.common.IndexMap`.
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM dolfinx/dolfinx:v0.4.1 as dolfinx-mpc
FROM dolfinx/dolfinx:v0.5.0 as dolfinx-mpc
WORKDIR /tmp
# Set env variables
ENV HDF5_MPI="ON" \
CC=mpicc \
HDF5_DIR="/usr/lib/x86_64-linux-gnu/hdf5/mpich/"
HDF5_DIR="/usr/local"

# Install dolfinx_mpc
RUN git clone https://github.com/jorgensd/dolfinx_mpc.git && \
RUN git clone -b v0.5.0 --single-branch --depth 1 https://github.com/jorgensd/dolfinx_mpc.git && \
cd dolfinx_mpc && \
git checkout a6fa82ac0160ac1a5d91682c4c05dd63a5489f2c && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build-dir cpp/ && \
ninja install -j4 -C build-dir && \
pip3 install python/. --upgrade
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ These assemblers are written in C++, but have equivalent Python assemblers in th

# Installation

Version 0.4.1 is available as an docker image at [DockerHub](https://hub.docker.com/r/dokken92/dolfinx_mpc)
Version 0.5.0 is available as an docker image at [DockerHub](https://hub.docker.com/r/dokken92/dolfinx_mpc)
and can be ran using
```bash
docker run -ti -v $(pwd):/root/shared -w /root/shared dokken92/dolfinx_mpc:v0.4.1
docker run -ti -v $(pwd):/root/shared -w /root/shared dokken92/dolfinx_mpc:v0.5.0
```

To install the latest version (master branch), you need to install the latest release of [dolfinx](https://github.com/FEniCS/dolfinx).
Expand Down
6 changes: 3 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.10)

#------------------------------------------------------------------------------
# Set project name and version number
project(DOLFINX_MPC VERSION "0.4.1.0")
project(DOLFINX_MPC VERSION "0.5.0.0")

#------------------------------------------------------------------------------
# Set CMake options, see `cmake --help-policy CMP000x`
Expand Down Expand Up @@ -90,13 +90,13 @@ set_package_properties(UFC PROPERTIES TYPE REQUIRED
URL "https://github.com/fenics/ffcx")

# Check for required package DOLFINX
find_package(DOLFINX 0.4.2 REQUIRED)
find_package(DOLFINX 0.5.0 REQUIRED)
set_package_properties(DOLFINX PROPERTIES TYPE REQUIRED
DESCRIPTION "New generation Dynamic Object-oriented Library for - FINite element computation"
URL "https://github.com/FEniCS/dolfinx"
PURPOSE "Main dependency of library")

find_package(Basix 0.4.2 REQUIRED)
find_package(Basix 0.5.0 REQUIRED)
set_package_properties(basix PROPERTIES TYPE REQUIRED
DESCRIPTION "FEniCS tabulation library"
URL "https://github.com/fenics/basix")
Expand Down
2 changes: 1 addition & 1 deletion cpp/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ xt::xtensor<double, 3> dolfinx_mpc::evaluate_basis_functions(
}

// Return early if we have no points
std::array<std::size_t, 4> basis_shape
[[maybe_unused]] std::array<std::size_t, 4> basis_shape
= element->basix_element().tabulate_shape(0, x.shape(0));
assert(basis_shape[2] == space_dimension);
assert(basis_shape[3] == value_size);
Expand Down
2 changes: 1 addition & 1 deletion python/benchmarks/bench_contact_3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def over_plane(p0, p1, p2):
top_cube = over_plane(if_points[:, 0], if_points[:, 1], if_points[:, 2])
for facet in i_facets:
i_cells = facet_to_cell.links(facet)
assert(len(i_cells == 1))
assert len(i_cells == 1)
i_cell = i_cells[0]
if top_cube(cell_midpoints[i_cell]):
top_interface.append(facet)
Expand Down
2 changes: 1 addition & 1 deletion python/benchmarks/post_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def visualize_side_by_side(dofs):
ax.set_xticks(range(len(dofs)))
labels = dofs
ax.set_xticklabels(labels)
assert(np.allclose(procs, procs[0]))
assert np.allclose(procs, procs[0])

# Shrink current axis by 20%
box = ax.get_position()
Expand Down
4 changes: 2 additions & 2 deletions python/demos/create_and_export_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def over_line(p0, p1):
facet_to_cell = mesh.topology.connectivity(fdim, tdim)
for facet in i_facets:
i_cells = facet_to_cell.links(facet)
assert(len(i_cells == 1))
assert len(i_cells == 1)
i_cell = i_cells[0]
if top_cube(cell_midpoints[i_cell]):
top_interface.append(facet)
Expand Down Expand Up @@ -541,7 +541,7 @@ def over_plane(p0, p1, p2):
top_cube = over_plane(if_points[:, 0], if_points[:, 1], if_points[:, 2])
for facet in i_facets:
i_cells = facet_to_cell.links(facet)
assert(len(i_cells == 1))
assert len(i_cells) == 1
i_cell = i_cells[0]
if top_cube(cell_midpoints[i_cell]):
top_interface.append(facet)
Expand Down
2 changes: 1 addition & 1 deletion python/demos/demo_elasticity_disconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
r2, r2_tag = 0.8, 3
outer_tag = 1
inner_tag = 2
assert(r0 < r1 and r1 < r2)
assert r0 < r1 and r1 < r2


gmsh.initialize()
Expand Down
2 changes: 1 addition & 1 deletion python/demos/demo_periodic3d_topological.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def periodic_relation(x):
old_local = u_out.x.map.size_local * u_out.x.bs
old_ghosts = u_out.x.map.num_ghosts * u_out.x.bs
mpc_local = u_h.x.map.size_local * u_h.x.bs
assert(old_local == mpc_local)
assert old_local == mpc_local
u_out.x.array[:old_local + old_ghosts] = u_h.x.array[:mpc_local + old_ghosts]
u_out.name = "u_" + ext
fname = f"results/demo_periodic3d_{ext}.bp"
Expand Down
2 changes: 1 addition & 1 deletion python/dolfinx_mpc/assemble_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def assemble_matrix(form: _fem.FormMetaClass,
The assembled bi-linear form
"""
if not isinstance(constraint, Sequence):
assert(form.function_spaces[0] == form.function_spaces[1])
assert form.function_spaces[0] == form.function_spaces[1]
constraint = (constraint, constraint)

# Generate matrix with MPC sparsity pattern
Expand Down
2 changes: 1 addition & 1 deletion python/dolfinx_mpc/multipointconstraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def add_constraint(self, V: _fem.FunctionSpace, slaves: npt.NDArray[numpy.int32]
masters_of_owned_slave[i] = masters[offsets[i]:offsets[i+1]]
"""
assert(V == self.V)
assert V == self.V
self._already_finalized()

if len(slaves) > 0:
Expand Down
14 changes: 7 additions & 7 deletions python/dolfinx_mpc/numba/assemble_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def add_diagonal(A: int, dofs: npt.NDArray[numpy.int32], diagval: _PETSc.ScalarT
for dof in dofs:
dof_list[0] = dof
ierr_loc = set_values_local(A, 1, ffi_fb(dof_list), 1, ffi_fb(dof_list), ffi_fb(dof_value), mode)
assert(ierr_loc == 0)
assert ierr_loc == 0
sink(dof_list, dof_value)


Expand Down Expand Up @@ -266,7 +266,7 @@ def assemble_slave_cells(A: int,
# Insert local contribution
ierr_loc = set_values_local(A, block_size * num_dofs_per_element, ffi_fb(local_dofs),
block_size * num_dofs_per_element, ffi_fb(local_dofs), ffi_fb(A_contribution), mode)
assert(ierr_loc == 0)
assert ierr_loc == 0

sink(A_contribution, local_dofs)

Expand Down Expand Up @@ -342,14 +342,14 @@ def modify_mpc_cell(A: int, num_dofs: int, block_size: int,
mpc_dofs[j * block_size + k] = local_blocks[j] * block_size + k
mpc_dofs[local_index] = master
ierr_row = set_values_local(A, block_size * num_dofs, ffi_fb(mpc_dofs), 1, ffi_fb(m0), ffi_fb(Arow), mode)
assert(ierr_row == 0)
assert ierr_row == 0

# Add slave row to master row
ierr_col = set_values_local(A, 1, ffi_fb(m0), block_size * num_dofs, ffi_fb(mpc_dofs), ffi_fb(Acol), mode)
assert(ierr_col == 0)
assert ierr_col == 0

ierr_master = set_values_local(A, 1, ffi_fb(m0), 1, ffi_fb(m0), ffi_fb(Am0m1), mode)
assert(ierr_master == 0)
assert ierr_master == 0

# Add contributions for other masters relating to slaves on the given cell
for j in range(num_flattened_masters):
Expand All @@ -361,7 +361,7 @@ def modify_mpc_cell(A: int, num_dofs: int, block_size: int,
m1[0] = other_master
Am0m1[0, 0] = coeff * other_coeff * Ae_original[local_index, other_local_index]
ierr_other_masters = set_values_local(A, 1, ffi_fb(m0), 1, ffi_fb(m1), ffi_fb(Am0m1), mode)
assert(ierr_other_masters == 0)
assert ierr_other_masters == 0

sink(Arow, Acol, Am0m1, m0, m1, mpc_dofs)

Expand Down Expand Up @@ -450,6 +450,6 @@ def assemble_exterior_slave_facets(A: int, kernel: cffi.FFI,
ierr_loc = set_values_local(A, block_size * num_dofs_per_element, ffi.from_buffer(local_dofs),
block_size * num_dofs_per_element, ffi.from_buffer(local_dofs),
ffi.from_buffer(A_contribution), mode)
assert(ierr_loc == 0)
assert ierr_loc == 0

sink(A_contribution, local_dofs)
Loading

0 comments on commit c0cf4a0

Please sign in to comment.