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 3349 - (view) (download) (as text)

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

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