MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / CustomLib

Method CustomLib

src/custom/impl/manager.cpp:35–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#endif
34
35CustomLib::CustomLib(const std::string& path, int mode = RTLD_LAZY)
36 : m_handle(nullptr, [](void* handle) { dlclose(handle); }) {
37 auto op_list_before_load = CustomOpManager::inst()->op_name_list();
38 std::unordered_set<std::string> op_set_before_load(
39 op_list_before_load.begin(), op_list_before_load.end());
40
41 m_handle.reset(dlopen(path.c_str(), mode));
42 mgb_assert(
43 m_handle != nullptr, "open custom op lib failed, error type: %s",
44 dlerror());
45
46 auto op_list_after_load = CustomOpManager::inst()->op_name_list();
47 for (auto& op : op_list_after_load) {
48 if (op_set_before_load.find(op) == op_set_before_load.end()) {
49 m_ops.emplace_back(op);
50 }
51 }
52}
53
54CustomLib::~CustomLib() {
55 for (auto& op : m_ops) {

Callers

nothing calls this directly

Calls 10

dlcloseFunction · 0.85
instFunction · 0.85
op_name_listMethod · 0.80
emplace_backMethod · 0.80
dlopenFunction · 0.70
dlerrorFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
resetMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected