Added initial OpenCL stub.
This commit is contained in:
parent
a9103dd1ae
commit
36da54b8ce
28 changed files with 6788 additions and 1 deletions
|
@ -35,6 +35,10 @@
|
|||
# include <hwloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
# include "backend/opencl/OclLib.h"
|
||||
#endif
|
||||
|
||||
#include "base/kernel/Entry.h"
|
||||
#include "base/kernel/Process.h"
|
||||
#include "core/config/usage.h"
|
||||
|
@ -44,6 +48,24 @@
|
|||
namespace xmrig {
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
static void printPlatforms()
|
||||
{
|
||||
std::vector<cl_platform_id> platforms = OclLib::getPlatformIDs();
|
||||
|
||||
char buf[128] = { 0 };
|
||||
|
||||
for (size_t i = 0; i < platforms.size(); i++) {
|
||||
if (OclLib::getPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, sizeof(buf), buf, nullptr) != CL_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("#%zu: %s\n", i, buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int showVersion()
|
||||
{
|
||||
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
|
||||
|
@ -142,6 +164,12 @@ xmrig::Entry::Id xmrig::Entry::get(const Process &process)
|
|||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
if (args.hasArg("--print-platforms")) {
|
||||
return Platforms;
|
||||
}
|
||||
# endif
|
||||
|
||||
return Default;
|
||||
}
|
||||
|
||||
|
@ -161,6 +189,14 @@ int xmrig::Entry::exec(const Process &process, Id id)
|
|||
return exportTopology(process);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
case Platforms:
|
||||
if (OclLib::init()) {
|
||||
printPlatforms();
|
||||
}
|
||||
return 0;
|
||||
# endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ public:
|
|||
Default,
|
||||
Usage,
|
||||
Version,
|
||||
Topo
|
||||
Topo,
|
||||
Platforms
|
||||
};
|
||||
|
||||
static Id get(const Process &process);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue