avoid memory leak with MPI-IO
This commit is contained in:
@ -44,7 +44,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
ReadRestart::ReadRestart(LAMMPS *lmp) : Command(lmp) {}
|
ReadRestart::ReadRestart(LAMMPS *lmp) : Command(lmp), mpiio(nullptr) {}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -110,8 +110,7 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
fp = fopen(hfile.c_str(),"rb");
|
fp = fopen(hfile.c_str(),"rb");
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
error->one(FLERR,"Cannot open restart file {}: {}",
|
error->one(FLERR,"Cannot open restart file {}: {}", hfile, utils::getsyserror());
|
||||||
hfile, utils::getsyserror());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// read magic string, endian flag, format revision
|
// read magic string, endian flag, format revision
|
||||||
@ -336,8 +335,7 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
procfile.replace(procfile.find("%"),1,fmt::format("{}",icluster));
|
procfile.replace(procfile.find("%"),1,fmt::format("{}",icluster));
|
||||||
fp = fopen(procfile.c_str(),"rb");
|
fp = fopen(procfile.c_str(),"rb");
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
error->one(FLERR,"Cannot open restart file {}: {}",
|
error->one(FLERR,"Cannot open restart file {}: {}", procfile, utils::getsyserror());
|
||||||
procfile, utils::getsyserror());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int procsperfile;
|
int procsperfile;
|
||||||
@ -525,8 +523,9 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
MPI_Barrier(world);
|
MPI_Barrier(world);
|
||||||
|
|
||||||
if (comm->me == 0)
|
if (comm->me == 0)
|
||||||
utils::logmesg(lmp," read_restart CPU = {:.3f} seconds\n",
|
utils::logmesg(lmp," read_restart CPU = {:.3f} seconds\n",MPI_Wtime()-time1);
|
||||||
MPI_Wtime()-time1);
|
|
||||||
|
delete mpiio;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user