Skip to content

Commit

Permalink
Fix deprecated warnings in sycl code
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Jul 10, 2024
1 parent eca5066 commit ddb3563
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ project(pffdtd_2d)
add_executable(pffdtd_2d)
target_sources(pffdtd_2d PRIVATE fdtd.cpp)
add_sycl_to_target(TARGET pffdtd_2d SOURCES fdtd.cpp)
target_compile_options(pffdtd_2d PRIVATE -Wno-deprecated-declarations)
target_link_libraries(pffdtd_2d PRIVATE HDF5::HDF5)
16 changes: 11 additions & 5 deletions src/2D/fdtd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ int main(int, char **argv) {
sycl::range<1>(Nr), [=](sycl::id<1> id) {
auto const r = id[0];
auto const r_ixy = out_ixy_acc[r];
out_acc[r][i] = u0_acc.get_pointer()[r_ixy];
auto flatPtr = u0_acc.get_multi_ptr<sycl::access::decorated::no>();
out_acc[r][i] = flatPtr[r_ixy];
});
});

Expand All @@ -258,15 +259,20 @@ int main(int, char **argv) {

auto save = std::vector<double>(Nt * Nr);
auto host = sycl::host_accessor{out, sycl::read_only};
auto absMax = 0.0;
auto max = 0.0;
auto min = 0.0;
for (auto i{0UL}; i < Nt; ++i) {
for (auto r{0UL}; r < Nr; ++r) {
save[i * Nr + r] = host[r][i];
absMax = std::max(absMax, std::abs(host[r][i]));
auto const sample = host[r][i];
save[i * Nr + r] = sample;
max = std::max(max, sample);
min = std::min(min, sample);
}
}

std::printf("MAX: %f\n", absMax);
std::puts("");
std::printf("MAX: %f\n", max);
std::printf("MIN: %f\n", min);

auto dir = filePath.parent_path();
auto outfile = dir / "out.h5";
Expand Down

0 comments on commit ddb3563

Please sign in to comment.