 #define CPU 1
 #define GPU 0
 
-#define MINI_NUM_TESTS 16
+#define NUM_TESTS 16
 
 #define CHECKBOARD_BLOCK_MAX_WIDTH  1
 #define CHECKBOARD_BLOCK_MAX_HEIGHT 256

void measureProductMatrixVector(Vector(*func)(const Matrix &, const Vector &)) {
	std::cout << "NEW MEASUREMENTS for Matrix-Vector product: " << std::endl;
	
	unsigned long int LAST_NUM_TESTS(MINI_NUM_TESTS);
	for (unsigned int size(2) ; size < 10000 ; size <<= 1) {
		Matrix h_m(size, size, CPU);
		randMatrix(h_m);
		
		Vector h_v(size, CPU);
		randVector(h_v);
		
		double time_required(0);
		unsigned long int NUM_TESTS(LAST_NUM_TESTS >> 2);
		if (NUM_TESTS < MINI_NUM_TESTS)
			NUM_TESTS = MINI_NUM_TESTS;
		
		while (time_required < 1000.) {
			clock_t t_chrono;
			t_chrono = clock();
			for (unsigned long int i(0) ; i != NUM_TESTS ; i++) {
				try {		
					func(h_m, h_v);
				} catch(cudaError_t &e) {
					return;
				}
			}
			t_chrono = clock() - t_chrono;
			time_required = 1000. * ((double) t_chrono)/CLOCKS_PER_SEC;
			
			if (time_required < 1000. && NUM_TESTS < (NUM_TESTS<<1))
				NUM_TESTS <<= 1;
			else
				break;
		}
		std::cout << "Size: " << size << "\tTests: " << NUM_TESTS << "\tTime: " << time_required << "ms" << std::endl;
		LAST_NUM_TESTS = NUM_TESTS;
	}
}


	
	checkResultsProductMatrixVector(productMatrixVectorCPU, productMatrixVectorGPU_naive);
	checkResultsProductMatrixVector(productMatrixVectorCPU, productMatrixVectorGPU_shared);
	checkResultsProductMatrixVector(productMatrixVectorCPU, productMatrixVectorGPU_row);
	
	measureProductMatrixVector(productMatrixVectorCPU);
	measureProductMatrixVector(productMatrixVectorGPU_naive);
	measureProductMatrixVector(productMatrixVectorGPU_shared);
	measureProductMatrixVector(productMatrixVectorGPU_row);
	
	return 0;
}
