Skip to content

GPU memory not being released #20

@ftorres-ucf

Description

@ftorres-ucf

Describe the bug
A clear and concise description of what the bug is.

When predict.py is run, sometimes it will release the gpu memory allocated and sometimes it wont release the memory from the GPU. This causes some problems when trying to run multiple models in serial execution.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

This error is not easily reproducible, and I also do not know if the files you guys have to work with can reproduce the error.

The error seems to happen the most when trying to run model e with the gpu specified. As in:
predict.py -g 0 -c Temp_Data/Candidates/ -m e

Expected behavior
A clear and concise description of what you expected to happen.

The expected behavior is for the program to run and then to close.

Screenshots
If applicable, add screenshots to help explain your problem.

Screenshot_20210830_144805
It gets stuck on the las line of the command line.

Additional context
Add any other context about the problem here.

I always like to find solutions for these problems before posting any bug. My best guess as to whats happening is that the Tensorflow module does not release the memory allocated in the get_model call in line 79.

By searching for solutions online, i found this:
https://stackoverflow.com/questions/39758094/clearing-tensorflow-gpu-memory-after-model-execution

Therefore, by splitting the program into two different processes, then asking them to join, it should release the GPU memory. I have not yet tried to implement this, however, I could possibly do a pull request after trying it and fixing it (if it is the right solution).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions