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

Port to alpaka #173

Merged
merged 35 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
eb21e92
* integrated some changes from hipifycation in alpaka
bernhardmgruber May 11, 2020
4b017be
* buffer Dim does not need to be the same as Acc Dim
bernhardmgruber May 22, 2020
40ed90e
fixes for compiling with nvcc again
bernhardmgruber May 22, 2020
3f62ab3
allowing XMallocSIMD to compile without CUDA as well
bernhardmgruber May 22, 2020
1ded906
changed alignment policies to work with size_t instead of uint32_t
bernhardmgruber May 22, 2020
7bfdc48
* switching to XMallocSIMD for dimensions tests
bernhardmgruber May 22, 2020
f5e90ec
fixed a few warnings
bernhardmgruber May 22, 2020
3f14283
fixed test thread block size and added static check for this
bernhardmgruber May 22, 2020
96aac16
parameterizing tests with accelerator to use
bernhardmgruber May 22, 2020
d248569
* fixed remaining atomic intrinsic in XMallocSIMD
bernhardmgruber May 22, 2020
f4b6535
modified tests to also have a grid size greater than 1
bernhardmgruber May 22, 2020
df9ccf0
improved detection for when compiling with HIP device compiler
bernhardmgruber May 22, 2020
5921f83
* changed accelerators in examples and verify_heap_config.hpp back to…
bernhardmgruber May 22, 2020
f0932e8
* fixed specification of error encountered with alpaka min/max
bernhardmgruber May 22, 2020
a143ca8
removed example2 from the examples target
bernhardmgruber May 22, 2020
28f7bdd
transformed dimensions.cpp tests into Catch2 unit tests
bernhardmgruber May 25, 2020
15218c0
* dropped all ReservePoolPolicies
bernhardmgruber May 25, 2020
cd97fe8
Explicitely specifying return types of alpaka min/max via decltype
bernhardmgruber May 25, 2020
6e6acce
fixed printf format specifiers
bernhardmgruber May 25, 2020
4aa77ae
building tests as well
bernhardmgruber May 25, 2020
bd15540
* dropped support for HCC
bernhardmgruber May 25, 2020
ec05ebd
made the AlpakaAcc type a template parameter of DeviceAllocator's and…
bernhardmgruber May 25, 2020
476d08a
renamed devAllocatorStorage into devAllocatorBuffer, since it's a buffer
bernhardmgruber May 25, 2020
b2c6a09
removed quotes around compile options
bernhardmgruber May 27, 2020
fef23d6
simplified specifying workdivs in 2/3D case
bernhardmgruber May 28, 2020
d15d8b8
preventing nvcc from swallowing catch2 header for generating main()
bernhardmgruber May 28, 2020
6cc5200
moved test main into separate library
bernhardmgruber May 28, 2020
739236e
creating a single unit test executable if CUDA version is 10.2 or higher
bernhardmgruber May 28, 2020
a0f391c
* reverted deletion of reserve pool policies
bernhardmgruber Jun 2, 2020
11a8063
* added unit tests for a few combinations of policies
bernhardmgruber Jun 2, 2020
07e5d80
* reverted to old behavior of CudaSetLimits policy to reset heap size…
bernhardmgruber Jun 3, 2020
bae8658
* added cudaDeviceReset() after unit tests involving CudaSetLimits
bernhardmgruber Jun 3, 2020
a478f53
Squashed 'alpaka/' changes from a5a8277cd..dcf09d485
bernhardmgruber Jun 23, 2020
4ebadba
Merge commit 'a478f53116b9e941c662cf60df9f3642c7973d29' into alpaka
bernhardmgruber Jun 23, 2020
7963ca2
simplified querying alpaka device
bernhardmgruber Jun 3, 2020
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ script:
- make
- make install
- make examples
- make tests

before_script:
- cat /etc/apt/sources.list
Expand Down
102 changes: 40 additions & 62 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
project(mallocMC LANGUAGES CUDA CXX)
project(mallocMC LANGUAGES CXX)
cmake_minimum_required(VERSION 3.8)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# helper for libs and packages
set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/"
"$ENV{CUDA_ROOT}" "$ENV{BOOST_ROOT}")


################################################################################
# CMake policies
#
# Search in <PackageName>_ROOT:
# https://cmake.org/cmake/help/v3.12/policy/CMP0074.html
################################################################################

if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
Expand Down Expand Up @@ -49,61 +35,53 @@ else()
find_package(Catch2 CONFIG REQUIRED)
endif()

###############################################################################
# CUDA
###############################################################################
if(NOT DEFINED COMPUTE_CAPABILITY)
set(COMPUTE_CAPABILITY "30")
endif()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_${COMPUTE_CAPABILITY} -use_fast_math")

