| 38 | } |
| 39 | |
| 40 | int main(int argc, char* argv[]) |
| 41 | { |
| 42 | b3SetCustomPrintfFunc(myprintf); |
| 43 | b3SetCustomWarningMessageFunc(myerrorwarningprintf); |
| 44 | b3SetCustomErrorMessageFunc(myerrorwarningprintf); |
| 45 | |
| 46 | b3Printf("test b3Printf\n"); |
| 47 | b3Warning("test warning\n"); |
| 48 | b3Error("test error\n"); |
| 49 | |
| 50 | int ciErrNum = 0; |
| 51 | |
| 52 | cl_device_type deviceType = CL_DEVICE_TYPE_ALL; |
| 53 | const char* vendorSDK = b3OpenCLUtils::getSdkVendorName(); |
| 54 | |
| 55 | b3Printf("This program was compiled using the %s OpenCL SDK\n", vendorSDK); |
| 56 | int numPlatforms = b3OpenCLUtils::getNumPlatforms(); |
| 57 | b3Printf("Num Platforms = %d\n", numPlatforms); |
| 58 | |
| 59 | for (int i = 0; i < numPlatforms; i++) |
| 60 | { |
| 61 | cl_platform_id platform = b3OpenCLUtils::getPlatform(i); |
| 62 | b3OpenCLPlatformInfo platformInfo; |
| 63 | b3OpenCLUtils::getPlatformInfo(platform, &platformInfo); |
| 64 | b3Printf("--------------------------------\n"); |
| 65 | b3Printf("Platform info for platform nr %d:\n", i); |
| 66 | b3Printf(" CL_PLATFORM_VENDOR: \t\t\t%s\n", platformInfo.m_platformVendor); |
| 67 | b3Printf(" CL_PLATFORM_NAME: \t\t\t%s\n", platformInfo.m_platformName); |
| 68 | b3Printf(" CL_PLATFORM_VERSION: \t\t\t%s\n", platformInfo.m_platformVersion); |
| 69 | |
| 70 | g_cxMainContext = b3OpenCLUtils::createContextFromPlatform(platform, deviceType, &ciErrNum); |
| 71 | |
| 72 | int numDevices = b3OpenCLUtils::getNumDevices(g_cxMainContext); |
| 73 | b3Printf("Num Devices = %d\n", numDevices); |
| 74 | for (int j = 0; j < numDevices; j++) |
| 75 | { |
| 76 | cl_device_id device = b3OpenCLUtils::getDevice(g_cxMainContext, j); |
| 77 | b3OpenCLDeviceInfo devInfo; |
| 78 | b3OpenCLUtils::getDeviceInfo(device, &devInfo); |
| 79 | b3OpenCLUtils::printDeviceInfo(device); |
| 80 | g_cqCommandQue = clCreateCommandQueue(g_cxMainContext, device, 0, &ciErrNum); |
| 81 | |
| 82 | b3OpenCLArray<char> memTester(g_cxMainContext, g_cqCommandQue, 0, true); |
| 83 | int maxMem = 0; |
| 84 | bool result = true; |
| 85 | for (size_t i = 1; result; i++) |
| 86 | { |
| 87 | size_t numBytes = i * 1024 * 1024; |
| 88 | result = memTester.resize(numBytes, false); |
| 89 | |
| 90 | if (result) |
| 91 | { |
| 92 | maxMem = numBytes; |
| 93 | } |
| 94 | else |
| 95 | { |
| 96 | break; |
| 97 | } |
nothing calls this directly
no test coverage detected