         // Copy results back to host
         cudaMemcpy(hostc, devc, size, cudaMemcpyDeviceToHost);
 
+        cudaDeviceSynchronize();
+        cudaEventRecord(stop);
+        cudaEventSynchronize(stop);
+
         // Print results
         for (int i = 0; i < vectorlength; ++i) {
             printf("C[%d] = %d\n", i, hostc[i]);

        }

        // Copy vectors to device
        cudaMemcpy(deva, hosta, size, cudaMemcpyHostToDevice);
        cudaMemcpy(devb, hostb, size, cudaMemcpyHostToDevice);

        // Calculate blocksize and threadnumber
        int blocksPerGrid = 1;

int solveProblem(const int argc, const char* argv[]){
	cudaError_t return_value;
	if(argc == 2){
		cudaEvent_t start, stop, memcopystart, memcopystop;
		float time, memcopytime;
		int vectorlength = atoi(argv[1]);
		cudaEventCreate(&start);
        cudaEventCreate(&stop);
        cudaEventCreate(&memcopystart);
        cudaEventCreate(&memcopystop);
		// Everything runs on stream 0
		cudaEventRecord(start);

