move fftw_cleanup() into LAMMPS::cleanup()
This commit is contained in:
@ -19,6 +19,9 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#ifdef FFT_FFTW3
|
||||||
|
#include <fftw3.h>
|
||||||
|
#endif
|
||||||
#include "style_angle.h" // IWYU pragma: keep
|
#include "style_angle.h" // IWYU pragma: keep
|
||||||
#include "style_atom.h" // IWYU pragma: keep
|
#include "style_atom.h" // IWYU pragma: keep
|
||||||
#include "style_bond.h" // IWYU pragma: keep
|
#include "style_bond.h" // IWYU pragma: keep
|
||||||
@ -1315,3 +1318,15 @@ void LAMMPS::print_config(FILE *fp)
|
|||||||
}
|
}
|
||||||
fputs("\n\n",fp);
|
fputs("\n\n",fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LAMMPS::cleanup() {
|
||||||
|
#ifdef FFT_FFTW3
|
||||||
|
// tell fftw3 to delete its global memory pool
|
||||||
|
// and thus avoid bogus valgrind memory leak reports
|
||||||
|
#ifdef FFT_SINGLE
|
||||||
|
fftwf_cleanup();
|
||||||
|
#else
|
||||||
|
fftw_cleanup();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|||||||
@ -79,6 +79,7 @@ class LAMMPS {
|
|||||||
void post_create();
|
void post_create();
|
||||||
void init();
|
void init();
|
||||||
void destroy();
|
void destroy();
|
||||||
|
void cleanup();
|
||||||
void print_config(FILE *); // print compile time settings
|
void print_config(FILE *); // print compile time settings
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
15
src/main.cpp
15
src/main.cpp
@ -19,10 +19,6 @@
|
|||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FFT_FFTW3
|
|
||||||
#include <fftw3.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(LAMMPS_EXCEPTIONS)
|
#if defined(LAMMPS_EXCEPTIONS)
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#endif
|
#endif
|
||||||
@ -63,18 +59,9 @@ int main(int argc, char **argv)
|
|||||||
#else
|
#else
|
||||||
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
|
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
|
||||||
lammps->input->file();
|
lammps->input->file();
|
||||||
|
lammps->cleanup();
|
||||||
delete lammps;
|
delete lammps;
|
||||||
#endif
|
#endif
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
MPI_Finalize();
|
MPI_Finalize();
|
||||||
|
|
||||||
#ifdef FFT_FFTW3
|
|
||||||
// tell fftw3 to delete its global memory pool
|
|
||||||
// and thus avoid bogus valgrind memory leak reports
|
|
||||||
#ifdef FFT_SINGLE
|
|
||||||
fftwf_cleanup();
|
|
||||||
#else
|
|
||||||
fftw_cleanup();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user