Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to link to an existing mfem library? #173

Closed
jan-janssen opened this issue Mar 16, 2023 · 7 comments
Closed

Is it possible to link to an existing mfem library? #173

jan-janssen opened this issue Mar 16, 2023 · 7 comments
Assignees
Labels

Comments

@jan-janssen
Copy link

I found the mfem conda package and I was wondering if I can install the pymfem package from pip without recompiling the mfem library?

@sshiraiwa
Copy link
Member

Hi @jan-janssen, I didn't use PyMFEM with conda mfem. Is it install a pre-compiled binary or source code?
If so, setup.py takes --mfem-prefix --mfem-source as parameters. With pip, you need to use --install-option.
to set each of these parameters. If you want to compile it with MPI, you also give --with-parallel, --hypre-prefix
and --metis-prefix.

@jan-janssen
Copy link
Author

I am a bit confused, I have the libmfem.so installed on my system. I am just looking for the pip command to link to this already installed version.

@sshiraiwa
Copy link
Member

Setup.py in PyMFEM generates a wrapper code from the MFEM source code. MFEM can be compiled with various options.
Depending the option you use, the wrapper code has to change. Therefore, if you have only libmfem.so, you can not do pip install.

@sshiraiwa sshiraiwa self-assigned this Mar 16, 2023
@jan-janssen
Copy link
Author

It was compiled with: https://github.com/conda-forge/mfem-feedstock/blob/main/recipe/build.sh

make config CXX=$CXX PREFIX=$PREFIX MFEM_SHARED=YES MFEM_STATIC=NO MFEM_USE_MPI=YES MFEM_USE_METIS_5=YES CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" LIBS="$LIBS" HYPRE_OPT="-I$PREFIX/include" GHV_CXX=$CXX_FOR_BUILD
make lib
make install

@sshiraiwa
Copy link
Member

We don't have a plan to change setup.py for this specific installation pattern. Probably, better approach would be to modify the feedstock and build the wrapper together.

@jan-janssen
Copy link
Author

We don't have a plan to change setup.py for this specific installation pattern.

I can patch the setup.py I just do not fully understand which option to change. I tried to add python -m pip install . -vv --mfem-prefix=${PREFIX} but that did not work. Can you just tell me how to disable the build process?

@sshiraiwa
Copy link
Member

In setup.py, we run SWIG to generate a wrapper code. SWIG needs to read all C++ header files.
The location of header files is set by using --mfem-source option. If Conda package does not contain
header file, SWIG will fail and thus we can not build PyMFEM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants