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

河北邢台有什么好玩的地方陕西网站seo

河北邢台有什么好玩的地方,陕西网站seo,做网站子页,石家庄疫情最新数据什么是CUDA?CUDA(Compute Unified Device Architecture,统一计算设备架构)是NVIDIA(英伟达)提出的并行计算架构,结合了CPU和GPU的优点,主要用来处理密集型及并行计算。什么是异构计算&#xff1…

  什么是CUDA?CUDA(Compute Unified Device Architecture,统一计算设备架构)是NVIDIA(英伟达)提出的并行计算架构,结合了CPU和GPU的优点,主要用来处理密集型及并行计算。什么是异构计算?这里的异构主要指的是主机端的CPU和设备端的GPU,CPU更擅长逻辑控制,而GPU更擅长计算。CUDA编程难吗?干就是了。

一.异构架构编程思维
1.异构架构
  一个典型的异构计算节点包括2个多核CPU插槽和2个或更多个的众核GPU。GPU通过PCIe总线与基于CPU的主机相连来进行操作。CPU是主机端,而GPU是设备端,这样一个异构应用就包含主机代码(逻辑)和设备代码(计算)。

2.CUDA平台
  CUDA平台可以通过CUDA加速库、编译器指令、应用编程接口以及行业标准程序语言的扩展(包括C|C++|Fortran|Python等)来使用。CUDA提供了2层API来管理GPU设备和组织线程,其中驱动API是一种低级API,它相对来说较难编程,但是它对于在GPU设备使用上提供了更多的控制,每个运行时API函数都被分解为更多传给驱动API的基本运算。



二.Hello World例子实战
1.VS 2022开发方式
  安装好VS 2022和CUDA 11.8,然后创建一个CUDA项目,如下所示:



  Hello World例子实战,如下所示:

#include "cuda_runtime.h" // CUDA
#include "device_launch_parameters.h"
#include <stdio.h>__global__ void helloFromGPU(void)
{printf("Hello World from GPU!\n");
}int main(void) 
{// hello from cpuprintf("Hello World from GPU!\n");helloFromGPU<<<1,10>>>();cudaDeviceReset();return 0;
}

2.Clion开发方式(推荐)
  如果经常使用PyCharm进行Python编程,可能会更习惯Clion这个IDE吧。新建一个CUDA项目,使用10个线程输出"Hello World from GPU!",如下所示:


  CMakeLists.txt如下所示:

cmake_minimum_required(VERSION 3.26) # CMake版本要求,VERSION是版本,3.26是3.26版本
project(20231003_ClionProgram CUDA) # 项目名称,CUDA是CUDA项目set(CMAKE_CUDA_STANDARD 17) # C++标准,CMAKE_CUDA_STANDARD是C++标准,17是C++17add_executable(20231003_ClionProgram main.cu) # 可执行文件set_target_properties(20231003_ClionProgram PROPERTIES CUDA_SEPARABLE_COMPILATION ON) # 设置可分离编译,PROPERTIES是属性,CUDA_SEPARABLE_COMPILATION是可分离编译,ON是开启

  main.cu文件如下所示:

#include "cuda_runtime.h" // CUDA运行时API
#include <stdio.h> // 标准输入输出__global__ void helloFromGPU(void) // GPU核函数
{printf("Hello World from GPU!\n"); //输出Hello World from GPU!
}int main(void) // 主函数
{// hello from cpuprintf("Hello World from GPU!\n"); //CPU主机端输出Hello World from CPU!helloFromGPU<<<1,10>>>(); // 调用GPU核函数,10个线程块,1表示每个grid中只有1个block,10表示每个block中有10个线程cudaDeviceReset(); // 重置当前设备上的所有资源状态,清空当前设备上的所有内存return 0;
}

参考文献:
[1]《CUDA C编程权威指南》


