Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
xpu
Commits
9d9633d2
Commit
9d9633d2
authored
3 years ago
by
Felix Weiglhofer
Browse files
Options
Downloads
Patches
Plain Diff
Add cmake option to set cuda architectures.
parent
5fd0c71d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+7
-1
7 additions, 1 deletion
CMakeLists.txt
README.md
+1
-0
1 addition, 0 deletions
README.md
templates/CMakeLists.txt.in
+1
-0
1 addition, 0 deletions
templates/CMakeLists.txt.in
with
9 additions
and
1 deletion
CMakeLists.txt
+
7
−
1
View file @
9d9633d2
...
@@ -14,6 +14,10 @@ if (NOT DEFINED XPU_ENABLE_CUDA)
...
@@ -14,6 +14,10 @@ if (NOT DEFINED XPU_ENABLE_CUDA)
set
(
XPU_ENABLE_CUDA OFF
)
set
(
XPU_ENABLE_CUDA OFF
)
endif
()
endif
()
if
(
NOT DEFINED XPU_CUDA_ARCHITECTURES
)
set
(
XPU_CUDA_ARCHITECTURES 75
)
endif
()
if
(
NOT DEFINED XPU_ENABLE_HIP
)
if
(
NOT DEFINED XPU_ENABLE_HIP
)
set
(
XPU_ENABLE_HIP OFF
)
set
(
XPU_ENABLE_HIP OFF
)
endif
()
endif
()
...
@@ -38,7 +42,7 @@ message(STATUS " XPU_BUILD_EXAMPLES: ${XPU_BUILD_EXAMPLES}")
...
@@ -38,7 +42,7 @@ message(STATUS " XPU_BUILD_EXAMPLES: ${XPU_BUILD_EXAMPLES}")
if
(
XPU_ENABLE_CUDA
)
if
(
XPU_ENABLE_CUDA
)
include
(
CheckLanguage
)
include
(
CheckLanguage
)
check_language
(
CUDA
)
check_language
(
CUDA
)
message
(
STATUS
" XPU_ENABLE_CUDA: ON (cc:
${
CMAKE_CUDA_COMPILER
}
)"
)
message
(
STATUS
" XPU_ENABLE_CUDA: ON (cc:
${
CMAKE_CUDA_COMPILER
}
, arch:
${
XPU_CUDA_ARCHITECTURES
}
)"
)
else
()
else
()
message
(
STATUS
" XPU_ENABLE_CUDA: OFF"
)
message
(
STATUS
" XPU_ENABLE_CUDA: OFF"
)
endif
()
endif
()
...
@@ -69,6 +73,7 @@ endif()
...
@@ -69,6 +73,7 @@ endif()
set_property
(
GLOBAL PROPERTY XpuRootDir
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
set_property
(
GLOBAL PROPERTY XpuRootDir
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
set_property
(
GLOBAL PROPERTY XpuEnableCuda
"
${
XPU_ENABLE_CUDA
}
"
)
set_property
(
GLOBAL PROPERTY XpuEnableCuda
"
${
XPU_ENABLE_CUDA
}
"
)
set_property
(
GLOBAL PROPERTY XpuCudaArchitectures
"
${
XPU_CUDA_ARCHITECTURES
}
"
)
set_property
(
GLOBAL PROPERTY XpuEnableHip
"
${
XPU_ENABLE_HIP
}
"
)
set_property
(
GLOBAL PROPERTY XpuEnableHip
"
${
XPU_ENABLE_HIP
}
"
)
if
(
DEFINED XPU_HIP_COMPILER
)
if
(
DEFINED XPU_HIP_COMPILER
)
set_property
(
GLOBAL PROPERTY XpuHipCompiler
"
${
XPU_HIP_COMPILER
}
"
)
set_property
(
GLOBAL PROPERTY XpuHipCompiler
"
${
XPU_HIP_COMPILER
}
"
)
...
@@ -78,6 +83,7 @@ function(xpu_create_subproject Library DriverType UnitySrcAbsolute)
...
@@ -78,6 +83,7 @@ function(xpu_create_subproject Library DriverType UnitySrcAbsolute)
include
(
ExternalProject
)
include
(
ExternalProject
)
set
(
SrcDir
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
Library
}
_
${
DriverType
}
"
)
set
(
SrcDir
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
Library
}
_
${
DriverType
}
"
)
get_property
(
RootDir GLOBAL PROPERTY XpuRootDir
)
get_property
(
RootDir GLOBAL PROPERTY XpuRootDir
)
get_property
(
CudaArchitectures GLOBAL PROPERTY XpuCudaArchitectures
)
get_target_property
(
IncludeDirectories
${
Library
}
INCLUDE_DIRECTORIES
)
get_target_property
(
IncludeDirectories
${
Library
}
INCLUDE_DIRECTORIES
)
get_property
(
HipCxx GLOBAL PROPERTY XpuHipCompiler
)
get_property
(
HipCxx GLOBAL PROPERTY XpuHipCompiler
)
...
...
This diff is collapsed.
Click to expand it.
README.md
+
1
−
0
View file @
9d9633d2
...
@@ -26,6 +26,7 @@ The public headers in `src/xpu` expose the entire API (With the exception of def
...
@@ -26,6 +26,7 @@ The public headers in `src/xpu` expose the entire API (With the exception of def
CMake Options:
CMake Options:
-
`XPU_ENABLE_CUDA`
: Enable / Disable compilation for cuda. (default=
`OFF`
)
-
`XPU_ENABLE_CUDA`
: Enable / Disable compilation for cuda. (default=
`OFF`
)
-
`XPU_CUDA_ARCHITECTURES`
: List of target cuda architectures. (default=
`75`
)
-
`XPU_ENABLE_HIP`
: Enable / Disable compilation for hip. (default=
`OFF`
)
-
`XPU_ENABLE_HIP`
: Enable / Disable compilation for hip. (default=
`OFF`
)
-
`XPU_HIP_COMPILER`
: Path to hip-clang. (default=
`/opt/rocm/llvm/bin/clang`
)
-
`XPU_HIP_COMPILER`
: Path to hip-clang. (default=
`/opt/rocm/llvm/bin/clang`
)
-
`XPU_DEBUG`
: Build gpu code with debug symbols and disable optimizations. (default=
`OFF`
)
-
`XPU_DEBUG`
: Build gpu code with debug symbols and disable optimizations. (default=
`OFF`
)
...
...
This diff is collapsed.
Click to expand it.
templates/CMakeLists.txt.in
+
1
−
0
View file @
9d9633d2
...
@@ -9,6 +9,7 @@ if (@DriverType@ STREQUAL "Cuda")
...
@@ -9,6 +9,7 @@ if (@DriverType@ STREQUAL "Cuda")
else()
else()
add_definitions(-DNDEBUG)
add_definitions(-DNDEBUG)
endif()
endif()
set(CMAKE_CUDA_ARCHITECTURES @CudaArchitectures@)
set_source_files_properties(@UnitySrcAbsolute@ PROPERTIES LANGUAGE CUDA)
set_source_files_properties(@UnitySrcAbsolute@ PROPERTIES LANGUAGE CUDA)
endif()
endif()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment