refactor handling of plugin loading to make plugin a global property

This commit is contained in:
Axel Kohlmeyer
2025-06-11 02:52:28 -04:00
parent 464b9f4b03
commit df08818fef
15 changed files with 305 additions and 55 deletions

View File

@ -357,7 +357,8 @@ completed and then MPI is cleanly shut down. After calling this
function no more MPI calls may be made.
*See also*
:cpp:func:`lammps_kokkos_finalize`, :cpp:func:`lammps_python_finalize`
:cpp:func:`lammps_kokkos_finalize`, :cpp:func:`lammps_python_finalize`,
:cpp:func:`lammps_plugin_finalize`
\endverbatim */
void lammps_mpi_finalize()
@ -389,7 +390,8 @@ closed (to release associated resources).
After calling this function no Kokkos functionality may be used.
*See also*
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_python_finalize`
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_python_finalize`,
:cpp:func:`lammps_plugin_finalize`
\endverbatim */
void lammps_kokkos_finalize()
@ -399,6 +401,35 @@ void lammps_kokkos_finalize()
/* ---------------------------------------------------------------------- */
/** Unload all plugins and release the corresponding DSO handles
*
\verbatim embed:rst
.. versionadded:: TBD
This function clears the list of all loaded plugins and closes the
corresponding DSO handles and releases the imported executable code.
However, this is **not** done when a LAMMPS instance is deleted because
plugins and their shared objects are global properties.
This function can be called to explicitly clear out all loaded plugins
in case it is safe to do so.
*See also*
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize`,
:cpp:func:`lammps_python_finalize`
\endverbatim */
void lammps_plugin_finalize()
{
#if defined(LMP_PLUGIN)
plugin_finalize();
#endif
}
/* ---------------------------------------------------------------------- */
/** Clear the embedded Python environment
*
\verbatim embed:rst
@ -425,7 +456,8 @@ This function can be called to explicitly clear the Python
environment in case it is safe to do so.
*See also*
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize`
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize`,
:cpp:func:`lammps_plugin_finalize`
\endverbatim */
void lammps_python_finalize()
@ -433,7 +465,6 @@ void lammps_python_finalize()
Python::finalize();
}
/* ---------------------------------------------------------------------- */
/** Call a LAMMPS Error class function