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

[REVIEW]Optimize pg.add_data for vector properties #3022

Merged

Conversation

VibhuJawa
Copy link
Member

This PR fixes #2991

Optimization around 4000x . See benchmarks.

On this PR:

------------------------------------------------------------------ benchmark: 12 tests -------------------------------------------------------------------
Name (time in ms, mem in bytes)                 Mean                   GPU mem            GPU Leaked mem            Rounds            GPU Rounds          
----------------------------------------------------------------------------------------------------------------------------------------------------------
bench_add_vector_features[32-10000]          21.3116 (1.0)           4,050,032 (1.0)                   0 (1.0)           1           1
bench_add_vector_features[32-100000]         23.9746 (1.12)         40,500,032 (10.00)                 0 (1.0)           1           1
bench_add_vector_features[64-100000]         32.7488 (1.54)         78,900,032 (19.48)                 0 (1.0)           1           1
bench_add_vector_features[64-10000]          33.9622 (1.59)          7,890,032 (1.95)                  0 (1.0)           1           1
bench_add_vector_features[128-10000]         46.1369 (2.16)         15,570,032 (3.84)                  0 (1.0)           1           1
bench_add_vector_features[32-1000000]        51.0027 (2.39)        405,000,032 (100.00)                0 (1.0)           1           1
bench_add_vector_features[128-100000]        56.5531 (2.65)        155,700,032 (38.44)                 0 (1.0)           1           1
bench_add_vector_features[32-10000000]      102.4596 (4.81)      4,050,000,032 (999.99)                0 (1.0)           1           1
bench_add_vector_features[64-1000000]       104.9687 (4.93)        789,000,032 (194.81)                0 (1.0)           1           1
bench_add_vector_features[64-10000000]      181.3918 (8.51)      7,890,000,032 (>1000.0)               0 (1.0)           1           1
bench_add_vector_features[128-1000000]      455.6243 (21.38)     1,557,000,032 (384.44)                0 (1.0)           1           1
bench_add_vector_features[128-10000000]     566.9107 (26.60)    15,570,000,032 (>1000.0)               0 (1.0)           1           1
----------------------------------------------------------------------------------------------------------------------------------------------------------

On Mainline:

---------------------------------------------------------------- benchmark: 2 tests ---------------------------------------------------------------
Name (time in s, mem in bytes)               Mean               GPU mem            GPU Leaked mem            Rounds            GPU Rounds          
---------------------------------------------------------------------------------------------------------------------------------------------------
bench_add_vector_features[32-10000]        5.6117 (1.0)       6,489,888 (1.0)                   0 (1.0)           1           1
bench_add_vector_features[32-100000]     102.9704 (18.35)    64,899,888 (10.00)                 0 (1.0)           1           1
...
...
...
...
---------------------------------------------------------------------------------------------------------------------------------------------------

@VibhuJawa VibhuJawa added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Dec 1, 2022
@VibhuJawa VibhuJawa marked this pull request as ready for review December 1, 2022 17:56
@VibhuJawa VibhuJawa requested a review from a team as a code owner December 1, 2022 17:56
@VibhuJawa VibhuJawa changed the title Optimize pg.add_data for vector properties [REVIEW]Optimize pg.add_data for vector properties Dec 1, 2022
@VibhuJawa VibhuJawa requested a review from eriknw December 1, 2022 17:56
@VibhuJawa VibhuJawa changed the base branch from branch-22.12 to branch-23.02 December 2, 2022 15:08
@BradReesWork BradReesWork added this to the 23.02 milestone Dec 2, 2022
@VibhuJawa
Copy link
Member Author

rerun tests

Copy link
Contributor

@rlratzel rlratzel left a comment

Choose a reason for hiding this comment

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

This is great, thanks for adding the benchmark too. I had one question below:

cp.arange(start=0, stop=len(data) + 1, step=n_cols), dtype="int32"
)
mask_col = cp.full(shape=n_rows, fill_value=True)
mask = cudf._lib.transform.bools_to_mask(as_column(mask_col))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intended to be a public API, or is there a risk cuDF could change it and break us?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is a risk that cuDF could change it later on but I could not come up with something without it.

https://github.com/search?q=repo%3Arapidsai%2Fcudf+bools_to_mask+language%3APython&type=code&l=Python

@rlratzel
Copy link
Contributor

@gpucibot merge

@rapids-bot rapids-bot bot merged commit c745570 into rapidsai:branch-23.02 Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX] Optimize adding vector properties to property graph
3 participants