Skip to content

Commit

Permalink
add thrust/PSTL example with particles and tracks
Browse files Browse the repository at this point in the history
TODO: includes massive hacks to LLAMA.
Using a custom fork of thrust to fix supporting proxy references.
  • Loading branch information
bernhardmgruber committed Nov 29, 2021
1 parent 75cb6fb commit 55a91cf
Show file tree
Hide file tree
Showing 8 changed files with 771 additions and 12 deletions.
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 @@ -74,6 +74,7 @@ if (LLAMA_BUILD_EXAMPLES)
add_subdirectory("examples/bitpack")
add_subdirectory("examples/bytesplit")
add_subdirectory("examples/floatpack")
add_subdirectory("examples/thrust")

# alpaka examples
find_package(alpaka 0.7.0 QUIET)
Expand Down
23 changes: 23 additions & 0 deletions examples/thrust/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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>:--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 -Xcompiler -march=native -ffast-math -fopenmp)
else()
target_compile_options(${PROJECT_NAME} PUBLIC -Xcompiler /openmp)
endif()
Loading

0 comments on commit 55a91cf

Please sign in to comment.