Skip to content

Commit

Permalink
lima 7.9.4 recipe, VTK 7.1.1 patch against sub-allocation for meshes …
Browse files Browse the repository at this point in the history
…>= 10 millions of cells.
  • Loading branch information
Charles PIGNEROL committed Nov 10, 2023
1 parent d03d4e5 commit 49e4cd7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions meshing/packages/lima/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Lima(CMakePackage):
patch('cmake-7.6.0.patch', when='@7.6.0')

version('main', branch='main')
version('7.9.4', sha256='ab2fae0938b08c86685b0b2809dff5f6f69bb139e50179c952b391447d5833ec')
version('7.9.3', sha256='4ef65333269ad9ba3a522a4b82d621b4a9ae6d920042a67361fe0a404c4fd0c1')
version('7.9.2', sha256='fee1d16d12b6b2beaa6680903f67feba0fe10a0b1159a61dd926816f89e635fa')
version('7.9.1', sha256='da517fa87a6df3b07e793d8a6a300865614803fa84cf1d3ec1994605e69b4571')
Expand Down
2 changes: 2 additions & 0 deletions meshing_supersede/packages/vtk-maillage/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class VtkMaillage(CMakePackage):
# when compiling vtk7 with gcc >= 11
patch('vtk-maillage_gcc11_const.patch', when='%gcc@11:')

# patch against underallocations for meshes of more than 10 million nodes/meshs
patch('vtk-maillage_vtkAbstractArray_SetNumberOfValues.patch')

depends_on('mpi', when='+mpi')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff -Naur VTK-7.1.1.old/Common/Core/vtkAbstractArray.cxx VTK-7.1.1/Common/Core/vtkAbstractArray.cxx
--- VTK-7.1.1.old/Common/Core/vtkAbstractArray.cxx 2023-11-10 08:09:27.968215356 +0100
+++ VTK-7.1.1/Common/Core/vtkAbstractArray.cxx 2023-11-10 08:20:58.107217364 +0100
@@ -187,8 +187,17 @@
//----------------------------------------------------------------------------
void vtkAbstractArray::SetNumberOfValues(vtkIdType numValues)
{
- if (this->Resize(std::ceil(numValues /
- static_cast<float>(this->NumberOfComponents))))
+/* VTK code 7.1.1.
+ * If NumberOfComponents is 1 and numValues ​​is 46640545, then numValues ​​/static_cast<float>(this->NumberOfComponents),
+ * of floating type, will be 46640544 (the floating precision is 7 significant digits,
+ * cf. https://www.h-schmidt .net/FloatConverter/IEEE754.html)
+ * => insufficient memory allocation causing crash and revealed by valgrind
+ * if (this->Resize(std::ceil(numValues /
+ * static_cast<float>(this->NumberOfComponents))))
+*/
+// Replacement VTK 8.2.0 code :
+ vtkIdType numTuples = this->NumberOfComponents == 1 ? numValues : (numValues + this->NumberOfComponents - 1) / this->NumberOfComponents;
+ if (this->Resize(numTuples))
{
this->MaxId = numValues - 1;
}

0 comments on commit 49e4cd7

Please sign in to comment.