Skip to content

Commit

Permalink
inserted/updated begin-end tags for Sphinx literalinclude
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Läufer <[email protected]>
  • Loading branch information
klaeufer committed Dec 10, 2023
1 parent ac58117 commit 1fe4bdd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/oneapi-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: OneAPI CI with CMake

on:
Expand All @@ -14,6 +13,7 @@ jobs:
env:
BUILD_DIR: cmake-build-debug

# UnoAPI:github-workflow-specific:begin
steps:
- name: Checkout project code
uses: actions/checkout@v2
Expand Down Expand Up @@ -42,3 +42,4 @@ jobs:
$BUILD_DIR/bin/montecarlo
# eventually keep only this loop for discovering all tests
for test_bin in $BUILD_DIR/bin/*tests; do "./$test_bin"; done
# UnoAPI:github-workflow-specific:end
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ project(
LANGUAGES CXX
)

# UnoAPI:CMakeLists-language-settings:begin
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# UnoAPI:CMakeLists-language-settings:end

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

include(FetchContent)

# UnoAPI:CMakeLists-fetchcontent:begin
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 8.1.1
)
FetchContent_MakeAvailable(fmt)
# UnoAPI:CMakeLists-fetchcontent:end

# Lots of compilation errors without this setting
option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" ON)
Expand Down
2 changes: 2 additions & 0 deletions integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# UnoAPI:CMakeLists-targetlibraries:begin
add_executable(integration main.cpp f.cpp trapezoid.cpp timestamps.cpp)
target_link_libraries(integration fmt::fmt spdlog::spdlog CLI11::CLI11)
# UnoAPI:CMakeLists-targetlibraries:end

enable_testing()
add_executable(integration_tests test.cpp f.cpp trapezoid.cpp)
Expand Down
12 changes: 6 additions & 6 deletions integration/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,33 @@ int main(const int argc, const char * const argv[]) {
// {{UnoAPI:main-parallel-devices:end}}

// we allow the queue to figure out the correct ordering of the three tasks
// {{UnoAPI:main-parallel-inorder-q:begin}}
// {{UnoAPI:main-parallel-queue:begin}}
sycl::queue q{device, dpc_common::exception_handler};
mark_time(timestamps,"Queue creation");
device_name = q.get_device().get_info<sycl::info::device::name>();
spdlog::info("Device: {}", device_name);
// {{UnoAPI:main-parallel-inorder-q:end}}
// {{UnoAPI:main-parallel-queue:end}}

// populate buffer with function values
// {{UnoAPI:main-parallel-submit-parallel-for:begin}}
// {{UnoAPI:main-parallel-submit-parallel-for-values:begin}}
q.submit([&](auto & h) {
const sycl::accessor v{v_buf, h};
h.parallel_for(size, [=](const auto & index) {
v[index] = f(x_min + index * dx);
});
}); // end of command group
// {{UnoAPI:main-parallel-submit-parallel-for:end}}
// {{UnoAPI:main-parallel-submit-parallel-for-values:end}}

// populate buffer with trapezoid values
// the inner, sequential loop performs a finer-grained calculation
// {{UnoAPI:main-parallel-submit-parallel-for:begin}}
// {{UnoAPI:main-parallel-submit-parallel-for-trapezoids:begin}}
q.submit([&](auto & h) {
const sycl::accessor t{t_buf, h};
h.parallel_for(size, [=](const auto & index) {
t[index] = compute_outer_trapezoid(grain_size, x_min + index * dx, dx_inner, half_dx_inner);
});
}); // end of command group
// {{UnoAPI:main-parallel-submit-parallel-for:end}}
// {{UnoAPI:main-parallel-submit-parallel-for-trapezoids:end}}

// perform reduction into result
// {{UnoAPI:main-parallel-submit-reduce:begin}}
Expand Down

0 comments on commit 1fe4bdd

Please sign in to comment.