#include "mat_mul.h" #include #include #define CHECK_ERROR(err) \ if (err != CL_SUCCESS) { \ printf("[%s:%d] OpenCL error %d\n", __FILE__, __LINE__, err); \ exit(EXIT_FAILURE); \ } #define TS 32 #define WPT 8 static cl_int err; static cl_platform_id platform; //static cl_device_id device; static cl_device_id devices[4]; static cl_context context; //static cl_command_queue queue; static cl_command_queue command_queue[4]; static cl_program program; static cl_kernel kernel[4]; static cl_mem a_d[4], b_d[4], c_d[4]; //static cl_uint num_devices; static float *A, *B, *C; static int M, N, K; int ndev; void mat_mul(float *_A, float *_B, float *_C, int _M, int _N, int _K) { A = _A, B = _B, C = _C; M = _M, N = _N, K = _K; // Setup kernel arguments for(int i=0;i a_d (gpu), B (cpu) -> b_d (gpu) for(int i=0;i C (cpu) for(int i=0;i