 	//the last line of Gwrite/Gread code section should be snapshot ()
 	snapshot(results, data, 0, input_size);
 	//###Gwrite/Gread code section end### 
+    printf("pagefault times = %d\n", PAGEFAULT);
 }
 // ******************************************************************
 
 int main() {
     int input_size = loadBinaryFile(DATAFILE, input, STORAGE_SIZE);
-    printf("pagefault times = %d\n", PAGEFAULT);
-    printf("input_size = %d\n", input_size);
-    //cudaSetDevice(2);
+    cudaSetDevice(2);
     mykernel<<<1, 1, 16384>>>(input_size);
     cudaDeviceSynchronize();
     cudaDeviceReset();
 
     writeBinaryFile(OUTPUTFILE, results, input_size);
-    printf("pagefault times = %d\n", PAGEFAULT);
     return 0;
 }

			// Update PTE
			pageTable[i] = makePTE(CURRENTTIME, pageNumber, VALID);
			CURRENTTIME++;
			return i*PAGE_SIZE + pageOffset;
		}
	}


	u32 leastEntry = DNE;
	u32 leastTime  = DNE;
	for (u32 i = 0; i < PAGE_ENTRIES; i++) {
		if (leastTime > getLastUsedTime(pageTable[i])) {
			leastTime = getLastUsedTime(pageTable[i]);
			leastEntry = i;
