 
 	// Allocate arrays on host memory
 	data_t *h_result = (float *) malloc(allocSize);
+
+	// Copying input matrix for pthread version
+	input_for_pthread = (data_t*) malloc(allocSize);
+	copy_matrix(input, input_for_pthread, len);
 
 	// GPU Timing variables
 	cudaEvent_t start, stop;

#define TOL 1e-4

int main() {
	const char filename[] = "matrix/2000.txt";

	//READING FROM FILE
	data_t * input;
	int len;
	read_matrix_from_file(&input, filename, & len);
	//END READING FROM FILE

			zeroCount++;
		}
	}
	printf("\nMaximum difference: %f", max_diff);
	
	if (errCount > 0) {
		printf("\n@ERROR: GPU TEST FAILED: %d results did not matched\n", errCount);
	}
	else if (zeroCount > 0){
		printf("\n@ERROR: GPU TEST FAILED: %d results (from GPU) are zero\n", zeroCount);
	}
	else {
		printf("\nGPU TEST PASSED: All results matched\n");
	}


	for(int i = 0; i < len * len; i++) {
		double diff = abs(input_for_pthread[i] - input[i]);
		if (diff > TOL) {
			if(diff > max_diff)
					max_diff = diff;
			errCount++;
		}
		if (input_for_pthread[i] == 0) {
			zeroCount++;
		}
	}
	printf("\nMaximum difference: %f", max_diff);
	
	if (errCount > 0) {
		printf("\n@ERROR: PTHREAD TEST FAILED: %d results did not matched\n", errCount);
	}
	else if (zeroCount > 0){
		printf("\n@ERROR: PTHREAD TEST FAILED: %d results (from GPU) are zero\n", zeroCount);
	}
	else {
		printf("\nPTHREAD TEST PASSED: All results matched\n");
	}

	CUDA_SAFE_CALL(cudaFree(d_matrix));
