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

Faster testing code #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AshwinParanjape
Copy link

  • Creating the softmax_W tensor on CPU makes it transfer the tensor from CPU to GPU for every batch during test time (where full softmax is used), slowing down the code by 5x or so.
  • Transposing softmax_W is a large operation compared to transposing input and output vectors, increasing the speed of full softmax further

By profiling using timeline from Tensorflow we observe the following
Before -
screen shot 2018-05-16 at 2 22 54 pm
After -
screen shot 2018-05-16 at 2 26 56 pm
The big MEMCPYHtoD and big Transpose before MatMul are gone

* Creating the softmax_W tensor on CPU makes it transfer the tensor from CPU to GPU for every batch during test time (where full softmax is used), slowing down the code by 5x or so. 
* Transposing softmax_W is a large operation compared to transposing input and output vectors, increasing the speed of full softmax further
@matt-peters
Copy link
Contributor

matt-peters commented May 16, 2018

Thanks for the PR!

I put the softmax variables on CPU for training as they occupy a lot of memory and were overwhelming the poor 8 GB GeForce GTX 1080 GPUs I originally used to train the ELMo model.

Can you make the device placement for the softmax configurable? Or place them on GPU for testing only (by checking the value of self.is_training)?

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

Successfully merging this pull request may close these issues.

2 participants