Skip to content
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

[on hold] Add thrust/PSTL example with particles and tracks #349

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "examples/raycast/Sponza"]
path = examples/raycast/Sponza
url = https://github.com/jimmiebergmann/Sponza
[submodule "thirdparty/thrust"]
path = thirdparty/thrust
url = https://github.com/bernhardmgruber/thrust.git
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ if (LLAMA_BUILD_EXAMPLES)
add_subdirectory("examples/stream")
add_subdirectory("examples/falsesharing")
add_subdirectory("examples/comptime")
add_subdirectory("examples/thrust")

# alpaka examples
find_package(alpaka 1.0)
Expand Down
29 changes: 29 additions & 0 deletions examples/thrust/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cmake_minimum_required (VERSION 3.15)
project(llama-thrust CXX CUDA)

set (Thrust_DIR "../../thirdparty/thrust/thrust/cmake/")
find_package(Thrust REQUIRED CONFIG)
thrust_create_target(Thrust FROM_OPTIONS)
find_package(OpenMP REQUIRED)
if (NOT TARGET llama::llama)
find_package(llama REQUIRED)
endif()
add_executable(${PROJECT_NAME} thrust.cu ../common/Stopwatch.hpp ../common/hostname.hpp)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
target_compile_options(${PROJECT_NAME} PUBLIC
$<$<COMPILE_LANGUAGE:CUDA>:
-forward-unknown-to-host-compiler
--expt-extended-lambda
--expt-relaxed-constexpr
--use_fast_math
--ftemplate-backtrace-limit 500>)
target_link_libraries(${PROJECT_NAME} PRIVATE llama::llama Thrust OpenMP::OpenMP_CXX)

# OpenMP is not added to the compiler commandline by cmake when using nvcc ..
if (NOT MSVC)
find_package(TBB REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE TBB::tbb)
target_compile_options(${PROJECT_NAME} PUBLIC -march=native -ffast-math -fopenmp)
else()
target_compile_options(${PROJECT_NAME} PUBLIC /openmp)
endif()
Loading