OPTION(CUDA_OUTPUT_INTERMEDIATE_CODE "Output ptx code" OFF)
if(CUDA_OUTPUT_INTERMEDIATE_CODE)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xptxas -v --keep")
endif()

SET(CUDA_OPTIMIZATION_TYPE "unset" CACHE STRING "CUDA Optimization")
set_property(CACHE CUDA_OPTIMIZATION_TYPE PROPERTY STRINGS "unset;-G0;-O0;-O1;-O2;-O3")
if(NOT ${CUDA_OPTIMIZATION_TYPE} STREQUAL "unset")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${CUDA_OPTIMIZATION_TYPE}")
endif()

# for installation, just copy include folder to install folder
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/include/."
DESTINATION include
)

################################################################################
# Warnings
################################################################################
# warnings
add_library(warnings INTERFACE)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -Wno-unknown-pragmas -Wextra -Wno-unused-parameter -Wno-unused-local-typedefs")
target_compile_options(warnings INTERFACE -Wall -Wshadow -Wno-unknown-pragmas -Wextra -Wno-unused-parameter -Wno-unused-local-typedefs)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow")
target_compile_options(warnings INTERFACE -Wall -Wshadow)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=inform")
target_compile_options(warnings INTERFACE -Minform=inform)
endif()

# Executables
file(GLOB_RECURSE headers src/include/**)
add_custom_target(mallocMCIde SOURCES ${headers}) # create a target with the header files for IDE projects
source_group(TREE ${CMAKE_CURRENT_LIST_DIR}/src/include FILES ${headers})

###############################################################################
# Installation
###############################################################################
alpaka_add_executable(mallocMC_Example01 EXCLUDE_FROM_ALL examples/mallocMC_example01.cpp)
target_include_directories(mallocMC_Example01 PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(mallocMC_Example01 PUBLIC alpaka::alpaka warnings)

# copy include folder to install folder
INSTALL(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/include/."
DESTINATION include
PATTERN ".git" EXCLUDE
PATTERN "mallocMC_config.hpp" EXCLUDE
)
alpaka_add_executable(mallocMC_Example03 EXCLUDE_FROM_ALL examples/mallocMC_example03.cpp)
target_include_directories(mallocMC_Example03 PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(mallocMC_Example03 PUBLIC alpaka::alpaka warnings)

alpaka_add_executable(VerifyHeap EXCLUDE_FROM_ALL tests/verify_heap.cpp tests/verify_heap_config.hpp)
target_include_directories(VerifyHeap PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(VerifyHeap PUBLIC alpaka::alpaka warnings)

###############################################################################
# Executables
###############################################################################
file(GLOB_RECURSE headers src/include/**)
add_custom_target(mallocMC SOURCES ${headers}) # create a target with the header files for IDE projects
source_group(TREE ${CMAKE_CURRENT_LIST_DIR}/src/include FILES ${headers})
if (CUDA_VERSION VERSION_LESS 10.2) # TODO(bgruber): I do not know exactly where it breaks. 9.1 does not work, 10.2 works
# the catch2 main needs to be in a non-CUDA file before CUDA 10.2, because nvcc fails to compile the catch2 header
# TODO: merge the test_main back into the tests exe, once CUDA 10.2 is the minimum version
add_library(tests_main EXCLUDE_FROM_ALL tests/main.cpp)
target_include_directories(tests_main PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(tests_main PUBLIC Catch2::Catch2 warnings)

alpaka_add_executable(tests EXCLUDE_FROM_ALL tests/dimensions.cpp tests/policies.cpp)
target_include_directories(tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(tests PUBLIC tests_main alpaka::alpaka Catch2::Catch2 warnings)
else()
alpaka_add_executable(tests EXCLUDE_FROM_ALL tests/main.cpp tests/dimensions.cpp tests/policies.cpp)
target_include_directories(tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(tests PUBLIC alpaka::alpaka Catch2::Catch2 warnings)
endif()

include_directories(${CMAKE_CURRENT_LIST_DIR}/src/include)
add_executable(mallocMC_Example01 EXCLUDE_FROM_ALL examples/mallocMC_example01.cu examples/mallocMC_example01_config.hpp)
add_executable(mallocMC_Example02 EXCLUDE_FROM_ALL examples/mallocMC_example02.cu)
add_executable(mallocMC_Example03 EXCLUDE_FROM_ALL examples/mallocMC_example03.cu)
add_executable(VerifyHeap EXCLUDE_FROM_ALL tests/verify_heap.cu tests/verify_heap_config.hpp)
add_custom_target(examples DEPENDS mallocMC_Example01 mallocMC_Example02 mallocMC_Example03 VerifyHeap)
add_custom_target(examples DEPENDS mallocMC_Example01 mallocMC_Example03 VerifyHeap)
Loading