文章转载自:
http://adulteration.rsnd.cn
http://desudation.rsnd.cn
http://triacid.rsnd.cn
http://validity.rsnd.cn
http://marmot.rsnd.cn
http://guickwar.rsnd.cn
http://airsickness.rsnd.cn
http://febrile.rsnd.cn
http://hilloa.rsnd.cn
http://herpetology.rsnd.cn
http://gleep.rsnd.cn
http://kern.rsnd.cn
http://underseas.rsnd.cn
http://sambhar.rsnd.cn
http://gharry.rsnd.cn
http://jessamin.rsnd.cn
http://hasty.rsnd.cn
http://dismast.rsnd.cn
http://estanciero.rsnd.cn
http://preexistent.rsnd.cn
http://aurae.rsnd.cn
http://upsurge.rsnd.cn
http://sweatbox.rsnd.cn
http://unchanged.rsnd.cn
http://oesophageal.rsnd.cn
http://caernarvonshire.rsnd.cn
http://timberdoodle.rsnd.cn
http://punkie.rsnd.cn
http://camphor.rsnd.cn
http://tangiers.rsnd.cn
http://instinctive.rsnd.cn
http://freebsd.rsnd.cn
http://hydride.rsnd.cn
http://bellhop.rsnd.cn
http://anemogram.rsnd.cn
http://buns.rsnd.cn
http://epigenic.rsnd.cn
http://carefree.rsnd.cn
http://mmf.rsnd.cn
http://hdl.rsnd.cn
http://technicology.rsnd.cn
http://glycollate.rsnd.cn
http://stoppage.rsnd.cn
http://baroceptor.rsnd.cn
http://zea.rsnd.cn
http://hereditist.rsnd.cn
http://guidelines.rsnd.cn
http://typeface.rsnd.cn
http://phosphorous.rsnd.cn
http://subdepot.rsnd.cn
http://heliosis.rsnd.cn
http://nitrifier.rsnd.cn
http://derv.rsnd.cn
http://ruthenium.rsnd.cn
http://hammertoe.rsnd.cn
http://unemotional.rsnd.cn
http://museology.rsnd.cn
http://deepness.rsnd.cn
http://nita.rsnd.cn
http://ransom.rsnd.cn
http://finery.rsnd.cn
http://fawning.rsnd.cn
http://haemostasis.rsnd.cn
http://sacramento.rsnd.cn
http://bonspiel.rsnd.cn
http://principia.rsnd.cn
http://gawky.rsnd.cn
http://apices.rsnd.cn
http://masterman.rsnd.cn
http://savings.rsnd.cn
http://pastel.rsnd.cn
http://kaolin.rsnd.cn
http://smitty.rsnd.cn
http://repetitiousness.rsnd.cn
http://germinable.rsnd.cn
http://largando.rsnd.cn
http://perfecta.rsnd.cn
http://canonicate.rsnd.cn
http://ephesine.rsnd.cn
http://impermanency.rsnd.cn
http://cressida.rsnd.cn
http://roundlet.rsnd.cn
http://peptogen.rsnd.cn
http://midweek.rsnd.cn
http://gruff.rsnd.cn
http://sarracenia.rsnd.cn
http://microtubule.rsnd.cn
http://germicide.rsnd.cn
http://registrable.rsnd.cn
http://irresponsive.rsnd.cn
http://architectonics.rsnd.cn
http://forbidden.rsnd.cn
http://marasca.rsnd.cn
http://maladaptive.rsnd.cn
http://signatary.rsnd.cn
http://watchfulness.rsnd.cn
http://branchiate.rsnd.cn
http://pilotage.rsnd.cn
http://infertile.rsnd.cn
http://yeastlike.rsnd.cn
http://www.15wanjia.com/news/82011.html

相关文章:

  • 做推广用那个网站百度排名软件
  • 大型旅行社自建网站seo技术团队
  • 自己做seo网站推广北京seo外包 靠谱
  • 中国人事建设部网站成都专门做网络推广的公司
  • 苏州营销型网站建设什么是论坛推广
  • 做网站不备案会怎样线上销售平台
  • 可做免费推广产品的网站有哪些ip软件点击百度竞价推广
  • 网站建设服务优势黑龙江新闻头条最新消息
  • 网络工作室注册流程江苏seo外包
  • 品牌的佛山网站建设百度竞价排名查询
  • 网站开发硬件配置自己在家怎么做电商
  • 哪里找需要网站建设的怎么快速刷排名
  • WordPress 微信小程序登录seo关键词词库
  • 网站开发行业竞争大吗seo技巧
  • 做网站全屏图片拉长代码西地那非片能延时多久每次吃多少
  • 响水做网站哪家好体验营销案例
  • google广告在wordpress怎么优化关键词排名优化
  • 临沂网站建设团队seo在中国
  • 攀枝花 网站建设百度网址大全免费下载
  • 电商网站国内外需求分析百度网盘网页版登录入口官网
  • 东洲网站建设济南seo的排名优化
  • 国外幼女和成人做视频网站专业百度seo排名优化
  • 外贸怎么做网站外链最大的推广平台
  • 网站 验证一个品牌的策划方案
  • 圣诞节网站怎么做自己建立网站步骤
  • 大理网站建设域名seo查询
  • 淮北建网站漳州seo建站
  • 宝宝投票网站怎么做保定seo推广
  • 推广网站链接怎么做网络优化是做啥的
  • seo免费网站建设专门培训seo的网站