-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor #112
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
Merged
Merged
Refactor #112
Conversation
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
Not working yet.
Both serial and mpi can work.
…rking. While example can run successfully, the unit test failed at numpy part. I think this is because the initialization of numpy cannot be shared between the one in libyt library and the one initialized in googletest. Because I can successfully called numpy c api in unit test, but failed in libyt.
This is because NumPy API initialization only imports the api within a translation unit. Since we compile it to a libyt library and make unit test link to it, it is in separate translation unit, we need to have a public API to initialize NumPy API within libyt library itself. (https://stackoverflow.com/questions/32899621/numpy-capi-error-with-import-array-when-compiling-multiple-modules/35362918)
This also raise a question of should I separate Mpi operation in DS class?
Though this fix it, I better not called it here, maybe I should singled out numpy function to a class. Again, this is due to numpy api initialization.
…der it. Some part is still not working, but at least breathe can read it. Since I haven't update all the doc to be able to parse by doxygen, I'm skipping this now. And will update it in the future. So currently the doxygen doc won't render in the web page.
This will solve the problem, but I don't think I have time to update every doc. Future work here. I'm not showing api doc in the website anyway. This is just a test.
though nasty but at least it is showing something.
Testing breathe purpose. I don't think I should use the doxygen generate api doc just yet.
updates: - [github.com/pre-commit/mirrors-clang-format: v18.1.8 → v19.1.7](pre-commit/mirrors-clang-format@v18.1.8...v19.1.7)
Signed-off-by: cindytsai <[email protected]>
cindytsai
added a commit
to cindytsai/libyt
that referenced
this pull request
Jun 18, 2025
All done!!! FINALLY!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactoring the Ugly Stuff
This pr doesn't change any API, only the underlying codes are refactored.
Enhancement
Pybind11
Directly using
pybind11to build libyt Python module and bind data.Even though I have added
pybind11, I still keep the original version build using pure Python C API.Note
What I have learned from this is to use Pybind11 to bind meta data, for example, building a dictionary, a list, etc. But for building a Python module, building a large dictionary, wrapping data to a NumPy array, using pure Python C API is just better.
Refactoring
Magic Command and Defined Command
I have merged these two classes.
Though there is still some space for improvement, I still think the definitions inside the new class are strange, I think it is ok to leave it for future, when coupling other well-defined
ipythonmagic command.Function Status and Function Status List
Refactor it to match the naming convention. Probably should decouple collective functions from local functions.
Libyt Process Control
Move all globals into this class.
It also holds different classes that governs different modules.
CommMpiRma
This new class handles the one-sided MPI operation. It separates the data to be distributed and mpi metadata, so that the class is agnostic to distributed data.
To use it, we need to inherit
CommMpiRma<T>and implement corresponding functions (GetDataSizeandGetDataLen).AMR grid and particle data use this.
DataStructureAmr
This class deals with everything about AMR data structure, including:
DataHub
Data hub is a temporary storage for generated or gathered data.
And once the class is deconstructed, it will free them based on whether this is a new allocation and whether the ownership is taken.
Unit Testing
googletestto do unit testnumpy_controllernumpy_controllerLibytPythonShell(with MPI)LibytPythonShellDataStructureAmr(with MPI)DataStructureAmrMemory Profiling
A new GitHub Action for doing memory profile using
valgrindis added. The profile will be in artifacts.GitHub Action
GitHub Action environment, ex: os (linux or macOS), Python version (3.7 ~ 3.14), MPI implementation (
openmpiormpich), different building options, are done in the way that different combination of these are covered.Because some of them are orthogonal, we can separate them.
Doc
Setup
doxygenandbreatheand show the index page. (Though this overlapped with the already documented libyt API, it will help us document the code instead of writing it again in the future.Formatting
clang-format
In the previous release, column limit 120 and indentation 4 were used.
This is taking TOO much space, so I changed to column limit 90 and indentation 2.
Changing the code formatting is not going to happen again.
cmake-format
Format cmake file. The configuration is in
cmake-format.json.TODO
conf.py,index.md)CMakeLists.txt)Doxyfile)libyt.hyt_libytandjupyter_libyt.jupyter-libyt-DUSE_PYBIND11.