-
Notifications
You must be signed in to change notification settings - Fork 17
specfem::Context struct and ContextGuard for initialization of kokkos, mpi, and handling initialization from python side etc. #1149
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: devel
Are you sure you want to change the base?
Conversation
|
If approved, this will need additional file edits for the documentation. |
Rohit-Kakodkar
left a comment
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.
I am mostly on board with this.
- I think we need a new enumeration that is different from dimension. How about
namespace specfem {
enum class execution_model {
dim2, dim3, globe, ...
}
}
- Use
std::unique_ptrwhere you can if the ptr is owned exclusively by core (which I think is the case). Or usestd::shared_ptrwithweak_ptrwhich might be appropriate as well. I recomment seeing Cherno's videos on those if you haven't.
Ok! I'm going to wait for @icui 's review as well before making the requested updates
I don't think I watched that one yet, will do! |
|
Looks good to me. Shall we rename it to |
|
I still have to update the documentation. But I thought since the updates were larger, I still wait for it. |
…rd fully manages the created context. For Python we still create a static instance that is checked against. This should theoretically allow for multiple Kokkoses in one executable.
- put context and execution in deeper namespaces - updated the original specfem2d and specfem3d executables to use ContextGuard. They are kept for compatibility for now. - add print functions to mpi object
- Updates names of the models - deprecates enumerations::execution - adds content to enumerations::simulation - updates references
- specfem::simulation now contains both context and execute function
- the execute function takes as an argument the 2d and 3d
- calls can be made like so
```cpp
try {
context = specfem::simulation::contextguard()
success = specfem::simulation::execute("2d", ...)
```
| #include <vector> | ||
| #include <yaml-cpp/yaml.h> | ||
|
|
||
| namespace specfem { |
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.
| namespace specfem { | |
| namespace specfem::simulation { |
|
I merged devel into #1416 by accident, so we just gotta wait for that one to merge into here, for the conflicts to be resolved. |
Description
When I was trying out the Kokkos::View extents syntax, I asked claude to create a basic cpp project for me to just play around with the dependencies, and not having to wrestle with specfem compilation.
It ended up creating a core initialization framework to handle initialization and ending of Kokkos.
I created this PR that implements everything. Everything is tested include the Python interface, so no issues there.
Claude's sample implementation (Click me)
mainfunction that uses itWhat's interesting is that it a allows for a pretty clean single executable without a lot of multiplied code:
running 2d:
running 3d:
Let me know what you think.
Issue Number
If there is an issue created for these changes, link it here
Checklist
Please make sure to check developer documentation on specfem docs.