<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">I'm using the following sequence of functions related to the Jacobian matrix:</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">DMDACreate1d(..., &da);</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">DMSetFromOptions(da);</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">DMSetUp(da);</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">DMSetMatType(da, MATAIJKOKKOS);</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">DMSetMatrixPreallocateSkip(da, PETSC_TRUE);</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">Mat J;</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">DMCreateMatrix(da, &J);</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">MatSetPreallocationCOO(J, ...);</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">I recently added the call to DMSetMatrixPreallocateSkip, hoping the allocation would be delayed to MatSetPreallocationCOO, and that it
would require less memory. The <a href="https://petsc.org/release/manualpages/DM/DMSetMatrixPreallocateSkip/" title="https://petsc.org/release/manualpages/DM/DMSetMatrixPreallocateSkip/" id="LPlnk731661">
documentation</a> says that the data structures will not be preallocated. The following data from heaptrack shows that the allocation is still happening in the call to DMCreateMatrix.</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);"><img style="max-width: 998px;" size="54775" contenttype="image/png" data-outlook-trace="F:1|T:1" src="cid:bda9ef12-a46f-47b2-9b9b-a4b2808b6b13"></span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">Can someone help me understand this?</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">Thanks,</span></div>
<div class="elementToProof" style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 11pt;"><b>Philip Fackler<br>
</b></span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Research Software Engineer, Application Engineering Group</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Advanced Computing Systems Research Section</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Computer Science and Mathematics Division<br>
</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>Oak Ridge National Laboratory</b></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
</div>
</body>
</html>