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

Support sparse_segment_sum ops on GPU. #55

Merged
merged 3 commits into from
May 12, 2021
Merged

Support sparse_segment_sum ops on GPU. #55

merged 3 commits into from
May 12, 2021

Conversation

Lifann
Copy link
Member

@Lifann Lifann commented Apr 23, 2021

SparseSegmentSum and SparseSegmentSumWithNumSegments are two important opeartions in sparse training and inference. Currently, there are no GPU impl in Tensorflow for them.

This PR provide GPU version of SparseSegmentSum and SparseSegmentSumWithNumSegments

@Lifann Lifann requested a review from rhdong as a code owner April 23, 2021 04:38
from tensorflow_recommenders_addons.dynamic_embedding.python.ops.restrict_policies import (
RestrictPolicy,
TimestampRestrictPolicy,
FrequencyRestrictPolicy,
)
from tensorflow_recommenders_addons.dynamic_embedding.python.ops.dynamic_embedding_variable import (
Copy link
Member

Choose a reason for hiding this comment

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

why delete ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I put it here to make it is ordered by alphabet.

@@ -14,6 +14,7 @@
# ==============================================================================
Copy link
Member

Choose a reason for hiding this comment

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

  1. Plz update "How to compile GPU version" to README.md.
  2. make workflow support GPU UnitTest.
  3. You just only add a op, but not apply to TFRA?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Accept.
  2. Currently, there is no available GPU host for UnitTest.
  3. Accept. The op is used in de.embedding_lookup_sparse.

"//conditions:default": ["-pthread", "-std=c++11", D_GLIBCXX_USE_CXX11_ABI],
"//conditions:default": [
"-pthread",
"-std=c++14",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why upgrade to c++14?

Copy link
Member Author

Choose a reason for hiding this comment

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

When reusing some code in Tensorflow 2.4.1, we need c++14 to pass the compilation.

@Mr-Nineteen
Copy link
Contributor

Please tell me, how to allocate video memory?

@Lifann
Copy link
Member Author

Lifann commented May 8, 2021

Please tell me, how to allocate video memory?

Just follow BFC when allocating the output tensor.

@google-cla
Copy link

google-cla bot commented May 10, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

README.md Outdated
@@ -81,6 +81,13 @@ pip install tensorflow-recommenders-addons[tensorflow]
```

Similar extras exist for the `tensorflow-gpu` and `tensorflow-cpu` packages.

On default, install `tensorflow-recommenders-addons` with pip will download GPU version packages and
Copy link
Member

Choose a reason for hiding this comment

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

By default
download CPU version

Copy link
Member Author

Choose a reason for hiding this comment

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

Accept

@rhdong rhdong changed the title Support GPU sparse_segment_sum ops. Support GPU sparse_segment_sum ops and HashTable On GPU. May 10, 2021
@google-cla
Copy link

google-cla bot commented May 10, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented May 10, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@Lifann Lifann changed the title Support GPU sparse_segment_sum ops and HashTable On GPU. Support GPU sparse_segment_sum ops On GPU. May 11, 2021
@Lifann Lifann changed the title Support GPU sparse_segment_sum ops On GPU. Support sparse_segment_sum ops on GPU. May 11, 2021
README.md Outdated Show resolved Hide resolved
@@ -8,6 +8,12 @@ _TF_SHARED_LIBRARY_NAME = "TF_SHARED_LIBRARY_NAME"

_TF_CXX11_ABI_FLAG = "TF_CXX11_ABI_FLAG"

TF_MAJOR_VERSION = "TF_MAJOR_VERSION"
Copy link
Member

Choose a reason for hiding this comment

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

when cuda is enabled, project name of whl should be 'tensorflow_recommenders_addons_gpu'

Copy link
Member Author

Choose a reason for hiding this comment

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

GPU and CPU version should share the same version number.

configure.py Outdated Show resolved Hide resolved
README.md Outdated
##### Compatibility Matrix with GPU
| TensorFlow Recommenders-Addons | TensorFlow | Compiler | CUDNN | CUDA | Compute Capability |
|:----------------------- |:---- |:---------| :------------ | :---- | :------------ |
| tensorflow-recommenders-addons-0.1.0 | 2.4.1 | GCC 7.3.1 | 8.2.0 | 11.0 | SM 3.5 and later |
Copy link
Member

Choose a reason for hiding this comment

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

make a list: 3.5, .......8.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Accept.

@rhdong
Copy link
Member

rhdong commented May 12, 2021

LGTM

@rhdong rhdong merged commit 5bf4bd8 into tensorflow:master May 12, 2021
@Lifann Lifann deleted the Lifann/support-sparse-segment-sum-ops-on-gpu branch June 18, 2021 07:24
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.

3 participants