Running deep learning program makes ubuntu 16.04 system freeze.

I am using a ubuntu 16.04.5 server with kernel 4.4.0-131-generic. My installed nvidia driver version is 390.77. After running a deep learning program, my system gets freezed and seems all process just halts, but the power is still on. The only one thing I can do is to reboot the server by pushing the button(tried alt+sys+REISUB, not working). No log is written to my disk when this things happen, and it will happen every time I run that program. Sometimes it freeze after serveral minutes I start the program, sometimes serveral hours. Is it possible that this is caused by the nvidia driver? Any help is appreciated in advance.