#ifndef _C_UTIL_ #define _C_UTIL_ #include #include //------------------------------------------------------------------- //--initialize array with maximum limit //------------------------------------------------------------------- template void fill(datatype *A, const int n, const datatype maxi){ for (int j = 0; j < n; j++) { A[j] = ((datatype) maxi * (rand() / (RAND_MAX + 1.0f))); } } //--print matrix template void print_matrix(datatype *A, int height, int width){ for(int i=0; i void verify_array(const datatype *cpuResults, const datatype *gpuResults, const int size){ char passed = true; #pragma omp parallel for for (int i=0; i MAX_RELATIVE_ERROR){ passed = false; } } if (passed){ std::cout << "--cambine:passed:-)" << endl; } else{ std::cout << "--cambine: failed:-(" << endl; } return ; } template void compare_results(const datatype *cpu_results, const datatype *gpu_results, const int size){ char passed = true; //#pragma omp parallel for for (int i=0; i