I am currently working on a project of building a simulator. Up till now I have mostly played around with very simple examples, but with regards to the future I have been thinking that it might be a good idea to use an external library for numerical computations, especially since I might also want to look into the possibility for parallelization.

So far I have used the Eigen library, which is very simple since you only need to include the appropriate header files and you are good to go. However, I am a bit uncertain about whether it is good enough in the long run? (versatility, speed etc.) Please correct me if you have used Eigen extensively and know I'm wrong! ;)

But anyway, my idea was to maybe learn to use one of the "big guns", Trilinos or Petsc, as I understand they are the most well regarded libraries. However, it seems like it might be a bit problematic to get everything to work on Windows? (using Visual Studio) From what I've found by googling and reading here, it seems there is an option compiling for Visual Studio using CMAKE, but I've found most of the user guides a bit confusing with regards to how well it will work, what possible ugly issues might turn up etc.

I guess my main question is: How easy will it be to set-up e.g. Trilinos for my current project? I mostly need code for doing linear algebra computations (vectors, sparse matrices etc.), possibly in parallel. There is also the issue of choosing the "right" mesh data structure, but maybe I should get those from elsewhere (or build my own, as I have so far).

  • $\begingroup$ Just use PETSc in Cygwin or (even better) virtualbox running a minimal install of Debian that you can ssh into. Trilinos is much more than just a linear algebra package and installing it is a pain even in Linux. $\endgroup$
    – stali
    Sep 20, 2014 at 20:51
  • $\begingroup$ Ok, but would it be possible to get this (e.g. PETSc) to work with Visual Studio? $\endgroup$
    – Axiom
    Sep 23, 2014 at 11:25

2 Answers 2


Here is something that works for me to build Trilinos. Put it in a batch file on a single line aftery modifying it for your file locations. Also install the third party software. Not all options below are strictly necessary. You can install clapack using cmake for (a slow) blas and lapack. See more here http://trilinos.sandia.gov/Trilinos10CMakeQuickstart.txt

"c:\Program Files (x86)\CMake 2.8\bin\cmake"
-G "Visual Studio 11 Win64"
-DMPI_BASE_DIR:PATH="c:/Program Files/Microsoft HPC Pack 2008 SDK"

Trilinos (and PETSc) will definitely work on windows, but it does have quite a few dependencies. How easy that will be depends on you. I'd suggest just starting up the CMake visual studio build and let it tell you what you're missing and just pick those up one at a time. In e.g. ubuntu it's a lot easier, just apt-get install trilinos.

As for if it's appropriate, it depends on the particulars of your program. If you definitely need parallelism, then it's a good idea to use trilinos or PETSc. But if you don't, I do find working with Eigen to be much more pleasant. I personally actually use a mix, where I have PETSc vectors for global, parallel data and use its linear/nonlinear solvers, but locally I use a lot of small matrix manipulation where it makes more sense to use Eigen.

  • $\begingroup$ Ok I'll see what I find out. Maybe I should try installing it on my private laptop first when I get the time to test it out! $\endgroup$
    – Axiom
    Sep 23, 2014 at 11:24
  • $\begingroup$ +1 for using Eigen for small local computations; it could actually work better than established BLAS and LAPACK libraries when used this way, because of kernel fusion etc. I use PETSc and Eigen in the same way. $\endgroup$ Mar 1, 2018 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.