-
Notifications
You must be signed in to change notification settings - Fork 24
[RAMSES][AMR] Histogram of AMR Levels and New Block Index Map #1632
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
Open
Akos299
wants to merge
35
commits into
Shamrock-code:main
Choose a base branch
from
Akos299:blocks_level_histrogram
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
42a7b2e
level 0 sizes
Akos299 679b9be
Merge branch 'Shamrock-code:main' into features/level0sizes
Akos299 c898fe8
made refinement as experimental
Akos299 b19f7f2
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl 243fa08
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl c8ed07b
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl 4c38506
Update src/shammodels/ramses/src/pyRamsesModel.cpp
tdavidcl ea4a92b
Update src/shammodels/ramses/src/pyRamsesModel.cpp
tdavidcl 32c02a2
Update src/shammodels/ramses/src/Solver.cpp
tdavidcl b84ac14
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl c29f166
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl f5a8c1c
Update src/shammodels/ramses/src/Solver.cpp
tdavidcl eaf218b
Merge branch 'main' into features/level0sizes
tdavidcl 628ec01
[autofix.ci] automatic fix: pre-commit hooks
autofix-ci[bot] 36befa9
Merge branch 'Shamrock-code:main' into features/level0sizes
Akos299 bf2aa9c
changed AMR level0 computation
Akos299 ed2184c
changed license in hearder file 2021-2015 to 2021-2026
Akos299 3e9ac8b
[Ramses][AMR][get amr levels]
Akos299 f144a7e
[Ramses][AMR] Histogram of AMR Levels and New Block Index Map
Akos299 0e8c625
[Ramses][AMR] Histogram for amr levels
Akos299 31614ad
fix template deduction conflict in atomic by static_cast
Akos299 dd6cdbb
Merge branch 'Shamrock-code:main' into blocks_level_histrogram
Akos299 c71474a
updates
Akos299 0f21307
Merge branch 'main' into blocks_level_histrogram
tdavidcl 3c20e15
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fdf8fa9
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl 74279d3
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl a1dc233
Update src/shammodels/ramses/include/shammodels/ramses/modules/Comput…
tdavidcl d1e5541
Update src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp
tdavidcl 2de8cc0
Update src/shammodels/ramses/include/shammodels/ramses/modules/AMRGri…
tdavidcl d9b41ca
Update src/shammodels/ramses/src/pyRamsesModel.cpp
tdavidcl a0bb0bb
Update src/shammodels/ramses/src/pyRamsesModel.cpp
tdavidcl 8aeeaee
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2e96796
[gh-action] trigger CI with empty commit
github-actions[bot] f21d033
Merge branch 'main' into blocks_level_histrogram
tdavidcl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/shammodels/ramses/include/shammodels/ramses/modules/ComputeLevel0CellSize.hpp
Akos299 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| // -------------------------------------------------------// | ||
| // | ||
| // 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 ComputeLevel0CellSize.hpp | ||
| * @author Léodasce Sewanou (leodasce.sewanou@ens-lyon.fr) | ||
| * @author Timothée David--Cléris (tim.shamrock@proton.me) --no git blame-- | ||
| * @brief | ||
| * | ||
| */ | ||
|
|
||
| #include "shamalgs/primitives/reduction.hpp" | ||
| #include "shammath/AABB.hpp" | ||
| #include "shamrock/solvergraph/IFieldRefs.hpp" | ||
| #include "shamrock/solvergraph/INode.hpp" | ||
| #include "shamrock/solvergraph/IPatchDataLayerRefs.hpp" | ||
| #include "shamrock/solvergraph/ScalarsEdge.hpp" | ||
| #include <memory> | ||
|
|
||
| namespace shammodels::basegodunov::modules { | ||
|
|
||
tdavidcl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| template<class Tvec, class TgridVec> | ||
| class ComputeLevel0CellSize : public shamrock::solvergraph::INode { | ||
| public: | ||
| ComputeLevel0CellSize() {} | ||
|
|
||
| struct Edges { | ||
| const shamrock::solvergraph::ScalarsEdge<shammath::AABB<TgridVec>> &patch_boxes; | ||
| const shamrock::solvergraph::IPatchDataLayerRefs &refs; | ||
| const shamrock::solvergraph::IFieldRefs<TgridVec> &spans_block_min; | ||
| const shamrock::solvergraph::IFieldRefs<TgridVec> &spans_block_max; | ||
| shamrock::solvergraph::ScalarsEdge<TgridVec> &level0_size; | ||
| }; | ||
|
|
||
| void set_edges( | ||
| std::shared_ptr<shamrock::solvergraph::ScalarsEdge<shammath::AABB<TgridVec>>> | ||
| patch_boxes, | ||
| std::shared_ptr<shamrock::solvergraph::IPatchDataLayerRefs> refs, | ||
| std::shared_ptr<shamrock::solvergraph::IFieldRefs<TgridVec>> spans_block_min, | ||
| std::shared_ptr<shamrock::solvergraph::IFieldRefs<TgridVec>> spans_block_max, | ||
| std::shared_ptr<shamrock::solvergraph::ScalarsEdge<TgridVec>> level0_size) { | ||
| __internal_set_ro_edges({patch_boxes, refs, spans_block_min, spans_block_max}); | ||
| __internal_set_rw_edges({level0_size}); | ||
| } | ||
|
|
||
| Edges get_edges() { | ||
| return Edges{ | ||
| get_ro_edge<shamrock::solvergraph::ScalarsEdge<shammath::AABB<TgridVec>>>(0), | ||
| get_ro_edge<shamrock::solvergraph::IPatchDataLayerRefs>(1), | ||
| get_ro_edge<shamrock::solvergraph::IFieldRefs<TgridVec>>(2), | ||
| get_ro_edge<shamrock::solvergraph::IFieldRefs<TgridVec>>(3), | ||
| get_rw_edge<shamrock::solvergraph::ScalarsEdge<TgridVec>>(0)}; | ||
| } | ||
|
|
||
| void _impl_evaluate_internal() { | ||
| auto edges = get_edges(); | ||
| edges.level0_size.values = edges.refs.get_const_refs().template map<TgridVec>( | ||
| [&](u64 id_patch, const shamrock::patch::PatchDataLayer &pdat) { | ||
| auto dev_sched = shamsys::instance::get_compute_scheduler_ptr(); | ||
| sham::DeviceQueue &q = shamsys::instance::get_compute_scheduler().get_queue(); | ||
| sham::DeviceBuffer<TgridVec> block_size_buf(pdat.get_obj_cnt(), dev_sched); | ||
|
|
||
| sham::EventList depends_list; | ||
| auto block_min_acc | ||
| = edges.spans_block_min.get_field(id_patch).get_buf().get_read_access( | ||
| depends_list); | ||
| auto block_max_acc | ||
| = edges.spans_block_max.get_field(id_patch).get_buf().get_read_access( | ||
| depends_list); | ||
| auto block_size_acc = block_size_buf.get_write_access(depends_list); | ||
|
|
||
| auto e = q.submit(depends_list, [&](sycl::handler &cgh) { | ||
| cgh.parallel_for( | ||
| sycl::range<1>(pdat.get_obj_cnt()), [=](sycl::item<1> gid) { | ||
| u32 id = gid.get_linear_id(); | ||
| block_size_acc[id] = block_max_acc[id] - block_min_acc[id]; | ||
| }); | ||
| }); | ||
| edges.spans_block_min.get_field(id_patch).get_buf().complete_event_state(e); | ||
| edges.spans_block_max.get_field(id_patch).get_buf().complete_event_state(e); | ||
| block_size_buf.complete_event_state(e); | ||
|
|
||
| auto patch_min = shamalgs::primitives::min( | ||
| dev_sched, block_size_buf, 0, pdat.get_obj_cnt()); | ||
Akos299 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| auto patch_max = shamalgs::primitives::max( | ||
| dev_sched, block_size_buf, 0, pdat.get_obj_cnt()); | ||
|
|
||
| // shammath::AABB<TgridVec> patch_box = edges.patch_boxes.values.get(id_patch); | ||
| // return patch_box.delt(); | ||
| return patch_max; | ||
| }); | ||
| } | ||
|
|
||
| inline virtual std::string _impl_get_label() const { return "ComputeLevel0CellSize"; }; | ||
|
|
||
| virtual std::string _impl_get_tex() const { return "ComputeLevel0CellSize"; }; | ||
| }; | ||
|
|
||
| } // namespace shammodels::basegodunov::modules | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.