Skip to content

Comments

Faster testing code#41

Open
AshwinParanjape wants to merge 2 commits intoallenai:masterfrom
AshwinParanjape:AshwinParanjape-patch-faster-testing
Open

Faster testing code#41
AshwinParanjape wants to merge 2 commits intoallenai:masterfrom
AshwinParanjape:AshwinParanjape-patch-faster-testing

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