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

Gpu mem leak with init invoked multiple times #1735

Merged
merged 2 commits into from
Oct 25, 2019

Conversation

ndtrung81
Copy link
Contributor

@ndtrung81 ndtrung81 commented Oct 21, 2019

Summary

This PR is to address the issue #1678 with the GPU package where host memory allocation increases when the run command is called multiple times.

Related Issues

Fixes #1678

Author(s)

Trung Nguyen (Northwestern)

Licensing

By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).

Backward Compatibility

Yes

Implementation Notes

The issue disappears if "pre no" is used, suggesting that the problem comes from init_style() in the /gpu pair styles, which go into the init function of the corresponding pair styles and pppm in the GPU library. The host memory increase is not reported as memory leaks by valgrind, but massif does show the memory allocation increase associated with libcuda.so for CUDA builds and libopencl.so with OpenCL builds. The changes in this PR are made to the base classes, which 1) remove a call to device->clear() in the clear_atomic() function, 2) move the section where the kernel and program deallocation to the destructor (assuming that the kernels and program are needed to be compiled once), and 3) initialize pair_program with NULL in the constructor, and delete the pointer if it is not NULL (that is, already allocated).

Post Submission Checklist

Please check the fields below as they are completed after the pull request has been submitted. Delete lines that don't apply

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system

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

Successfully merging this pull request may close these issues.

[BUG] GPU Memory Leak
3 participants