Skip to content
Open
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
11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@ project(
VERSION 0.3.0
LANGUAGES CXX)

# check if the project is top-level
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(GPU_ARRAY_IS_TOPLEVEL_PROJECT ON)
else()
set(GPU_ARRAY_IS_TOPLEVEL_PROJECT OFF)
endif()

# options
option(ENABLE_HIP "Enable HIP support" OFF)
option(GPU_ARRAY_BUILD_TEST "Build ${PROJECT_NAME} tests"
${GPU_ARRAY_IS_TOPLEVEL_PROJECT})
${PROJECT_IS_TOP_LEVEL})

# library
include(GNUInstallDirs)
Expand All @@ -30,7 +23,7 @@ target_include_directories(
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})

# install
if(GPU_ARRAY_IS_TOPLEVEL_PROJECT)
if(PROJECT_IS_TOP_LEVEL)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}_Targets)

install(
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,20 @@ gpu-array supports both Array of structures (AoS) and Structure of arrays (SoA)

```cpp
#include <gpu_array.hpp>
#include <tuple>
#include <vector>

using namespace gpu_array;

// std::tuple or its derived struct can be used as structure type
// gpu_array::tuple (or std::tuple) or its derived struct can be used as structure type
// The below example shows a tuple-derived struct with three members and their accessors
template <typename... Ts>
requires (sizeof...(Ts) == 3)
struct CustomTuple : public std::tuple<Ts...>
struct CustomTuple : public tuple<Ts...>
{
using std::tuple<Ts...>::tuple;
__host__ __device__ auto& get_a() { return std::get<0>(*this); }
__host__ __device__ auto& get_b() { return std::get<1>(*this); }
__host__ __device__ auto& get_c() { return std::get<2>(*this); }
using tuple<Ts...>::tuple;
__host__ __device__ auto& get_a() { return get<0>(*this); }
__host__ __device__ auto& get_b() { return get<1>(*this); }
__host__ __device__ auto& get_c() { return get<2>(*this); }
};
using Struct = CustomTuple<int, float, double>;

Expand Down
Loading
Loading