# LSTM on a GPU

**URL:** <https://discourse.julialang.org/t/lstm-on-a-gpu/25113>\
**Category:** Machine Learning\
**Created:** [June 10, 2019, 11:06am UTC](https://discourse.julialang.org/t/lstm-on-a-gpu/25113 "2019-06-10T11:06:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanhevg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tanhevg/32/12025_2.png) [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Post date:** [June 10, 2019, 11:06am UTC](https://discourse.julialang.org/t/lstm-on-a-gpu/25113/1 "2019-06-10T11:06:17Z")

</div>

Hello,

I am trying to run the [Flux model zoo LSTM example](https://github.com/tanhevg/model-zoo/blob/tanhevg/gpu-blstm-example/audio/speech-blstm/01-speech-blstm.jl) on a GPU. Turns out there is no performance improvement; on the contrary, it gets worse. The example uses ~500mb of training data, and each epoch runs for ~25sec on CPU and ~55sec on GPU. I am using the CUDAnative workflow from Flux (not CuLSTM). A few questions:

1. Should I expect better GPU performance on a problem of this size?
2. I suspect one of the reasons of poor performance could be unnecessary copying of data between CPU and GPU. Are there tools to debug this?
3. I noticed there is another set of models in Flux that use the `cudnn` NVidia library, the `CuLSTM` model. Is it better to use those? Are there any examples?
4. Should I be using an entirely different ML package?

Thanks in advance.
