Registered Member
|
Hello,
At work I try to update our simulation lib to use eigen. So I switched the Solver for sparse linear systems to the SparseLU solver from eigen. First I used a test programm, it worked perfectly and very fast. then i puut it in our dll (the same code no changes, just that the matrix didnt come from a test file, instead it comes from the programm, which uses the simulation dll). Suddenly I get Access Violation Errors in GeneralBlockPanelKernel.h:
So I looked at the position with the Debugger and everything seems to be in order (at least for the debugging tool from visual studio 2013). So i controlled the input, the matrix and everything else. And if i protocol step by step in short:
I get the following info: - Matrix get initialised successfully - Matrix get compressed successfully - analyzePattern and factorize are successfull and by solve I get the Access Violation. Has somebody an Idea what I do wrong? Or is it a problem, because eigen is inside a dll? Thanks in Advance, Kai Gödde |
Moderator
|
First, make sure that both the DLL and your application are compiled with the same flags.
Second, could you show the values of b (the address, not the values pointed by b), k and n? It might be that b is not aligned. It would also be interesting to test with EIGEN_DONT_VECTORIZE predefined for both the DLL and your program. |
Registered Member
|
Thank you for your fast answer.
- If I compile with EIGEN_DONT_VECTORIZE it just works. But how much speed did I loose than? - If i dont use the compiler flag, than b = 0x068bb62c k = 0 n = 2 |
Moderator
|
Alright, so the problem is that b is not aligned. Maybe the stack is not aligned and so alloca does not return aligned memory within DLLs. You can verify this guess by adding:
#undef EIGEN_ALLOCA right after it has been defined in Eigen/src/Core/util/Memory.h |
Registered Member
|
Thanks,
If I use the flag #undef EIGEN_ALLOCA it works fine, but it is really slow. How can I fix that? |
Moderator
|
In the Memory.h file, you can modify the lines:
to
If that work, we'll apply the fix upstream. |
Registered Member
|
Thank you
Now it works fine (but slow, because i have created some redundancies, which i now have to clean up). SO now i just have to show my superior how much faster we can get Kind regards, Kai Gödde |
Moderator
|
https://bitbucket.org/eigen/eigen/commits/95bf819b5849/
Changeset: 95bf819b5849 User: ggael Date: 2014-02-14 00:04:38 Summary: alloca is not necessarily alligned on windows |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]