DeepPavlov icon indicating copy to clipboard operation
DeepPavlov copied to clipboard

Performance issue in /deeppavlov/core/common (by P3)

Open DLPerf opened this issue 3 years ago • 3 comments

Hello! I've found a performance issue in /deeppavlov/core/common/check_gpu.py: with tf.Session(config=sess_config)(here) is defined in the function check_gpu_existence(here) which is called in the function cudnn_gru_wrapper(here) which is called in the function cudnn_bi_gru(here) which is repeatedly called in the loop for n in range(n_stacks)(here).

tf.Session being defined repeatedly could lead to incremental overhead. If you define tf.Session out of the loop and pass tf.Session as a parameter to the loop, your program would be much more efficient. Here is the Stack Overflow post to support it.

Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.

DLPerf avatar Aug 25 '21 08:08 DLPerf

Hello, I'm looking forward to your reply~

DLPerf avatar Nov 04 '21 09:11 DLPerf

Hey @DLPerf sorry for the late response. Unfortunately, deprecated tf 1.x models have very limited support nowadays. I suggest you to describe what are developing exactly, maybe we can find a modern replacement in our DeepPavlov.

vaskonov avatar Nov 04 '21 11:11 vaskonov

Hello! I've found a performance issue in /deeppavlov/core/common/check_gpu.py: with tf.Session(config=sess_config)(here) is defined in the function check_gpu_existence(here) which is called in the function cudnn_gru_wrapper(here) which is called in the function cudnn_bi_gru(here) which is repeatedly called in the loop for n in range(n_stacks)(here).

tf.Session being defined repeatedly could lead to incremental overhead. If you define tf.Session out of the loop and pass tf.Session as a parameter to the loop, your program would be much more efficient. Here is the Stack Overflow post to support it.

Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.

Hey, I think the tf.Session is not called every single time, the if condition if _gpu_available is None: here helps in this. global _gpu_available is used to keep track of any previous results of existence of gpu.

Correct me if I am wrong. Thank you

Rushour0 avatar Dec 14 '21 05:12 Rushour0

Hello, @DLPerf! We are now using PyTorch instead of TensorFlow, so there should be no problem with this now. If you are still having difficulties with our library, please let us know.

IgnatovFedor avatar Jul 06 '23 12:07 IgnatovFedor