-
Notifications
You must be signed in to change notification settings - Fork 34
[Algs] add buf to checksum utility (for debug) #1773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 59 commits
5d07c43
de797a6
b161128
58b4695
ff5a902
e0cd91d
6bc2845
ee3632a
f815d5f
cdca66a
d811e5f
775d26a
3944ef1
1d53302
9011b2a
9dc904d
bd98637
9534a22
dcd76b0
2ebb27a
8f7087b
36b2516
5e2d837
8d69537
0f0d14c
c4217cd
e698051
9079339
05bf4f7
b6228ea
e0a117d
6ec6ec7
2b28ecd
2ab4df4
1bed2de
35941e4
5687d48
06eee3e
98b1e99
d2ddf42
9774603
f376a07
91848f5
afe16b0
5ce8eae
2634fc2
098ef5e
40347bb
bc83f81
e78096e
e8977bf
38b4785
90486c3
46632aa
7f0079e
46ed9b7
ece0151
0ba522b
f1b4ecb
28a757e
cbd3e14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // -------------------------------------------------------// | ||
| // | ||
| // SHAMROCK code for hydrodynamics | ||
| // Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me> | ||
| // SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1 | ||
| // Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information | ||
| // | ||
| // -------------------------------------------------------// | ||
|
|
||
| #pragma once | ||
|
|
||
| /** | ||
| * @file buf_checksum.hpp | ||
| * @author Timothée David--Cléris (tim.shamrock@proton.me) | ||
| * @brief | ||
| * | ||
| */ | ||
|
|
||
| #include "shambase/checksum.hpp" | ||
| #include "shamalgs/primitives/flatten.hpp" | ||
| #include "shambackends/DeviceBuffer.hpp" | ||
|
|
||
| namespace shamalgs { | ||
|
|
||
| template<class T> | ||
| inline u64 buf_checksum(const sham::DeviceBuffer<T> &buf) { | ||
| auto flattened_buf = primitives::flatten_buffer(buf); | ||
|
|
||
| using Tscal = typename shambase::VectorProperties<T>::component_type; | ||
| std::vector<Tscal> data = flattened_buf.copy_to_stdvec(); | ||
| return shambase::fnv1a_hash( | ||
| reinterpret_cast<const char *>(data.data()), data.size() * sizeof(Tscal)); | ||
| } | ||
|
|
||
| } // namespace shamalgs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // -------------------------------------------------------// | ||
| // | ||
| // SHAMROCK code for hydrodynamics | ||
| // Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me> | ||
| // SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1 | ||
| // Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information | ||
| // | ||
| // -------------------------------------------------------// | ||
|
|
||
| #pragma once | ||
|
|
||
| /** | ||
| * @file checksum.hpp | ||
| * @author Timothée David--Cléris (tim.shamrock@proton.me) | ||
| * @brief | ||
| * | ||
| */ | ||
|
|
||
| #include "shambase/aliases_int.hpp" | ||
| #include <cstddef> | ||
|
|
||
| namespace shambase { | ||
|
|
||
| /** | ||
| * @brief Compute the FNV-1a hash of a given data | ||
| * | ||
| * @param data | ||
| * @param size | ||
| * @return u64 | ||
| */ | ||
| inline u64 fnv1a_hash(const char *data, size_t size) { | ||
| constexpr u64 fnv_offset_basis = 14695981039346656037ULL; | ||
| constexpr u64 fnv_prime = 1099511628211ULL; | ||
|
|
||
| u64 hash = fnv_offset_basis; | ||
| for (size_t i = 0; i < size; ++i) { | ||
| hash ^= static_cast<u64>(static_cast<unsigned char>(data[i])); | ||
| hash *= fnv_prime; | ||
| } | ||
| return hash; | ||
| } | ||
|
|
||
| } // namespace shambase |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1583,6 +1583,12 @@ shammodels::sph::TimestepLog shammodels::sph::Solver<Tvec, Kern>::evolve_once() | |||||
| sham::MemPerfInfos mem_perf_infos_start = sham::details::get_mem_perf_info(); | ||||||
| f64 mpi_timer_start = shamcomm::mpi::get_timer("total"); | ||||||
|
|
||||||
| for (auto &callbacks : timestep_callbacks) { | ||||||
| if (callbacks.step_begin_callback) { | ||||||
| shambase::get_check_ref(callbacks.step_begin_callback)(); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| Tscal t_current = solver_config.get_time(); | ||||||
| Tscal dt = solver_config.get_dt_sph(); | ||||||
|
|
||||||
|
|
@@ -2643,6 +2649,12 @@ shammodels::sph::TimestepLog shammodels::sph::Solver<Tvec, Kern>::evolve_once() | |||||
|
|
||||||
| tstep.end(); | ||||||
|
|
||||||
| for (auto it = timestep_callbacks.rbegin(); it != timestep_callbacks.rend(); ++it) { | ||||||
| if (it->step_begin_callback) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The condition checks
Suggested change
|
||||||
| shambase::get_check_ref(it->step_end_callback)(); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| f64 delta_mpi_timer = shamcomm::mpi::get_timer("total") - mpi_timer_start; | ||||||
| sham::MemPerfInfos mem_perf_infos_end = sham::details::get_mem_perf_info(); | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
continuestatement here will cause the benchmark loop to be skipped entirely. This appears to be leftover debug code that should be removed to allow the benchmark to run.