cuda 1

mayflowers posted @ 2010年11月19日 06:04 in cuda with tags cuda linux GPU , 1914 阅读

第一个cuda例子: 

注意:cuda 是对 C 的扩展,所以要用标准的 C 函数库。而我安装好后就兴冲冲地

#include <iostream>

cout<<"hello, word!";

结果编译不过,找了半天才反应过来。

#include <cuda.h>
#include <stdio.h>
#include <string.h>
#include <cutil.h>

int main(int argc, char** argv)
{
 int deviceCount;
 CUDA_SAFE_CALL(cudaGetDeviceCount(&deviceCount));
 if(deviceCount==0){
 printf("There is no device supporting CUDA\n");
 }
 else{
 int dev;
 for(dev=0;dev<deviceCount;++dev){
 cudaDeviceProp deviceProp;
 CUDA_SAFE_CALL(cudaGetDeviceProperties(&deviceProp,dev));
 printf("\nDevice %d:\"%s\"\n",dev,deviceProp.name);
 printf(" Revision:\t\t%d.%d\n", deviceProp.major,deviceProp.minor);
 printf(" Memory:\t\t %u M\n",deviceProp.totalGlobalMem/(1024*1024));
 printf(" SMs:\t\t %d\n",deviceProp.multiProcessorCount);
 printf(" SPs:\t\t %d\n",8*deviceProp.multiProcessorCount);
 printf(" Clock rate:\t\t %.2f GHz\n", deviceProp.clockRate*1e-6f);
 printf(" Threads:\t\t%d\n",deviceProp.maxThreadsPerBlock);
 printf(" Block Dim:\t\t%d X%dX%d\n",deviceProp.maxThreadsDim[0],deviceProp.maxThreadsDim[1],deviceProp.maxThreadsDim[2]);
 printf(" Grid Dim:\t\t%d X%dX%d\n",deviceProp.maxGridSize[0],deviceProp.maxGridSize[1],deviceProp.maxGridSize[2]);
 }
 }
 system("pause");
 return 0;
}

 

There are 1 devices supporting CUDA

Device 0:"GeForce GT 220"
  Revision:    1.2
  Memory:      986 M
  SMs:         6
  SPs:         48
  Clock rate:  1.34 GHz
  Threads:     512
  Block Dim:   512x512x64
  Grid Dim:    65535x65535x1
请按任意键继续. . .

 

NSEIT Payment Reques 说:
2022年8月08日 00:28

The Insurance Institute of India is a very well known Institution that has two branches in India. It considered as one of the finest educational institutes when it comes to learning about Insurance. If you are a student from NSE IT then you might already know that the payment can also made online now. This guide will help you through the same process to make hassle free online payment. NSEIT Payment Request In this article we will help you understand about the process through which you can make NSEIT exam payment easily from online. You can follow this method to either book your exam slots or else you can also book your batch accordingly if required.

UBSE 12th Model Pape 说:
2022年8月16日 21:06

Every year the UK Board Intermediate 1st and 2nd year final Examination tests will be held in between March to April months with New Syllabus as per Boar Provided Text Books for Regular and Private Students.

TNDGE Model Paper Cl 说:
2022年8月20日 15:36

Tamilnadu Board Model Paper 2023 Class 5 Pdf Download with Answers for Tamil Medium, English Medium, Hindi Medium, Urdu Medium & Students for Small Answers, Long Answer, Very Long Answer Questions, and Essay Type Questions to Term1 & Term2 Exams at official website. TNDGE Model Paper Class 5 New Exam Scheme or Question Pattern for Sammittive Assignment Exams (SA1 & SA2): Very Long Answer (VLA), Long Answer (LA), Small Answer (SA), Very Small Answer (VSA), Single Answer, Multiple Choice and etc.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter