Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /trunk/src/lib/cl-target/clinfo.h
ViewVC logotype

Annotation of /trunk/src/lib/cl-target/clinfo.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3349 - (view) (download) (as text)

1 : jhr 1671 /*! \file clinfo.h
2 :     *
3 :     * \author John Reppy
4 :     */
5 :    
6 :     /*
7 : jhr 3349 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
8 :     *
9 :     * COPYRIGHT (c) 2015 The University of Chicago
10 : jhr 1671 * All rights reserved.
11 :     */
12 :    
13 :     #ifndef _CLINFO_H_
14 :     #define _CLINFO_H_
15 :    
16 : lamonts 2060 #define NVIDIA_VENDOR_ID 4318
17 :     #define AMD_VENDOR_ID 4098
18 :    
19 : jhr 1671 #include "Diderot/diderot.h"
20 :     # ifdef HAVE_CL_CL_H
21 :     # include <CL/cl.h>
22 :     # elif defined(HAVE_OPENCL_CL_H)
23 :     # include <OpenCL/cl.h>
24 :     # else
25 :     # error no cl.h
26 :     # endif
27 :    
28 :     typedef struct {
29 :     char *name; //!< name of device
30 :     char *vendor; //!< device vendor
31 :     int majorVersion; //!< major OpenCL version number supported by the device
32 :     int minorVersion; //!< minor OpenCL version number supported by the device
33 : lamonts 2060 cl_uint vendorId; //!< A unique device vndeo identifier.
34 : jhr 1671 cl_device_id id; //!< the device ID
35 :     cl_device_type ty; //!< the type of the device
36 :     cl_bool isAvail; //!< true, if the device is available
37 :     cl_uint addrBits; //!< number of address bits on device (32 or 64)
38 :     cl_bool littleEndian; //!< true if device is little endian
39 :     cl_uint numCUs; //!< number of compute units
40 :     cl_uint cuWidth; //!< width of a compute unit; this value is determined
41 :     //! by looking at the device type and vendor string.
42 :     cl_uint maxConstArgs; //!< maximum number of __constant arguments
43 :     cl_uint maxWIDims; //!< maximum number of work item dimensions
44 :     size_t maxWGSize; //!< maximum workgroup size
45 :     size_t *maxWISize; //!< maximum number of work items in each dimension
46 :     cl_ulong globalMemSzb; //!< the size of the device's global memory
47 :     cl_ulong localMemSzb; //!< the size of the device's local memory
48 :     size_t maxParamSzb; //!< the maximum size in bytes of the kernel arguments
49 :     cl_ulong maxConstBufSzb; //!< maximum size of a constant buffer
50 :     cl_ulong maxAllocSzb; //!< maximum allocation size in bytes
51 :     size_t maxImg2D[2]; //!< maximum width and height of 2D images
52 :     size_t maxImg3D[3]; //!< maximim width, height, and depthe of 3D images
53 :     // prefered vector widths by type:
54 :     cl_uint charWid; //!< prefered width of char vectors
55 :     cl_uint shortWid; //!< prefered width of short vectors
56 :     cl_uint intWid; //!< prefered width of int vectors
57 :     cl_uint longWid; //!< prefered width of long vectors
58 :     cl_uint floatWid; //!< prefered width of float vectors
59 :     cl_uint doubleWid; //!< prefered width of double vectors
60 :     //! (0 if doubles are not supported)
61 :     } DeviceInfo_t;
62 :    
63 :     typedef struct {
64 :     char *name; //!< name of platform
65 :     cl_platform_id id; //! the platform ID
66 :     int numDevices; //!< number of devices supported by platform
67 :     DeviceInfo_t *devices; //!< array of devices
68 :     } PlatformInfo_t;
69 :    
70 :     typedef struct {
71 :     int numPlatforms; //!< number of platforms supported by system
72 :     PlatformInfo_t *platforms; //!< array of supported platforms.
73 :     } CLInfo_t;
74 :    
75 :     /*! \brief return information about the OpenCL support of the system.
76 :     * \return pointer to a CLInfo_t structure or 0 if there is an error.
77 :     */
78 :     CLInfo_t *GetCLInfo ();
79 :    
80 :     /*! \brief print the CL profile information to an output stream.
81 :     */
82 :     void PrintCLInfo (FILE *outS, CLInfo_t *clinfo);
83 :    
84 :     /*! \brief check to see if a device is a GPU */
85 :     STATIC_INLINE bool isGPUDevice (DeviceInfo_t *dev)
86 :     {
87 :     return ((dev->ty & CL_DEVICE_TYPE_GPU) != 0);
88 :     }
89 :    
90 :     /*! \brief check to see if a device is a CPU */
91 :     STATIC_INLINE bool isCPUDevice (DeviceInfo_t *dev)
92 :     {
93 :     return ((dev->ty & CL_DEVICE_TYPE_CPU) != 0);
94 :     }
95 :    
96 :     #endif /* !_CLINFO_H_ */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0