-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake and autodetect gpu #70
Open
jkrauska
wants to merge
11
commits into
data61:master
Choose a base branch
from
jkrauska:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bbe0716
cuda 10 support and multi-arch gpu
jkrauska 72be12c
cmake
jkrauska 34e0f05
NDEBUG only for test-suite and check for Gtest
jkrauska 74243d5
-lineinfo
jkrauska 46a0db8
move NDEBUG
jkrauska ca4165d
readd tests
jkrauska 5f7a921
fix whitespace
jkrauska 5778c89
typo, doesn't run
jkrauska 5d2dfcc
GTEST DIR
jkrauska 1224be0
comment out debug
jkrauska d613f53
Merge pull request #1 from data61/master
jkrauska File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Build | ||
build | ||
|
||
# Test input | ||
tests/add_* | ||
tests/sub_* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(cuda-fixnum CXX CUDA) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CUDA_STANDARD 11) | ||
set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin") | ||
|
||
# CUDA | ||
find_package(CUDA REQUIRED) | ||
set(CUDA_ARCH_LIST Auto CACHE LIST | ||
"List of CUDA architectures (e.g. Pascal, Volta, etc) or \ | ||
compute capability versions (6.1, 7.0, etc) to generate code for. \ | ||
Set to Auto for automatic detection (default)." | ||
) | ||
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCH_LIST}) | ||
string(REPLACE ";" " " CUDA_ARCH_FLAGS_SPACES "${CUDA_ARCH_FLAGS}") | ||
|
||
string(APPEND CMAKE_CUDA_FLAGS " ${CUDA_ARCH_FLAGS_SPACES}") | ||
string(APPEND CMAKE_CUDA_FLAGS " -Xcompiler -Wall,-Wextra") | ||
set(CMAKE_CUDA_FLAGS_DEBUG "-g -G") | ||
|
||
# source | ||
include_directories(src) | ||
|
||
# bench | ||
add_executable(bench bench/bench.cu) | ||
target_compile_definitions(bench PUBLIC -DNDEBUG) | ||
target_link_libraries(bench -lstdc++) | ||
|
||
# test-suite | ||
find_package(GTest) | ||
if(GTEST_FOUND) | ||
add_executable(check tests/test-suite.cu) | ||
target_link_libraries(check -lstdc++ -L${GTEST_INCLUDE_DIR} -lgtest) | ||
target_compile_options(check PUBLIC -lineinfo) | ||
else() | ||
message(WARNING "GTest libraries not found - not building test-suite") | ||
endif() | ||
|
||
# FIXME: Add test runs | ||
# enable_testing() | ||
# add_test(NAME mytest | ||
# COMMAND mytest) | ||
|
||
# DEBUG CMAKE Variables | ||
#get_cmake_property(_variableNames VARIABLES) | ||
#list (SORT _variableNames) | ||
#foreach (_variableName ${_variableNames}) | ||
# message(STATUS "${_variableName}=${${_variableName}}") | ||
#endforeach() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://cmake.org/cmake/help/v3.15/module/FindCUDA.html, by listing
CUDA
up there inproject
, thisfind_package
should be unnecessary. Maybe this is a source of some of cmake's confusion?