-
Notifications
You must be signed in to change notification settings - Fork 229
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
api: Add op.cinterface for C-level interoperability #1843
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1843 +/- ##
==========================================
+ Coverage 89.51% 89.54% +0.02%
==========================================
Files 209 210 +1
Lines 34875 34939 +64
Branches 5261 5271 +10
==========================================
+ Hits 31218 31285 +67
+ Misses 3164 3161 -3
Partials 493 493
Continue to review full report at Codecov.
|
@@ -603,6 +603,39 @@ def cfunction(self): | |||
|
|||
return self._cfunction | |||
|
|||
def cinterface(self, force=False): |
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.
How about adding name=None to the API (and a if not name
before line 621) so that the caller can change the default?
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 user can control that already via Operator(..., name=X)
-- so here (unlike "classic" devito use model) we don't use the .soname
but rather the actual Operator
name.
|
||
def _operator_includes(self, o): | ||
includes = super()._operator_includes(o) | ||
includes.append(c.Include("%s.h" % o.name, system=False)) |
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.
why this not in _operator_includes
?
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.
well when we normally execute devito and run op.apply
there's no Operator-specific header file to include --it's all in the .c
, no? :)
@@ -467,9 +468,34 @@ def visit_HaloSpot(self, o): | |||
body = flatten(self._visit(i) for i in o.children) | |||
return c.Collection(body) | |||
|
|||
def visit_Operator(self, o): | |||
blankline = c.Line("") | |||
# Operator-handle machinery |
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.
handling?
xfilter = lambda i: not isinstance(i, public_types) | ||
|
||
typedecls = [i._C_typedecl for i in o.parameters | ||
if xfilter(i) and i._C_typedecl is not None] |
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.
is not None
can be safely dropped I think?
xfilter = lambda i: not isinstance(i, public_types) | ||
|
||
typedecls = [i._C_typedecl for i in o.parameters | ||
if xfilter(i) and i._C_typedecl is not None] |
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.
is not None
can be safely dropped I think?
if not i.local: | ||
continue | ||
typedecls.extend([j._C_typedecl for j in i.root.parameters | ||
if xfilter(j) and j._C_typedecl is not None]) |
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.
is not None
can be safely dropped I think?
if not i.local: | ||
continue | ||
typedecls.extend([j._C_typedecl for j in i.root.parameters | ||
if xfilter(j) and j._C_typedecl is not None]) |
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.
is not None
can be safely dropped I think?
CI error is a stupid codecov failing to upload this is GTG |
No description provided.