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

Build and install of a shared libmpm library #723

Open
lgiraldi opened this issue Jan 28, 2022 · 2 comments
Open

Build and install of a shared libmpm library #723

lgiraldi opened this issue Jan 28, 2022 · 2 comments

Comments

@lgiraldi
Copy link

Describe the feature
Split the current mpm CMake target into a mpm executable and a libmpm shared library.

For the context, we are planning to build a data analysis tool for simulation results while reusing mpm particles and grid functionalities as much as possible. Therefore, we would greatly appreciate to link our software to such "libmpm" shared library.

Describe alternatives

  • Do not create a shared library, and compile our new tool with every source file from this codebase,
  • Create a static library,
  • Create multiple shared libraries (e.g. libmpmfunctions, libmpmio, libmpmbase, ...),
  • Create multiple static libraries.

Additional context

I already have a minimal example up and running for a single shared library, I can provide a PR.

@kks32
Copy link
Contributor

kks32 commented Jan 29, 2022

Hi @lgiraldi Thanks. We use to have a libmpm shared library build and even had a toggle option. 05823df#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a

There was some performance reason why we don't do it anymore....digging through the history of CMakelists.txt might provide a better insight on why we don't do that anymore. lib will reduce compile times, but there was some other issue that stopped us from continuing to do this...I can look into this further...if you can find out in the commit histories that would be greatly appreciated too.

Happy to help integrate your data analysis tool. If you can provide a little more detail, maybe using HDF5 files could be a viable option?

@lgiraldi
Copy link
Author

Thanks for the quick reply. I could find the issue #662 and the PR #664 related to the commit you were mentioning.
Taking these comments into account, another alternative would be to make the executable not depending on the shared
library with something like

add_executable(mpm ${mpm_SOURCE_DIR}/src/main.cc ${mpm_src} ${mpm_vtk})
if(MPM_BUILD_LIB)
  add_library(lmpm SHARED ${mpm_src} ${mpm_vtk})
endif()

Otherwise, would using a static library solve #662 ? Sorry for the ingenuous question, I am no MPI expert.

Regarding our tool, it is related to a research project whose goal is to update the simulation state using external data sources (data assimilation) for an experimental process.
For some technical reasons, we would like to play with the simulation state from the FE mesh and not from the particles (so we can't use HDF5 directly). At the moment, our plan is to reuse mpm capabilities for going from the particles to the mesh back and forth in order to simplify our implementation.

I am willing to give you more details about my research through another private channel.

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

No branches or pull requests

2 participants