mfem / PyMFEM

Python wrapper for MFEM
http://mfem.org
BSD 3-Clause "New" or "Revised" License
220 stars 62 forks source link

Problem building PyMFEM with SuiteSparse #250

Open mdavids-cfs opened 2 months ago

mdavids-cfs commented 2 months ago

Hi all, first of all: thanks a lot for putting together this python wrapper for MFEM. I've been using MFEM for quite a while, and it's been a huge upgrade to the usability of MFEM for me.

I've been trying to build PyMFEM with SuiteSparse but cannot get it to work. I've successfully downloaded and built mfem, hypre, metis, and SuiteSparse and I am trying to build PyMFEM against these existing libraries using:

python setup.py install --with-parallel --with-suitesparse --skip-ext --mfemp-prefix=$HOME/local 
--mfem-source=$HOME/code/mfem --hypre-prefix=$HOME/local --metis-prefix=$HOME/local
--suitesparse-prefix=$HOME/code/SuiteSparse-7.8.2

"$HOME/local" has the lib and include folders with the neccessary headers and lib files. The parallel MFEM was also build with hypre, metis, and SuiteSparse, and I was able to run the UMFpack solver in one of the MFEM examples.

In file included from schwarz_wrap.cxx:4107:
./../../headers/schwarz.cpp:1059:29: error: unknown type name 'UMFPackSolver'
         PatchInv[ip] = new UMFPackSolver;
                            ^
./../../headers/schwarz.cpp:1060:24: error: no member named 'Control' in 'mfem::GMRESSolver'
         PatchInv[ip]->Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_AMD;
         ~~~~~~~~~~~~  ^
./../../headers/schwarz.cpp:1060:32: error: use of undeclared identifier 'UMFPACK_ORDERING'
         PatchInv[ip]->Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_AMD;
                               ^
./../../headers/schwarz.cpp:1060:52: error: use of undeclared identifier 'UMFPACK_ORDERING_AMD'
         PatchInv[ip]->Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_AMD;
                                                   ^
./../../headers/schwarz.cpp:1145:29: error: unknown type name 'UMFPackSolver'
         PatchInv[ip] = new UMFPackSolver;
                            ^

Could it be that PyMFEM is not linking against the UMFpack library libumfpack.a? It's located in "$HOME/local" Any help is greatly appreciated! Mathias

PS: Is there any plans to include a direct solver in the automatic build process of PyMFEM? I think that would be incredibly helpful for many users!

sshiraiwa commented 1 month ago

Hi @mdavids-cfs, I could be wrong on this. But, I think that UMFPack is a serial solver? If you want to use MPI (--with-parallel), we need to use a different solver. Having this said, I haven't looked at how straightforward it is to do so in Python. However, I think it will be an good enhancement.

mdavids-cfs commented 1 month ago

Hi @sshiraiwa , thanks for the hint. I thought I was able to build the normal (C++) version of MFEM in parallel with SuiteSparse but I may be wrong. Let me look into that.. Thanks, Mathias