1.GPU简介及英伟达开发环境配置

前言

This book shows how, by harnessing the power of your computer’s graphics process unit (GPU), you can write high-performance software for a wide rangeof applications.Although originally designed to render computer graphics ona monitor (and still used for this purpose), GPUs are increasingly being calledupon for equally demanding programs in science, engineering, and finance,among other domains.We refer collectively to GPU programs that address problems in nongraphics domains as general-purpose. Happily, although you need to have some experience working in C or C++ to benefit from this book,you need not have any knowledge of computer graphics. None whatsoever! GPU programming simply offers you an opportunity to build-and to build mightily-on your existing programming skills.
To program NVlDlA GPUs to perform general-purpose computing tasks, you will want to know what CUDA is. NVlDlA GPUs are built on what’s known as the CUDA Architecture. You can think of the CUDA Architecture as the scheme by which NVlDlA has built GPUs that can perform both traditional graphics-rendering tasks and general-purpose tasks. To program CUDA GPUs, we will be using a language known as CUDA C. As you will see very early in this book.
CUDA C is essentially C with a handful of extensions to allow programming of massively parallel machines like NVIDIA GPUs.
We’ve geared CUDA by Example toward experienced C or C++ programmers who have enough familiarity with C such that they are comfortable reading and writing code in C. This book builds on your experience with C and intends to serve as an example-driven, “quick-start" guide to using NVIDlA’s CUDA C program-
ming language. By no means do you need to have done large-scale software architecture, to have written a C compiler or an operating system kernel, or to know all the ins and outs of the ANSlC standards. However, we do not spend time reviewing C syntax or common C library routines such as malloc() or memcpy ( ) , so we will assume that you are already reasonably familiar with these topics.
You will encounter some techniques that can be considered general parallel programming paradigms, although this book does not aim to teach general parallel programming techniques. Also, while we will look at nearly every part of the CUDA APl, this book does not serve as an extensive APl reference nor will it go into gory detail about every tool that you can use to help develop your CUDA C software. Consequently, we highly recommend that this book be used in conjunction with NVlDlA’s freely available documentation, in particular the NVIDIA CUDA Programming Guide and the NVIDlA CUDA Best Practices Guide. But don’t stress out about collecting all these documents because we’ll walk you through every-thing you need to do.
Without further ado, the world of programming NVlDlA GPUs with CUDA C awaits!

