windows安装cuda的方法

合集下载

第一课:CUDA的安装配置(Win8.164位NVIDIAGT705VS2012)

第一课:CUDA的安装配置(Win8.164位NVIDIAGT705VS2012)

第一课:CUDA的安装配置(Win8.164位NVIDIAGT705VS2012)捣鼓了一天,终于把环境搭建好了,测试代码也运行成功。

期间遇到了一些问题,甚至觉得是操作系统的问题,想着要不要换个操作系统。

吃中饭的时候,认真思考了一下,觉得不能半途而废,win8.1肯定是没问题的,事实证明我是对的。

下面是配置的详细步骤:step 1:首先当然是要有Visual Studio啦如果你是学生,可以到Microsoft DreamSpark的官网下载,完全免费。

step 2:根据操作系统的类型下载最新版本的CUDA(现在是CUDA 7),网址是:/cuda-downloads。

如果你注册了CUDA社区的账号还可以下载先行版呢。

step 3:下载完了当然是安装啦,安装步骤就不用说了吧。

选择自己喜欢的目录然后安装吧。

step 4:安装完毕后,可以看到系统中多了CUDA_PATH和CUDA_PATH_V6_0两个环境变量,接下来,还要在系统中添加以下几个环境变量:CUDA_SDK_PATH = C:\ProgramData\NVIDIA Corporation\CUDA Samples\v7.0CUDA_LIB_PATH = %CUDA_PATH%\lib 64CUDA_BIN_PATH = %CUDA_PATH%\binCUDA_SDK_BIN_PATH = %CUDA_SDK_PATH%\bin\win64CUDA_SDK_LIB_PATH = %CUDA_SDK_PATH%\common\lib 64然后,在系统变量PATH的末尾添加:;%CUDA_LIB_PATH%;%CUDA_BIN_PATH%;%CUDA_SDK_LIB_ PATH%;%CUDA_SDK_BIN_PATH%;step 5:重启计算机使环境变量生效step 6:打开VS2012建立一个空的Win32控制台项目step 7:右键点击源文件 => 添加 => 新建项,然后选择NVIDIA CUDA 7.0 => Code => CUDA C/C++ Filestep 8:右键项目=> 生成自定义,在弹出的对话框中勾选“ CUDA 7.0 xxx” 选项。

CUDA2[1].3、3.2、4.0安装总结

CUDA2[1].3、3.2、4.0安装总结

tllovejf1 2011\9\25Windows平台配置CUDA编译环境一、CUDA2.3(CUDA2.3具有Emudebug调试功能)(注:CUDA3.2配置同2.3一样)安装步骤:1.平台:Windows7 SP1 旗舰版X64+VS2008SP1;2.安装VS2008时,选择自定义,勾选X64编译器(很重要);3.根据自己的显卡,依次安装CUDA drivers,cudatoolkit_2.3_win_64,cudasdk_2.3_win_64;(路径默认就行,中间过程都选完全安装)下载地址:/cuda-toolkit-23-downloads4.运行CUDA_VS_Wizard_W64.2.2;5.在系统环境变量,PATH环境变量最后添加“Debug;EmuDebug;Release;EmuRelease”的路径(很重要)。

例如CUDASDK按默认路径安装则添加:C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\bin\win64\Debug;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\bin\win64\EmuDebug;C:\ProgramData\NVIDIACorporation\NVIDIAGPU Computing SDK\C\bin\win64\EmuRelease;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\bin\win64\Release;6.测试例子:新建项目->cuda64->sample.cu;7.高亮配置:(1)打开VS, 选择:工具->选项->项目与解决方案->VC++项目设置,在“C/C++文件扩展名”后添加*.cu,在“包括的扩展名”后添加.cu;(2)打开Visual AssistantX设置,在Projects->C/C++ Directories 里,Platform选择Custom,Show Directories for选择Stable include files,添加CUDA Toolkit的include目录路径;注意:如果高亮还有问题可以再添加:CUDA Toolkit的lib64,bin64,common\inc等目录路径。

Windows搭建CUDA开发环境

Windows搭建CUDA开发环境

Windows搭建CUDA开发环境CUDA(Compute Unified Device Architecture,统⼀计算架构)是由英伟达所推出的⼀种集成技术,向⽤户提供了可以很优雅地调⽤GPU进⾏并⾏计算的编程接⼝。

然⽽对于很多刚接触这门技术的⼈来说,怎么把⼀个简单的cuda程序跑起来却也是⼀个“说⼤不⼤,说⼩不⼩”的问题。

我⼤致整理出了在Windows上搭建cuda开发环境的⽅案,勉勉强强可以被当作⼀份参考。

此处我的⽬标主要为:完成对简单CUDA C程序的编译和运⾏。

当然,要搭建⼀个真实的cuda开发环境,得先确保⾃⼰电脑是⽀持cuda的。

(安装了英伟达显卡的应该都没问题)命令⾏编译⾸先去英伟达官⽹下载⼀个,然后安装上。

安装完成后,试试nvcc -V查看是否是否能正常使⽤nvcc,如果不能的话,去环境变量中检查⼀下类似C:\Program Files\NVIDIA GPUComputing Toolkit\CUDA\v11.1\bin\这样的值有没有被加到Path⾥,如果没有的话记得⼿动加⼀下(记得使⽤⾃⼰的真实的CUDA⼯具包的安装位置,不要直接复制我这⾥的)。

