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

SCM Repository

[diderot] Annotation of /branches/vis12-cl/src/clinfo/clinfo.h
ViewVC logotype

Annotation of /branches/vis12-cl/src/clinfo/clinfo.h

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : jhr 2737 /*! \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 :     #include "Diderot/config.h"
15 :     # 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 :     #include <stdio.h>
23 :     #include <stdbool.h>
24 :    
25 :     typedef struct {
26 :     unsigned short index[2]; //!< the platform/device index of the device
27 :     char *name; //!< name of device
28 :     char *vendor; //!< device vendor
29 :     int majorVersion; //!< major OpenCL version number supported by the device
30 :     int minorVersion; //!< minor OpenCL version number supported by the device
31 :     cl_device_id id; //!< the device ID
32 :     cl_device_type ty; //!< the type of the device
33 :     cl_bool isAvail; //!< true, if the device is available
34 :     cl_uint addrBits; //!< number of address bits on device (32 or 64)
35 :     cl_bool littleEndian; //!< true if device is little endian
36 :     cl_uint numCUs; //!< number of compute units
37 :     cl_uint cuWidth; //!< width of a compute unit; this value is determined
38 :     //! by looking at the device type and vendor string.
39 :     cl_uint maxConstArgs; //!< maximum number of __constant arguments
40 :     cl_uint maxWIDims; //!< maximum number of work item dimensions
41 :     size_t maxWGSize; //!< maximum workgroup size
42 :     size_t *maxWISize; //!< maximum number of work items in each dimension
43 :     cl_ulong globalMemSzb; //!< the size of the device's global memory
44 :     cl_ulong localMemSzb; //!< the size of the device's local memory
45 :     size_t maxParamSzb; //!< the maximum size in bytes of the kernel arguments
46 :     cl_ulong maxConstBufSzb; //!< maximum size of a constant buffer
47 :     cl_ulong maxAllocSzb; //!< maximum allocation size in bytes
48 :     size_t maxImg2D[2]; //!< maximum width and height of 2D images
49 :     size_t maxImg3D[3]; //!< maximim width, height, and depthe of 3D images
50 :     // prefered vector widths by type:
51 :     cl_uint charWid; //!< prefered width of char vectors
52 :     cl_uint shortWid; //!< prefered width of short vectors
53 :     cl_uint intWid; //!< prefered width of int vectors
54 :     cl_uint longWid; //!< prefered width of long vectors
55 :     cl_uint floatWid; //!< prefered width of float vectors
56 :     cl_uint doubleWid; //!< prefered width of double vectors
57 :     //! (0 if doubles are not supported)
58 :     } DeviceInfo_t;
59 :    
60 :     typedef struct {
61 :     char *name; //!< name of platform
62 :     cl_platform_id id; //! the platform ID
63 :     int numDevices; //!< number of devices supported by platform
64 :     DeviceInfo_t *devices; //!< array of devices
65 :     } PlatformInfo_t;
66 :    
67 :     typedef struct {
68 :     int numPlatforms; //!< number of platforms supported by system
69 :     PlatformInfo_t *platforms; //!< array of supported platforms.
70 :     } CLInfo_t;
71 :    
72 :     /*! \brief return information about the OpenCL support of the system.
73 :     * \return pointer to a CLInfo_t structure or 0 if there is an error.
74 :     */
75 :     CLInfo_t *Diderot_GetCLInfo ();
76 :    
77 :     /*! \brief return the device with the given index.
78 :     */
79 :     DeviceInfo_t *Diderot_GetDeviceByIndex (CLInfo_t *clinfo, unsigned int platIdx, unsigned int devIdx);
80 :    
81 :     /*! \brief return the default device for the system.
82 :     */
83 :     DeviceInfo_t *Diderot_DefaultCLDevice (CLInfo_t *clinfo);
84 :    
85 :     /*! \brief print the CL profile information to an output stream.
86 :     */
87 :     void Diderot_PrintCLInfo (FILE *outS, CLInfo_t *clinfo);
88 :    
89 :     /*! \brief check to see if a device is a GPU */
90 :     STATIC_INLINE bool isGPUDevice (DeviceInfo_t *dev)
91 :     {
92 :     return ((dev->ty & CL_DEVICE_TYPE_GPU) != 0);
93 :     }
94 :    
95 :     /*! \brief check to see if a device is a CPU */
96 :     STATIC_INLINE bool isCPUDevice (DeviceInfo_t *dev)
97 :     {
98 :     return ((dev->ty & CL_DEVICE_TYPE_CPU) != 0);
99 :     }
100 :    
101 :     #endif /* !_CLINFO_H_ */

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