Merge branch 'master' into symbolic-atom-constants

This commit is contained in:
Axel Kohlmeyer
2020-09-15 14:58:13 -04:00
459 changed files with 11521 additions and 10514 deletions

View File

@ -315,41 +315,23 @@ void Info::command(int narg, char **arg)
}
if (flags & MEMORY) {
double meminfo[3];
get_memory_info(meminfo);
fputs("\nMemory allocation information (MPI rank 0):\n\n",out);
bigint bytes = 0;
bytes += atom->memory_usage();
bytes += neighbor->memory_usage();
bytes += comm->memory_usage();
bytes += update->memory_usage();
bytes += force->memory_usage();
bytes += modify->memory_usage();
for (int i = 0; i < output->ndump; i++)
bytes += output->dump[i]->memory_usage();
double mbytes = bytes/1024.0/1024.0;
fmt::print(out,"Total dynamically allocated memory: {:.4} Mbyte\n",mbytes);
fmt::print(out,"Total dynamically allocated memory: {:.4} Mbyte\n",
meminfo[0]);
#if defined(_WIN32)
HANDLE phandle = GetCurrentProcess();
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(phandle,(PROCESS_MEMORY_COUNTERS *)&pmc,sizeof(pmc));
fmt::print(out,"Non-shared memory use: {:.4} Mbyte\n",
(double)pmc.PrivateUsage/1048576.0);
fmt::print(out,"Maximum working set size: {:.4} Mbyte\n",
(double)pmc.PeakWorkingSetSize/1048576.0);
fmt::print(out,"Non-shared memory use: {:.4} Mbyte\n",meminfo[1]);
fmt::print(out,"Maximum working set size: {:.4} Mbyte\n",meminfo[2]);
#else
#if defined(__linux__)
struct mallinfo mi;
mi = mallinfo();
fmt::print(out,"Current reserved memory pool size: {:.4} Mbyte\n",
(double)mi.uordblks/1048576.0+(double)mi.hblkhd/1048576.0);
meminfo[1]);
#endif
struct rusage ru;
if (getrusage(RUSAGE_SELF, &ru) == 0) {
fmt::print(out,"Maximum resident set size: {:.4} Mbyte\n",
(double)ru.ru_maxrss/1024.0);
}
fmt::print(out,"Maximum resident set size: {:.4} Mbyte\n",meminfo[2]);
#endif
}
@ -1300,6 +1282,41 @@ std::string Info::get_cxx_info()
/* ---------------------------------------------------------------------- */
void Info::get_memory_info(double *meminfo)
{
double bytes = 0;
bytes += atom->memory_usage();
bytes += neighbor->memory_usage();
bytes += comm->memory_usage();
bytes += update->memory_usage();
bytes += force->memory_usage();
bytes += modify->memory_usage();
for (int i = 0; i < output->ndump; i++)
bytes += output->dump[i]->memory_usage();
meminfo[0] = bytes/1024.0/1024.0;
meminfo[1] = 0;
meminfo[2] = 0;
#if defined(_WIN32)
HANDLE phandle = GetCurrentProcess();
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(phandle,(PROCESS_MEMORY_COUNTERS *)&pmc,sizeof(pmc));
meminfo[1] = (double)pmc.PrivateUsage/1048576.0;
meminfo[2] = (double)pmc.PeakWorkingSetSize/1048576.0;
#else
#if defined(__linux__)
struct mallinfo mi;
mi = mallinfo();
meminfo[1] = (double)mi.uordblks/1048576.0+(double)mi.hblkhd/1048576.0;
#endif
struct rusage ru;
if (getrusage(RUSAGE_SELF, &ru) == 0)
meminfo[2] = (double)ru.ru_maxrss/1024.0;
#endif
}
/* ---------------------------------------------------------------------- */
char **Info::get_variable_names(int &num) {
num = input->variable->nvar;
return input->variable->names;