MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / LoadCustomDevice

Function LoadCustomDevice

paddle/fluid/platform/init.cc:161–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159
160#ifdef PADDLE_WITH_CUSTOM_DEVICE
161void LoadCustomDevice(const std::string &library_dir) {
162 LOG(INFO) << "Try loading custom device libs from: [" << library_dir << "]";
163 std::vector<std::string> libs = phi::ListAllLibraries(library_dir);
164 for (const auto &lib_path : libs) {
165 auto dso_handle = dlopen(lib_path.c_str(), RTLD_LAZY);
166 PADDLE_ENFORCE_NOT_NULL(
167 dso_handle,
168 common::errors::InvalidArgument(
169 "Fail to open library: %s with error: %s", lib_path, dlerror()));
170
171 paddle::LoadCustomLib(lib_path, dso_handle);
172 }
173 phi::CustomKernelMap::Instance().RegisterCustomKernels();
174 LOG(INFO) << "Finished in LoadCustomDevice with libs_path: [" << library_dir
175 << "]";
176}
177#endif
178
179static std::once_flag init_devices_flag;

Callers 1

InitDevicesFunction · 0.85

Calls 6

ListAllLibrariesFunction · 0.85
dlopenFunction · 0.85
LoadCustomLibFunction · 0.85
InstanceFunction · 0.85
c_strMethod · 0.80
RegisterCustomKernelsMethod · 0.80

Tested by

no test coverage detected