prabindh / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
122 stars 46 forks source link

Freeing VRAM and RAM in arapaho destructor #57

Closed turkishviking closed 6 years ago

turkishviking commented 6 years ago

Hi,

I had some problems with arapaho destructor not being able to free ram and vram. I have modified arapaho.cpp to do that (near to TODO : massive cleanup ;) ).

It is not perfect, I can't figure how to cleanup network.input_gpu and network.truth_gpu, but you can create and remove arapaho objects without going out of memory (both vram and ram).

It works for me on linux 64bits, cuda8, cudnn 5.1, gtx980, gcc and g++ 5.4

turkishviking commented 6 years ago

Yes of course, tell me if it is sufficient

prabindh commented 6 years ago

Can we run this in a loop - with a create/destroy sequence of the object, for an overnight run ?

turkishviking commented 6 years ago

Yes, I think it will be ok, I use that to switch yolo network on the fly. I haven't notice leakage yet. But like I said in the commit, net.input_gpu and net.truth_gpu aren't freed, im interested of the result of an overnight run, you will do that?

prabindh commented 6 years ago

With the yolov3 mainline sync in the master branch, this patch needs some changes, can you please check ?

turkishviking commented 6 years ago

ok, this is done (not a big conflict ^^⁾

prabindh commented 6 years ago

this change fails build, because net is now a pointer, not a struct. Please check,

turkishviking commented 6 years ago

ho sorry, I didn't see that, i 'll check

turkishviking commented 6 years ago

OK, this is done, it'now much more easy with net as pointer :)

prabindh commented 6 years ago

There is no boxes field, as it is part of the detection structure.

turkishviking commented 6 years ago

Sorry , it remains from the Yolo-V2 version, I'm not on today

prabindh commented 6 years ago

Please also set net to NULL after free.

turkishviking commented 6 years ago

done