Last active
August 29, 2015 13:57
-
-
Save soravux/9730635 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
| #include "simpleCL.h" | |
| int main() { | |
| char buf[]="Hello, World!"; | |
| size_t global_size[2], local_size[2]; | |
| int found, worksize; | |
| sclHard hardware; | |
| sclSoft software; | |
| // Target buffer just so we show we got the data from OpenCL | |
| worksize = strlen(buf); | |
| char buf2[worksize]; | |
| buf2[0]='?'; | |
| buf2[worksize]=0; | |
| // Get the hardware | |
| hardware = sclGetGPUHardware( 0, &found ); | |
| // Get the software | |
| software = sclGetCLSoftware( "example.cl", "example", hardware ); | |
| // Set NDRange dimensions | |
| global_size[0] = strlen(buf); global_size[1] = 1; | |
| local_size[0] = global_size[0]; local_size[1] = 1; | |
| sclManageArgsLaunchKernel( hardware, software, global_size, local_size, | |
| " %r %w ", | |
| worksize, buf, worksize, buf2 ); | |
| // Finally, output out happy message. | |
| puts(buf2); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment