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
f119ea7c
Commit
f119ea7c
authored
Sep 23, 2024
by
sangwzh
Browse files
update dgl_sparse code to hip
parent
6ac701f8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
35 additions
and
21 deletions
+35
-21
dgl_sparse/CMakeLists.txt
dgl_sparse/CMakeLists.txt
+3
-3
dgl_sparse/build.sh
dgl_sparse/build.sh
+7
-3
dgl_sparse/src/elemenwise_op.cc
dgl_sparse/src/elemenwise_op.cc
+2
-1
dgl_sparse/src/matmul.cc
dgl_sparse/src/matmul.cc
+3
-2
dgl_sparse/src/matrix_ops_impl.h
dgl_sparse/src/matrix_ops_impl.h
+2
-1
dgl_sparse/src/sddmm.cc
dgl_sparse/src/sddmm.cc
+3
-2
dgl_sparse/src/softmax.cc
dgl_sparse/src/softmax.cc
+3
-2
dgl_sparse/src/sparse_format.cc
dgl_sparse/src/sparse_format.cc
+2
-1
dgl_sparse/src/sparse_matrix.cc
dgl_sparse/src/sparse_matrix.cc
+2
-1
dgl_sparse/src/sparse_matrix_coalesce.cc
dgl_sparse/src/sparse_matrix_coalesce.cc
+2
-1
dgl_sparse/src/spmm.cc
dgl_sparse/src/spmm.cc
+3
-2
dgl_sparse/src/spspmm.cc
dgl_sparse/src/spspmm.cc
+3
-2
No files found.
dgl_sparse/CMakeLists.txt
View file @
f119ea7c
...
@@ -22,9 +22,9 @@ list(GET TORCH_VERSION_LIST 1 TORCH_VERSION_MINOR)
...
@@ -22,9 +22,9 @@ list(GET TORCH_VERSION_LIST 1 TORCH_VERSION_MINOR)
set
(
SPARSE_LINKER_LIBS
""
)
set
(
SPARSE_LINKER_LIBS
""
)
if
(
USE_CUDA
)
if
(
USE_CUDA
OR USE_HIP
)
add_definitions
(
-DDGL_USE_CUDA
)
add_definitions
(
-DDGL_USE_CUDA
)
enable_language
(
CUDA
)
enable_language
(
HIP
)
endif
()
endif
()
# For windows, define NOMINMAX to avoid conflict with std::min/max
# For windows, define NOMINMAX to avoid conflict with std::min/max
...
@@ -49,7 +49,7 @@ file(GLOB SPARSE_SRC
...
@@ -49,7 +49,7 @@ file(GLOB SPARSE_SRC
${
SPARSE_DIR
}
/*.cc
${
SPARSE_DIR
}
/*.cc
${
SPARSE_DIR
}
/cpu/*.cc
${
SPARSE_DIR
}
/cpu/*.cc
)
)
if
(
USE_
CUDA
)
if
(
USE_
HIP
)
file
(
GLOB SPARSE_CUDA_SRC
file
(
GLOB SPARSE_CUDA_SRC
${
SPARSE_DIR
}
/cuda/*.cu
${
SPARSE_DIR
}
/cuda/*.cu
)
)
...
...
dgl_sparse/build.sh
View file @
f119ea7c
...
@@ -4,6 +4,9 @@ set -e
...
@@ -4,6 +4,9 @@ set -e
mkdir
-p
build
mkdir
-p
build
mkdir
-p
$BINDIR
/dgl_sparse
mkdir
-p
$BINDIR
/dgl_sparse
echo
">>>>> SPARSE DIR:
$BINDIR
"
cd
build
cd
build
if
[
$(
uname
)
=
'Darwin'
]
;
then
if
[
$(
uname
)
=
'Darwin'
]
;
then
...
@@ -12,14 +15,15 @@ else
...
@@ -12,14 +15,15 @@ else
CPSOURCE
=
*
.so
CPSOURCE
=
*
.so
fi
fi
CMAKE_FLAGS
=
"-DCUDA_TOOLKIT_ROOT_DIR=
$CUDA_TOOLKIT_ROOT_DIR
-DTORCH_CUDA_ARCH_LIST=
$TORCH_CUDA_ARCH_LIST
-DUSE_CUDA=
$USE_CUDA
-DEXTERNAL_DMLC_LIB_PATH=
$EXTERNAL_DMLC_LIB_PATH
"
# CMAKE_FLAGS="-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_TOOLKIT_ROOT_DIR -DTORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST -DUSE_CUDA=$USE_CUDA -DEXTERNAL_DMLC_LIB_PATH=$EXTERNAL_DMLC_LIB_PATH"
CMAKE_FLAGS
=
"-DTORCH_CUDA_ARCH_LIST=
$TORCH_HIP_ARCH_LIST
-DUSE_HIP=
$USE_HIP
-DEXTERNAL_DMLC_LIB_PATH=
$EXTERNAL_DMLC_LIB_PATH
"
# CMake passes in the list of directories separated by spaces. Here we replace them with semicolons.
# CMake passes in the list of directories separated by spaces. Here we replace them with semicolons.
CMAKE_FLAGS
=
"
$CMAKE_FLAGS
-DDGL_INCLUDE_DIRS=
${
INCLUDEDIR
// /;
}
-DDGL_BUILD_DIR=
$BINDIR
"
CMAKE_FLAGS
=
"
$CMAKE_FLAGS
-DDGL_INCLUDE_DIRS=
${
INCLUDEDIR
// /;
}
-DDGL_BUILD_DIR=
$BINDIR
"
echo
$CMAKE_FLAGS
echo
$CMAKE_FLAGS
if
[
$#
-eq
0
]
;
then
if
[
$#
-eq
0
]
;
then
$CMAKE_COMMAND
$CMAKE_FLAGS
..
$CMAKE_COMMAND
$CMAKE_FLAGS
..
make
-j
make
-j
VERBOSE
=
1
cp
-v
$CPSOURCE
$BINDIR
/dgl_sparse
cp
-v
$CPSOURCE
$BINDIR
/dgl_sparse
else
else
for
PYTHON_INTERP
in
$@
;
do
for
PYTHON_INTERP
in
$@
;
do
...
@@ -27,7 +31,7 @@ else
...
@@ -27,7 +31,7 @@ else
mkdir
-p
$TORCH_VER
mkdir
-p
$TORCH_VER
cd
$TORCH_VER
cd
$TORCH_VER
$CMAKE_COMMAND
$CMAKE_FLAGS
-DPYTHON_INTERP
=
$PYTHON_INTERP
../..
$CMAKE_COMMAND
$CMAKE_FLAGS
-DPYTHON_INTERP
=
$PYTHON_INTERP
../..
make
-j
make
-j
VERBOSE
=
1
cp
-v
$CPSOURCE
$BINDIR
/dgl_sparse
cp
-v
$CPSOURCE
$BINDIR
/dgl_sparse
cd
..
cd
..
done
done
...
...
dgl_sparse/src/elemenwise_op.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file elementwise_op.cc
* @file elementwise_op.cc
...
@@ -11,7 +12,7 @@
...
@@ -11,7 +12,7 @@
#include <memory>
#include <memory>
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/matmul.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file matmul.cc
* @file matmul.cc
* @brief DGL sparse matrix multiplication functions.
* @brief DGL sparse matrix multiplication functions.
*/
*/
#include "
./
matmul.h"
#include "matmul.h"
// clang-format off
// clang-format off
#include <sparse/dgl_headers.h>
#include <sparse/dgl_headers.h>
...
@@ -12,7 +13,7 @@
...
@@ -12,7 +13,7 @@
#include <sparse/sparse_matrix.h>
#include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include <torch/script.h>
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/matrix_ops_impl.h
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2023 by Contributors
* Copyright (c) 2023 by Contributors
* @file matrix_ops_impl.h
* @file matrix_ops_impl.h
...
@@ -12,7 +13,7 @@
...
@@ -12,7 +13,7 @@
#include <tuple>
#include <tuple>
#include <vector>
#include <vector>
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{}
// namespace sparse
namespace
sparse
{}
// namespace sparse
...
...
dgl_sparse/src/sddmm.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file sddmm.cc
* @file sddmm.cc
...
@@ -9,8 +10,8 @@
...
@@ -9,8 +10,8 @@
#include <sstream>
#include <sstream>
#include "
./
matmul.h"
#include "matmul.h"
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/softmax.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file softmax.cc
* @file softmax.cc
...
@@ -8,8 +9,8 @@
...
@@ -8,8 +9,8 @@
#include <sparse/sparse_matrix.h>
#include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include <torch/script.h>
#include "
./
matmul.h"
#include "matmul.h"
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/sparse_format.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file sparse_format.cc
* @file sparse_format.cc
...
@@ -9,7 +10,7 @@
...
@@ -9,7 +10,7 @@
#include <sparse/sparse_format.h>
#include <sparse/sparse_format.h>
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/sparse_matrix.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file sparse_matrix.cc
* @file sparse_matrix.cc
...
@@ -12,7 +13,7 @@
...
@@ -12,7 +13,7 @@
#include <sparse/sparse_matrix.h>
#include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include <torch/script.h>
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/sparse_matrix_coalesce.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file sparse_matrix_coalesce.cc
* @file sparse_matrix_coalesce.cc
...
@@ -9,7 +10,7 @@
...
@@ -9,7 +10,7 @@
#include <sparse/sparse_matrix.h>
#include <sparse/sparse_matrix.h>
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/spmm.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file spmm.cc
* @file spmm.cc
...
@@ -11,8 +12,8 @@
...
@@ -11,8 +12,8 @@
#include <sstream>
#include <sstream>
#include "
./
matmul.h"
#include "matmul.h"
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
dgl_sparse/src/spspmm.cc
View file @
f119ea7c
// !!! This is a file automatically generated by hipify!!!
/**
/**
* Copyright (c) 2022 by Contributors
* Copyright (c) 2022 by Contributors
* @file spspmm.cc
* @file spspmm.cc
...
@@ -9,8 +10,8 @@
...
@@ -9,8 +10,8 @@
#include <sparse/spspmm.h>
#include <sparse/spspmm.h>
#include <torch/script.h>
#include <torch/script.h>
#include "
./
matmul.h"
#include "matmul.h"
#include "
./
utils.h"
#include "utils.h"
namespace
dgl
{
namespace
dgl
{
namespace
sparse
{
namespace
sparse
{
...
...
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