0_Simple__simplePrintf
在设备代码中使用函数 printf(),没有新的认识。
▶ 源代码
#include <stdio.h>
#include <cuda_runtime.h>
#include "device_launch_parameters.h"
#include <helper_functions.h>
#include <helper_cuda.h> __global__ void testKernel(int val)
{
printf("[%d, %d]:\t\tValue is:%d\n", blockIdx.y*gridDim.x + blockIdx.x, threadIdx.z*blockDim.x*blockDim.y + threadIdx.y*blockDim.x + threadIdx.x, val);
} int main(int argc, char **argv)
{
int devID;
cudaDeviceProp props;
devID = findCudaDevice(argc, (const char **)argv);
cudaGetDevice(&devID);
cudaGetDeviceProperties(&props, devID);
printf("Device %d: \"%s\" with Compute %d.%d capability\n",devID, props.name, props.major, props.minor); dim3 dimGrid(, );
dim3 dimBlock(, , );
testKernel<<<dimGrid, dimBlock>>>();
cudaDeviceSynchronize(); getchar();
return ;
}
▶ 输出结果
GPU Device : "GeForce GTX 1070" with compute capability 6.1 Device : "GeForce GTX 1070" with Compute 6.1 capability
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
[, ] : Value is :
0_Simple__simplePrintf的更多相关文章
随机推荐
- bool dfs 解决单一解问题的优越性
dfs的返回值类型可以是int 或者 void .bool 由void 与 int 作为返回值类型的dfs在得到解之后不能立即返回,即使你加上语句if(key)return;也要在得到解之后一点点返 ...
- hdu1227 dp
题意:在一条路上有 n 个站点,并给定了每个站点的坐标,然后想要在 k 个站点旁边分别各建一个补给站,求所有站点到最近的补给站的距离和的最小值. 是的,毫无疑问,显然是 DP 问题,但是这题怎么递推还 ...
- Spring Boot(5) 集成Hibernate 日志配置
https://blog.csdn.net/ZNG_XP/article/details/78131809 https://blog.csdn.net/u011998835/article/detai ...
- Linux regulator系统
1. 概念:Regulator : 电源芯片, 比如电压转换芯片Consumer : 消费者,使用电源的部件, Regulator是给Consumer供电的machine : 单板,上面焊接有Regu ...
- stenciljs 学习一 web 组件开发
stenciljs 介绍参考官方网站,或者 https://www.cnblogs.com/rongfengliang/p/9706542.html 创建项目 使用脚手架工具 npm init ste ...
- npm bower gulp
npm即nodejs package manager ,是nodeJs的包管理工具,使用前需安装nodeJs(https://www.npmjs.com.cn/getting-started/inst ...
- python安装途中遇到的问题和解决方法
一.setuptools安装错误:RuntimeError: Compression requires the (missing) zlib module 1. 描述 搞了个腾讯云的服务器,闲在手上没 ...
- 从操作系统rm数据文件后,利用句柄与rman恢复的过程。(已验证)
以下操作代码的流程是配的,但是相应的文件名,啥的 必须改动. 故障现象 数据文件被误删除 具体情况 接到反馈说,数据文件data20120512.dbf被误删除,需要恢复 数据库提示 ERROR ...
- meta viewport 理解
移动设备上的浏览器如果不指明 viewport 这个meta,当你从移动设备上浏览网页的时候,它假设(你浏览的是桌面版并且你想看到所有的内容),不只是一个左上角.因此,它会把viewport的宽度设置 ...
- Queque 方法对比和分类
添加类:方法 public boolean add(E e) 增加一个元索 如果队列已满,则抛出一个IIIegaISlabEepeplian异常 bo ...