Cuda development: Understanding device Properties

Source: Internet
Author: User

Original article link

Today, we will introduce the relevant properties of Cuda devices. We can write code that is more suitable for hardware work only when we are familiar with the hardware and how it works. The cudadeviceprop struct records the properties of the device.

1 struct cudadeviceprop 2 {3 char name [256];/** <ascii id of the device */4 size_t totalglobalmem;/** <amount of available global memory, in bytes */5 size_t sharedmemperblock;/** <The amount of shared memory available for each block, in bytes */6 int regsperblock; /** <The number of 32-bit registers available in each block */7 int warpsize;/** <the size of the thread's warp block */8 size_t mempitch; /** <maximum allowable memory replication correction, in bytes */9 int maxthreadsperblock;/** <maximum number of processes in each block */10 int maxthreadsdim [3]; /** <maximum thread volume per dimension in a block */11 int maxgr Idsize [3];/** <maximum number of dimensions in a grid */12 INT clockrate;/** <clock frequency, unit: kHz */13 size_t totalconstmem; /** <constant memory available on the device, in bytes */14 int Major;/** <main version number of the computing function */15 int minor; /** <computing function version number */16 size_t texturealignment;/** <aligment required texture */17 int deviceoverlap; /*** <determines whether the device can copy the memory and execute the kernel simultaneously. Expired. Use asyncenginecount */18 int multiprocessorcount;/** <Number of processors on the device */19 int kernelexectimeoutenabled;/** <whether the kernel function is run by Time Limit */20 int integrated; /** <whether the device is independent */21 int canmaphostmemory;/** <whether the device can map the host cudahostalloc/cudahostgetdevicepointer */22 int computemode;/** <computing mode, default, exclusive, prohibited, and exclusive process (see: cudacomputemode) */23 int maxtexture1d;/** <1D maximum texture */24 int maxtexture2d [2]; /** <maximum dimension of 2D Texture */25 int maxtexture3d [3];/** <maximum dimension of 3D texture */26 int maxtexture1dlayered [2]; /** <maximum 1d layered texture size */27 int maxtexture2dlayered [3];/** <maximum 2D layered texture size */28 size_t surfacealignment; /** <surface alignment requirements */29 int concurrentkernels;/** <whether the device can execute multiple kernels at the same time */30 int eccenabled; /** <whether the device supports ECC */31 int pcibusid;/** <the PCI bus ID of the device */32 int pcideviceid; /** <PCI device ID */33 int pcidomainid;/** <PCI device domain ID */34 int tccdriver; /** <1 if the device uses a TCC-driven Tesla device, otherwise it is 0 */35 int asyncenginecount;/** <Number of asynchronous engines */36 int unifiedaddressing; /** <whether the device shares the unified address space with the Host */37 int memoryclockrate;/** <peak memory clock rate, in kHz */38 int memorybuswidth; /** <global memory bus width, in bit */39 int l2cachesize;/** <L2 cache size, in bytes */40 int maxthreadspermultiprocessor; /** <maximum resident thread for each multi-processor */41 };

Use cudagetdeviceproperties () to obtain the device attribute. Use cudagetdevicecount () to obtain the number of devices. Use cudachoosedevice () to select devices that meet the condition and use cudagetdevice () to obtain the current device, use cudasetdevice () to select a device. SLI technology supports multiple GPUs.

For more information, click:

Cuda zone: http://cuda.it168.com/

Cuda Forum: http://cudabbs.it168.com/

Cuda development: Understanding device Properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.