#include #include #ifdef __APPLE__ #include #else #include #endif #include "ftest/ftest.h" #define VECTOR_SIZE 1024 const char *saxpy_kernel = "__kernel \n" "void saxpy_kernel(float alpha, \n" " __global float *A, \n" " __global float *B, \n" " __global float *C) \n" "{ \n" " // Get the index of the work-item \n" " int index = get_global_id(0); \n" " C[index] = alpha * A[index] + B[index]; \n" "} \n"; TEST(openCL_one){ int i; // Alocate space for vectors A, B, C float alpha = 3.0; float *A = (float*)malloc(sizeof(float)*VECTOR_SIZE); float *B = (float*)malloc(sizeof(float)*VECTOR_SIZE); float *C = (float*)malloc(sizeof(float)*VECTOR_SIZE); for(i = 0; i