Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
74d88bf8
Commit
74d88bf8
authored
Feb 20, 2025
by
sangwz
Browse files
Merge branch 'dtk25.04' of
http://developer.sourcefind.cn/codes/OpenDAS/dgl
into 2.2.1
parents
2a1ac588
314cedc1
Changes
179
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
51 additions
and
32 deletions
+51
-32
notebooks/stochastic_training/node_classification.ipynb
notebooks/stochastic_training/node_classification.ipynb
+1
-1
python/dgl/_ffi/libinfo.py
python/dgl/_ffi/libinfo.py
+1
-0
python/dgl/_ffi/runtime_ctypes.py
python/dgl/_ffi/runtime_ctypes.py
+4
-4
python/dgl/backend/pytorch/tensor.py
python/dgl/backend/pytorch/tensor.py
+1
-1
python/dgl/ndarray.py
python/dgl/ndarray.py
+2
-1
python/update_version.py
python/update_version.py
+3
-0
src/array/arith.h
src/array/arith.h
+4
-3
src/array/array.cc
src/array/array.cc
+5
-4
src/array/array_arith.cc
src/array/array_arith.cc
+3
-2
src/array/cpu/array_cumsum.cc
src/array/cpu/array_cumsum.cc
+1
-0
src/array/cpu/array_sort.cc
src/array/cpu/array_sort.cc
+1
-1
src/array/cpu/gather_mm.cc
src/array/cpu/gather_mm.cc
+2
-1
src/array/cpu/labor_sampling.cc
src/array/cpu/labor_sampling.cc
+2
-1
src/array/cpu/rowwise_sampling.cc
src/array/cpu/rowwise_sampling.cc
+2
-1
src/array/cpu/rowwise_topk.cc
src/array/cpu/rowwise_topk.cc
+2
-1
src/array/cpu/sddmm.cc
src/array/cpu/sddmm.cc
+2
-1
src/array/cpu/segment_reduce.cc
src/array/cpu/segment_reduce.cc
+3
-2
src/array/cpu/spmm.cc
src/array/cpu/spmm.cc
+2
-1
src/array/cpu/traversal.cc
src/array/cpu/traversal.cc
+2
-1
src/array/cuda/array_cumsum.hip
src/array/cuda/array_cumsum.hip
+8
-6
No files found.
notebooks/stochastic_training/node_classification.ipynb
View file @
74d88bf8
...
...
@@ -375,4 +375,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
\ No newline at end of file
python/dgl/_ffi/libinfo.py
View file @
74d88bf8
...
...
@@ -105,4 +105,5 @@ def find_lib_path(name=None, search_path=None, optional=False):
# We use the version of the incoming release for code
# that is under development.
# The following line is set by dgl/python/update_version.py
__version__
=
"2.2.1"
python/dgl/_ffi/runtime_ctypes.py
View file @
74d88bf8
...
...
@@ -123,7 +123,7 @@ class DGLContext(ctypes.Structure):
7
:
"vulkan"
,
8
:
"metal"
,
9
:
"vpi"
,
10
:
"
rocm
"
,
10
:
"
gpu
"
,
11
:
"opengl"
,
12
:
"ext_dev"
,
}
...
...
@@ -131,9 +131,9 @@ class DGLContext(ctypes.Structure):
"llvm"
:
1
,
"stackvm"
:
1
,
"cpu"
:
1
,
"gpu"
:
2
,
"cuda"
:
2
,
"nvptx"
:
2
,
"gpu"
:
10
,
"cuda"
:
10
,
"nvptx"
:
10
,
"cl"
:
4
,
"opencl"
:
4
,
"aocl"
:
5
,
...
...
python/dgl/backend/pytorch/tensor.py
View file @
74d88bf8
...
...
@@ -116,7 +116,7 @@ def to_backend_ctx(dglctx):
dev_type
=
dglctx
.
device_type
if
dev_type
==
1
:
return
th
.
device
(
"cpu"
)
elif
dev_type
==
2
:
elif
dev_type
==
2
or
dev_type
==
10
:
return
th
.
device
(
"cuda"
,
dglctx
.
device_id
)
else
:
raise
ValueError
(
"Unsupported DGL device context:"
,
dglctx
)
...
...
python/dgl/ndarray.py
View file @
74d88bf8
...
...
@@ -80,7 +80,8 @@ def gpu(dev_id=0):
ctx : DGLContext
The created context
"""
return
DGLContext
(
2
,
dev_id
)
# device type for dcu is 10, nv is 2
return
DGLContext
(
10
,
dev_id
)
def
array
(
arr
,
ctx
=
cpu
(
0
)):
...
...
python/update_version.py
View file @
74d88bf8
...
...
@@ -16,7 +16,10 @@ import re
# (usually "aYYMMDD")
# The environment variable DGL_VERSION_SUFFIX is the local version label
# suffix for indicating CPU and CUDA versions as in PEP 440 (e.g. "+cu102")
__version__
=
"2.2.1"
+
os
.
getenv
(
"DGL_PRERELEASE"
,
""
)
__version__
+=
os
.
getenv
(
"DGL_VERSION_SUFFIX"
,
""
)
print
(
__version__
)
...
...
src/array/arith.h
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2019 by Contributors
* @file array/arith.h
...
...
@@ -6,13 +7,13 @@
#ifndef DGL_ARRAY_ARITH_H_
#define DGL_ARRAY_ARITH_H_
#ifdef __
CUDA
CC__
#define DGLDEVICE __device__
#ifdef __
HIP
CC__
#define DGLDEVICE __device__
__host__
#define DGLINLINE __forceinline__
#else
#define DGLDEVICE
#define DGLINLINE inline
#endif // __
CUDA
CC__
#endif // __
HIP
CC__
namespace
dgl
{
namespace
aten
{
...
...
src/array/array.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2019-2022 by Contributors
* @file array/array.cc
...
...
@@ -14,9 +15,9 @@
#include <sstream>
#include "../c_api_common.h"
#include "
./
arith.h"
#include "
./
array_op.h"
#include "
./
kernel_decl.h"
#include "arith.h"
#include "array_op.h"
#include "kernel_decl.h"
using
namespace
dgl
::
runtime
;
...
...
@@ -585,7 +586,7 @@ COOMatrix CSRRowWiseSampling(
// prob_or_mask is pinned and rows on GPU is valid
CHECK_VALID_CONTEXT
(
prob_or_mask
,
rows
);
ATEN_CSR_SWITCH_CUDA_UVA
(
mat
,
rows
,
XPU
,
IdType
,
"CSRRowWiseSampling"
,
{
CHECK
(
!
(
prob_or_mask
->
dtype
.
bits
==
8
&&
XPU
==
kDGLCUDA
))
CHECK
(
!
(
prob_or_mask
->
dtype
.
bits
==
8
&&
(
XPU
==
kDGLCUDA
||
XPU
==
kDGLROCM
)
))
<<
"GPU sampling with masks is currently not supported yet."
;
ATEN_FLOAT_INT8_UINT8_TYPE_SWITCH
(
prob_or_mask
->
dtype
,
FloatType
,
"probability or mask"
,
{
...
...
src/array/array_arith.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2019 by Contributors
* @file array/array_aritch.cc
...
...
@@ -8,8 +9,8 @@
#include <dgl/runtime/ndarray.h>
#include "../c_api_common.h"
#include "
./
arith.h"
#include "
./
array_op.h"
#include "arith.h"
#include "array_op.h"
using
namespace
dgl
::
runtime
;
...
...
src/array/cpu/array_cumsum.cc
View file @
74d88bf8
...
...
@@ -29,6 +29,7 @@ IdArray CumSum(IdArray array, bool prepend_zero) {
IdType
*
out_d
=
ret
.
Ptr
<
IdType
>
();
out_d
[
0
]
=
in_d
[
0
];
for
(
int64_t
i
=
1
;
i
<
len
;
++
i
)
out_d
[
i
]
=
out_d
[
i
-
1
]
+
in_d
[
i
];
std
::
cout
<<
"limm cpu ret : "
<<
ret
<<
std
::
endl
;
return
ret
;
}
}
...
...
src/array/cpu/array_sort.cc
View file @
74d88bf8
...
...
@@ -48,7 +48,7 @@ void swap(const PairRef<V1, V2>& r1, const PairRef<V1, V2>& r2) {
}
template
<
typename
V1
,
typename
V2
>
struct
PairIterator
__host__
struct
PairIterator
:
public
std
::
iterator
<
std
::
random_access_iterator_tag
,
std
::
pair
<
V1
,
V2
>
,
std
::
ptrdiff_t
,
std
::
pair
<
V1
*
,
V2
*>
,
PairRef
<
V1
,
V2
>>
{
...
...
src/array/cpu/gather_mm.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2020 by Contributors
* @file kernel/cpu/gaher_mm.cc
* @brief GatherMM C APIs and definitions.
*/
#include "
./
gather_mm.h"
#include "gather_mm.h"
#include <dgl/array.h>
...
...
src/array/cpu/labor_sampling.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/*!
* Copyright (c) 2022, NVIDIA Corporation
* Copyright (c) 2022, GT-TDAlab (Muhammed Fatih Balin & Umit V. Catalyurek)
...
...
@@ -18,7 +19,7 @@
* \file array/cuda/labor_sampling.cc
* \brief labor sampling
*/
#include "
./
labor_pick.h"
#include "labor_pick.h"
namespace
dgl
{
namespace
aten
{
...
...
src/array/cpu/rowwise_sampling.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2020 by Contributors
* @file array/cpu/rowwise_sampling.cc
...
...
@@ -7,7 +8,7 @@
#include <numeric>
#include "
./
rowwise_pick.h"
#include "rowwise_pick.h"
namespace
dgl
{
namespace
aten
{
...
...
src/array/cpu/rowwise_topk.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2020 by Contributors
* @file array/cpu/rowwise_topk.cc
...
...
@@ -6,7 +7,7 @@
#include <algorithm>
#include <numeric>
#include "
./
rowwise_pick.h"
#include "rowwise_pick.h"
namespace
dgl
{
namespace
aten
{
...
...
src/array/cpu/sddmm.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2020 by Contributors
* @file aten/cpu/sddmm.cc
* @brief SDDMM C APIs and definitions.
*/
#include "
./
sddmm.h"
#include "sddmm.h"
#include <dgl/array.h>
...
...
src/array/cpu/segment_reduce.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2020 by Contributors
* @file kernel/cpu/segment_reduce.cc
* @brief Segment reduce C APIs and definitions.
*/
#include "
./
segment_reduce.h"
#include "segment_reduce.h"
#include <dgl/array.h>
#include <string>
#include "
./
spmm_binary_ops.h"
#include "spmm_binary_ops.h"
namespace
dgl
{
namespace
aten
{
...
...
src/array/cpu/spmm.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2020 by Contributors
* @file kernel/cpu/spmm.cc
* @brief SPMM C APIs and definitions.
*/
#include "
./
spmm.h"
#include "spmm.h"
#include <dgl/array.h>
...
...
src/array/cpu/traversal.cc
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
/**
* Copyright (c) 2020 by Contributors
* @file array/cpu/traversal.cc
* @brief Graph traversal implementation
*/
#include "
./
traversal.h"
#include "traversal.h"
#include <dgl/graph_traversal.h>
...
...
src/array/cuda/array_cumsum.
cu
→
src/array/cuda/array_cumsum.
hip
View file @
74d88bf8
// !!! This is a file automatically generated by hipify!!!
#include "hip/hip_runtime.h"
/**
* Copyright (c) 2020 by Contributors
* @file array/cpu/array_cumsum.cu
* @brief Array cumsum GPU implementation
*/
#include <dgl/array.h>
#include "../../../include/dgl/array.h"
#include <cub/cub.
cuh
>
#include <
hip
cub/
hip
cub.
hpp
>
#include "../../runtime/cuda/cuda_common.h"
#include "
./
utils.h"
#include "utils.h"
namespace dgl {
using runtime::NDArray;
...
...
@@ -23,7 +26,7 @@ IdArray CumSum(IdArray array, bool prepend_zero) {
: aten::Full(0, 1, array->dtype.bits, array->ctx);
auto device = runtime::DeviceAPI::Get(array->ctx);
cuda
Stream_t
stream
=
runtime
::
getCurrent
CUDA
Stream
();
hip
Stream_t stream = runtime::getCurrent
HIP
Stream
MasqueradingAsCUDA
();
const IdType* in_d = array.Ptr<IdType>();
IdArray ret;
IdType* out_d = nullptr;
...
...
@@ -36,16 +39,15 @@ IdArray CumSum(IdArray array, bool prepend_zero) {
}
// Allocate workspace
size_t workspace_size = 0;
CUDA_CALL
(
cub
::
DeviceScan
::
InclusiveSum
(
CUDA_CALL(
hip
cub::DeviceScan::InclusiveSum(
nullptr, workspace_size, in_d, out_d, len, stream));
void* workspace = device->AllocWorkspace(array->ctx, workspace_size);
// Compute cumsum
CUDA_CALL
(
cub
::
DeviceScan
::
InclusiveSum
(
CUDA_CALL(
hip
cub::DeviceScan::InclusiveSum(
workspace, workspace_size, in_d, out_d, len, stream));
device->FreeWorkspace(array->ctx, workspace);
return ret;
}
...
...
Prev
1
2
3
4
5
6
7
8
9
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment