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

Allow creating matrices based on hash tables #3983

Draft
wants to merge 29 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d557acc
Space between function name and parens
lindsayad Oct 30, 2024
1e02946
Add init_hash methods to SparseMatrix
lindsayad Oct 30, 2024
2ead745
Try using hash table in system of eq ex7
lindsayad Oct 30, 2024
274d57e
Add a destroy_on_exit parameter to constructor-from-Mat
lindsayad Oct 30, 2024
0fc8c94
Create copy_from_hash method
lindsayad Oct 30, 2024
63451fe
Revert "Space between function name and parens"
lindsayad Nov 3, 2024
3989719
Refactoring: add use_hash_table methods to SparseMatrix
lindsayad Nov 4, 2024
4228676
reset -> reset_memory
lindsayad Nov 5, 2024
d7b4e6e
We don't prefer hash table matrix assembly by default
lindsayad Nov 22, 2024
d2b80e0
Don't break after return type in clang-format
lindsayad Nov 22, 2024
3d5e4b2
Move setting of new nonzero error into new finish_initialization routine
lindsayad Nov 22, 2024
b368217
PETSc didn't support hash table assembly until 3.19
lindsayad Nov 25, 2024
e617d40
Adjust reset_memory error message
lindsayad Nov 25, 2024
705627d
WIP: Address Roy review
lindsayad Dec 18, 2024
f102d7c
Add VSCode related files to gitignore
lindsayad Dec 18, 2024
2bb581b
Create miscellaneous example 17
lindsayad Dec 19, 2024
6f81eae
Changes to make our example unique
lindsayad Dec 19, 2024
47e999e
Add example to autotools files
lindsayad Dec 19, 2024
00a3ac7
bootstrap
lindsayad Dec 19, 2024
50abf05
Make example smaller
lindsayad Dec 19, 2024
bdc9e26
do repeat solves, resetting memory in between
lindsayad Dec 19, 2024
a3d8bf2
Always honor `use_hash_table` if `true`
lindsayad Dec 19, 2024
300ac39
Add monitor programmatically
lindsayad Dec 19, 2024
a3bed02
Add html for John
lindsayad Dec 19, 2024
17092ad
Skip resetting preallocation for now
lindsayad Dec 20, 2024
3829c12
Put PETSc version guards around code that calls MatResetHash
lindsayad Dec 21, 2024
5559c3f
Guard petscksp include
lindsayad Dec 23, 2024
a7df39b
More guards
lindsayad Dec 23, 2024
4a8a5e3
Keep fighting CI to make example workable without PETSc
lindsayad Dec 24, 2024
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: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,7 @@ installed

# Allow developers to use .clang-format without dirtying git
.clang-format

# VSCode related things
.cache
.vscode
2 changes: 1 addition & 1 deletion clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AllowShortLoopsOnASingleLine: false
SortIncludes: false
IndentCaseLabels: true
ConstructorInitializerIndentWidth: 2
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: true

FixNamespaceComments: false
Expand Down
3 changes: 2 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -60504,7 +60504,7 @@ printf "%s\n" "#define BUILD_DATE __DATE__ \" \" __TIME__" >>confdefs.h
if test "x$enableexamples" = "xyes"
then :