添加完成后记得要重新打开⼀个cmd或shell才能正常加载。

创建⼀个cuda程序hello.cu,参考程序附于⽂末;在当前⽬录使⽤nvcc -o hello hello.cu进⾏编译,如果⼀切正常,这个⽬录中将出现hello.exe, hello.exp, hello.lib这⼏个⽂件。

但通常来说,这⾥会出现找不到cl的情况。

如果没有安装Visual Studio的话,先安装⼀个找到cl.exe的位置,并将该⽬录加⼊到环境变量Path中,我这⾥给出⼀个参考:D:\Program Files (x86)\Microsoft VisualStudio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64使⽤Visual Studio⾸先如果没有安装VC的话当然是需要先安装⼀个,⾄于安装的时候具体要选哪些模块,我现在也还不是很清楚,也没来得及去验证。

CUDA4.0 X32 + Windows7 32bit + Visual Studio2008+ Visual Assist安装指南

CUDA4.0 X32 + Windows7 32bit + Visual Studio2008+ Visual Assist安装指南

CUDA4.0 X32 + Windows7 32bit + Visual Studio2008+ Visual Assist安装指南1,需要安装的软件:CUDA Toolkit4.0 + GPUComputing SDK + CUDA Wizard + +对应的显卡驱动+ Visual Assist破解版+ VS2008下载地址:/cuda-toolkit-402,先安装显卡,得确保显卡支持CUDA加速。

查询是否支持可看此网站:/cuda-gpus3,再安装Toolkit4.0和SDK,最好选择默认。

在Win7环境下,Toolkit4.0安装后文件路径为:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2SDK默认安装文件路径为:C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0,注意:ProgramData Win7为隐藏文件,XP系统下默认安装路径为C:\Documents and Settings\All Users\ApplicationData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.04,C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\src该目录下,为SDK所带的demo程序,有VS2005、VS2008和VS2010三个版本。

5,安装CUDAWizard,下载地址:/projects/cudavswizard/安装后,重新打开VS2008,此时【新建项目类型】多了【CUDA】一项,此时可以新建CUDA C程序了。

但此时肯定编译通不过,缺少必要的环境变量设置。

6,Ctrl+R,输入cmd,进入命令提示窗口输入setcuda,看是否出现以CUDA开头的环境变量,如果没有,说明SDK安装不正确,重新安装之后,在环境变量中设置【用户变量】中的【path】,添加上C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\bin\win32\Debug和C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\bin\win32\Release7,打开VS2008,【工具】-【选项】-【项目和解决方案】-【VC++目录】-【包含文件】添加上C:\ProgramFiles\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include、和C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\common\inc【库文件】添加上C:\ProgramFiles\NVIDIA GPU Computing Toolkit\CUDA\v4.0\lib和C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\common\lib【源文件】添加上C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\common\src8,【工具】-【选项】-【项目和解决方案】-【VC++项目设置】-【C/C++文件扩展名】添加上*.cu【包括的扩展名】添加上.cuh【规则文件搜索路径】C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\common9,产生一些必须的库文件打开文件夹C:\ProgramData\NVIDIACorporation\NVIDIA GPU Computing SDK 4.0\C\common用VS打开Release_vs2008.sln(包含有cutil_vs2008和rendercheckgl_vs2008项目),选择【生成】-【批生成】,选择【Debug|Win32】和【Release|Win32】,点击【生成】,即可生成一些必须的库文件。

Win10下安装CUDA11.0...

Win10下安装CUDA11.0...

Win10下安装CUDA11.0...⽬录下载地址安装CUDA配置环境变量安装CUDNN验证CUDA是否安装成功安装tesorflow-gpu2.4.1安装pytorch-gpu1.7.0安装paddlepaddle-gpu2.0.0下载地址官⽅下载:和.安装之前,建议关掉360安全卫⼠双击cuda_11.0.3_451.82_win10.exe⽂件根据⾃⼰需要更改安装路径将Visual Studio Integration的勾去掉配置环境变量C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\libnvvp;安装CUDNN将下载的CUDNN解压缩,如下图。

将将CUDNN⽂件夹⾥⾯的bin、include、lib⽂件直接复制到CUDA的安装⽬录,如下图为CUDA的安装位置,粘贴过来直接覆盖即可。

# CUDA的安装⽬录C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0等待复制完成,即可!验证CUDA是否安装成功打开cmd,输⼊如下命令,即可!nvcc -V安装tesorflow-gpu2.4.1查看对应版本pip install -i https:///simple tensorflow-gpu==2.4.1测试代码import tensorflow as tfimport osos.environ['TF_CPP_MIN_LOG_LEVEL']='2'print(tf.__version__)a = tf.constant(1.)b = tf.constant(2.)print(a+b)print('GPU:', tf.test.is_gpu_available())安装pytorch-gpu1.7.0查看对应版本pip install torch===1.7.0+cu110 torchvision===0.8.1+cu110 torchaudio===0.7.0 -f https:///whl/torch_stable.html测试代码import torchprint(torch.__version__)print(torch.cuda.is_available())安装paddlepaddle-gpu2.0.0查看对应版本python -m pip install paddlepaddle-gpu==2.0.0.post110 -f https:///whl/stable.html测试代码import paddlepaddle.utils.run_check()到此这篇关于Win10下安装CUDA11.0+CUDNN8.0+tensorflow-gpu2.4.1+pytorch1.7.0+paddlepaddle-gpu2.0.0的⽂章就介绍到这了,更多相关tensorflow pytorch CUDA 安装内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!。

