-
Notifications
You must be signed in to change notification settings - Fork 38
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
C restructure #417
C restructure #417
Conversation
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.
Couple of comments but overall this is SUPER nice. Thank you!!!
lib.Broadcast_struct_global_PS(up(), cp()) | ||
lib.Broadcast_struct_global_UF(up(), cp()) | ||
lib.Broadcast_struct_global_IT(up(), cp(), ap(), fo()) | ||
lib.Broadcast_struct_global_all(up(), cp(), ap(), fo()) |
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.
This is not your task necessarily (certainly not in this PR) but I'd love to have a nicer lower level wrapper that just exposes these functions directly in Python style, so you could call like
broadcast_structs(up, cp, ap, fo)
```
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.
do you mean just adding something like the following to the wrapper? these functions are already exposed
def broadcast_inputstructs(up,cp,ap=None,fo=None):
if not isinstance(up,UserParams) or not isinstance(cp,CosmoParams):
raise ValueError
if isinstance(ap,AstroParams) and isinstance(fo,FlagOptions):
lib.Broadcast_struct_global_all(up(), cp(), ap(), fo())
lib.Broadcast_struct_global_noastro(up(), cp())
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.
Exactly.
for more information, see https://pre-commit.ci
A draft pull request for a restructure of the C backend. #359
Changes:
GenerateICs.c
#include "X.c"
have been removedbuild.cffi
has been changed to make it clear which functions and definitions are available to the python wrapper.cdef()
calls as well as in theset_source()
header files.cdef()
code cannot contain compiler directives, as a result new header files were created labelled_something_wrapper.h
to contain exposed definitions. these are also included in the relevant header files for the backend so we only have to edit one file to expose a function properly.UsefulFunctions.c
andps.c
have been split up into functions grouped together by their themes e.gcosmology.c
thermochem.c
hmf.c
etc...Todos:
unsigned long long
, but single axis indices are sometimesint
orunsigned long long
.float
, most of these should bedouble
unless they are a grid which takes up significant memory/disk space Migration toward double precision floating point numbers #361heating_helper_progs.c
as well