emmmm,这是这本书的前言,大家应该能看明白吧,我看网上推荐这本书,去网上搜了一下就下单了,然后收到发现是一本原版的,也挺好,可以收藏😂,还写着美刀的定价呢
![请添加图片描述](https://i-blog.csdnimg.cn/direct/8539add7b2934b958b8a7d3db71fc9b1.jpeg
等我看明白了,再用汉语写出来分享给大家

一、WHY CUDA? WHY NOW?

这一章说了一下为什么有了GPU:CPU从单核,为了让它能力更强把单核的时钟频率做到了很高。之后发现,可以不只用一个核,可以多个核一起用,这样就不用每个核的频率都很高。这样还会更省电。
随着时代发展,2D-3D的推进,需要更多的图形处理算力,再加上大型游戏的崛起,就让GPU发展起来了。
前言中也提到现在的GPU(graphics process unit) 不仅负责图形处理,还负责(general-purpose computations)通用计算 – 我们可以通过参数的传递欺骗GPU,让它以为这是在对图像计算。

二、CUDA

2.1 What Is the CUDA Architecture?

Unlike previous generations that partitioned computing resources into vertex and pixel shaders, the CUDA Architecture included a unified shader pipeline,allowing each and every arithmetic logic unit (ALU) on the chip to be marshaled by a program intending to perform general-purpose computations.Because NVIDlA intended this new family of graphics processors to be used for qeneral-
purpose computing, these ALUs were built to comply with lEEE requirements for single-precision floating-point arithmetic and were designed to use an instruction set tailored for general computation rather than specifically for graphics.
Furthermore, the execution units on the GPU were allowed arbitrary read and write access to memory as well as access to a software-managed cache known as shared memory. All of these features of the CUDA Architecture were added in order to create a GPU that would excel at computation in addition to performing well at traditional graphics tasks.

这也不太好翻译,大家意会一下…
Ⅰ.CUDA 架构包含一个统一的着色器流水线,这个流水线使通用计算程序把芯片上每个算术逻辑单元(ALU)组织起来。
Ⅱ.GPU可以读写软件的共享内存
Ⅲ.CUDA架构添加的所有功能都是为了使GPU不仅能执行传统的图形计算,还能高效的执行通用计算。
重要的就这三点吧,我就胡乱给大家翻一下…

2.2 Using the CUDA Architecture

这里说了一下没有CUDA之前,大家都要了解OpenGL或者Direct才能写GPU程序。
NVIDIA专门开发的CUDA C语言后,我们不再需要了解OpenGL或者DirectX图形编程结构,也不需要将通用计算问题伪装为图形计算问题。

Applications of CUDA

介绍了用CUDA实现的系统应用:医学影像,流体力学,环境科学
这都需要大量的算力作为支撑。


这下进入正文…
电脑是英伟达的显卡才可以,这点要注意,不是可不行,如果不是,可以转向入门到放弃🙄

使用CUDA开发应用程序需要配置以下先决条件:
支持CUDA的GPU
NVIDIA显卡驱动程序
标准C编译器
CUDA开发工具包

大家别着急,不是需要下载四个东西

https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local

这个网址下载 CUDA开发工具包,选择电脑的版本,我下载的network的,这个就30M,然后安装了40多分钟。

在这里插入图片描述

然后C编译器的话就下载 Visual Studio
然后点击创建项目,这里就会有了
在这里插入图片描述
创建完毕后,软件会自动生成一段基于GPU编程的代码,运行之后如果能正常出结果,说明你的CUDA安装与系统环境配置没有问题了:
在这里插入图片描述
出现问题MSB3721的话,大家看一下这两篇文章
在这里插入图片描述
https://blog.csdn.net/weixin_45566134/article/details/127266422

https://blog.csdn.net/u012374012/article/details/132038568

我就是把那个环境变量改了,然后重启,就能用了。在网上搜了大半天才解决,最难的就是环境配置了…

总结

大家先把环境配置好,我们就踏上征程!

祝大家:
元旦安康,平安喜乐!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/891381.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

电脑cxcore100.dll丢失怎么办?

电脑运行时常见问题解析:应对DLL文件丢失、文件损坏与系统报错的实用指南 在数字时代,电脑已成为我们工作、学习和娱乐不可或缺的工具。然而,正如任何精密机械都可能遇到故障,电脑在运行过程中也难免会遇到各种问题,如…

HTML——49.header和footer标签

<!DOCTYPE html> <html><head><meta charset"UTF-8"><title>header和footer标签</title></head><body><!--header和footer标签:是html5中新标签--><!--header:定义文档的页眉&#xff0c;通常用来定义可见…

【无线传感网】时间同步技术

文章目录 时间同步模型时钟模型1. 节点本地时钟模型2. 节点逻辑时钟模型 通信模型1. 单向报文传递2. 双向报文交换3. 广播参考报文4. 参数拟合技术 时钟同步的误差来源 时间同步协议时钟同步的类别1. 时钟速率同步与偏移同步2. 同步期限&#xff1a;长期同步与按需同步3. 同步范…

C# 实用工具分享(1)

大家好&#xff0c;今天分享一些在开发过程中比较实用的工具。 首先在软件开发的过程中不可避免的要使用截图这样的功能&#xff0c;以前这样的功能我自己也是选择开发出新功能。但是自己开发还是非常费时费力的&#xff0c;并且效果也不一定特别好。 于是我找到了一个现成的…

积分图(Integral Image)与均值滤波的快速实现

积分图&#xff08;Integral Image&#xff09;也称为求和图&#xff08;Summed Area Table&#xff09;&#xff0c;是一种用于快速计算图像中任意矩形区域像素值总和的技术。 基本概念 积分图的每个位置(i, j)存储的是从图像左上角(1, 1)到当前位置(i, j)所有像素值的累积和…

curl+openssl 踩坑笔记

curl编译&#xff1a;点击跳转 踩坑一 * SSL certificate problem: unable to get local issuer certificate * closing connection #0 curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.se/docs/sslcerts.html …

[AI] 深度学习的“黑箱”探索:从解释性到透明性

目录 1. 深度学习的“黑箱”问题&#xff1a;何为不可解释&#xff1f; 1.1 为什么“黑箱”问题存在&#xff1f; 2. 可解释性研究的现状 2.1 模型解释的方法 2.1.1 后置可解释性方法&#xff08;Post-hoc Explanations&#xff09; 2.1.2 内在可解释性方法&#xff08;I…

C++STL中vector的介绍与使用

在C STL中&#xff0c;vector 是一个非常重要的容器&#xff0c;它提供了动态数组的功能。以下是 vector 头文件中的一些常用函数及其使用方法和细节&#xff0c;以及在算法竞赛中的使用细节和总结&#xff1a; 1. 构造、析构、赋值 构造函数 (std::vector::vector): 可以无参…

python-Flask:SQLite数据库路径不正确但是成功访问到了数据库,并对表进行了操作

出现了这个问题&#xff0c;就好像是我要去找在南方的人&#xff0c;然后我刚好不分南北&#xff0c;我认为的方向错了&#xff0c;实则方向对了。 在我针对复盘解决&#xff1a;sqlite3.OperationalError: unrecognized token: “{“-CSDN博客这个内容的时候&#xff0c;又出现…

对称密码算法(分组密码算法 序列密码算法 密码杂凑算法)中的基本操作

对称密码算法(分组密码算法 序列密码算法 密码杂凑算法)中的基本操作 相比非对称加密算法&#xff0c;对称加密算法因为加解密效率较高&#xff0c;因而在日常使用中更加广泛。为了让大家更加熟悉常见的对称加密算法&#xff0c;本文列举出了对称密码算法设计中经常用到的13种基…

大数据治理,数字化转型运营平台建设方案(PPT完整版)

1、大数据治理整体运营思路 2、数据资产定义及流程规范 3、治理规范及质量管控 4、质量考核标准及提升方案 软件全套资料部分文档清单&#xff1a; 工作安排任务书&#xff0c;可行性分析报告&#xff0c;立项申请审批表&#xff0c;产品需求规格说明书&#xff0c;需求调研计划…

专题十四——BFS

目录 一BFS解决FloodFill算法 1图像渲染 2岛屿数量 3岛屿的最大面积 4被环绕的区域 二BFS解决蛋源最短路径问题 1迷宫中离入口最近的出口 2最小基因变化 3单词接龙 4为高尔夫比赛砍树 三BFS解决多源最短路径问题 1 01矩阵 2飞地的数量 3地图中的最高点 4地图分…

DMDRS部署:搭建DM8-DM8数据同步

一、部署要求 1.1 硬件要求 DMDRS服务描述源DMDRS 内存要求至少2GB的内存空间。推荐配置4GB及以上的内存空间。 源DMDRS对内存空间的需求主要与装载的并发数相关。当内存空间配置低于2GB时&#xff0c;可以调整装载的线程数来降低源DMDRS对内存空间的需求。 磁盘要求至少10GB…

latex与word优缺点对比

老金之前一直以为LaTeX只是写公式用的&#xff0c;没想到这玩艺原来是个像word一样的文档处理工具&#xff0c;好奇心驱使下&#xff0c;查了一下与word的优缺点对比。 LaTeX的优点 排版质量高&#xff1a;擅长复杂排版&#xff0c;专业而美观&#xff0c;尤其对数学公式支持…

仓颉笔记——windows11安装启用cangjie语言,并使用vscode编写“你好,世界”

2025年1月1日第一篇日记&#xff0c;大家新年好。 去年就大致看了一下&#xff0c;感觉还不错&#xff0c;但一直没上手&#xff0c;这次借着元旦的晚上安装了一下&#xff0c;今年正式开动&#xff0c;公司众多的应用国产化正等着~~ 第一步&#xff1a;准备 官网&#xff1a;…

自动化办公 | 根据成绩进行自动评级

今天我们将介绍一个常见的自动化办公需求&#xff1a;根据成绩自动评级。通过这篇文章&#xff0c;我们将介绍如何利用Python进行自动化办公&#xff0c;将表格中的成绩根据预定的规则进行评级&#xff0c;并生成一个新的带评级信息的表格。 需求背景 我们有一个表格&#xf…

datalist的作用?怎么用的?

在 HTML 中&#xff0c;<datalist> 元素用于为 <input> 元素提供一个可选项列表&#xff0c;帮助用户通过预定义的选项进行快速选择。它是一个增强输入体验的功能&#xff0c;类似于自动完成&#xff08;autocomplete&#xff09;&#xff0c;但与传统的 <selec…

Cocos2dx Lua绑定生成中间文件时参数类型与源码类型不匹配

这两天维护的一个项目&#xff0c;使用arm64-v8a指令集编译时遇到了报错&#xff0c;提示类型不匹配&#xff0c;具体报错的代码【脚本根据C源文件生成的中间文件】如下&#xff1a; const google::protobuf::RepeatedField<unsigned long long>& ret cobj->equi…

1、ELK的架构和安装

ELK简介 elk&#xff1a;elasticsearch logstash kibana&#xff0c;统一日志收集系统。 elasticsearch&#xff1a;分布式的全文索引引擎的非关系数据库&#xff0c;json格式&#xff0c;在elk中存储所有的日志信息&#xff0c;架构有主和从&#xff0c;最少需要2台。 …

17000.机器学习-数字1-9实例

文章目录 1 搭建环境1.1 下载 libtorch c 版本1.2 下载数字数据集1.3 目录结构 2 源码目录2.1 CMakeLists.txt文件2.2 训练集主程序 main.cpp2.2 dataset.h2.3 model.cpp2.4 识别主程序 3 运行结果3.1 训练集程序运行3.2 识别程序 1 搭建环境 1.1 下载 libtorch c 版本 由于我…