Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TPA-LSTM trains slower on GPU than on CPU #15

Open
sdobber opened this issue Jan 6, 2021 · 4 comments
Open

TPA-LSTM trains slower on GPU than on CPU #15

sdobber opened this issue Jan 6, 2021 · 4 comments

Comments

@sdobber
Copy link
Owner

sdobber commented Jan 6, 2021

Apparently, the construction with Flux.unstack and Flux.stack is much slower than the 'slow' Zygote.Buffer. The latter cannot be used on the GPU due to missing support for array mutation.

@DhairyaLGandhi
Copy link

Probably open an issue on Flux.jl with an MWE?

@sdobber
Copy link
Owner Author

sdobber commented Jan 19, 2021

Which issue are you referring to? The fact that stack and unstack are slower, or that Zygote.Buffer does not work? I will try to get a MWE together (though it might take a bit due to another project I need to work on). I have to admit that the mistake could as well be completely on my side. I'm new to GPU programming, so I'm still learning a lot while slowly moving forward, and I'm probably still doing a lot of things the wrong way 😄

@DhairyaLGandhi
Copy link

Both? I'm happy to help with network architectures as well. Btw, did you check that we added a reference to this repo on the flux site https://fluxml.ai/ecosystem.html#advanced-models

sdobber added a commit that referenced this issue Jan 26, 2021
This should address issue #15. Update of Flux to newer version stops GPU
from segfaulting when writing to a `Zygote.Buffer`.
@sdobber
Copy link
Owner Author

sdobber commented Jan 26, 2021

Note to myself: MWE for Zygote.Buffer segfault on GPU:

using Flux
inp = rand(Float32, 137, 10, 1000) |> gpu
B = Flux.Zygote.Buffer(inp, 137,9,1000) 
t = 1
x = inp[:,t,:]
B[:,t,:] = x 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants