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

SCM Repository

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

Annotation of /branches/pure-cfg/src/lib/cl-target/clinfo.h

Parent Directory Parent Directory | Revision Log Revision Log


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

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

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