Skip to content

Commit

Permalink
[cpp] Remove return value from 3d engines
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Sep 22, 2024
1 parent 6a67d30 commit beab747
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion run_3d.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e

root_dir="$(cd "$(dirname "$0")" && pwd)"
pffdtd_engine="$root_dir/build/src/cpp/pffdtd-engine"
pffdtd_engine="$root_dir/cmake-build-sycl/src/cpp/pffdtd-engine"
pffdtd_engine="$root_dir/cmake-build-cuda/src/cpp/pffdtd-engine"

sim_name="ProStudio"
sim_setup="${sim_name}.py"
Expand Down
6 changes: 2 additions & 4 deletions src/cpp/pffdtd/engine_3d_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ auto process_bnl_fd(
return getTime() - start;
}

auto run(Simulation3D& sd) -> double {
auto run(Simulation3D& sd) -> void {
// keep local ints, scalars
int64_t const Ns = sd.Ns;
int64_t const Nr = sd.Nr;
Expand Down Expand Up @@ -366,12 +366,10 @@ auto run(Simulation3D& sd) -> double {
fmt::println("Air update: {:.6}s, {:.2} Mvox/s", elapsedAir, Npts * Nt / 1e6 / elapsedAir);
fmt::println("Boundary loop: {:.6}s, {:.2} Mvox/s", elapsedBn, Nb * Nt / 1e6 / elapsedBn);
fmt::println("Combined (total): {:.6}s, {:.2} Mvox/s", elapsed, Npts * Nt / 1e6 / elapsed);

return elapsed;
}

} // namespace

auto Engine3DCPU::operator()(Simulation3D& sim) const -> double { return run(sim); }
auto Engine3DCPU::operator()(Simulation3D& sim) const -> void { run(sim); }

} // namespace pffdtd
2 changes: 1 addition & 1 deletion src/cpp/pffdtd/engine_3d_cpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace pffdtd {

struct Engine3DCPU {
auto operator()(Simulation3D& sim) const -> double;
auto operator()(Simulation3D& sim) const -> void;
};

} // namespace pffdtd
5 changes: 2 additions & 3 deletions src/cpp/pffdtd/engine_3d_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ void split_data(Simulation3D const* sim, std::span<HostData<Real>> ghds) {
}

// run the sim!
static auto run(Simulation3D const& sim) -> double {
static auto run(Simulation3D const& sim) -> void {
// if you want to test synchronous, env variable for that
char const* s = getenv("CUDA_LAUNCH_BLOCKING");
if (s != nullptr) {
Expand Down Expand Up @@ -1357,9 +1357,8 @@ static auto run(Simulation3D const& sim) -> double {
std::printf("Boundary loop: %.6fs, %.2f Mvox/s\n", elapsedBoundary, sim.Nb * sim.Nt / 1e6 / elapsedBoundary);
std::printf("Air update: %.6fs, %.2f Mvox/s\n", elapsedAir, sim.Npts * sim.Nt / 1e6 / elapsedAir);
std::printf("Combined (total): %.6fs, %.2f Mvox/s\n", elapsed, sim.Npts * sim.Nt / 1e6 / elapsed);
return elapsed;
}

auto Engine3DCUDA::operator()(Simulation3D& sim) const -> double { return run(sim); }
auto Engine3DCUDA::operator()(Simulation3D& sim) const -> void { run(sim); }

} // namespace pffdtd
2 changes: 1 addition & 1 deletion src/cpp/pffdtd/engine_3d_cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace pffdtd {

struct Engine3DCUDA {
auto operator()(Simulation3D& sim) const -> double;
auto operator()(Simulation3D& sim) const -> void;
};

} // namespace pffdtd
6 changes: 1 addition & 5 deletions src/cpp/pffdtd/engine_3d_sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace pffdtd {

auto Engine3DSYCL::operator()(Simulation3D& sim) const -> double {
auto Engine3DSYCL::operator()(Simulation3D& sim) const -> void {
PFFDTD_ASSERT(sim.fcc_flag == 0);

auto queue = sycl::queue{sycl::property::queue::enable_profiling{}};
Expand Down Expand Up @@ -318,10 +318,6 @@ auto Engine3DSYCL::operator()(Simulation3D& sim) const -> double {
for (auto i{0UL}; i < static_cast<size_t>(Nr * Nt); ++i) {
sim.u_out[i] = host[i];
}

fmt::println("");

return 0.0;
}

} // namespace pffdtd
2 changes: 1 addition & 1 deletion src/cpp/pffdtd/engine_3d_sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace pffdtd {

struct Engine3DSYCL {
auto operator()(Simulation3D& sim) const -> double;
auto operator()(Simulation3D& sim) const -> void;
};

} // namespace pffdtd

0 comments on commit beab747

Please sign in to comment.