Closed pointhi closed 2 years ago
Hi Thomas,
Could you also attach the .msh file and the .msh2 file?
Alex
I suspect we might have a name collision with perhaps https://gitlab.onelab.info/gmsh/gmsh/-/blob/master/src/post/shapeFunctions.h#L12
Simply because you and gmsh define the element
datatype, and sparselizards elements
should not interact with gmsh I think, but it does according the the stacktrace. This leads to an incorrect free.
tmp_written_gmsh_v2.zip
The proper solution would be to wrap the sparselizard codebase into a namespace.
It really looks that way, both libraries define the same symbol name for the destructor:
$ objdump /usr/lib/libgmsh.so.4.9 -T | grep _ZN7elementD1Ev
00000000009f1b30 w DF .text 0000000000000052 Base _ZN7elementD1Ev
$ objdump /usr/lib/libsparselizard.so -T | grep _ZN7elementD1Ev
0000000000103cc0 w DF .text 0000000000000032 Base _ZN7elementD1Ev
Thanks for the details. Sparselizard has both an 'element' and 'elements' class... Could it be that gmsh has added the element class quite recently? Can you rather easily work around for now or not?
Note: SL can natively read gmsh 2 format so there is no need to use the mesh('gmsh:file.msh2'), just use mesh('file.msh2'). Could that help?
Loading sparselizard first into the application seems to solve the problem locally: LD_PRELOAD=/usr/lib/libsparselizard.so
, but that's only a workaround. The cleanest solution would be to have sparselizard inside a namespace, which would automatically lead to unique symbol names.
Duly noted! Hope you can live with it for some time though, but let me know if it becomes a seriously blocking issue for you.
@pointhi I get the errors as well. I can only recommend using the only yet validated gmsh version for sparselizard:
http://gmsh.info/bin/Linux/gmsh-4.5.2-Linux64-sdk.tgz
With the 4.9.1 I even tried without any call to sparselizard, just an Ax = b resolution using the latest petsc (see code below). I am a little surprised that even with petsc-only calls it crashes, even if there should be at no moment a gmsh or SL call.
Code:
int main(void) {
PetscInitialize(0,{},0,0);
std::vector<int> Arows = {0,1,2};
std::vector<int> Acols = {0,1};
std::vector<double> Avals = {10,20};
Mat Amat;
MatCreateSeqAIJWithArrays(PETSC_COMM_SELF, 2, 2, Arows.data(), Acols.data(), Avals.data(), &Amat);
MatAssemblyBegin(Amat, MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(Amat, MAT_FINAL_ASSEMBLY);
MatView(Amat, PETSC_VIEWER_STDOUT_SELF);
Vec myvec;
VecCreate(PETSC_COMM_SELF, &myvec);
VecSetSizes(myvec, PETSC_DECIDE, 2);
VecSetFromOptions(myvec);
VecSet(myvec, 0.0);
VecView(myvec, PETSC_VIEWER_STDOUT_SELF);
KSP ksp;
PC pc;
KSPCreate(PETSC_COMM_SELF, &ksp);
KSPSetOperators(ksp, Amat, Amat);
KSPSetFromOptions(ksp);
KSPGetPC(ksp,&pc);
PCSetType(pc,PCLU);
PCFactorSetMatSolverType(pc, "mumps");
KSPSolve(ksp, myvec, myvec);
PetscFinalize();
}
I cannot read a gmsh 4.9 file using
gmsh:api
as well as by storing the file first and then loading it withgmsh:filename.msh2
again. I use https://github.com/halbux/sparselizard/tree/v.2021.11:The code can be found in https://gitlab.com/pointhi/kicad/-/tree/sparselizard_fem, and I can reproduce the failure with
qa/fem_proto/sparselizard_DC