MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / InitCL

Function InitCL

test_conformance/printf/test_printf.cpp:1083–1191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1081}
1082
1083test_status InitCL( cl_device_id device )
1084{
1085 char* pcTempFname = get_temp_filename();
1086 if (pcTempFname != nullptr)
1087 {
1088 strncpy(gFileName, pcTempFname, sizeof(gFileName) - 1);
1089 gFileName[sizeof(gFileName) - 1] = '\0';
1090 }
1091
1092 free(pcTempFname);
1093
1094 if (strlen(gFileName) == 0)
1095 {
1096 log_error("get_temp_filename failed\n");
1097 return TEST_FAIL;
1098 }
1099
1100 gMTdata = MTdataHolder(gRandomSeed);
1101
1102 uint32_t device_frequency = 0;
1103 uint32_t compute_devices = 0;
1104
1105 int err;
1106 gFd = acquireOutputStream(&err);
1107 if (err != 0)
1108 {
1109 log_error("Error while redirection stdout to file");
1110 return TEST_FAIL;
1111 }
1112
1113 size_t config_size = sizeof( device_frequency );
1114#if MULTITHREAD
1115 if( (err = clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS, config_size, &compute_devices, NULL )) )
1116#endif
1117 compute_devices = 1;
1118
1119 config_size = sizeof(device_frequency);
1120 if((err = clGetDeviceInfo(device, CL_DEVICE_MAX_CLOCK_FREQUENCY, config_size, &device_frequency, NULL )))
1121 device_frequency = 1;
1122
1123 releaseOutputStream(gFd);
1124
1125 log_info( "\nCompute Device info:\n" );
1126 log_info( "\tProcessing with %d devices\n", compute_devices );
1127 log_info( "\tDevice Frequency: %d MHz\n", device_frequency );
1128
1129 printDeviceHeader( device );
1130
1131 PrintArch();
1132
1133 auto version = get_device_cl_version(device);
1134 auto expected_min_version = Version(1, 2);
1135 if (version < expected_min_version)
1136 {
1137 version_expected_info("Test", "OpenCL",
1138 expected_min_version.to_string().c_str(),
1139 version.to_string().c_str());
1140 return TEST_SKIP;

Callers

nothing calls this directly

Calls 13

get_temp_filenameFunction · 0.85
MTdataHolderClass · 0.85
acquireOutputStreamFunction · 0.85
releaseOutputStreamFunction · 0.85
printDeviceHeaderFunction · 0.85
PrintArchFunction · 0.85
get_device_cl_versionFunction · 0.85
VersionClass · 0.85
version_expected_infoFunction · 0.85
is_extension_availableFunction · 0.85
generateRefFunction · 0.85

Tested by

no test coverage detected