Connection::Connection(int descriptor, QObject *parent) : QTcpSocket(parent), key(0), descriptor(descriptor)/*, socket(tcpSocket)*/ { /* First we havet to set the descriptor for socket. * It is very important because we are reaching to socketEngine * where the address many parameters are set ie. peer port and address; * * see here: http://download.froglogic.com/public/qt5-squishcoco-report/QtBase/source_480_preprocessed.html */ qDebug() << "Creating descriptor " << descriptor; this->setSocketDescriptor(descriptor); counter += 1; key = rsHash(this->peerAddress(), this->peerPort()); }
cl::Kernel KernelCache::getKernel(cl::CommandQueue& queue, const std::string& program_name, const std::string& kernel_name, const std::string& params) { //!! ASSUMPTION: Kernel name == program name; #if (BUILD_CLVERSION >= 120) std::string _params = " -cl-kernel-arg-info -cl-std=CL1.2 "; #else std::string _params = " -cl-std=CL1.1 "; #endif _params.append(params); std::string key; key.append( "[" + program_name + "/" + kernel_name + "]"); key.append(_params); auto hash = rsHash(key); #ifndef NDEBUG std::cout << "key: " << key << " hash = " << hash << std::endl; #endif auto kernel_iterator = kernel_map.find(hash); if (kernel_iterator != kernel_map.end()) { #ifndef NDEBUG std::cout << "kernel found: " << hash <<std::endl; #endif return kernel_iterator->second; } else //build program and compile the kernel; { #ifndef NDEBUG std::cout << "kernel not found in cache: " << hash <<std::endl; #endif const cl::Program* program = NULL; program = getProgram(queue, program_name, _params); if (program == nullptr) { std::cout << "Problem with getting program [" << program_name << "] " << std::endl; delete program; return cl::Kernel(); } cl_int status; cl::Kernel kernel(*program, kernel_name.c_str(), &status); if (status != CL_SUCCESS) { std::cout << "Problem with creating kernel [" << kernel_name << "]" << std::endl; delete program; return cl::Kernel(); } kernel_map[hash] = kernel; delete program; return kernel; } }