Created
May 4, 2010 00:02
-
-
Save mikejs/388761 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// === === === === === === === | |
//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; | |
} | |
// === === === === === === === | |
// === === === === === === === |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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