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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1379 - (download) (as text) (annotate)
Thu Jun 23 14:48:07 2011 UTC (7 years, 11 months ago) by jhr
File size: 2684 byte(s)
  Improved OpenCL info and added mechanism to print the OpenCL profile
/*! \file clinfo.h
 * \author John Reppy

 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.

#ifndef _CLINFO_H_
#define _CLINFO_H_

#include "Diderot/diderot.h"
# ifdef HAVE_CL_CL_H
#   include <CL/cl.h>
# elif defined(HAVE_OPENCL_CL_H)
#   include <OpenCL/cl.h>
# else
#   error no cl.h
# endif

typedef struct {
    char            *name;              //!< name of device
    cl_device_id    id;                 //!< the device ID
    cl_device_type  ty;                 //!< the type of the device
    cl_bool         isAvail;            //!< true, if the device is available
    cl_uint         addrBits;           //!< number of address bits on device (32 or 64)
    cl_bool         littleEndian;       //!< true if device is little endian
    cl_uint         numCUs;             //!< number of compute units
    cl_uint         maxWIDims;          //!< maximum number of work item dimensions
    size_t          maxWGSize;          //!< maximum workgroup size
    size_t          *maxWISize;         //!< maximum number of work items in each dimension
    cl_ulong        globalMemSzb;       //!< the size of the device's global memory
    cl_ulong        localMemSzb;        //!< the size of the device's local memory
    cl_ulong        maxAllocSzb;        //!< maximum allocation size in bytes
    size_t          maxImg2D[2];        //!< maximum width and height of 2D images
    size_t          maxImg3D[3];        //!< maximim width, height, and depthe of 3D images
} DeviceInfo_t;

typedef struct {
    char            *name;              //!< name of platform
    cl_platform_id  id;                 //! the platform ID
    int             numDevices;         //!< number of devices supported by platform
    DeviceInfo_t    *devices;           //!< array of devices
} PlatformInfo_t;

typedef struct {
    int             numPlatforms;       //!< number of platforms supported by system
    PlatformInfo_t  *platforms;         //!< array of supported platforms.
} CLInfo_t;

/*! \brief return information about the OpenCL support of the system.
 *  \return pointer to a CLInfo_t structure or 0 if there is an error.
CLInfo_t *GetCLInfo ();

/*! \brief print the CL profile information to an output stream.
void PrintCLInfo (FILE *outS, CLInfo_t *clinfo);

/*! \brief check to see if a device is a GPU */
STATIC_INLINE bool isGPUDevice (DeviceInfo_t *dev)
    return ((dev->ty & CL_DEVICE_TYPE_GPU) != 0);

/*! \brief check to see if a device is a CPU */
STATIC_INLINE bool isCPUDevice (DeviceInfo_t *dev)
    return ((dev->ty & CL_DEVICE_TYPE_CPU) != 0);

#endif /* !_CLINFO_H_ */

ViewVC Help
Powered by ViewVC 1.0.0