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

[CUDA][Kernel] A bunch of int64 kernels for COO and CSR #1883

Merged
merged 16 commits into from
Jul 30, 2020

Conversation

jermainewang
Copy link
Member

@jermainewang jermainewang commented Jul 29, 2020

Description

New kernels added for int64 CSR/COO on CUDA:

  • COOSort
  • CSRSort
  • COO2CSR
  • CSR2COO
  • CSR2CSC

TODO
* Integrate with python and fix bugs.

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented
  • To the my best knowledge, examples are either not affected by this change,
    or have been fixed to be compatible with this change
  • Related issue is referred in this PR

@jermainewang jermainewang requested a review from yzh119 July 29, 2020 09:52
@jermainewang jermainewang changed the title [WIP][CUDA][Kernel] A bunch of int64 kernels for COO and CSR [CUDA][Kernel] A bunch of int64 kernels for COO and CSR Jul 29, 2020
* \brief Sort the ID vector in ascending order.
*
* It performs both sort and arg_sort (returning the sorted index). The sorted index
* is always in int64.
Copy link
Member

Choose a reason for hiding this comment

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

Why the sorted index is always int64, is it designed to be compatible with pytorch?

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 think int64 is the safest since the tensor shape is in int64.

python/dgl/nn/tensorflow/softmax.py Show resolved Hide resolved
return ret;
}

std::ptrdiff_t operator-(const PairIterator& other) const {
Copy link
Member

Choose a reason for hiding this comment

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

Is it used for computing the difference of two iterators? When would this function be called?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's part of the random-access iterator interface. I guess some sort algorithms might use this operator.

IdType* val_data = val.Ptr<IdType>();
int64_t* idx_data = idx.Ptr<int64_t>();
typedef std::pair<IdType, int64_t> Pair;
#ifdef PARALLEL_ALGORITHMS
Copy link
Member

Choose a reason for hiding this comment

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

@classicsong , when would this flag be activated?

src/array/cuda/csr2coo.cu Outdated Show resolved Hide resolved
src/array/cuda/csr2coo.cu Show resolved Hide resolved
src/graph/heterograph.h Show resolved Hide resolved
@jermainewang jermainewang merged commit f4608c2 into dmlc:master Jul 30, 2020
@jermainewang jermainewang deleted the int64-cuda branch July 30, 2020 13:02
kingmbc pushed a commit to kingmbc/dgl that referenced this pull request Aug 2, 2020
* COO sort

* COOToCSR

* CSR2COO

* CSRSort; CSRTranspose

* pass all CSR tests

* lint

* remove int32 conversion

* fix tensorflow nn tests

* turn on CI

* fix

* addreess comments
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