windows10安装cuda10.1+pytorch1.4

windows10安装cuda10.1+pytorch1.4

windows10安装cuda10.1+pytorch1.4windows10 版本号:1909 操作系统版本:18363.7780x1 确定 nvidia 显卡驱动的版本是否满⾜安装条件1. 打开 nvidia 控制⾯板,看到我的显卡为 GTX1060 驱动版本为445.752. 进⼊,查看 CUDA 版本与 nvidia 显卡驱动版本之间的关系我们要安装的是 CUDA10.1,可以看到在 64 位 Windows 下 nvidia 显卡驱动版本⼤于418.96即可安装。

0x2 下载CUDA与cuDNNCUDA是⼀种由NVIDIA推出的通⽤并⾏计算架构,cuDNN是⽤于深度神经⽹络的GPU加速库。

要能够运⾏gpu版本的tensorflow和pytorch 等框架,需要同时安装这两个模块。

1. 下载CUDA10.1进⼊,下载windows10版本的exe(local),点击直接下载2. 添加环境变量C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64安装完重启电脑,验证cuda是否安装成功$ nvcc -V3. 下载CUDA对应的cuDNN进⼊,需要登录,没有账号的注册⼀个即可,点击直接下载4. 将cuDNN下载得到的三个⽂件夹⾥的⽂件复制到CUDA对应的三个⽂件夹⾥打开环境变量查看CUDA的安装⽬录打开C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1,依次复制⽂件夹⾥⾯的⽂件到对应的⽂件夹。

