MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / initCL

Function initCL

test/OpenCL/ParallelPrimitives/main.cpp:47–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45const char* g_deviceName = 0;
46
47void initCL(int preferredDeviceIndex, int preferredPlatformIndex)
48{
49 //void* glCtx=0;
50 //void* glDC = 0;
51 int ciErrNum = 0;
52 //bound search and radix sort only work on GPU right now (assume 32 or 64 width workgroup without barriers)
53
54 cl_device_type deviceType = CL_DEVICE_TYPE_ALL;
55
56 g_context = b3OpenCLUtils::createContextFromType(deviceType, &ciErrNum, 0, 0, preferredDeviceIndex, preferredPlatformIndex);
57 oclCHECKERROR(ciErrNum, CL_SUCCESS);
58 int numDev = b3OpenCLUtils::getNumDevices(g_context);
59 if (numDev > 0)
60 {
61 b3OpenCLDeviceInfo info;
62 g_device = b3OpenCLUtils::getDevice(g_context, 0);
63 g_queue = clCreateCommandQueue(g_context, g_device, 0, &ciErrNum);
64 oclCHECKERROR(ciErrNum, CL_SUCCESS);
65 b3OpenCLUtils::printDeviceInfo(g_device);
66 b3OpenCLUtils::getDeviceInfo(g_device, &info);
67 g_deviceName = info.m_deviceName;
68 }
69}
70
71void exitCL()
72{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected