Giter Club home page Giter Club logo

clu's Introduction

The Computing Language Utility (CLU) is a lightweight API designed to help programmers explore, learn, and rapidly prototype programs with OpenCL. This API reduces the complexity associated with initializing OpenCL devices, contexts, kernels and parameters, etc. while preserving the ability to drop down to the lower level OpenCL API at will when programmers wants to get their hands dirty. The CLU release includes an open source implementation along with documentation and samples that demonstrate how to use CLU in real applications. It has been tested on Windows 7 with Visual Studio and OS X.

clu's People

Contributors

allenhux avatar allenhux-intel avatar awatry avatar bmerry avatar dpetre avatar gkohri avatar settle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clu's Issues

Every variant of cluBuildSource*() should have a compile_options parameter

Only cluBuildSourceArray() offers a compile_options parameter, which forces the user to manually read a .cl-file in case she wants to specify compiler options. To my experience, the latter is very common to pass defines for code configuration and compile-time arguments.

If whoever is responsible for that decision agrees, I would happily deliver the changes as a pull request.

cluNDRange* should take size_t not int

Since the arguments all get converted to size_t when creating the return value, it might as well take them as size_t, which would also avoid truncation issues if someone passes a value outside the range of int.

cluGetDeviceInfo should query properties of specific device

Would be nice to query the properties of a specific device. E.g. use query to find a device that supports a specific extension, then initialize clu to use that device by default. Or start up CLU, then query the properties of the devices it picked for the default context.

Link errors with Clang 3.4 due to incorrect use of inline

C99 has different semantics from C++ for inline functions. This causes Clang to generate link errors. See http://clang.llvm.org/compatibility.html#inline for more explanation.

The simplest fix is probably to change the inline functions to static inline. Alternatively, the inline functions in clu.h could have out-of-line implementations in clu_runtime.c - but that would need some verification to check that this works under all the flavours of inlining (C99, gnu89, C++, MSVC's not-quite-C compiler).

Note that this affects both clu.h and the code generated by clu_generator.

INLINE macro pollutes the namespace

Putting a macro called INLINE into the macro namespace has potential to clash with any other package (or user's code) that wants to do the same thing. It should be named CLU_INLINE or something like that.

Errors while compiling with gcc

When compiling under gcc the following errors occur:

clu_runtime.cpp: In constructor ‘DeviceTypeToId::DeviceTypeToId()’:
clu_runtime.cpp:137:47: error: ‘memset’ was not declared in this scope
clu_runtime.cpp: At global scope:
clu_runtime.cpp:260:1: error: specializing member ‘CLU_Runtime::CLU_Specific<cl_context>::~ CLU_Runtime::CLU_Specific<cl_context>’ requires ‘template<>’ syntax
clu_runtime.cpp:261:1: error: specializing member ‘CLU_Runtime::CLU_Specific<cl_command_queue>::~ CLU_Runtime::CLU_Specific<cl_command_queue>’ requires ‘template<>’ syntax
clu_runtime.cpp:262:1: error: specializing member ‘CLU_Runtime::CLU_Specific<cl_program>::~ CLU_Runtime::CLU_Specific<cl_program>’ requires ‘template<>’ syntax
clu_runtime.cpp: In member function ‘void CLU_Runtime::Reset()’:
clu_runtime.cpp:287:53: error: ‘memset’ was not declared in this scope
clu_runtime.cpp: In function ‘cl_platform_id* GetPlatformByVendor(cl_uint, cl_platform_id* const, const char, cl_int_)’:
clu_runtime.cpp:362:42: error: ‘strstr’ was not declared in this scope
clu_runtime.cpp: In function ‘cl_program cluBuildSourceArray(cl_uint, const char**, const char_, cl_int_)’:
clu_runtime.cpp:832:92: error: ‘strlen’ was not declared in this scope
clu_runtime.cpp:832:93: error: ‘strncmp’ was not declared in this scope
clu_runtime.cpp: In function ‘const char* CLU_GetDeviceInfo(cl_int*)’:
clu_runtime.cpp:1105:90: warning: passing NULL to non-pointer argument 3 of ‘cl_int clGetDeviceIDs(cl_platform_id, cl_device_type, cl_uint, _cl_device_id**, cl_uint*)’ [-Wconversion-null]

The errors related to memset, strlen, strncmp, etc. can be fixed by including cstring:

include

The errors on line 260, 261 and 262 can be fixed by following the compiler's suggestion:

template<>
CLU_Runtime::CLU_Specific<cl_context>::~CLU_Specific() {clReleaseContext(m_o);}

template<>
CLU_Runtime::CLU_Specific<cl_command_queue>::~CLU_Specific() {clReleaseCommandQueue(m_o);}

template<>
CLU_Runtime::CLU_Specific<cl_program>::~CLU_Specific() {clReleaseProgram(m_o);}

Finally, the warning can be dealt with by converting the NULL to a 0:

status = clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, NULL, &numDevices);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.