(注意是把⾥⾯的⽂件复制过去,分别为cudnn.lib、cudnn.h、cudnn64_7.dll检验cudnn是不是安装成功(不要把命令中引号删了,下同)$ "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\demo_suite\deviceQuery.exe"看到PASS$ "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\demo_suite\bandwidthTest.exe"看到PASS,则cuDNN安装成功0x3 安装anaconda去下载anaconda windows 64位版本,点击直接下载0x4 安装pytorch1.4 与torchvision1. 创建conda环境$ conda create -n myenv python==3.6.5这个表⽰安装⼀个名字为myenv的环境,并同时安装python版本为3.6.5不要使⽤python3.6.0版本,⾎的教训,安装pytorch后会报找不到dll模块的错误。

cuda编程在windows下的几种安装方法

在windows下安装cuda硬件环境:cuda支持目前NV的市面上的绝大多数显卡,包括Tesla、Quadro、GeForce,只有少数早期的旧型号显卡不支持cuda。

详见/object/cuda_learn_products_cn.html软件环境:cuda可以在Windows(32/64)、Mac OS、Linux(32/64)中的大多数版本中安装。

在windows下,目前cuda只支持在 Visual Studio 7.x 系列、Visual Studio 8以及免费的 Visual Studio C++ 2005 Express。

所以需要预先安装以上软件中的任意一种。

下面我们以Visual Studio 2005 为例演示cuda的安装。

1、cuda安装包cuda是免费使用的,各种操作系统下的cuda安装包均可以在/object/cuda_get_cn.html上免费下载。

Cuda提供3个安装包,分别是:SDK, Toolkit和Display。

SDK包括许多例子程序和函数库。

Toolkit包括cuda的基本工具。

Display包括了NV显卡的驱动程序。

Toolkit是核心。

2、安装cuda2.1 安装cuda toolkit双击NVIDIA_CUDA_toolkit_2.0_win32.exe安装,安装完成后在安装目录下出现6个文件夹,分别是:Bin :工具程序和动态链接库Doc :相关文档Include : header头文件包Lib :静态库Open64 :基于open64的cuda compilerSrc :部分原始代码安装过程中toolkit自动设定了3个环境变量:CUDA_BIN_PATH、CUDA_INC_PATH和CUDA_LIB_PATH分别对应工具程序库、头文件库和程序库,预设路径为当前安装文件夹下的bin、include 和lib三个文件夹。

并将bin文件夹目录加入环境变量path中。

NVIDIA CUDA软件安装指南 for Microsoft Windows说明书

DU-05349-001_v10.1 | April 2019Installation and Verification on WindowsTABLE OF CONTENTS Chapter 1. Introduction (1)1.1. System Requirements (1)1.1.1. x86 32-bit Support (2)1.2. About This Document (3)Chapter 2. Installing CUDA Development T ools (4)2.1. Verify You Have a CUDA-Capable GPU (4)2.2. Download the NVIDIA CUDA T oolkit (4)2.3. Install the CUDA Software (5)2.3.1. Uninstalling the CUDA Software (8)2.4. Use a Suitable Driver Model (8)2.5. Verify the Installation (9)2.5.1. Running the Compiled Examples (9)Chapter 3. Compiling CUDA Programs (11)3.1. Compiling Sample Projects (11)3.2. Sample Projects (11)3.3. Build Customizations for New Projects (12)3.4. Build Customizations for Existing Projects (12)Chapter 4. Additional Considerations (14)CUDA® is a parallel computing platform and programming model invented by NVIDIA. It enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU).CUDA was developed with several design goals in mind:‣Provide a small set of extensions to standard programming languages, like C, that enable a straightforward implementation of parallel algorithms. With CUDA C/C++, programmers can focus on the task of parallelization of the algorithms rather than spending time on their implementation.‣Support heterogeneous computation where applications use both the CPU and GPU. Serial portions of applications are run on the CPU, and parallel portions are offloaded to the GPU. As such, CUDA can be incrementally applied to existingapplications. The CPU and GPU are treated as separate devices that have their own memory spaces. This configuration also allows simultaneous computation on the CPU and GPU without contention for memory resources.CUDA-capable GPUs have hundreds of cores that can collectively run thousands of computing threads. These cores have shared resources including a register file and a shared memory. The on-chip shared memory allows parallel tasks running on these cores to share data without sending it over the system memory bus.This guide will show you how to install and check the correct operation of the CUDA development tools.1.1. System RequirementsTo use CUDA on your system, you will need the following installed:‣ A CUDA-capable GPU‣ A supported version of Microsoft Windows‣ A supported version of Microsoft Visual Studio‣the NVIDIA CUDA Toolkit (available at /cuda-downloads)The next two tables list the currently supported Windows operating systems and compilers.T able 1 Windows Operating System Support in CUDA 10.1T able 2 Windows Compiler Support in CUDA 10.1x86_32 support is limited. See the x86 32-bit Support section for details.For more information on MSVC versions, Visual Studio product versions, visit https:// dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd.1.1.1. x86 32-bit SupportNative development using the CUDA Toolkit on x86_32 is unsupported. Deployment and execution of CUDA applications on x86_32 is still supported, but is limited to use with GeForce GPUs. To create 32-bit CUDA applications, use the cross-development capabilities of the CUDA Toolkit on x86_64.Support for developing and running x86 32-bit applications on x86_64 Windows is limited to use with:‣GeForce GPUs‣CUDA Driver‣CUDA Runtime (cudart)‣CUDA Math Library (math.h)‣CUDA C++ Compiler (nvcc)‣CUDA Development Tools1.2. About This DocumentThis document is intended for readers familiar with Microsoft Windows operating systems and the Microsoft Visual Studio environment. You do not need previous experience with CUDA or experience with parallel computation.Basic instructions can be found in the Quick Start Guide. Read on for more detailed instructions.The setup of CUDA development tools on a system running the appropriate version of Windows consists of a few simple steps:‣Verify the system has a CUDA-capable GPU.‣Download the NVIDIA CUDA Toolkit.‣Install the NVIDIA CUDA Toolkit.‣Test that the installed software runs correctly and communicates with the hardware.2.1. Verify You Have a CUDA-Capable GPUYou can verify that you have a CUDA-capable GPU through the Display Adapters section in the Windows Device Manager. Here you will find the vendor name and model of your graphics card(s). If you have an NVIDIA card that is listed in http:// /cuda-gpus, that GPU is CUDA-capable. The Release Notes for the CUDA Toolkit also contain a list of supported products.The Windows Device Manager can be opened via the following steps:1.Open a run window from the Start Menu2.Run:control /name Microsoft.DeviceManager2.2. Download the NVIDIA CUDA T oolkitThe NVIDIA CUDA Toolkit is available at /cuda-downloads. Choose the platform you are using and one of the following installer formats:work Installer: A minimal installer which later downloads packages required forinstallation. Only the packages selected during the selection phase of the installerare downloaded. This installer is useful for users who want to minimize download time.2.Full Installer: An installer which contains all the components of the CUDA Toolkitand does not require any further download. This installer is useful for systemswhich lack network access and for enterprise deployment.The CUDA Toolkit installs the CUDA driver and tools needed to create, build and run a CUDA application as well as libraries, header files, CUDA samples source code, and other resources.Download VerificationThe download can be verified by comparing the MD5 checksum posted at http:// /cuda-downloads/checksums with that of the downloadedfile. If either of the checksums differ, the downloaded file is corrupt and needs to be downloaded again.To calculate the MD5 checksum of the downloaded file, follow the instructions at http:// /kb/889768.2.3. Install the CUDA SoftwareBefore installing the toolkit, you should read the Release Notes, as they provide details on installation and software functionality.The driver and toolkit must be installed for CUDA to function. If you have notinstalled a stand-alone driver, install the driver from the NVIDIA CUDA T oolkit.The installation may fail if Windows Update starts after the installation has begun.Wait until Windows Update is complete and then try the installation again. Graphical InstallationInstall the CUDA Software by executing the CUDA installer and following the on-screen prompts.Silent InstallationThe installer can be executed in silent mode by executing the package with the -s flag. Additional parameters can be passed which will install specific subpackages instead of all packages. See the table below for a list of all the subpackage names.T able 3 Possible Subpackage NamesFor example, to install only the compiler and driver components:<PackageName>.exe -s nvcc_10.1 Display.DriverExtracting and Inspecting the Files ManuallySometimes it may be desirable to extract or inspect the installable files directly, such as in enterprise deployment, or to browse the files before installation. The full installation package can be extracted using a decompression tool which supports the LZMA compression method, such as 7-zip or WinZip.Once extracted, the CUDA Toolkit files will be in the CUDAToolkit folder, and similarily for the CUDA Samples and CUDA Visual Studio Integration. Within each directory isa .dll and .nvi file that can be ignored as they are not part of the installable files.Accessing the files in this manner does not set up any environment settings, suchas variables or Visual Studio integration. This is intended for enterprise-leveldeployment.2.3.1. Uninstalling the CUDA SoftwareAll subpackages can be uninstalled through the Windows Control Panel by using the Programs and Features widget.2.4. Use a Suitable Driver ModelOn Windows 7 and later, the operating system provides two driver models under which the NVIDIA Driver may operate:‣The WDDM driver model is used for display devices.‣The Tesla Compute Cluster (TCC) mode of the NVIDIA Driver is available for non-display devices such as NVIDIA Tesla GPUs, and the GeForce GTX Titan GPUs; it uses the Windows WDM driver model.The TCC driver mode provides a number of advantages for CUDA applications on GPUs that support this mode. For example:‣TCC eliminates the timeouts that can occur when running under WDDM due to the Windows Timeout Detection and Recovery mechanism for display devices.‣TCC allows the use of CUDA with Windows Remote Desktop, which is not possible for WDDM devices.‣TCC allows the use of CUDA from within processes running as Windows services, which is not possible for WDDM devices.‣TCC reduces the latency of CUDA kernel launches.TCC is enabled by default on most recent NVIDIA Tesla GPUs. To check which driver mode is in use and/or to switch driver modes, use the nvidia-smi tool that is included with the NVIDIA Driver installation (see nvidia-smi -h for details).Keep in mind that when TCC mode is enabled for a particular GPU, that GPU cannotbe used as a display device.NVIDIA GeForce GPUs (excluding GeForce GTX Titan GPUs) do not support TCC mode.2.5. Verify the InstallationBefore continuing, it is important to verify that the CUDA toolkit can find and communicate correctly with the CUDA-capable hardware. To do this, you need to compile and run some of the included sample programs.2.5.1. Running the Compiled ExamplesThe version of the CUDA Toolkit can be checked by running nvcc -V in a Command Prompt window. You can display a Command Prompt window by going to:Start > All Programs > Accessories > Command PromptCUDA Samples include sample programs in source form. To verify a correct configuration of the hardware and software, it is highly recommended that you build and run the deviceQuery sample program. The sample can be built using the provided VS solution files, and the compiled executable can be located at:C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\bin\win64\ReleaseThis assumes that you used the default installation directory structure. If CUDA is installed and configured correctly, the output should look similar to Figure 1.Figure 1 Valid Results from deviceQuery CUDA SampleThe exact appearance and the output lines might be different on your system. The important outcomes are that a device was found, that the device(s) match what is installed in your system, and that the test passed.If a CUDA-capable device and the CUDA Driver are installed but deviceQuery reports that no CUDA-capable devices are present, ensure the deivce and driver are properly installed.Running the bandwidthTest program, located in the same directory as deviceQuery above, ensures that the system and the CUDA-capable device are able to communicate correctly. The output should resemble Figure 2.Figure 2 Valid Results from bandwidthT est CUDA SampleThe device name (second line) and the bandwidth numbers vary from system to system. The important items are the second line, which confirms a CUDA device was found, and the second-to-last line, which confirms that all necessary tests passed.If the tests do not pass, make sure you do have a CUDA-capable NVIDIA GPU on your system and make sure it is properly installed.To see a graphical representation of what CUDA can do, run the sample Particles executable atC:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\bin\win64\ReleaseThe project files in the CUDA Samples have been designed to provide simple, one-click builds of the programs that include all source code. To build the Windows projects (for release or debug mode), use the provided *.sln solution files for Microsoft Visual Studio 2010, 2012, or 2013. You can use either the solution files located in each of the examples directories inC:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1\<category>\<sample_name> or the global solution files Samples*.sln located inC:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1CUDA Samples are organized according to <category>. Each sample is organized into one of the following folders: (0_Simple, 1_Utilities, 2_Graphics, 3_Imaging, 4_Finance, 5_Simulations, 6_Advanced, 7_CUDALibraries).3.1. Compiling Sample ProjectsThe bandwidthTest project is a good sample project to build and run. It is located in the NVIDIA Corporation\CUDA Samples\v10.1\1_Utilities\bandwidthTest directory.If you elected to use the default installation location, the output is placed in CUDA Samples\v10.1\bin\win64\Release. Build the program using the appropriate solution file and run the executable. If all works correctly, the output should be similar to Figure 2.3.2. Sample ProjectsThe sample projects come in two configurations: debug and release (where release contains no debugging information) and different Visual Studio projects.A few of the example projects require some additional setup. The simpleD3D9 example requires the system to have a Direct3D SDK (June 2010 or later) installed and the Visual C++ directory paths (located in Tools > Options...) properly configured. Consult the Direct3D documentation for additional details.These sample projects also make use of the $CUDA_PATH environment variable to locate where the CUDA Toolkit and the associated .props files are.The environment variable is set automatically using the Build Customization CUDA 10.1.props file, and is installed automatically as part of the CUDA Toolkit installation process.T able 4 CUDA Visual Studio .props locationsYou can reference this CUDA 10.1.props file when building your own CUDA applications.3.3. Build Customizations for New ProjectsWhen creating a new CUDA application, the Visual Studio project file must be configured to include CUDA build customizations. To accomplish this, click File-> New | Project... NVIDIA-> CUDA->, then select a template for your CUDA Toolkit version. For example, selecting the "CUDA 10.1 Runtime" template will configure your project for use with the CUDA 10.1 Toolkit. The new project is technically a C++ project (.vcxproj) that is preconfigured to use NVIDIA's Build Customizations. All standard capabilities of Visual Studio C++ projects will be available.To specify a custom CUDA Toolkit location, under CUDA C/C++, select Common, and set the CUDA Toolkit Custom Dir field as desired. Note that the selected toolkit must match the version of the Build Customizations.3.4. Build Customizations for Existing ProjectsWhen adding CUDA acceleration to existing applications, the relevant Visual Studio project files must be updated to include CUDA build customizations. This can be done using one of the following two methods:1.Open the Visual Studio project, right click on the project name, and select BuildCustomizations..., then select the CUDA Toolkit version you would like to target.2.Alternatively, you can configure your project always to build with the most recentlyinstalled version of the CUDA Toolkit. First add a CUDA build customization to your project as above. Then, right click on the project name and select Properties.Under CUDA C/C++, select Common, and set the CUDA Toolkit Custom Dir fieldto $(CUDA_PATH) . Note that the $(CUDA_PATH) environment variable is set by the installer.While Option 2 will allow your project to automatically use any new CUDA Toolkit version you may install in the future, selecting the toolkit version explicitly as in Option 1 is often better in practice, because if there are new CUDA configuration options added to the build customization rules accompanying the newer toolkit, you would not see those new options using Option 2.If you use the $(CUDA_PATH) environment variable to target a version of the CUDA Toolkit for building, and you perform an installation or uninstallation of any version of the CUDA Toolkit, you should validate that the $(CUDA_PATH) environment variable points to the correct installation directory of the CUDA Toolkit for your purposes. You can access the value of the $(CUDA_PATH) environment variable via the following steps:1.Open a run window from the Start Menu2.Run:control sysdm.cpl3.Select the "Advanced" tab at the top of the window4.Click "Environment Variables" at the bottom of the windowFiles which contain CUDA code must be marked as a CUDA C/C++ file. This can done when adding the file by right clicking the project you wish to add the file to, selecting Add\New Item, selecting NVIDIA CUDA 10.1\Code\CUDA C/C++ File, and then selecting the file you wish to add.Note for advanced users: If you wish to try building your project against a newer CUDA Toolkit without making changes to any of your project files, go to the Visual Studio command prompt, change the current directory to the location of your project, and execute a command such as the following:msbuild <projectname.extension> /t:Rebuild /p:CudaToolkitDir="drive:/path/to/ new/toolkit/"Now that you have CUDA-capable hardware and the NVIDIA CUDA Toolkit installed, you can examine and enjoy the numerous included programs. To begin using CUDA to accelerate the performance of your own applications, consult the CUDA C Programming Guide, located in the CUDA Toolkit documentation directory.A number of helpful development tools are included in the CUDA Toolkit or are available for download from the NVIDIA Developer Zone to assist you as you develop your CUDA programs, such as NVIDIA® Nsight™ Visual Studio Edition, NVIDIA Visual Profiler, and cuda-memcheck.For technical support on programming questions, consult and participate in the developer forums at /cuda/.NoticeALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATEL Y, "MATERIALS") ARE BEING PROVIDED "AS IS." NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE MATERIALS, AND EXPRESSL Y DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.Information furnished is believed to be accurate and reliable. However, NVIDIA Corporation assumes no responsibility for the consequences of use of such information or for any infringement of patents or other rights of third parties that may result from its use. No license is granted by implication of otherwise under any patent rights of NVIDIA Corporation. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all other information previously supplied. NVIDIA Corporation products are not authorized as critical components in life support devices or systems without express written approval of NVIDIA Corporation.TrademarksNVIDIA and the NVIDIA logo are trademarks or registered trademarks of NVIDIA Corporation in the U.S. and other countries. Other company and product names may be trademarks of the respective companies with which they are associated. Copyright© 2009-2019 NVIDIA Corporation. All rights reserved.。

