17 Commits

Author SHA1 Message Date
Hongzhi (Steve), Chen 8f9f2e2a4d [Misc] Rename number_of_edges and number_of_nodes to num_edges and num_nodes. (#5472)
* core

* revert

---------

Co-authored-by: Ubuntu <ubuntu@ip-172-31-28-63.ap-northeast-1.compute.internal>
2023-03-29 08:57:47 +08:00
Xin Yao ae4a5b7394 [Feature] Add state_dict, load_state_dict, param_groups to dgl.optim.SparseGradOptimizer (#5311)
* init update

* all get/set optm_state

* add unit tests

* add docstring

* fix for multiple embeddings

* move embedding methods to private

* fix lint

* fix unit tests

* resolve comments

* merge master
2023-03-08 16:46:34 +08:00
Xin Yao 8d5d8962ad [Refactor] Replace third_party/nccl with PyTorch's NCCL backend (#4989)
* expose GeneratePermutation

* add sparse_all_to_all_push

* add sparse_all_to_all_pull

* add unit test

* handle world_size=1

* remove python nccl wrapper

* remove the nccl dependency

* use pinned memory to speedup D2H copy

* fix lint

* resolve comments

* fix lint

* fix ut

* resolve comments
2023-03-08 12:59:10 +08:00
peizhou001 611393021a [API Deprecation] Remove candidates in DGLGraph (#4946) 2022-12-01 16:41:53 +08:00
Hongzhi (Steve), Chen 76bb54044e [Misc] Black auto fix. (#4682)
Co-authored-by: Steve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
2022-10-08 14:16:12 +08:00
nv-dlasalle 020f02498c [Performance][Optimizer] Enable using UVA and FP16 with SparseAdam Optimizer (#3885)
* Add uva by default to embedding

* More updates

* Update optimizer

* Add new uva functions

* Expose new pinned memory function

* Add unit tests

* Update formatting

* Fix unit test

* Handle auto UVA case when training is on CPU

* Allow per-embedding decisions for whether to use UVA

* Address spares_optim.py comments

* Remove unused templates

* Update unit test

* Use dgl allocate memory for pinning

* allow automatically unpin

* workaround for d2h copy with a different dtype

* fix linting

* update error message

* update copyright

Co-authored-by: Xin Yao <xiny@nvidia.com>
Co-authored-by: Minjie Wang <wmjlyjemaine@gmail.com>
2022-06-24 09:20:08 +08:00
ndickson-nvidia edf2d52666 [Dist][Optim] Fixed race conditions in distributed SparseAdam and SparseAdagrad (#3971)
* * Fixed race condition bug in distributed/optim/pytorch/sparse_optim.py's SparseAdam::update, corresponding with the bug fixed in the non-distributed version in https://github.com/dmlc/dgl/pull/3013 , though using the newer Event-based approach from that corresponding function.  The race condition would often result in NaNs, like the previously fixed bug. https://github.com/dmlc/dgl/issues/2760

* * Fixed race condition bug in SparseAdagrad::update corresponding with the one fixed in SparseAdam::update in the previous commit.  Same info applies.

* * Fixed typo in all copies of a repeatedly-copied comment near bug fixed 3 commits ago, checking all implementations nearby for a corresponding bug.  (All of them appear to have been fixed as of 2 commits ago.)

* * Removed trailing whitespace

Co-authored-by: Quan (Andy) Gan <coin2028@hotmail.com>
Co-authored-by: Rhett Ying <85214957+Rhett-Ying@users.noreply.github.com>
2022-05-09 09:05:31 -07:00
xiang song(charlie.song) a609b4f023 [Bugfix] Fix #3291 (#3333)
* Fix #3291

* update

* fix

* Unit key

* Fix

Co-authored-by: Ubuntu <ubuntu@ip-172-31-2-66.ec2.internal>
Co-authored-by: Jinjing Zhou <VoVAllen@users.noreply.github.com>
2021-09-14 08:57:20 +08:00
nv-dlasalle 6001001fed Improve usage of pinned memory in sparse_optimizer (#3207)
Co-authored-by: xiang song(charlie.song) <classicxsong@gmail.com>
2021-08-02 14:16:23 +08:00
xiang song(charlie.song) 2f7ca41459 [Bug fix] Use shared memory for grad sync when NCCL is not avaliable as PyTorch distributed backend. (#3034)
* Use shared memory for grad sync when NCCL is not avaliable as PyTorch distributed backend.

Fix small bugs and update unitests

* Fix bug

* update test

* update test

* Fix unitest

* Fix unitest

* Fix test

* Fix

* simple update

Co-authored-by: Ubuntu <ubuntu@ip-172-31-24-212.ec2.internal>
2021-06-24 12:06:54 +08:00
nv-dlasalle 8932285652 [bugfix] Fix sparse_optim when the state is stored on the CPU (fixes #2760) (#3013)
* Fix sparse optimizer to wait on copies to the CPU

* Fix linting

* Fix typo

Co-authored-by: xiang song(charlie.song) <classicxsong@gmail.com>
2021-06-15 11:37:32 -07:00
nv-dlasalle 17d604b5c7 [Feature] Allow using NCCL for communication in dgl.NodeEmbedding and dgl.SparseOptimizer (#2824)
* Split from NCCL PR

* Fix type in comment

* Expand documentation for sparse_all_to_all_push

* Restore previous behavior in example

* Re-work optimizer to use NCCL based on gradient location

* Allow for running with embedding on CPU but using NCCL for gradient exchange

* Optimize single partition case

* Fix pylint errors

* Add missing include

* fix gradient indexing

* Fix line continuation

* Migrate 'first_step'

* Skip tests without enough GPUs to run NCCL

* Improve empty tensor handling for pytorch 1.5

* Fix indentation

* Allow multiple NCCL communicator to coexist

* Improve handling of empty message

* Update python/dgl/nn/pytorch/sparse_emb.py

Co-authored-by: xiang song(charlie.song) <classicxsong@gmail.com>

* Update python/dgl/nn/pytorch/sparse_emb.py

Co-authored-by: xiang song(charlie.song) <classicxsong@gmail.com>

* Keepy empty tensor dimensionaless

* th.empty -> th.tensor

* Preserve shape for empty non-zero dimension tensors

* Use shared state, when embedding is shared

* Add support for gathering an embedding

* Fix typo

* Fix more typos

* Fix backend call

* Use NodeDataLoader to take advantage of ddp

* Update training script to share memory

* Only squeeze last dimension

* Better handle empty message

* Keep embedding on the target device GPU if dgl_sparse if false in RGCN example

* Fix typo in comment

* Add asserts

* Improve documentation in example

Co-authored-by: xiang song(charlie.song) <classicxsong@gmail.com>
2021-06-10 21:19:00 -07:00
xiang song(charlie.song) c37e036432 [Bug Fix] Fix sparse opt bug (#2859)
* Fix #2856

* upd

* Fix unitest

* upd

* upd

* upd

* Fix

Co-authored-by: Ubuntu <ubuntu@ip-172-31-57-25.ec2.internal>
2021-04-25 13:40:21 +08:00
xiang song(charlie.song) 80c26877de [Bug Fix] Fix munmap bug in sparse optimizer (#2675)
* Fix munmap bug

* lint

* update

Co-authored-by: Ubuntu <ubuntu@ip-172-31-56-220.ec2.internal>
2021-02-22 11:33:44 +08:00
xiang song(charlie.song) 453d358d2c [Doc] Fix docs for sparse optimizer (#2680)
Co-authored-by: Ubuntu <ubuntu@ip-172-31-56-220.ec2.internal>
Co-authored-by: Minjie Wang <wmjlyjemaine@gmail.com>
2021-02-19 14:07:35 +08:00
xiang song(charlie.song) 23afe911b2 [Bug Fix] Fix several sparse optimizer bugs (#2596)
* Fix pytorch TCP kvstore bug

* lint

* Fix

* upd

* Fix lint

* Fix

* trigger

* fix

Co-authored-by: Ubuntu <ubuntu@ip-172-31-56-220.ec2.internal>
2021-02-05 11:49:41 +08:00
xiang song(charlie.song) a7e941c379 [Feature] Add support for sparse embedding (#2451)
* Add sparse embedding for dgl and update rgcn example

* upd

* Fix

* Revert "Fix"

This reverts commit 4da87cdfb8b8c3506b7fc7376cd2385ba8045c2a.

* Fix

* upd

* upd

* Fix

* Add unitest and update impl

* fix

* Clean up rgcn example code

* upd

* upd

* update

* Fix

* update score

* sparse for sage

* remove model sparse

* upd

* upd

* remove global norm

* revert delete model_sparse.py

* update according to comments

* Fix doc

* upd

* Fix test

* upd

* lint

* lint

* lint

* upd

* upd

* clean up

Co-authored-by: Ubuntu <ubuntu@ip-172-31-56-220.ec2.internal>
2021-01-28 00:26:49 +08:00