legate::TaskRegistrar#
-
class TaskRegistrar#
A helper class for task variant registration.
The
legate::TaskRegistrar
class is designed to simplify the boilerplate that client libraries need to register all its task variants. The following is a boilerplate that each library needs to write:struct MyLibrary { static legate::TaskRegistrar& get_registrar(); }; template <typename T> struct MyLibraryTaskBase : public legate::LegateTask<T> { using Registrar = MyLibrary; ... };
In the code above, the
MyLibrary
has a static member that returns a singletonlegate::TaskRegistrar
object. Then, theMyLibraryTaskBase
points to the class so Legate can find where task variants are collected.Once this registrar is set up in a library, each library task can simply register itself with the
LegateTask::register_variants
method like the following:// In a header struct MyLibraryTask : public MyLibraryTaskBase<MyLibraryTask> { ... }; // In a C++ file static void __attribute__((constructor)) register_tasks() { MyLibraryTask::register_variants(); }
Public Functions
-
class Impl#
-
class RecordTaskKey#
-
class Impl#