ac_config_files="$ac_config_files examples/introduction/introduction_ex1/Makefile examples/introduction/introduction_ex2/Makefile examples/introduction/introduction_ex3/Makefile examples/introduction/introduction_ex4/Makefile examples/introduction/introduction_ex5/Makefile examples/adaptivity/adaptivity_ex1/Makefile examples/adaptivity/adaptivity_ex2/Makefile examples/adaptivity/adaptivity_ex3/Makefile examples/adaptivity/adaptivity_ex4/Makefile examples/adaptivity/adaptivity_ex5/Makefile examples/adjoints/adjoints_ex1/Makefile examples/adjoints/adjoints_ex2/Makefile examples/adjoints/adjoints_ex3/Makefile examples/adjoints/adjoints_ex4/Makefile examples/adjoints/adjoints_ex5/Makefile examples/adjoints/adjoints_ex6/Makefile examples/adjoints/adjoints_ex7/Makefile examples/eigenproblems/eigenproblems_ex1/Makefile examples/eigenproblems/eigenproblems_ex2/Makefile examples/eigenproblems/eigenproblems_ex3/Makefile examples/eigenproblems/eigenproblems_ex4/Makefile examples/fem_system/fem_system_ex1/Makefile examples/fem_system/fem_system_ex2/Makefile examples/fem_system/fem_system_ex3/Makefile examples/fem_system/fem_system_ex4/Makefile examples/fem_system/fem_system_ex5/Makefile examples/solution_transfer/solution_transfer_ex1/Makefile examples/miscellaneous/miscellaneous_ex1/Makefile examples/miscellaneous/miscellaneous_ex2/Makefile examples/miscellaneous/miscellaneous_ex3/Makefile examples/miscellaneous/miscellaneous_ex4/Makefile examples/miscellaneous/miscellaneous_ex5/Makefile examples/miscellaneous/miscellaneous_ex6/Makefile examples/miscellaneous/miscellaneous_ex7/Makefile examples/miscellaneous/miscellaneous_ex8/Makefile examples/miscellaneous/miscellaneous_ex9/Makefile examples/miscellaneous/miscellaneous_ex10/Makefile examples/miscellaneous/miscellaneous_ex11/Makefile examples/miscellaneous/miscellaneous_ex12/Makefile examples/miscellaneous/miscellaneous_ex13/Makefile examples/miscellaneous/miscellaneous_ex14/Makefile examples/miscellaneous/miscellaneous_ex15/Makefile examples/miscellaneous/miscellaneous_ex16/Makefile examples/optimization/optimization_ex1/Makefile examples/optimization/optimization_ex2/Makefile examples/subdomains/subdomains_ex1/Makefile examples/subdomains/subdomains_ex2/Makefile examples/subdomains/subdomains_ex3/Makefile examples/systems_of_equations/systems_of_equations_ex1/Makefile examples/systems_of_equations/systems_of_equations_ex2/Makefile examples/systems_of_equations/systems_of_equations_ex3/Makefile examples/systems_of_equations/systems_of_equations_ex4/Makefile examples/systems_of_equations/systems_of_equations_ex5/Makefile examples/systems_of_equations/systems_of_equations_ex6/Makefile examples/systems_of_equations/systems_of_equations_ex7/Makefile examples/systems_of_equations/systems_of_equations_ex8/Makefile examples/systems_of_equations/systems_of_equations_ex9/Makefile examples/reduced_basis/reduced_basis_ex1/Makefile examples/reduced_basis/reduced_basis_ex2/Makefile examples/reduced_basis/reduced_basis_ex3/Makefile examples/reduced_basis/reduced_basis_ex4/Makefile examples/reduced_basis/reduced_basis_ex5/Makefile examples/reduced_basis/reduced_basis_ex6/Makefile examples/reduced_basis/reduced_basis_ex7/Makefile examples/transient/transient_ex1/Makefile examples/transient/transient_ex2/Makefile examples/vector_fe/vector_fe_ex1/Makefile examples/vector_fe/vector_fe_ex2/Makefile examples/vector_fe/vector_fe_ex3/Makefile examples/vector_fe/vector_fe_ex4/Makefile examples/vector_fe/vector_fe_ex5/Makefile examples/vector_fe/vector_fe_ex6/Makefile examples/vector_fe/vector_fe_ex7/Makefile examples/vector_fe/vector_fe_ex8/Makefile examples/vector_fe/vector_fe_ex9/Makefile examples/Makefile"
ac_config_files="$ac_config_files examples/introduction/introduction_ex1/Makefile examples/introduction/introduction_ex2/Makefile examples/introduction/introduction_ex3/Makefile examples/introduction/introduction_ex4/Makefile examples/introduction/introduction_ex5/Makefile examples/adaptivity/adaptivity_ex1/Makefile examples/adaptivity/adaptivity_ex2/Makefile examples/adaptivity/adaptivity_ex3/Makefile examples/adaptivity/adaptivity_ex4/Makefile examples/adaptivity/adaptivity_ex5/Makefile examples/adjoints/adjoints_ex1/Makefile examples/adjoints/adjoints_ex2/Makefile examples/adjoints/adjoints_ex3/Makefile examples/adjoints/adjoints_ex4/Makefile examples/adjoints/adjoints_ex5/Makefile examples/adjoints/adjoints_ex6/Makefile examples/adjoints/adjoints_ex7/Makefile examples/eigenproblems/eigenproblems_ex1/Makefile examples/eigenproblems/eigenproblems_ex2/Makefile examples/eigenproblems/eigenproblems_ex3/Makefile examples/eigenproblems/eigenproblems_ex4/Makefile examples/fem_system/fem_system_ex1/Makefile examples/fem_system/fem_system_ex2/Makefile examples/fem_system/fem_system_ex3/Makefile examples/fem_system/fem_system_ex4/Makefile examples/fem_system/fem_system_ex5/Makefile examples/solution_transfer/solution_transfer_ex1/Makefile examples/miscellaneous/miscellaneous_ex1/Makefile examples/miscellaneous/miscellaneous_ex2/Makefile examples/miscellaneous/miscellaneous_ex3/Makefile examples/miscellaneous/miscellaneous_ex4/Makefile examples/miscellaneous/miscellaneous_ex5/Makefile examples/miscellaneous/miscellaneous_ex6/Makefile examples/miscellaneous/miscellaneous_ex7/Makefile examples/miscellaneous/miscellaneous_ex8/Makefile examples/miscellaneous/miscellaneous_ex9/Makefile examples/miscellaneous/miscellaneous_ex10/Makefile examples/miscellaneous/miscellaneous_ex11/Makefile examples/miscellaneous/miscellaneous_ex12/Makefile examples/miscellaneous/miscellaneous_ex13/Makefile examples/miscellaneous/miscellaneous_ex14/Makefile examples/miscellaneous/miscellaneous_ex15/Makefile examples/miscellaneous/miscellaneous_ex16/Makefile examples/miscellaneous/miscellaneous_ex17/Makefile examples/optimization/optimization_ex1/Makefile examples/optimization/optimization_ex2/Makefile examples/subdomains/subdomains_ex1/Makefile examples/subdomains/subdomains_ex2/Makefile examples/subdomains/subdomains_ex3/Makefile examples/systems_of_equations/systems_of_equations_ex1/Makefile examples/systems_of_equations/systems_of_equations_ex2/Makefile examples/systems_of_equations/systems_of_equations_ex3/Makefile examples/systems_of_equations/systems_of_equations_ex4/Makefile examples/systems_of_equations/systems_of_equations_ex5/Makefile examples/systems_of_equations/systems_of_equations_ex6/Makefile examples/systems_of_equations/systems_of_equations_ex7/Makefile examples/systems_of_equations/systems_of_equations_ex8/Makefile examples/systems_of_equations/systems_of_equations_ex9/Makefile examples/reduced_basis/reduced_basis_ex1/Makefile examples/reduced_basis/reduced_basis_ex2/Makefile examples/reduced_basis/reduced_basis_ex3/Makefile examples/reduced_basis/reduced_basis_ex4/Makefile examples/reduced_basis/reduced_basis_ex5/Makefile examples/reduced_basis/reduced_basis_ex6/Makefile examples/reduced_basis/reduced_basis_ex7/Makefile examples/transient/transient_ex1/Makefile examples/transient/transient_ex2/Makefile examples/vector_fe/vector_fe_ex1/Makefile examples/vector_fe/vector_fe_ex2/Makefile examples/vector_fe/vector_fe_ex3/Makefile examples/vector_fe/vector_fe_ex4/Makefile examples/vector_fe/vector_fe_ex5/Makefile examples/vector_fe/vector_fe_ex6/Makefile examples/vector_fe/vector_fe_ex7/Makefile examples/vector_fe/vector_fe_ex8/Makefile examples/vector_fe/vector_fe_ex9/Makefile examples/Makefile"


