0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-14 00:34:18 +01:00

ircd:🆑 Add shlib path conf.

This commit is contained in:
Jason Volk 2021-12-28 13:33:35 -08:00
parent 5a6cd51530
commit 781ead25b5
2 changed files with 45 additions and 28 deletions

View file

@ -30,9 +30,10 @@ namespace ircd::cl
extern const info::versions version_api;
extern info::versions version_abi;
extern conf::item<std::string> envs[];
extern conf::item<std::string> path;
extern conf::item<milliseconds> nice_rate;
extern conf::item<uint64_t> watchdog_tsc;
extern conf::item<std::string> envs[];
extern conf::item<bool> profile_queue;
extern conf::item<bool> enable;
extern log::log log;

View file

@ -136,6 +136,14 @@ ircd::cl::profile_queue
{ "persist", false },
};
decltype(ircd::cl::path)
ircd::cl::path
{
{ "name", "ircd.cl.path" },
{ "default", "libOpenCL.so" },
{ "persist", false },
};
decltype(ircd::cl::nice_rate)
ircd::cl::nice_rate
{
@ -150,31 +158,6 @@ ircd::cl::watchdog_tsc
{ "default", 268'435'456L },
};
decltype(ircd::cl::primary_stats)
ircd::cl::primary_stats
{
{ { "name", "ircd.cl.sync.count" } },
{ { "name", "ircd.cl.flush.count" } },
{ { "name", "ircd.cl.alloc.count" } },
{ { "name", "ircd.cl.alloc.bytes" } },
{ { "name", "ircd.cl.dealloc.count" } },
{ { "name", "ircd.cl.dealloc.bytes" } },
{ { "name", "ircd.cl.work.waits" } },
{ { "name", "ircd.cl.work.waits.async" } },
{ { "name", "ircd.cl.work.errors" } },
{ { "name", "ircd.cl.exec.tasks" } },
{ { "name", "ircd.cl.exec.kern.tasks" } },
{ { "name", "ircd.cl.exec.kern.threads" } },
{ { "name", "ircd.cl.exec.kern.groups" } },
{ { "name", "ircd.cl.exec.write.tasks" } },
{ { "name", "ircd.cl.exec.write.bytes" } },
{ { "name", "ircd.cl.exec.read.tasks" } },
{ { "name", "ircd.cl.exec.read.bytes" } },
{ { "name", "ircd.cl.exec.copy.tasks" } },
{ { "name", "ircd.cl.exec.copy.bytes" } },
{ { "name", "ircd.cl.exec.barrier.tasks" } },
};
decltype(ircd::cl::envs)
ircd::cl::envs
{
@ -200,6 +183,31 @@ ircd::cl::envs
},
};
decltype(ircd::cl::primary_stats)
ircd::cl::primary_stats
{
{ { "name", "ircd.cl.sync.count" } },
{ { "name", "ircd.cl.flush.count" } },
{ { "name", "ircd.cl.alloc.count" } },
{ { "name", "ircd.cl.alloc.bytes" } },
{ { "name", "ircd.cl.dealloc.count" } },
{ { "name", "ircd.cl.dealloc.bytes" } },
{ { "name", "ircd.cl.work.waits" } },
{ { "name", "ircd.cl.work.waits.async" } },
{ { "name", "ircd.cl.work.errors" } },
{ { "name", "ircd.cl.exec.tasks" } },
{ { "name", "ircd.cl.exec.kern.tasks" } },
{ { "name", "ircd.cl.exec.kern.threads" } },
{ { "name", "ircd.cl.exec.kern.groups" } },
{ { "name", "ircd.cl.exec.write.tasks" } },
{ { "name", "ircd.cl.exec.write.bytes" } },
{ { "name", "ircd.cl.exec.read.tasks" } },
{ { "name", "ircd.cl.exec.read.bytes" } },
{ { "name", "ircd.cl.exec.copy.tasks" } },
{ { "name", "ircd.cl.exec.copy.bytes" } },
{ { "name", "ircd.cl.exec.barrier.tasks" } },
};
//
// init
//
@ -216,7 +224,13 @@ ircd::cl::init::init()
return;
}
const ctx::posix::enable_pthread enable_pthread;
const std::string &path
{
cl::path
};
if(path.empty())
return;
// Setup options
for(const auto &item : envs)
@ -232,9 +246,11 @@ ircd::cl::init::init()
sys::call(putenv, option[options++]);
}
const ctx::posix::enable_pthread enable_pthread;
// Load the pipe.
assert(!linkage);
if(!(linkage = dlopen("libOpenCL.so", RTLD_LAZY | RTLD_GLOBAL)))
if(!(linkage = dlopen(path.c_str(), RTLD_LAZY | RTLD_GLOBAL)))
return;
// Get the platforms.