Skip to content

Instantly share code, notes, and snippets.

@mikejs
Created May 4, 2010 00:02
Show Gist options
  • Save mikejs/388761 to your computer and use it in GitHub Desktop.
Save mikejs/388761 to your computer and use it in GitHub Desktop.
// === === === === === === ===
//CLyther Module
struct _array_desc_ {
size_t start[3];
size_t stop[3];
size_t step[3];
size_t shape[3];
size_t size;
};
typedef struct _array_desc_ array_desc;
// === === === === === === ===
// Prototypes
// === === === === === === ===
__kernel
int wrong( int a );
// === === === === === === ===
// End Prototypes
// === === === === === === ===
__kernel
int wrong( int a )
{
/* function wrong */
return a;
}
// === === === === === === ===
// === === === === === === ===
import ctypes
import clyther
import copencl as cl
@clyther.kernel
def wrong(a):
return a
if __name__ == '__main__':
clyther.init('GPU')
devices = cl.get_devices('GPU')
context = cl.Context([devices[0]])
# a will have type 'int' in the OpenCL source
wrong = wrong.argtypes(ctypes.c_uint, context=context)
print wrong.source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment