Skip to content

Commit 4546f6a

Browse files
authored
Bump versions and destroy petsc objects (#132)
* Bump versions Add destruction of PETSc objects to tests, demos and benchmarks * Fix date * Ruff formatting
1 parent 0f75163 commit 4546f6a

14 files changed

+27
-7
lines changed

CITATION.cff

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ authors:
55
given-names: Jørgen Schartum
66
orcid: https://orcid.org/0000-0001-6489-8858
77
title: "DOLFINx-MPC"
8-
version: 0.8.0
9-
date-released: 2023-04-25
8+
version: 0.9.0
9+
date-released: 2024-10-15

cpp/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.21)
44

55
#------------------------------------------------------------------------------
66
# Set project name and version number
7-
project(DOLFINX_MPC VERSION "0.8.0.0")
7+
project(DOLFINX_MPC VERSION "0.9.0.0")
88

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

2525
# Check for required package DOLFINX
26-
find_package(DOLFINX 0.8.0.0 REQUIRED)
26+
find_package(DOLFINX 0.9.0.0 REQUIRED)
2727
set_package_properties(DOLFINX PROPERTIES TYPE REQUIRED
2828
DESCRIPTION "New generation Dynamic Object-oriented Library for - FINite element computation"
2929
URL "https://github.com/FEniCS/dolfinx"

python/benchmarks/bench_contact_3D.py

+2
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ def sigma(v):
372372
if comm.rank == 0:
373373
print(op, num_calls, avg_time, min_time, max_time, file=results_file)
374374
list_timings(MPI.COMM_WORLD, [TimingType.wall])
375+
b.destroy()
376+
solver.destroy()
375377

376378

377379
if __name__ == "__main__":

python/demos/demo_contact_2D.py

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def left_corner(x):
210210
uh_numpy = K @ d
211211
assert np.allclose(uh_numpy, u_mpc, rtol=tol, atol=tol)
212212
L_org.destroy()
213+
A_org.destroy()
213214

214215

215216
if __name__ == "__main__":

python/demos/demo_elasticity.py

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def l2b(li):
173173
l2g = dofmap.index_map.local_to_global(np.arange(num_local, dtype=np.int32))
174174
l_index = np.flatnonzero(l2g == in_data[0] // bs)[0]
175175
print("Master*Coeff (on other proc): {0:.5e}".format(u_h.x.array[l_index * bs + in_data[0] % bs] * in_data[1]))
176+
L_org.destroy()
177+
solver.destroy()
176178

177179

178180
if __name__ == "__main__":

python/dolfinx_mpc/utils/mpc_utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ def tangential_proj(u, n):
143143
solver.solve(b, nh.x.petsc_vec)
144144
nh.x.petsc_vec.ghostUpdate(addv=PETSc.InsertMode.INSERT, mode=PETSc.ScatterMode.FORWARD) # type: ignore
145145
timer.stop()
146+
solver.destroy()
147+
b.destroy()
146148
return nh
147149

148150

python/pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ build-backend = "scikit_build_core.build"
1313

1414
[project]
1515
name = "dolfinx_mpc"
16-
version = "0.8.0.dev0"
16+
version = "0.9.0"
1717
description = "DOLFINx_MPC Python interface"
1818
readme = "README.md"
1919
requires-python = ">=3.8.0"
@@ -24,7 +24,7 @@ dependencies = [
2424
"cffi",
2525
"petsc4py",
2626
"mpi4py",
27-
"fenics-dolfinx>0.8.0",
27+
"fenics-dolfinx>=0.9.0",
2828
]
2929

3030
[project.optional-dependencies]

python/tests/test_cube_contact.py

+2
Original file line numberDiff line numberDiff line change
@@ -298,5 +298,7 @@ def sigma(v):
298298
atol = 1000 * np.finfo(default_scalar_type).resolution
299299
nt.assert_allclose(uh_numpy, u_mpc, atol=atol)
300300
L_org.destroy()
301+
b.destroy()
302+
solver.destroy()
301303

302304
list_timings(comm, [TimingType.wall])

python/tests/test_integration_domains.py

-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def l2b(li):
127127
)
128128
solver.destroy()
129129
b.destroy()
130-
del uh
131130
A.destroy()
132131
pc.destroy()
133132
L_org.destroy()

python/tests/test_lifting.py

+3
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ def l2b(li):
118118
nt.assert_allclose(uh_numpy, u_mpc, rtol=1e-5, atol=1e-8)
119119

120120
list_timings(comm, [TimingType.wall])
121+
L_org.destroy()
122+
b.destroy()
123+
solver.destroy()

python/tests/test_linear_problem.py

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ def PeriodicBoundary(x):
9797
rtol=500 * np.finfo(default_scalar_type).resolution,
9898
atol=500 * np.finfo(default_scalar_type).resolution,
9999
)
100+
L_org.destroy()
101+
A_org.destroy()
100102

101103
else:
102104
uh = fem.Function(V)

python/tests/test_surface_integral.py

+4
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def l2b(li):
140140

141141
L_org.destroy()
142142
b.destroy()
143+
A_org.destroy()
144+
solver.destroy()
143145
list_timings(comm, [TimingType.wall])
144146

145147

@@ -213,4 +215,6 @@ def l2b(li):
213215
dolfinx_mpc.utils.compare_mpc_rhs(L_org, b, mpc, root=root)
214216
L_org.destroy()
215217
b.destroy()
218+
A_org.destroy()
219+
A.destroy()
216220
list_timings(comm, [TimingType.wall])

python/tests/test_vector_assembly.py

+2
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,5 @@ def l2b(li):
6060
dolfinx_mpc.utils.compare_mpc_rhs(L_org, b, mpc, root=root)
6161

6262
list_timings(comm, [TimingType.wall])
63+
b.destroy()
64+
L_org.destroy()

python/tests/test_vector_poisson.py

+1
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,5 @@ def l2b(li):
130130

131131
b.destroy()
132132
L_org.destroy()
133+
solver.destroy()
133134
list_timings(comm, [TimingType.wall])

0 commit comments

Comments
 (0)