Windows下安装CUDA8.0

Windows下安装CUDA8.0在Win10下安装CUDA8.0,并使⽤VS2013测试;机器配置:Windows 10VS 2013CUDA8.0CUDA 8.0:CUDA其他版本:1. 安装CUDA 8.0双击安装下载的.exe⽂件,然后选择解压路径,如下图,解压到哪⾥⽆所谓,安装成功会⾃动删除;解压完成后,得到如下图:精简:安装所有CUDA模块,并覆盖掉当前的NVIDIA驱动程序;(说实话,容易出问题)⾃定义:选择⾃⼰想要安装的模块,此处选择这⾥;选择⾃定义后,出现下图所⽰:下⾯⼏个模块准确具体有什么⽤,不能100%确定,但能⼤概才出来:CUDA:这个是必须的,下⾯有CUDA Runntime、Samples⼀些东西;NVIDIA GeForce Experience:这个好像是为了更好的游戏体验,之前安装显卡驱动程序时也提⽰是否安装,果断拒绝了;Other components:这⾥的PhysX好像也是为了游戏体验来的;Driver components:这个就要慎重了,意思就是重新安装显卡驱动程序;如果之前已经成功安装驱动程序,这⾥就不⽤选了;如果之前没安装驱动程序,建议还是去官⽹上单独下载驱动程序进⾏安装吧;选择好需要安装的模块,就要选择安装路径了,我的选择如下图:在如图所⽰位置建⽴相应⽂件夹,然后再指定安装路径;安装成功后;Ctrl+R,打开cmd:nvcc -V输出版本信息,则表明安装成功;配置环境变量将F:\CUDA\NVIDIA GPU Computing Tookit\CUDA\v8.0\lib\x64添加的系统变量的path中;2. 安装CuDNN下载对应CUDA 8.0版本的CuDNN:(如果安装的是其他版本的CUDA,注意CuDNN的版本)下载完成后,解压得到⼀个名为cuda的⽂件夹;将该⽂件夹下的⽂件复制到上⼀步安装的CUDA中;注意对应的⽂件夹;./cuda/bin/**.dll 复制到 ./NVIDIA GPU Computing Tookit/CUDA/v8.0/bin/./cuda/include/**.dll 复制到 ./NVIDIA GPU Computing Tookit/CUDA/v8.0/include/./cuda/lib/x64/**.dll 复制到 ./NVIDIA GPU Computing Tookit/CUDA/v8.0/lib/x64/安装完成;3. 测试1使⽤VS2013打开./cuda/v8.0/Samples_vs2013.sln;加载完成后,执⾏本地Windows编译,最后输出成功,见下图;4. 测试2在VS2013上配置CUDA;4.1 新建项⽬并进⾏配置1. 打开VS2013,新建空⽩项⽬,设置项⽬名称、位置信息,如下图;2. 在源⽂件添加—>新建项—>NVIDIA CUDA 8.0—>CUDA C/C++ File,命名为hello.cu,如下图;hello.cu右键—>属性—>配置属性—>常规—>项类型,配置如下图;3. 在项⽬上右键—>⽣成依赖项—>⽣成⾃定义—>选择CUDA 8.0,如下图;4. 在项⽬上右键—>属性—>常规—>配置管理器—>活动解决⽅案平台(新建)—>键⼊或选择新平台(选择x64),如下图;5. 项⽬右键—>属性—>VC++⽬录—>包含⽬录,如下图,添加;F:\CUDA\NVIDIA GPU Computing Tookit\CUDA\v8.0\include6. 项⽬右键—>属性—>VC++⽬录—>库⽬录,如下图,添加;F:\CUDA\NVIDIA GPU Computing Tookit\CUDA\v8.0\lib\x647. 项⽬右键—>属性—>链接器—>常规,如下图,添加;$(CUDA_PATH_V8_0)\lib\$(Platform)8. 项⽬右键—>属性—>链接器—>输⼊—>附加依赖项,如下图,添加;注意:不同版本的CUDA,下⾯的lib是不同的;当然,⼀个项⽬也不⼀定需要所有的lib;具体有哪些lib,位于:F:\CUDA_Dev_Doc_Sam\v8.0\lib\x64;cublas.libcublas_device.libcuda.libcudadevrt.libcudart.libcudart_static.libcudnn.libcufft.libcufftw.libcurand.libcusolver.libcusparse.libnppc.libnppi.libnppial.libnppicc.libnppicom.libnppidei.libnppif.libnppig.libnppim.libnppist.libnppisu.libnppitc.libnpps.libnvblas.libnvcuvid.libnvgraph.libnvml.libnvrtc.libOpenCL.lib4.2 编译在上⾯建的hello.cu⽂件中添加下⾯代码:// CUDA runtime 库 + CUBLAS 库#include <cuda_runtime.h>#include <cublas_v2.h>#include <device_launch_parameters.h>#include <time.h>#include <iostream># pragma warning (disable:4819)using namespace std;bool initDevice(void)int cnt, i;cudaGetDeviceCount(&cnt);if (cnt < 0){cout << "Can not find CUDA device" << endl;return false;}for (i = 0; i < cnt; i++){cudaDeviceProp porp;if (cudaGetDeviceProperties(&porp, i) == cudaSuccess){if (porp.major >= 1) {break;}}}if (i == cnt){cout << "< 1.0" << endl;}return true;}__global__ void kernel_compute(float *model, float *input, float *output){int idx_x, idx_y;idx_y = blockIdx.x;idx_x = idx_y * blockDim.x + threadIdx.x;float sum = 0;for (int i = 0; i < 9; i++){sum += input[idx_x] * model[i];}//printf("%3d %d %2.6f %2.6f\n", idx_x, idx_y, sum, input[idx_x]);output[idx_x] = sum;}/*block ---> row*/int buildMaps(float *model, float *input, float *output, int height, int width){initDevice();float *dev_m = NULL, *dev_i = NULL, *dev_o = NULL;int size = height * width;cudaMalloc((void **)&dev_m, 9 * sizeof(float));cudaMalloc((void **)&dev_i, size * sizeof(float));cudaMalloc((void **)&dev_o, size * sizeof(float));cudaMemcpy(dev_m, model, 9 * sizeof(float), cudaMemcpyHostToDevice);cudaMemcpy(dev_i, input, size * sizeof(float), cudaMemcpyHostToDevice);dim3 grid(height, 1, 1);dim3 block(width, 1, 1);kernel_compute << <grid, block >> > (dev_m, dev_i, dev_o);cudaMemcpy(output, dev_o, size * sizeof(float), cudaMemcpyDeviceToHost); return 0;}新建main.cpp⽂件;#include <iostream>#include <Windows.h>#include <stdlib.h>#include <time.h>using namespace std;extern int buildMaps(float *model, float *input, float *output, int height, int width); void show(float *ptr, int height, int width, char *str){cout << str << " : " << endl;for (int h = 0; h < height; h++){for (int w = 0; w < width; w++){int cnt = h * width + w;printf("%5.5f ", ptr[cnt]);}cout << endl;}}#define width 5#define size (width * width)int main(){float *model = (float *)malloc(9 * sizeof(float));float *input = (float *)malloc(size * sizeof(float));float *output = (float *)malloc(size * sizeof(float));if (!model || !input || !output){std::cout << "Malloc Error" << endl;exit(-1);for (int i = 0; i < 9; i++){model[i] = (float)(i);}srand((unsigned)time(0));for (long long int i = 0; i < size; i++){input[i] = ((rand() % 100) * 1.f) / (rand() % 100 + 1);}buildMaps((float *)model, (float *)input, output, width, width); show(model, 3, 3, "model");show(input, width, width, "input");show(output, width, width, "output");int a;cin >> a;}编译,输出结果为:。

