#include "defs.hh" #include "device.hh" #include #include #include #include #include #ifdef __APPLE__ # include #else # include #endif namespace OpenCLRunTime { // String typedef char char_arr[10000]; // Integer vector struct size_t_arr { size_t arr[3]; }; ostream& operator<< (ostream& os, size_t_arr const& arr) { for (size_t i=0; i= size); \ os << spaces.substr(0, OFFSET) \ << macro.substr(begin, LENGTH+2) << val << endl; \ } else { \ os << spaces.substr(0, OFFSET) \ << macro.substr(begin, LENGTH+2) \ << "[error " << errcode1 << "]" << endl; \ } \ } while (0) #define PRINT_UNSP(os, device, FUNCTION, MACRO, NAME, OFFSET, LENGTH, TYPE) \ do { \ string const spaces = " "; \ string const macro = string(NAME) + ": " + spaces; \ size_t const begin = macro.find('_', macro.find('_',0)+1)+1; \ os << spaces.substr(0, OFFSET) \ << macro.substr(begin, LENGTH+2) \ << "[unsupported]" << endl; \ } while (0) // Output information about the OpenCL device extern "C" void OpenCLRunTime_DeviceInfo(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; stringstream filename; filename << out_dir << "/opencl.txt"; ofstream file(filename.str().c_str()); // Display some information about the available compute devices cl_uint num_platforms; checkErr(clGetPlatformIDs(0, NULL, &num_platforms)); file << "NUM_PLATFORMS: " << num_platforms << endl; vector platforms(num_platforms); vector > devices(num_platforms); checkErr(clGetPlatformIDs(num_platforms, &platforms[0], &num_platforms)); for (cl_uint plat_ind=0; plat_ind