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
60a27bc6
Unverified
Commit
60a27bc6
authored
Dec 26, 2023
by
Muhammed Fatih BALIN
Committed by
GitHub
Dec 26, 2023
Browse files
[GraphBolt][CUDA] Pass GPU architecture option from DGL (#6792)
parent
5ce42668
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
CMakeLists.txt
CMakeLists.txt
+3
-0
cmake/modules/CUDA.cmake
cmake/modules/CUDA.cmake
+4
-0
graphbolt/CMakeLists.txt
graphbolt/CMakeLists.txt
+6
-0
No files found.
CMakeLists.txt
View file @
60a27bc6
...
...
@@ -527,6 +527,7 @@ endif(BUILD_SPARSE)
if
(
BUILD_GRAPHBOLT
)
message
(
STATUS
"Configuring graphbolt library"
)
string
(
REPLACE
";"
"
\\
;"
CUDA_ARCHITECTURES_ESCAPED
"
${
CUDA_ARCHITECTURES
}
"
)
file
(
TO_NATIVE_PATH
${
CMAKE_CURRENT_BINARY_DIR
}
BINDIR
)
file
(
TO_NATIVE_PATH
${
CMAKE_COMMAND
}
CMAKE_CMD
)
if
(
MSVC
)
...
...
@@ -541,6 +542,7 @@ if(BUILD_GRAPHBOLT)
BINDIR=
${
BINDIR
}
CFLAGS=
${
CMAKE_C_FLAGS
}
CXXFLAGS=
${
CMAKE_CXX_FLAGS
}
CUDAARCHS=
"
${
CUDA_ARCHITECTURES_ESCAPED
}
"
LDFLAGS=
${
CMAKE_SHARED_LINKER_FLAGS
}
cmd /e:on /c
${
BUILD_SCRIPT
}
${
TORCH_PYTHON_INTERPS
}
DEPENDS
${
BUILD_SCRIPT
}
...
...
@@ -557,6 +559,7 @@ if(BUILD_GRAPHBOLT)
BINDIR=
${
CMAKE_CURRENT_BINARY_DIR
}
CFLAGS=
${
CMAKE_C_FLAGS
}
CXXFLAGS=
${
CMAKE_CXX_FLAGS
}
CUDAARCHS=
"
${
CUDA_ARCHITECTURES_ESCAPED
}
"
LDFLAGS=
${
CMAKE_SHARED_LINKER_FLAGS
}
bash
${
BUILD_SCRIPT
}
${
TORCH_PYTHON_INTERPS
}
DEPENDS
${
BUILD_SCRIPT
}
...
...
cmake/modules/CUDA.cmake
View file @
60a27bc6
...
...
@@ -176,6 +176,7 @@ function(dgl_select_nvcc_arch_flags out_variable)
set
(
__nvcc_flags
"--expt-relaxed-constexpr"
)
set
(
__nvcc_archs_readable
""
)
set
(
__archs
""
)
# Tell NVCC to add binaries for the specified GPUs
foreach
(
__arch
${
__cuda_arch_bin
}
)
...
...
@@ -183,10 +184,12 @@ function(dgl_select_nvcc_arch_flags out_variable)
# User explicitly specified PTX for the concrete BIN
list
(
APPEND __nvcc_flags -gencode arch=compute_
${
CMAKE_MATCH_2
}
,code=sm_
${
CMAKE_MATCH_1
}
)
list
(
APPEND __nvcc_archs_readable sm_
${
CMAKE_MATCH_1
}
)
list
(
APPEND __archs
${
CMAKE_MATCH_1
}
)
else
()
# User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN
list
(
APPEND __nvcc_flags -gencode arch=compute_
${
__arch
}
,code=sm_
${
__arch
}
)
list
(
APPEND __nvcc_archs_readable sm_
${
__arch
}
)
list
(
APPEND __archs
${
__arch
}
)
endif
()
endforeach
()
...
...
@@ -199,6 +202,7 @@ function(dgl_select_nvcc_arch_flags out_variable)
string
(
REPLACE
";"
" "
__nvcc_archs_readable
"
${
__nvcc_archs_readable
}
"
)
set
(
${
out_variable
}
${
__nvcc_flags
}
PARENT_SCOPE
)
set
(
${
out_variable
}
_readable
${
__nvcc_archs_readable
}
PARENT_SCOPE
)
set
(
CUDA_ARCHITECTURES
${
__archs
}
PARENT_SCOPE
)
endfunction
()
################################################################################################
...
...
graphbolt/CMakeLists.txt
View file @
60a27bc6
...
...
@@ -49,6 +49,9 @@ if(USE_CUDA)
${
BOLT_DIR
}
/cuda/*.cu
)
list
(
APPEND BOLT_SRC
${
BOLT_CUDA_SRC
}
)
if
(
DEFINED ENV{CUDAARCHS}
)
set
(
CMAKE_CUDA_ARCHITECTURES $ENV{CUDAARCHS}
)
endif
()
endif
()
add_library
(
${
LIB_GRAPHBOLT_NAME
}
SHARED
${
BOLT_SRC
}
${
BOLT_HEADERS
}
)
...
...
@@ -67,6 +70,9 @@ if(USE_CUDA)
"../third_party/cccl/thrust"
"../third_party/cccl/cub"
"../third_party/cccl/libcudacxx/include"
)
get_property
(
archs TARGET
${
LIB_GRAPHBOLT_NAME
}
PROPERTY CUDA_ARCHITECTURES
)
message
(
STATUS
"CUDA_ARCHITECTURES for graphbolt:
${
archs
}
"
)
endif
()
# The Torch CMake configuration only sets up the path for the MKL library when
...
...
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