#include #include #include #include // C++ , C // // Do A * B matrix multiplication, where A and B each represent a batch of matrices. // // Further, A is a sparse matrix, where matrices are packed along the diagonal not to interfere with each other. // void matrix_multiplication_batch_processing(); int main(int argc, char* argv[]) { libra_Init(argc, argv); libra_SetDefaultDataType(GFLOAT32); // See example on how to batch small matrices into bigger batches for fast processing. matrix_multiplication_batch_processing(); libra_Shutdown(); printf("\n\n\nPress a key...\n\n\n"); _getch(); return 0; } void getDataCompletedCallback(float* memory, void* userData) { // // // ... } void matrix_multiplication_batch_processing() { // Batch matrices into a supermatrix (sparse). const int matrixRowComponentCount = 4; const int matrixColumnComponentCount = 4; const int matrixCount = 10000; const int batchMatrixRowComponentCount = matrixCount*matrixRowComponentCount; const int batchMatrixColumnComponentCount = matrixCount*matrixColumnComponentCount; const int batchVectorRowComponentCount = batchMatrixRowComponentCount; const int batchVectorColumnComponentCount = matrixColumnComponentCount; // // Setup dummy application format // struct Matrix { float data[matrixRowComponentCount*matrixColumnComponentCount]; }; Matrix* applicationMatrices = new Matrix[matrixCount]; float one = 1.0f; int initValue = *(int*)(void*)&one; // Create dummy app data for (int i=0;i