-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31fb36d
commit b7f6a7b
Showing
4 changed files
with
65 additions
and
0 deletions.
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
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,18 @@ | ||
# Copyright 2023 Bernhard Manfred Gruber | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
cmake_minimum_required (VERSION 3.18.3) | ||
project(llama-comptime CXX) | ||
|
||
set(LLAMA_COMPTIME_RECORD_DIM_SIZE 20 CACHE STRING "comptime example record dimension size") | ||
|
||
if (NOT TARGET llama::llama) | ||
find_package(llama REQUIRED) | ||
endif() | ||
add_executable(${PROJECT_NAME} comptime.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE llama::llama) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE -DLLAMA_COMPTIME_RECORD_DIM_SIZE=${LLAMA_COMPTIME_RECORD_DIM_SIZE}) | ||
|
||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") | ||
target_compile_options(${PROJECT_NAME} PRIVATE -fbracket-depth=1500) | ||
endif() |
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,8 @@ | ||
#!/bin/bash | ||
|
||
# the record dim has 1095 entries | ||
for i in {0..1000..20}; do | ||
cmake -DLLAMA_COMPTIME_RECORD_DIM_SIZE=$i .. > /dev/null 2>&1 | ||
s=$(\time -f "%e" make llama-comptime 2>&1 > /dev/null) | ||
echo $i $s | ||
done |
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,38 @@ | ||
// Copyright 2023 Bernhard Manfred Gruber | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
#ifndef LLAMA_COMPTIME_RECORD_DIM_SIZE | ||
# define LLAMA_COMPTIME_RECORD_DIM_SIZE 20 | ||
#endif | ||
|
||
#include "../common/ttjet_13tev_june2019.hpp" | ||
|
||
#include <llama/llama.hpp> | ||
|
||
using RecordDim = boost::mp11::mp_take_c<Event, LLAMA_COMPTIME_RECORD_DIM_SIZE>; | ||
|
||
auto main() -> int | ||
try | ||
{ | ||
constexpr auto extents = llama::ArrayExtents{1024 * 1024}; | ||
using ArrayExtents = std::remove_const_t<decltype(extents)>; | ||
// const auto packedAoSMapping = llama::mapping::PackedAoS<ArrayExtents, RecordDim>{extents}; | ||
const auto alignedAoSMapping = llama::mapping::AlignedAoS<ArrayExtents, RecordDim>{extents}; | ||
// const auto multiBlobSoAMapping = llama::mapping::MultiBlobSoA<ArrayExtents, RecordDim>{extents}; | ||
// const auto aosoa8Mapping = llama::mapping::AoSoA<ArrayExtents, RecordDim, 8>{extents}; | ||
// const auto aosoa32Mapping = llama::mapping::AoSoA<ArrayExtents, RecordDim, 32>{extents}; | ||
// const auto aosoa64Mapping = llama::mapping::AoSoA<ArrayExtents, RecordDim, 64>{extents}; | ||
|
||
auto view = llama::allocViewUninitialized(alignedAoSMapping); | ||
llama::forEachLeafCoord<RecordDim>( | ||
[&](auto coord) | ||
{ | ||
using Type = llama::GetType<Event, decltype(coord)>; | ||
for(std::size_t i = 0; i < extents[0]; i++) | ||
view(i)(coord) = Type{}; | ||
}); | ||
} | ||
catch(const std::exception& e) | ||
{ | ||
std::cerr << "Exception: " << e.what() << '\n'; | ||
} |