Skip to content
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

Bump versions and destroy petsc objects #132

Merged
merged 3 commits into from
Oct 15, 2024
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
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors:
given-names: Jørgen Schartum
orcid: https://orcid.org/0000-0001-6489-8858
title: "DOLFINx-MPC"
version: 0.8.0
date-released: 2023-04-25
version: 0.9.0
date-released: 2024-10-15
4 changes: 2 additions & 2 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.21)

#------------------------------------------------------------------------------
# Set project name and version number
project(DOLFINX_MPC VERSION "0.8.0.0")
project(DOLFINX_MPC VERSION "0.9.0.0")

#------------------------------------------------------------------------------
# General configuration
Expand All @@ -23,7 +23,7 @@ option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Add paths to linker search and install
add_feature_info(CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INSTALL_RPATH_USE_LINK_PATH "Add paths to linker search and installed rpath.")

# Check for required package DOLFINX
find_package(DOLFINX 0.8.0.0 REQUIRED)
find_package(DOLFINX 0.9.0.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"
Expand Down
2 changes: 2 additions & 0 deletions python/benchmarks/bench_contact_3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ def sigma(v):
if comm.rank == 0:
print(op, num_calls, avg_time, min_time, max_time, file=results_file)
list_timings(MPI.COMM_WORLD, [TimingType.wall])
b.destroy()
solver.destroy()


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions python/demos/demo_contact_2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def left_corner(x):
uh_numpy = K @ d
assert np.allclose(uh_numpy, u_mpc, rtol=tol, atol=tol)
L_org.destroy()
A_org.destroy()


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions python/demos/demo_elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def l2b(li):
l2g = dofmap.index_map.local_to_global(np.arange(num_local, dtype=np.int32))
l_index = np.flatnonzero(l2g == in_data[0] // bs)[0]
print("Master*Coeff (on other proc): {0:.5e}".format(u_h.x.array[l_index * bs + in_data[0] % bs] * in_data[1]))
L_org.destroy()
solver.destroy()


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions python/dolfinx_mpc/utils/mpc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def tangential_proj(u, n):
solver.solve(b, nh.x.petsc_vec)
nh.x.petsc_vec.ghostUpdate(addv=PETSc.InsertMode.INSERT, mode=PETSc.ScatterMode.FORWARD) # type: ignore
timer.stop()
solver.destroy()
b.destroy()
return nh


Expand Down
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "dolfinx_mpc"
version = "0.8.0.dev0"
version = "0.9.0"
description = "DOLFINx_MPC Python interface"
readme = "README.md"
requires-python = ">=3.8.0"
Expand All @@ -24,7 +24,7 @@ dependencies = [
"cffi",
"petsc4py",
"mpi4py",
"fenics-dolfinx>0.8.0",
"fenics-dolfinx>=0.9.0",
]

[project.optional-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions python/tests/test_cube_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,5 +298,7 @@ def sigma(v):
atol = 1000 * np.finfo(default_scalar_type).resolution
nt.assert_allclose(uh_numpy, u_mpc, atol=atol)
L_org.destroy()
b.destroy()
solver.destroy()

list_timings(comm, [TimingType.wall])
1 change: 0 additions & 1 deletion python/tests/test_integration_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def l2b(li):
)
solver.destroy()
b.destroy()
del uh
A.destroy()
pc.destroy()
L_org.destroy()
Expand Down
3 changes: 3 additions & 0 deletions python/tests/test_lifting.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ def l2b(li):
nt.assert_allclose(uh_numpy, u_mpc, rtol=1e-5, atol=1e-8)

list_timings(comm, [TimingType.wall])
L_org.destroy()
b.destroy()
solver.destroy()
2 changes: 2 additions & 0 deletions python/tests/test_linear_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def PeriodicBoundary(x):
rtol=500 * np.finfo(default_scalar_type).resolution,
atol=500 * np.finfo(default_scalar_type).resolution,
)
L_org.destroy()
A_org.destroy()

else:
uh = fem.Function(V)
Expand Down
4 changes: 4 additions & 0 deletions python/tests/test_surface_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def l2b(li):

L_org.destroy()
b.destroy()
A_org.destroy()
solver.destroy()
list_timings(comm, [TimingType.wall])


Expand Down Expand Up @@ -213,4 +215,6 @@ def l2b(li):
dolfinx_mpc.utils.compare_mpc_rhs(L_org, b, mpc, root=root)
L_org.destroy()
b.destroy()
A_org.destroy()
A.destroy()
list_timings(comm, [TimingType.wall])
2 changes: 2 additions & 0 deletions python/tests/test_vector_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ def l2b(li):
dolfinx_mpc.utils.compare_mpc_rhs(L_org, b, mpc, root=root)

list_timings(comm, [TimingType.wall])
b.destroy()
L_org.destroy()
1 change: 1 addition & 0 deletions python/tests/test_vector_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,5 @@ def l2b(li):

b.destroy()
L_org.destroy()
solver.destroy()
list_timings(comm, [TimingType.wall])