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
77968e30
Unverified
Commit
77968e30
authored
Nov 14, 2020
by
Minjie Wang
Committed by
GitHub
Nov 14, 2020
Browse files
[Build] use different flags for NVCC and CC (#2342)
parent
cb2bc69b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
CMakeLists.txt
CMakeLists.txt
+4
-2
cmake/modules/CUDA.cmake
cmake/modules/CUDA.cmake
+23
-11
No files found.
CMakeLists.txt
View file @
77968e30
...
@@ -89,9 +89,11 @@ if(MSVC)
...
@@ -89,9 +89,11 @@ if(MSVC)
endif
()
endif
()
else
(
MSVC
)
else
(
MSVC
)
include
(
CheckCXXCompilerFlag
)
include
(
CheckCXXCompilerFlag
)
check_cxx_compiler_flag
(
"-std=c++1
4
"
SUPPORT_CXX1
4
)
check_cxx_compiler_flag
(
"-std=c++1
1
"
SUPPORT_CXX1
1
)
set
(
CMAKE_C_FLAGS
"-O2 -Wall -fPIC
${
CMAKE_C_FLAGS
}
"
)
set
(
CMAKE_C_FLAGS
"-O2 -Wall -fPIC
${
CMAKE_C_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"-O2 -Wall -fPIC -std=c++14
${
CMAKE_CXX_FLAGS
}
"
)
# We still use c++11 flag in CPU build because gcc5.4 (our default compiler) is
# not fully compatible with c++14 feature.
set
(
CMAKE_CXX_FLAGS
"-O2 -Wall -fPIC -std=c++11
${
CMAKE_CXX_FLAGS
}
"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"-Wl,--warn-common
${
CMAKE_SHARED_LINKER_FLAGS
}
"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"-Wl,--warn-common
${
CMAKE_SHARED_LINKER_FLAGS
}
"
)
endif
(
MSVC
)
endif
(
MSVC
)
...
...
cmake/modules/CUDA.cmake
View file @
77968e30
...
@@ -239,18 +239,30 @@ macro(dgl_config_cuda out_variable)
...
@@ -239,18 +239,30 @@ macro(dgl_config_cuda out_variable)
src/geometry/cuda/*.cu
src/geometry/cuda/*.cu
)
)
# NVCC flags
# Manually set everything
set
(
CUDA_PROPAGATE_HOST_FLAGS OFF
)
# 0. Add host flags
message
(
STATUS
"
${
CMAKE_CXX_FLAGS
}
"
)
string
(
REGEX REPLACE
"[
\t\n\r
]"
","
CXX_HOST_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
list
(
APPEND CUDA_NVCC_FLAGS
"-Xcompiler ,
${
CXX_HOST_FLAGS
}
"
)
# 1. Add arch flags
dgl_select_nvcc_arch_flags
(
NVCC_FLAGS_ARCH
)
dgl_select_nvcc_arch_flags
(
NVCC_FLAGS_ARCH
)
string
(
REPLACE
";"
" "
NVCC_FLAGS_ARCH
"
${
NVCC_FLAGS_ARCH
}
"
)
list
(
APPEND CUDA_NVCC_FLAGS
${
NVCC_FLAGS_ARCH
}
)
set
(
NVCC_FLAGS_EXTRA
${
NVCC_FLAGS_ARCH
}
)
# for lambda support in moderngpu
# 2. flags in third_party/moderngpu
set
(
NVCC_FLAGS_EXTRA
"
${
NVCC_FLAGS_EXTRA
}
--expt-extended-lambda"
)
list
(
APPEND CUDA_NVCC_FLAGS
"--expt-extended-lambda;-Wno-deprecated-declarations"
)
# suppress deprecated warning in moderngpu
set
(
NVCC_FLAGS_EXTRA
"
${
NVCC_FLAGS_EXTRA
}
-Wno-deprecated-declarations"
)
# for compile with c++14
# 3. CUDA 11 requires c++14 by default
set
(
NVCC_FLAGS_EXTRA
"
${
NVCC_FLAGS_EXTRA
}
--expt-extended-lambda --std=c++14"
)
include
(
CheckCXXCompilerFlag
)
message
(
STATUS
"NVCC extra flags:
${
NVCC_FLAGS_EXTRA
}
"
)
check_cxx_compiler_flag
(
"-std=c++14"
SUPPORT_CXX14
)
set
(
CUDA_NVCC_FLAGS
"
${
CUDA_NVCC_FLAGS
}
${
NVCC_FLAGS_EXTRA
}
"
)
string
(
REPLACE
"-std=c++11"
""
CUDA_NVCC_FLAGS
"
${
CUDA_NVCC_FLAGS
}
"
)
list
(
APPEND CMAKE_CUDA_FLAGS
"
${
NVCC_FLAGS_EXTRA
}
"
)
list
(
APPEND CUDA_NVCC_FLAGS
"--std=c++14"
)
message
(
STATUS
"CUDA flags:
${
CUDA_NVCC_FLAGS
}
"
)
list
(
APPEND DGL_LINKER_LIBS
list
(
APPEND DGL_LINKER_LIBS
${
CUDA_CUDART_LIBRARY
}
${
CUDA_CUDART_LIBRARY
}
...
...
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