fi
Expand Down Expand Up @@ -62808,6 +62808,7 @@ do
"examples/miscellaneous/miscellaneous_ex14/Makefile") CONFIG_FILES="$CONFIG_FILES examples/miscellaneous/miscellaneous_ex14/Makefile" ;;
"examples/miscellaneous/miscellaneous_ex15/Makefile") CONFIG_FILES="$CONFIG_FILES examples/miscellaneous/miscellaneous_ex15/Makefile" ;;
"examples/miscellaneous/miscellaneous_ex16/Makefile") CONFIG_FILES="$CONFIG_FILES examples/miscellaneous/miscellaneous_ex16/Makefile" ;;
"examples/miscellaneous/miscellaneous_ex17/Makefile") CONFIG_FILES="$CONFIG_FILES examples/miscellaneous/miscellaneous_ex17/Makefile" ;;
"examples/optimization/optimization_ex1/Makefile") CONFIG_FILES="$CONFIG_FILES examples/optimization/optimization_ex1/Makefile" ;;
"examples/optimization/optimization_ex2/Makefile") CONFIG_FILES="$CONFIG_FILES examples/optimization/optimization_ex2/Makefile" ;;
"examples/subdomains/subdomains_ex1/Makefile") CONFIG_FILES="$CONFIG_FILES examples/subdomains/subdomains_ex1/Makefile" ;;
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ AS_IF([test "x$enableexamples" = "xyes"],
examples/miscellaneous/miscellaneous_ex14/Makefile
examples/miscellaneous/miscellaneous_ex15/Makefile
examples/miscellaneous/miscellaneous_ex16/Makefile
examples/miscellaneous/miscellaneous_ex17/Makefile
examples/optimization/optimization_ex1/Makefile
examples/optimization/optimization_ex2/Makefile
examples/subdomains/subdomains_ex1/Makefile
Expand Down
147 changes: 147 additions & 0 deletions doc/html/examples/miscellaneous_ex17.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<!doctype html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>libMesh - A C++ Finite Element Library</title>
<meta name="author" content="libMesh development team">
<link rel="stylesheet" type="text/css" media="all" href="../styles.css">
<link rel="stylesheet" type="text/css" media="all" href="../doxygen_stylesheet.css">
</head>

<body>
<nav id="fixedbar">
<ul id="fixednav">
<li><a href="../index.html">Home</a></li>
<li><a href="../support.html">About Us</a></li>
<li><a href="../publications.html">Publications</a></li>
<li><a href="https://github.com/libMesh/libmesh/graphs/contributors">Developers</a></li>
<li><a href="../installation.html">Installation</a></li>
<li><a href="../examples.html">Examples</a></li>
<li><a href="https://mooseframework.inl.gov/docs/doxygen/libmesh/index.html">Documentation</a></li>
</ul>
</nav>

<div id="w">
<header id="logo"><a href="../index.html"><span id="logobg">SomeWebsiteLogo</span></a></header>

<nav id="navigation">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a href="../support.html">About Us</a></li>
<li><a href="../publications.html">Publications</a></li>
<li><a href="https://github.com/libMesh/libmesh/graphs/contributors">Developers</a></li>
<li><a href="../installation.html">Installation</a></li>
<li><a href="../examples.html">Examples</a></li>
<li><a href="https://mooseframework.inl.gov/docs/doxygen/libmesh/index.html">Documentation</a></li>
</ul>
</nav>

<div id="content">

<br> <h1> Link to the source code for this example: </h1>
<a href="https://github.com/libMesh/libmesh/tree/master/examples/miscellaneous/miscellaneous_ex17" target="_blank">Open miscellaneous_ex17 in new tab.</a>
<a name="output"></a>
<br><br><br> <h1> The console output of the program: </h1>
<pre>
CXX example_dbg-miscellaneous_ex17.o
CXXLD example-dbg
CXX example_devel-miscellaneous_ex17.o
CXXLD example-devel
CXX example_oprof-miscellaneous_ex17.o
CXXLD example-oprof
***************************************************************
* Running Example miscellaneous_ex17:
* ./example-opt
***************************************************************

Running /data/lindad/libmesh-worktrees/libmesh/build/examples/miscellaneous/miscellaneous_ex17/.libs/example-opt

Mesh Information:
elem_dimensions()={2}
elem_default_orders()={1}
supported_nodal_order()=1
spatial_dimension()=2
n_nodes()=9
n_local_nodes()=9
n_elem()=4
n_local_elem()=4
n_active_elem()=4
n_subdomains()=1
n_elemsets()=0
n_partitions()=1
n_processors()=1
n_threads()=1
processor_id()=0
is_prepared()=true
is_replicated()=true

EquationSystems
n_systems()=1
System #0, "Poisson"
Type "LinearImplicit"
Variables="u"
Finite Element Types="LAGRANGE"
Approximation Orders="FIRST"
n_dofs()=9
n_local_dofs()=9
max(n_local_dofs())=9
n_constrained_dofs()=0
n_local_constrained_dofs()=0
max(local unconstrained dofs)=9
n_vectors()=1
n_matrices()=2
DofMap Sparsity
Average On-Processor Bandwidth <= 5.44444
Average Off-Processor Bandwidth <= 0
Maximum On-Processor Bandwidth <= 9
Maximum Off-Processor Bandwidth <= 0
DofMap Constraints
Number of DoF Constraints = 0

0 KSP Residual norm 1.688435532300e+00
1 KSP Residual norm 4.775853068521e-03
2 KSP Residual norm 8.773680887473e-05
3 KSP Residual norm 2.605740036645e-06
0 KSP Residual norm 1.688435532300e+00
1 KSP Residual norm 4.775853068521e-03
2 KSP Residual norm 8.773680887473e-05
3 KSP Residual norm 2.605740036645e-06

***************************************************************
* Done Running Example miscellaneous_ex17:
* ./example-opt
***************************************************************
</pre>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(window).on('scroll',function() {
var scrolltop = $(this).scrollTop();

if(scrolltop >= 215) {
$('#fixedbar').fadeIn(250);
}

else if(scrolltop <= 210) {
$('#fixedbar').fadeOut(250);
}
});
});
</script>

