Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e3ab517
initial thoughts parallel strided assign
Feb 4, 2021
2087ed0
trigger strided assign properly
May 27, 2021
643b601
Fix openMP parallel linear assign
Nov 30, 2022
8e75d92
Fix typo on xassign.hpp
starboerg Nov 30, 2022
63381a8
initial thoughts parallel strided assign
Feb 4, 2021
01e156e
trigger strided assign properly
May 27, 2021
da29eda
Fix openMP parallel linear assign
Nov 30, 2022
1531f81
Fix typo on xassign.hpp
starboerg Nov 30, 2022
198b385
Fix wrong merge
ewoudwempe Feb 1, 2023
aa9d078
Try at fixed strided loop assignment
ewoudwempe Feb 1, 2023
68ba3de
Compiles and maybe works now..
ewoudwempe Feb 1, 2023
0a62ded
Use static partitioner instead
ewoudwempe Feb 1, 2023
3c4e93a
Remove unused variable
ewoudwempe Feb 1, 2023
d1209f2
Make explicitly the steppers in teh lambda instead of a copy
ewoudwempe Feb 1, 2023
01c8b4c
Fix the strided assigner
ewoudwempe Feb 2, 2023
e4558a6
Add a test, and fix a few bugs for the strided (parallel) assigner.
ewoudwempe Feb 23, 2023
1cc5b59
Revert some unnecessary changes again
ewoudwempe Feb 23, 2023
011d843
Add tbb to benchmark
ewoudwempe Feb 26, 2023
7c179a5
Fix typo
ewoudwempe Feb 25, 2023
4c49f91
Fix a few things and refactor to amke things backward-compatible
ewoudwempe Feb 26, 2023
0b3caff
Use tbb and opnemp also in benchmark
ewoudwempe Feb 26, 2023
609d848
Use the various THRESHOLDs for the strided loops
ewoudwempe Feb 26, 2023
6a9d205
Add benchmark for stencil operations
ewoudwempe Feb 26, 2023
4299283
Add two-direction stencil too
ewoudwempe Feb 26, 2023
f66ab3f
Add more elaborate view test
ewoudwempe Feb 26, 2023
32595af
Remove some buggy checks
ewoudwempe Feb 26, 2023
df7abfb
Fix a few more bugs
ewoudwempe Feb 26, 2023
b2cea00
run clang-format on xcontainer
ewoudwempe Feb 27, 2023
d84724e
Run clang-format on xassign & test_xassign
ewoudwempe Feb 27, 2023
68a5a9e
Fix for column layout default
ewoudwempe Feb 27, 2023
36483d6
Fix openmp version
ewoudwempe Feb 27, 2023
2f678c1
Try to fix the VS2015 test on appveyor
ewoudwempe Feb 27, 2023
3bf9d1b
Remove no longer relevant comment and refactor a few lines
ewoudwempe Mar 16, 2023
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: 10 additions & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,16 @@ set(XTENSOR_BENCHMARK

set(XTENSOR_BENCHMARK_TARGET benchmark_xtensor)
add_executable(${XTENSOR_BENCHMARK_TARGET} EXCLUDE_FROM_ALL ${XTENSOR_BENCHMARK} ${XTENSOR_HEADERS})
target_link_libraries(${XTENSOR_BENCHMARK_TARGET} xtensor ${GBENCHMARK_LIBRARIES})
target_link_libraries(${XTENSOR_BENCHMARK_TARGET} PUBLIC xtensor ${GBENCHMARK_LIBRARIES})

if(XTENSOR_USE_TBB)
target_compile_definitions(${XTENSOR_BENCHMARK_TARGET} PUBLIC XTENSOR_USE_TBB)
target_include_directories(${XTENSOR_BENCHMARK_TARGET} PUBLIC ${TBB_INCLUDE_DIRS})
target_link_libraries(${XTENSOR_BENCHMARK_TARGET} PUBLIC ${TBB_LIBRARIES})
endif()
if(XTENSOR_USE_OPENMP)
target_compile_definitions(${XTENSOR_BENCHMARK_TARGET} PUBLIC XTENSOR_USE_OPENMP)
endif()

add_custom_target(xbenchmark
COMMAND benchmark_xtensor
Expand Down
70 changes: 70 additions & 0 deletions benchmark/benchmark_views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,76 @@ namespace xt
BENCHMARK_TEMPLATE(view_assign_strided_view_noalias, float);
}

namespace finite_diff
{
inline auto stencil_threedirections(benchmark::State& state, size_t size)
{
for (auto _ : state)
{
const std::array<size_t, 3> shape = {size, size, size};
xt::xtensor<double, 3> a(shape), b(shape);
auto core = xt::range(1, size - 1);
xt::noalias(xt::view(b, core, core, core)
) = 1.0 / 7.0
* (xt::view(a, core, core, core) + xt::view(a, core, core, xt::range(2, size))
+ xt::view(a, core, core, xt::range(0, size - 2))
+ xt::view(a, core, xt::range(2, size), core)
+ xt::view(a, core, xt::range(0, size - 2), core)
+ xt::view(a, xt::range(2, size), core, core)
+ xt::view(a, xt::range(0, size - 2), core, core));
benchmark::DoNotOptimize(b);
}
}

inline auto stencil_twodirections(benchmark::State& state, size_t size)
{
for (auto _ : state)
{
const std::array<size_t, 3> shape = {size, size, size};
xt::xtensor<double, 3> a(shape), b(shape);
auto core = xt::range(1, size - 1);
xt::noalias(xt::view(b, core, core, core)
) = 1.0 / 7.0
* (xt::view(a, core, core, core) + xt::view(a, core, xt::range(2, size), core)
+ xt::view(a, core, xt::range(0, size - 2), core)
+ xt::view(a, xt::range(2, size), core, core)
+ xt::view(a, xt::range(0, size - 2), core, core));
benchmark::DoNotOptimize(b);
}
}

inline auto stencil_onedirection(benchmark::State& state, size_t size)
{
for (auto _ : state)
{
const std::array<size_t, 3> shape = {size, size, size};
xt::xtensor<double, 3> a(shape), b(shape);
auto core = xt::range(1, size - 1);
xt::noalias(xt::view(b, core, core, core)
) = 1.0 / 2.0
* (xt::view(a, xt::range(2, size), core, core)
- xt::view(a, xt::range(0, size - 2), core, core));
benchmark::DoNotOptimize(b);
}
}

BENCHMARK_CAPTURE(stencil_threedirections, stencil_threedirections_50, 50);
BENCHMARK_CAPTURE(stencil_threedirections, stencil_threedirections_100, 100);
BENCHMARK_CAPTURE(stencil_threedirections, stencil_threedirections_200, 200);
BENCHMARK_CAPTURE(stencil_threedirections, stencil_threedirections_300, 300);
BENCHMARK_CAPTURE(stencil_threedirections, stencil_threedirections_500, 500);
BENCHMARK_CAPTURE(stencil_twodirections, stencil_twodirections_50, 50);
BENCHMARK_CAPTURE(stencil_twodirections, stencil_twodirections_100, 100);
BENCHMARK_CAPTURE(stencil_twodirections, stencil_twodirections_200, 200);
BENCHMARK_CAPTURE(stencil_twodirections, stencil_twodirections_300, 300);
BENCHMARK_CAPTURE(stencil_twodirections, stencil_twodirections_500, 500);
BENCHMARK_CAPTURE(stencil_onedirection, stencil_onedirections_50, 50);
BENCHMARK_CAPTURE(stencil_onedirection, stencil_onedirections_100, 100);
BENCHMARK_CAPTURE(stencil_onedirection, stencil_onedirections_200, 200);
BENCHMARK_CAPTURE(stencil_onedirection, stencil_onedirections_300, 300);
BENCHMARK_CAPTURE(stencil_onedirection, stencil_onedirections_500, 500);
}

namespace stridedview
{

Expand Down
Loading