Windows 7 64bit +VS2008+ CUDA 4.0安装配置完全过程

Windows 7 64bit +VS2008+ CUDA 4.0安装配置完全过程安装CUDA4.0时,碰到了很多意外,花费了较多时间,最终取得了成功,现对期间的经验教训总结如下,供大家分享,期待提高大家的工作质量和效率。

一 安装环境Windows 7 64bit 家庭版,VS2008(安装了X64编译器),CUDA 4.0 64bit版本;二 安装软件Windows 7 64bit 家庭版是购买笔记本时自带的系统,不再详说。

2.1 安装VS2008安装的professional版本,在安装时选择自定义安装,选择自己需要的组件,如下图1所示(这里借用了别人的一张图片),注意展开Visual C++子树,选中X64组件。

图1 自定义安装VS2008组件安装完毕后,对于如何取消90天试用限制问题,采用了别人的破解办法,具体的操作方法如下:打开 控制面板 Î 添加删除程序, 找到VS2008的安装项,运行VS2008的安装卸载程序,出现如下图2所示界面:图2 VS2008的安装卸载界面下载 破解程序CrackVS2008ForWindows7.zip,然后右键点击该破解程序,选择以管理员身份运行,出现如下的图3所示界面:图3 破解程序界面点击图3右上角 按钮“Bug 微软”,则久违的图4界面出现了:图4 破解后的界面输入相应的序列号,就可以了,以下是收集的序列号:1.Visual Studio 2008 Professional Edition:XMQ2Y-4T3V6-XJ48Y-D3K2V-6C4WT2.Visual Studio 2008 Team Test Load Agent:WPX3J-BXC3W-BPYWP-PJ8CM-F7M8T3.Visual Studio 2008 Team System:PYHYP-WXB3B-B2CCM-V9DX9-VDY8T4.Visual Studio 2008 Team Foundation Server:WPDW8-M962C-VJX9M-HQB4Q-JVTDM2.2 安装CUDA4.0在nvidia的下载网页上,下载了64bit的开发组件,包括driver、tookit、sdk 等主要组件,具体如下:devdriver_4.0_winvista-win7_64_275.33_notebook.execudatoolkit_4.0.17_win_64.msigpucomputingsdk_4.0.19_win_64.execudatools_4.0.17_win_64.msiCUDA4_0BuildCustomizationFix.zip注意驱动选择台式机或者笔记本版本。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

