Skip to content
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

CUDA Docs: Restore Dispatcher.forall() docs #6128

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/cuda-reference/kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ creating a specialized instance:

.. autoclass:: numba.cuda.compiler.Dispatcher
:members: inspect_asm, inspect_llvm, inspect_sass, inspect_types,
specialize, specialized, extensions
specialize, specialized, extensions, forall


Intrinsic Attributes and Functions
Expand Down
19 changes: 15 additions & 4 deletions numba/cuda/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,12 +814,23 @@ def __getitem__(self, args):
return self.configure(*args)

def forall(self, ntasks, tpb=0, stream=0, sharedmem=0):
"""Returns a configured kernel for 1D kernel of given number of tasks
``ntasks``.
"""Returns a 1D-configured kernel for a given number of tasks.

This assumes that:
- the kernel 1-to-1 maps global thread id ``cuda.grid(1)`` to tasks.
- the kernel must check if the thread id is valid."""

- the kernel maps the Global Thread ID ``cuda.grid(1)`` to tasks on a
1-1 basis.
- the kernel checks that the Global Thread ID is upper-bounded by
``ntasks``, and does nothing if it is not.

:param ntasks: The number of tasks.
:param tpb: The size of a block. An appropriate value is chosen if this
parameter is not supplied.
:param stream: The stream on which the configured kernel will be
launched.
:param sharedmem: The number of bytes of dynamic shared memory required
by the kernel.
:return: A configured kernel, ready to launch on a set of arguments."""

return ForAll(self, ntasks, tpb=tpb, stream=stream, sharedmem=sharedmem)

Expand Down