// ================================================================================================= // This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This // project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- // width of 100 characters per line. // // Author(s): // Cedric Nugteren // // This file demonstrates the use of the Netlib CBLAS API of the CLBlast library. This API is not // recommended if you want full control over performance: it will internally copy buffers from and // to the OpenCL device. // // Note that this example is meant for illustration purposes only. CLBlast provides other programs // for performance benchmarking ('client_xxxxx') and for correctness testing ('test_xxxxx'). // // ================================================================================================= #include #include #include // Includes the CLBlast library (Netlib CBLAS interface) #include // ================================================================================================= // Example use of the single-precision routine SGEMM int main(void) { // Example SGEMM arguments const int m = 128; const int n = 64; const int k = 512; const float alpha = 0.7f; const float beta = 1.0f; const int a_ld = k; const int b_ld = n; const int c_ld = n; // Populate host matrices with some example data float* host_a = (float*)malloc(sizeof(float)*m*k); float* host_b = (float*)malloc(sizeof(float)*n*k); float* host_c = (float*)malloc(sizeof(float)*m*n); for (int i=0; i