当前位置: 首页 > news >正文

优秀集团网站做微商能利用的网站有哪些

优秀集团网站,做微商能利用的网站有哪些,企业查询显示利好什么意思,齐齐哈尔网站设计为了确保能够真正地了解线程块的分配,接下来我们写一个简短的内核程序来输出线程块、线程、线程束和线程全局标号到屏幕上。现在,除非你使用的是 3.2 版本以上的 SDK否则内核中是不支持 printf的。因此,我们可以将数据传送回 CPU 端然后输出到…

        为了确保能够真正地了解线程块的分配,接下来我们写一个简短的内核程序来输出线程块、线程、线程束和线程全局标号到屏幕上。现在,除非你使用的是 3.2 版本以上的 SDK否则内核中是不支持 printf的。因此,我们可以将数据传送回 CPU 端然后输出到控制台窗口,内核的代码如下:


#include "cuda_runtime.h"
#include "device_launch_parameters.h"#include <stdio.h>
#include <stdlib.h>
#include <conio.h>__global__ void what_is_my_id(unsigned int* const block,unsigned int* const thread,unsigned int* const warp,unsigned int* const calc_thread) {/* Thread id is block index * block size + thread offset into the block */const unsigned int thread_idx = (blockIdx.x * blockDim.x) + threadIdx.x;block[thread_idx] = blockIdx.x; thread[thread_idx] = threadIdx.x;/* Calculate warp using buit in variable warpSize */warp[thread_idx] = threadIdx.x / warpSize;calc_thread[thread_idx] = thread_idx;
}#define ARRAY_SIZE 128
#define ARRAY_SIZE_IN_BYTES (sizeof(unsigned int)* (ARRAY_SIZE))/* Declare statically four arrays of ARRAY_SIZE each */
unsigned int cpu_block[ARRAY_SIZE];
unsigned int cpu_thread[ARRAY_SIZE];
unsigned int cpu_warp[ARRAY_SIZE];
unsigned int cpu_calc_thread[ARRAY_SIZE];int main(void) {/* Total thread count =2*64=128 */const unsigned int num_blocks = 2;const unsigned int num_threads = 64;char ch;/* Declare pointers for GPU based params */unsigned int* gpu_block;unsigned int* gpu_thread;unsigned int* gpu_warp;unsigned int* gpu_calc_thread;/* Declare loop counter for use later */unsigned int i;/* Allocate four arrays on the GPU */cudaMalloc((void**)&gpu_block, ARRAY_SIZE_IN_BYTES);cudaMalloc((void**)&gpu_thread, ARRAY_SIZE_IN_BYTES);cudaMalloc((void**)&gpu_warp, ARRAY_SIZE_IN_BYTES);cudaMalloc((void**)&gpu_calc_thread, ARRAY_SIZE_IN_BYTES);/* Execute our kerne] */what_is_my_id <<<num_blocks, num_threads>>>(gpu_block, gpu_thread, gpu_warp, gpu_calc_thread);/* Copy back the gpu results to the CPU */cudaMemcpy(cpu_block, gpu_block, ARRAY_SIZE_IN_BYTES, cudaMemcpyDeviceToHost);cudaMemcpy(cpu_thread, gpu_thread, ARRAY_SIZE_IN_BYTES, cudaMemcpyDeviceToHost);cudaMemcpy(cpu_warp, gpu_warp, ARRAY_SIZE_IN_BYTES, cudaMemcpyDeviceToHost);cudaMemcpy(cpu_calc_thread, gpu_calc_thread, ARRAY_SIZE_IN_BYTES, cudaMemcpyDeviceToHost);/* Free the arrays on the GPU as now we're done with them */cudaFree(gpu_block);cudaFree(gpu_thread);cudaFree(gpu_warp);cudaFree(gpu_calc_thread);/* Iterate through the arrays and print */for (i = 0; i < ARRAY_SIZE; i++) {printf("Calculated Thread: %3u - Block:%2u - Warp %2u - Thread %3u\n", cpu_calc_thread[i], cpu_block[i], cpu_warp[i], cpu_thread[i]);}ch = getch();
}

        在这个例子中,我们可以看到线程块按照线程块的编号紧密相连。由于处理的是一维数组,所以我们对线程块采用相同的布局便可简单解决问题。以下是此程序的输出结果:

                  

        正如我们计算的那样,线程索引是0~ 127。一共有两个线块,每个线程块包含 64个线程,每个线程块内部线程的索引为0~63。一个线程块包含两个线束。

http://www.yayakq.cn/news/954509/

相关文章:

  • 书画院网站建设三水区网站建设
  • 简单网站开发实例总结网站建设与维护招聘
  • 公司网站制作教程郑州网站建设白杨网络
  • 建设网站需要懂什么产品宣传册模板
  • 自己怎么做网站啊人脉推广app
  • 黄埭网站建设产业互联网平台
  • 建设银行网站201308网站设计的评估
  • 网站维护更新费用做服装哪个网站图片多
  • 搭建购物网站永久免费网站怎么建
  • 云购网站开发建设部网站退休注册人员
  • 郴州市建设局网站专业网站建设微信官网开发
  • 湘潭网站建设 技精磐石网络付网站建设费用计入科目
  • 韩国设计网站推荐福州网站建设策划方案
  • 自己电脑怎么做网站百度推广一天烧几千
  • 网站开发的上市公司有哪些中企动力这个公司怎么样
  • 项目工程监理公司网站建设方案WordPress国外音乐播放器
  • 网站正在建设中页面的英文网站后台怎么上传文章
  • 企业网站 多网站推广杭州网站设计公司推荐
  • 休闲旅游产品营销网站的建设策略如何注册一个网站
  • 自助建站信息网asp.net+mvc+网站开发
  • 网站建设设计网站建设的服务器
  • 品牌网站建设服务商lnmp wordpress ftp
  • 无锡快速建设网站方法嘉兴网站系统总部
  • 自己做网站给自己淘宝引流大型网站开发 书籍
  • 中创高科官方网站关键词优化的技巧
  • 个人怎么做购物网站优化绿松石是什么意思
  • 九江建网站多少钱网站设计 评价 方法
  • 网站建设程序招聘国外特效网站
  • 网站下拉框怎么做四川成都网站制作公司
  • 做平面设计都在那个网站找免费素材编程外包平台