intmain(){//定义存储在主机上地变量和显卡上的变量int h_a[arraySize]={5,9,3,4,8};int h_b[arraySize];int* d_a,* d_b;//给变量分配显存cudaMalloc((void**)&d_b, arraySize *sizeof(int));cudaMalloc((void**)&d_a, arraySize *sizeof(int));//将变量值从主机复制到显卡// Copy input vector from host memory to GPU buffers.cudaMemcpy(d_a, h_a, arraySize *sizeof(int), cudaMemcpyHostToDevice);//核函数执行排序计算// Launch a kernel on the GPU with one thread for each element.addKernel <<<arraySize / threadPerBlock, threadPerBlock >>>(d_a, d_b);//等待所有线程同步计算完成cudaDeviceSynchronize();//将变量值从显存复制到内存// Copy output vector from GPU buffer to host memory.cudaMemcpy(h_b, d_b, arraySize *sizeof(int), cudaMemcpyDeviceToHost);printf("The Enumeration sorted Array is: \n");for(int i =0; i < arraySize; i++){printf("%d\n", h_b[i]);}//释放显存cudaFree(d_a);cudaFree(d_b);return0;}
需求描述
doc表有很多重复的title,想去除掉重复的记录
表结构
CREATE TABLE doc (id INT PRIMARY KEY,title VARCHAR(255),content TEXT
);去重SQL
-- 创建临时表
CREATE TEMPORARY TABLE temp_doc AS
SELECT * FROM doc
WHERE 10;-- 插入唯一的记录(每个title最…