<!-- Google Analytics stuff -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-24978333-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

</body>
</html>
5 changes: 5 additions & 0 deletions doc/html/src/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ <h1>A Series of Example Programs</h1>

<li><L1><a href="examples/miscellaneous_ex16.html">Static Condensation with Second Order Lagrange Elements</a></L1></li>

<li>
<L1><a href="examples/miscellaneous_ex17.html">Demonstrating mix of preallocated/hash-table matrix assemblies</a>
</L1>
</li>

</ol> </li>


Expand Down
1 change: 1 addition & 0 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ SUBDIRS = \
miscellaneous/miscellaneous_ex14 \
miscellaneous/miscellaneous_ex15 \
miscellaneous/miscellaneous_ex16 \
miscellaneous/miscellaneous_ex17 \
optimization/optimization_ex1 \
optimization/optimization_ex2 \
subdomains/subdomains_ex1 \
Expand Down
1 change: 1 addition & 0 deletions examples/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ SUBDIRS = \
miscellaneous/miscellaneous_ex14 \
miscellaneous/miscellaneous_ex15 \
miscellaneous/miscellaneous_ex16 \
miscellaneous/miscellaneous_ex17 \
optimization/optimization_ex1 \
optimization/optimization_ex2 \
subdomains/subdomains_ex1 \
Expand Down
14 changes: 14 additions & 0 deletions examples/miscellaneous/miscellaneous_ex17/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
example_name = miscellaneous_ex17
check_SCRIPTS = run.sh
install_dir = $(examples_install_path)/introduction/ex3
data = miscellaneous_ex17.C exact_solution.C run.sh
sources = $(data) run.sh

CLEANFILES = out.pvtu

clean-local:
-rm -rf out_*.vtu

##############################################
# include common example environment
include $(top_srcdir)/examples/Make.common
Loading