windows安装cuda的方法
CUDA是NVIDIA公司开发的一个并行计算平台和编程模型,可以让开发者使用GPU来加速应用程序的运算速度。

在Windows操作系统下,安装CUDA可以让开发者在本地环境中进行CUDA程序的编写和测试。

以下是安装CUDA的方法:
1. 下载CUDA安装包
从NVIDIA官网下载与自己显卡型号和操作系统版本相匹配的CUDA安装包。

2. 安装CUDA Toolkit
运行下载的CUDA安装包,按照提示完成安装。

3. 配置环境变量
在环境变量中添加CUDA的路径,以便在命令行中运行CUDA程序。

在系统变量中添加以下两个环境变量:
(1)CUDA_PATH:CUDA安装路径,例如“C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.1”
(2)PATH:CUDA相关的路径,例如
“%CUDA_PATH%bin;%CUDA_PATH%libnvvp”
4. 安装显卡驱动
安装显卡驱动可以确保CUDA程序能够正常运行。

从NVIDIA官网下载与自己显卡型号和操作系统版本相匹配的显卡驱动程序,运行安装即可。

5. 验证CUDA安装成功
在命令行中输入“nvcc -V”,如果输出CUDA的版本信息,则表示CUDA安装成功。

现在,您已经完成了在Windows操作系统下安装CUDA的全部步骤,可以开始使用CUDA进行并行计算了。

相关文档
最新文档