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

Add chunk batching #20

Merged
merged 1 commit into from
Dec 6, 2023
Merged

Add chunk batching #20

merged 1 commit into from
Dec 6, 2023

Conversation

sorenmulli
Copy link
Member

@sorenmulli sorenmulli commented Nov 28, 2023

Result of running the timing example shown below.
On GPU, batching gives 2x speedup. On CPU 1.6x. Batched GPU is >5x speedup compared to batched CPU.
Slightly underwhelming numbers but is probably considerably better on GPU for longer texts, haven't tested thoroughly.

➜ CUDA_VISIBLE_DEVICES=0 python scripts/test_timing.py
>>> Profiling device cpu on batch size 1
Initialization time 1.187613
Average time: 1.316037
Std. time: 0.044134
>>> Profiling device cpu on batch size 16
Initialization time 1.461619
Average time: 0.809319
Std. time: 0.026769
>>> Profiling device cpu on batch size 32
Initialization time 1.456767
Average time: 0.791711
Std. time: 0.010899
>>> Profiling device cpu on batch size 64
Initialization time 1.402210
Average time: 0.807623
Std. time: 0.012546
>>> Profiling device cuda on batch size 1
Initialization time 2.387370
Average time: 0.310700
Std. time: 0.000787
>>> Profiling device cuda on batch size 16
Initialization time 1.499094
Average time: 0.150101
Std. time: 0.000458
>>> Profiling device cuda on batch size 32
Initialization time 1.382926
Average time: 0.151230
Std. time: 0.001125
>>> Profiling device cuda on batch size 64
Initialization time 1.308398
Average time: 0.151791
Std. time: 0.015773

@sorenmulli sorenmulli closed this Nov 28, 2023
@sorenmulli sorenmulli force-pushed the feature/accelerate-gpu branch from 8d099ea to 5fc6fbb Compare November 28, 2023 21:26
@sorenmulli sorenmulli reopened this Nov 28, 2023
@sorenmulli sorenmulli marked this pull request as ready for review November 28, 2023 21:32
@sorenmulli sorenmulli requested a review from zer0x42 November 28, 2023 21:32
Copy link
Contributor

@zer0x42 zer0x42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sorenmulli sorenmulli merged commit 3b2e024 into main Dec 6, 2023
4 checks passed
@sorenmulli sorenmulli deleted the feature/accelerate-gpu branch December 6, 2023 13:42
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