❶ 有沒有一本講解gpu和CUDA編程的經典入門書籍
CUDA自帶的編程手冊就是最好的書籍,因為目前市場上你看到的精典書籍,對於一些架構的描述都已經過時了,怕你看完,如果對架構原理了解不透徹,反而容易誤入歧途,走火入魔。
❷ CUDA編程
cuda的文件以.cu結尾,cpp是肯定不行的,建議你用別人樣例的代碼然後自己修改,這樣至少這些環境配置都是對的
❸ cuda編程
從字面上解釋。。。應該是使用了太多的本地數據。。。。
使用的本地數據佔了0x706c bytes
但是最大隻有0x4000 bytes
希望對你有點幫助。。。。
❹ cuda編程,把CPU轉到CUDA的編程,這演算法有點不正確!求解
cuda是基於標准c語言的,你先把c語言的基礎學好,然後動手自己寫一些c語言的程序,等對c語言有一定的功底之後,再看cuda,cuda與c語言的不同之處我覺得在於那個內核函數,以及如何劃分線程塊和柵格的緯度和大小,以及如何實現對於線程的索引的搜索,讓每一個線程處理對應的一個變數或者幾個變數。
然後是cuda的一些基礎的語法,這些你可以看一些簡單的cuda的例子,例如矩陣相加的例子,通過這些程序的例子可以很好的理解這些語法。
❺ cuda編程前的環境配置
CUDA開發環境配置
依次安裝 Driver,Toolkit,SDK。注意最好安裝路徑中不含空格。
使用開勇的CUDA_VS_Wizard (http://sourceforge.net/projects/cudavswizard/) 配置Visual Studio 2008的CUDA項目
安裝Visual AssistantX
打開VS, 選擇 工具->選項->項目與解決方案->VC++項目設置,在「C/C++文件擴展名」後添加*.cu,在「包括的擴展名」後添加.cu
打開Visual AssistantX設置,在Projects->C/C++ Directories 里,Platform選擇Custom,Show Directories for選擇Stable include files,添加CUDA Toolkit的include目錄路徑
導入注冊表(點我),讓Visual AssistantX支持CUDA的cu文件和語法高亮
在系統環境變數添加一個新項,隨便起名。這里作為例子,取CUDA_DLL。
值填寫SDK裡面\C\Bin\win32\下面的四個目錄(64位系統將win32改成win64)。
(例如sdk安裝在目錄E:\CUDA\win7_64_2.3\sdk里,則CUDA_DLL環境變數的值應為:
E:\CUDA\win7_64_2.3\sdk\C\win64\Debug;
E:\CUDA\win7_64_2.3\sdk\C\win64\EmuDebug;
E:\CUDA\win7_64_2.3\sdk\C\win64\EmuRelease;
E:\CUDA\win7_64_2.3\sdk\C\win64\Release
再在PATH環境變數最後添加%CUDA_DLL%
2009/12/20 Update:
在64位系統,完成以上步驟後,在vs新建項目時遇到錯誤"Err Source: CreateCustomProject"
解決方法:在控制面板->添加刪除程序,進入vs的維護模式,勾選Visual C++下面的x64編譯器(此選項在默認是沒有安裝的),之後可能會遇到找不到"SQLSysClrTypes.msi"的問題,取消之即可(這個文件在vs2008 sp1的iso裡面有,但無論我選擇sp1 iso的根目錄還是該文件所在的目錄,均無法繼續安裝)
❻ cuda編程問題 運行出錯
Compiling CUDA source file ..\..\src\caffe\layers\bnll_layer.cu...
1>
1> D:\Caffe\WindowsCaffe_detect\Caffe_Windows_Detection-master\build\MSVC2013>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version 2013 -ccbin "D:\gzSoft\vs2013\VC\bin\x86_amd64" -I../../3rdparty/include -I../../src -I../../include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\cuda\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static --verbose --keep -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= -D_VARIADIC_MAX=10 -DWIN32 -D_DEBUG -D_CONSOLE -D_UNICODE -DUNICODE -Xcompiler "/EHsc /W1 /nologo /Od /Zi /RTC1 /MDd " -o Debug\bnll_layer.cu.obj "D:\Caffe\WindowsCaffe_detect\Caffe_Windows_Detection-master\src\caffe\layers\bnll_layer.cu"
1> #$ _SPACE_=
1> #$ _CUDART_=cudart
1> #$ _HERE_=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin
1> #$ _THERE_=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin
1> #$ _TARGET_SIZE_=
1> #$ _TARGET_DIR_=
1> #$ _TARGET_SIZE_=64
1> #$ _WIN_PLATFORM_=x64
1> #$ TOP=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/..
1> #$ NVVMIR_LIBRARY_DIR=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../nvvm/libdevice
1> #$ PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../open64/bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../nvvm/bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../lib;D:\gzSoft\vs2013\VC\bin\x86_amd64;D:\gzSoft\vs2013\VC\bin;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools;D:\gzSoft\vs2013\Common7\Tools\bin;D:\gzSoft\vs2013\Common7\tools;D:\gzSoft\vs2013\Common7\ide;C:\Program Files (x86)\HTML Help Workshop;;C:\Program Files (x86)\MSBuild\12.0\bin\;C:\Windows\Microsoft.NET\Framework\v4.0.30319\;;C:\Program Files\DahuaTech\MV Viewer\Runtime\x64\;C:\Program Files\DahuaTech\MV Viewer\Runtime\x64\GenICam_v2_4\bin\Win64_x64\;C:\Program Files\DahuaTech\MV Viewer\Runtime\Win32\;C:\Program Files\DahuaTech\MV Viewer\Runtime\Win32\GenICam_v2_4\bin\Win32_i86\;C:\Program Files\Basler\pylon 4\pylon\bin\x64;C:\Program Files\Basler\pylon 4\pylon\bin\Win32;C:\Program Files\Basler\pylon 4\genicam\Bin\Win64_x64;C:\Program Files\Basler\pylon 4\genicam\Bin\Win32_i86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\gzSoft\opencv2.4.11\build_Sour\vc11\bin;D:\gzSoft\opencv2.4.10\build_Sour\vc10\bin;D:\gzSoft\qt5.2.1\5.2.1\msvc2012\bin;D:\MinGW\MinGW\bin;D:\gzSoft\vs2012\VC\bin;D:\gzSoft\javaTool\jdk1.7\bin;D:\gzSoft\javaTool\jdk1.7\jre\bin;D:\gzSoft\matlab\runtime\win64;D:\gzSoft\matlab\bin;D:\gzSoft\matlab\polyspace\bin;D:\software\eslib\bin;D:\gzSoft\lualib;D:\gzSoft\halcon12\bin\x86sse2-win32;D:\gzSoft\halcon12\FLEXlm\x86sse2-win32 ;C:\Program Files (x86)\Toshiba Teli\TeliCamSDK\TeliCamApi\bin\x86;C:\Program Files (x86)\CMake\bin\;D:\Program\opencv_pro\opencv-3.3.0\opencv-3.3.0\bulid\install\x86\vc11\bin;D:\gzSoft\doxygen\bin;D:\gzSoft\python2.7.10;D:\gzSoft\python2.7.10\Scripts;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;D:\Caffe\WindowsCaffeProject\caffe-master\Build\x64\Debug;
1> #$ INCLUDES="-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../include"
1> #$ LIBRARIES= "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../lib/x64"
1> #$ CUDAFE_FLAGS=--sdk_dir "C:\Program Files (x86)\Windows Kits\8.1"
1> #$ PTXAS_FLAGS=
1> bnll_layer.cu
1> nvcc fatal : Failed to create the host compiler response file 'x64/Debug/bnll_layer.compute_52.cpp1.ii.res'
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 7.5.targets(604,9): error MSB3721: 命令「"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version 2013 -ccbin "D:\gzSoft\vs2013\VC\bin\x86_amd64" -I../../3rdparty/include -I../../src -I../../include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\cuda\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static --verbose --keep -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= -D_VARIADIC_MAX=10 -DWIN32 -D_DEBUG -D_CONSOLE -D_UNICODE -DUNICODE -Xcompiler "/EHsc /W1 /nologo /Od /Zi /RTC1 /MDd " -o Debug\bnll_layer.cu.obj "D:\Caffe\WindowsCaffe_detect\Caffe_Windows_Detection-master\src\caffe\layers\bnll_layer.cu"」已退出,返回代碼為 1。
========== 生成: 成功 0 個,失敗 1 個,最新 0 個,跳過 0 個 ==========
❼ cuda編程的環境
建議還是換個顯卡吧,除了NVIDIA其他都不行,就算是模擬器也不能執行,看不了結果還不是白忙活。
❽ GPU設備,請問能夠先進行CUDA編程嗎
CUDA CUDA(Compute Unified Device Architecture),顯卡廠商NVidia推出的運算平台。 CUDA是一種由NVIDIA推出的通用並行計算架構,該架構使GPU能夠解決復雜的計算問題。 它包含了CUDA指令集架構(ISA)以及GPU內部的並行計算引擎。 開發人員現在可以使用C語言來為CUDA架構編寫程序,C語言是應用最廣泛的一種高級編程語言。所編寫出的程序於是就可以在支持CUDA的處理器上以超高性能運行。 將來還會支持其它語言,包括FORTRAN以及C++。 隨著顯卡的發展,GPU越來越強大,而且GPU為顯示圖像做了優化。在計算上已經超越了通用的CPU。如此強大的晶元如果只是作為顯卡就太浪費了,因此NVidia推出CUDA,讓顯卡可以用於圖像計算以外的目的。 目前只有G80、G92、G94和GT200平台的NVidia顯卡才能使用CUDA,工具集的核心是一個C語言編譯器。G80中擁有128個單獨的ALU,因此非常適合並行計算,而且數值計算的速度遠遠優於CPU。 CUDA的SDK中的編譯器和開發平台支持Windows、Linux系統,可以與Visual Studio2005集成在一起。 Geforce8CUDA(Compute Unified Device Architecture)是一個新的基礎架構,這個架構可以使用GPU來解決商業、工業以及科學方面的復雜計算問題。它是一個完整的GPGPU解決方案,提供了硬體的直接訪問介面,而不必像傳統方式一樣必須依賴圖形API介面來實現GPU的訪問。在架構上採用了一種全新的計算體系結構來使用GPU提供的硬體資源,從而給大規模的數據計算應用提供了一種比CPU更加強大的計算能力。CUDA採用C語言作為編程語言提供大量的高性能計算指令開發能力,使開發者能夠在GPU的強大計算能力的基礎上建立起一種效率更高的密集數據計算解決方案。 從CUDA體系結構的組成來說,包含了三個部分:開發庫、運行期環境和驅動(表2)。
❾ 請問CUDA編程對顯卡的要求是怎麼樣NVIDIA那些型號的顯卡可以
顯卡要求見此:http://www.nvidia.cn/object/cuda_gpus_cn.html 建議:雙敏 G92核心的9600GSO 384MB 192bit,此卡遠比同價位的其他NVIDIA圖形卡好,特別是GPU運算能力,是同價位的GT220、9500GT的數倍。但是可能缺貨,還有就是功耗較高。 如果你有500塊的話,就可以考慮昂達G92核心的9600GSO 384MB 192bit 或 昂達GT240 512MB GDDR5
❿ 如何使用CUDA 顯卡編程
第一步 先確定你的顯卡 是不是N卡(控制面板 》系統》設備管理器》顯示適配器)
第二步 查看你的顯卡 在不在 支持的顯卡 行列 https://developer.nvidia.com/cuda-gpus點擊打開鏈接
第三步 安裝( windows電腦中 須是 vs2008 vs2005)
CUDA Development Tools https://developer.nvidia.com/cuda-downloads點擊打開鏈接
NVIDIA CUDA Getting Started Guide for Microsoft Windows
Introction
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 existing applications. 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.
System Requirements
To use CUDA on your system, you will need the following:
CUDA-capable GPU
Microsoft Windows XP, Vista, 7, or 8 or Windows Server 2003 or 2008
NVIDIA CUDA Toolkit (available at no cost from http://www.nvidia.com/content/cuda/cuda-downloads.html)
Microsoft Visual Studio 2008 or 2010, or a corresponding version of Microsoft Visual C++ Express
About This Document
This document is intended for readers familiar with Microsoft Windows XP, Microsoft Windows Vista, or Microsoft Windows 7 operating systems and the Microsoft Visual Studio environment. You do not need previous experience with CUDA or experience with parallel computation.
Installing CUDA Development Tools
The installation 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 communicated with the hardware.