Skip to content

Commit

Permalink
Use the new legate api
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Apr 25, 2023
1 parent cd30dd7 commit 7b2000b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
18 changes: 10 additions & 8 deletions legate/cpp/legate_mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace legate_kvikio {

class Mapper : public legate::mapping::LegateMapper {
class Mapper : public legate::mapping::Mapper {
public:
Mapper() {}

Expand Down Expand Up @@ -76,18 +76,20 @@ Legion::Logger log_legate_kvikio(library_name);
return registrar;
}

// void registration_callback()
// {
// auto context = legate::Runtime::get_runtime()->create_library(library_name);
// Registry::get_registrar().register_all_tasks(context);
// }

void registration_callback()
{
legate::ResourceConfig config;
config.max_mappers = 1;
config.max_tasks = OP_NUM_TASK_IDS;

legate::LibraryContext context(library_name, config);
config.max_tasks = OP_NUM_TASK_IDS;

auto context = legate::Runtime::get_runtime()->create_library(
library_name, config, std::make_unique<Mapper>());
Registry::get_registrar().register_all_tasks(context);

// Now we can register our mapper with the runtime
context.register_mapper(std::make_unique<Mapper>(), 0);
}

} // namespace legate_kvikio
Expand Down
6 changes: 0 additions & 6 deletions legate/cpp/legate_mapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
namespace legate_kvikio {

struct Registry {
public:
template <typename... Args>
static void record_variant(Args&&... args)
{
get_registrar().record_variant(std::forward<Args>(args)...);
}
static legate::TaskRegistrar& get_registrar();
};

Expand Down
9 changes: 1 addition & 8 deletions legate/legate_kvikio/library_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from legate_kvikio.install_info import header, libpath

from legate.core import Library, ResourceConfig, get_legate_runtime
from legate.core import Library, get_legate_runtime


class LibraryDescription(Library):
Expand All @@ -30,13 +30,6 @@ def get_c_header(self) -> str:
def get_registration_callback(self) -> str:
return "legate_kvikio_perform_registration"

def get_resource_configuration(self) -> ResourceConfig:
assert self.shared_object is not None
config = ResourceConfig()
config.max_mappers = 1
config.max_tasks = self.cffi.OP_NUM_TASK_IDS
return config

def initialize(self, shared_object: Any) -> None:
self.shared_object = shared_object

Expand Down

0 comments on commit 7b2000b

Please sign in to comment.