     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();


// ******************************************************************
// Read/Write
__device__ inline u32 isValid(u32 PTE) {
	return PTE & VALID;
}
__device__ inline u32 getPageNumber(u32 PTE) {
	return (PTE & PAGENUMBERMASK) >> 1;
}
__device__ inline u32 getLastUsedTime(u32 PTE) {
	return (PTE & LASTTIMEMASK) >> 13;
}
__device__ inline u32 makePTE(u32 time, u32 pageNumber, u32 validbit) {
	return (time << 13) | (pageNumber << 1) | validbit;
}
__device__ u32 paging(uchar *memory, u32 pageNumber, u32 pageOffset) {
	// ******************************************************************** //

	u32 leastEntry = DNE;
	u32 leastTime  = DNE;
	for (u32 i = 0; i < PAGE_ENTRIES; i++) {
		/*
		u32 tmp = CURRENTTIME - getLastUsedTime(pageTable[i]);
		if (tmp > leastTime) {
			leastTime = tmp;
			leastTime = i;
		}
		*/
		if (leastTime > getLastUsedTime(pageTable[i])) {
			leastTime = getLastUsedTime(pageTable[i]);
			leastEntry = i;
