Skip to content

Commit d0ad955

Browse files
committed
add docstrings
1 parent 94adcfc commit d0ad955

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

pyop2/host.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,21 @@ def generate_code(self):
819819
def wrapper_snippets(itspace, args,
820820
kernel_name=None, wrapper_name=None, user_code=None,
821821
iteration_region=ALL, applied_blas=False):
822+
"""Generates code snippets for the wrapper,
823+
ready to be into a template.
824+
825+
:param itspace: :class:`IterationSpace` object of the :class:`ParLoop`,
826+
This is built from the iteration :class:`Set`.
827+
:param args: :class:`Arg`s of the :class:`ParLoop`
828+
:param kernel_name: Kernel function name (forwarded)
829+
:param user_code: Code to insert into the wrapper (forwarded)
830+
:param wrapper_name: Wrapper function name (forwarded)
831+
:param iteration_region: Iteration region, this is specified when
832+
creating a :class:`ParLoop`.
833+
:param applied_blas: COFFEE sometimes sets this true.
834+
835+
:return: dict containing the code snippets
836+
"""
822837

823838
assert kernel_name is not None
824839
if wrapper_name is None:
@@ -827,9 +842,6 @@ def wrapper_snippets(itspace, args,
827842
user_code = ""
828843

829844
direct = all(a.map is None for a in args)
830-
# args, iteration_region: directly specified
831-
# itspace: built from iterset
832-
# applied_blas: False, except when COFFEE turns it on
833845

834846
def itspace_loop(i, d):
835847
return "for (int i_%d=0; i_%d<%d; ++i_%d) {" % (i, i, d, i)

pyop2/sequential.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,21 @@ def _compute(self, part, fun, *arglist):
157157

158158

159159
def generate_cell_wrapper(itspace, args, forward_args=(), kernel_name=None, wrapper_name=None):
160+
"""Generates wrapper for a single cell. No iteration loop, but cellwise data is extracted.
161+
Cell is expected as an argument to the wrapper. For extruded, the numbering of the cells
162+
is columnwise continuous, bottom to top.
163+
164+
:param itspace: :class:`IterationSpace` object. Can be built from
165+
iteration :class:`Set` using pyop2.base.build_itspace
166+
:param args: :class:`Arg`s
167+
:param forward_args: To forward unprocessed arguments to the kernel via the wrapper,
168+
give an iterable of strings describing their C types.
169+
:param kernel_name: Kernel function name
170+
:param wrapper_name: Wrapper function name
171+
172+
:return: string containing the C code for the single-cell wrapper
173+
"""
174+
160175
direct = all(a.map is None for a in args)
161176
snippets = host.wrapper_snippets(itspace, args, kernel_name=kernel_name, wrapper_name=wrapper_name)
162177

0 commit comments

Comments
 (0)