Example #1
0
int main(int argc, const char **argv)
{
	char hostname[32];
	
	//Getting my ID
	if (argc >= 3) {
		strncpy(hostname, argv[1], 32);
		myid = atoi(argv[1]);
	} else {
		gethostname(hostname, 32);
		if ( strstr(hostname, "nohost") != NULL ) {
			myid = atoi(hostname+strlen("nohost"));
		} else if( strstr(hostname, "bdbm") != NULL ) {
			myid = atoi(hostname+strlen("bdbm"));
		} else {
			myid = 1;
		}
	}

	fprintf(stderr, "Main: hostname=%s myid=%d\n", hostname, myid);

	init_dma();


	long actualFrequency=0;
	long requestedFrequency=1e9/MainClockPeriod;
	int status = setClockFrequency(0, requestedFrequency, &actualFrequency);
	fprintf(stderr, "Requested Freq: %5.2f, Actual Freq: %5.2f, status=%d\n"
			,(double)requestedFrequency*1.0e-6
			,(double)actualFrequency*1.0e-6,status);

	//Start ext aurora
	auroraifc_start(myid);

	device->start(0);
	device->setDebugVals(0,0); //flag, delay

	device->debugDumpReq(0);
	sleep(1);
	device->debugDumpReq(0);
	sleep(1);

	//void local_test(bool check, int read_repeat, int debug_lvl )
//	local_test(true, 1, 5);
//	LOG(0, "Press any key to continue..\n");
	//gets(str);

	//void one_to_many_test(bool check, int read_repeat, int debug_lvl, int accessNode)
	one_to_many_test(true, 1, 5, 1);
	LOG(0, "Press any key to continue..\n");
//	gets(str);
	
	//void many_to_many_test(bool check, int test_repeat, int read_repeat, int debug_lvl)
//	many_to_many_test(true, 1, 10, 5);


}
Example #2
0
int main(int argc, const char **argv)
{

	//Getting my ID
	char hostname[32];
	gethostname(hostname,32);

	char* userhostid = getenv("BDBM_ID");
	if ( userhostid != NULL ) {
		myid = atoi(userhostid);
	} else {
		myid = atoi(hostname+strlen("bdbm"));
		if ( strstr(hostname, "bdbm") == NULL ) {
			myid = 1;
		}
	}

	fprintf(stderr, "Main: myid=%d\n", myid);

	init_dma();


	//Start ext aurora
	auroraifc_start(myid);

	device->start(0);
	device->setDebugVals(0,0); //flag, delay

	device->debugDumpReq(0);
	sleep(1);
	device->debugDumpReq(0);
	sleep(1);

	char str[10];

	//void local_test(bool check, int read_repeat, int debug_lvl )
	local_test(true, 1, 5);
	LOG(0, "Press any key to continue..\n");
	gets(str);

	/*
	//void one_to_many_test(bool check, int read_repeat, int debug_lvl, int accessNode)
	one_to_many_test(true, 1, 5, 1);
	LOG(0, "Press any key to continue..\n");
	gets(str);
	*/

	
	//void many_to_many_test(bool check, int test_repeat, int read_repeat, int debug_lvl)
	many_to_many_test(true, 1, 10, 5);


}
Example #3
0
int main(int argc, const char **argv)
{
	char hostname[32];
	gethostname(hostname,32);

	//FIXME "lightning" is evaluated to 0,
	// so when bdbm00 is returned to the cluster,
	// code needs to be modified
	if ( strstr(hostname, "bdbm") == NULL 
		&& strstr(hostname, "umma") == NULL
		&& strstr(hostname, "lightning") == NULL ) {
		
		fprintf(stderr, "ERROR: hostname should be bdbm[idx] or lightning\n");
		return 1;
	}
	int myid = atoi(hostname+strlen("bdbm"));

	DmaDebugRequestProxy *hostDmaDebugRequest = new DmaDebugRequestProxy(IfcNames_HostDmaDebugRequest);
	MMUConfigRequestProxy *dmap = new MMUConfigRequestProxy(IfcNames_HostMMUConfigRequest);
	DmaManager *dma = new DmaManager(hostDmaDebugRequest, dmap);
	DmaDebugIndication *hostDmaDebugIndication = new DmaDebugIndication(dma, IfcNames_HostDmaDebugIndication);
	MMUConfigIndication *hostMMUConfigIndication = new MMUConfigIndication(dma, IfcNames_HostMMUConfigIndication);


	fprintf(stderr, "Main::allocating memory...\n");
	
	interface_init();

	printf( "Done initializing hw interfaces\n" ); fflush(stdout);

	portalExec_start();
	printf( "Done portalExec_start\n" ); fflush(stdout);

	interface_alloc(dma);
	
	printf( "Done allocating DMA buffers\n" ); fflush(stdout);

	printf( "initializing aurora with node id %d\n", myid ); fflush(stdout);
	auroraifc_start(myid);

	/////////////////////////////////////////////////////////

	fprintf(stderr, "Main::flush and invalidate complete\n");
	if ( sem_init(&wait_sem, 1, 0) ) {
		//error
		fprintf(stderr, "sem_init failed!\n" );
	}

	for ( int j = 0; j < WRITE_BUFFER_COUNT; j++ ) {
		for ( int i = 0; i < (8192+64)/4; i++ ) {
			writeBuffers[j][i] = j;
		}
	}
	for ( int j = 0; j < READ_BUFFER_COUNT; j++ ) {
		for ( int i = 0; i < (8192+64)/4; i++ ) {
			readBuffers[j][i] = 8192/4-i;
		}
	}

	sleep(5);

	printf ( "sending start msg\n" ); fflush(stdout);
	generalifc_start(/*datasource*/1);
	//auroraifc_sendTest();

	if ( myid == 1 ) { 
		generalifc_readRemotePage();
	}
	
	printf( "Entering idle loop\n" );
	while(1) sleep(10);
	exit(0);
}
Example #4
0
int main(int argc, const char **argv)
{

	int myid = 0;

	fprintf(stderr, "Main: myid=%d\n", myid);

	MemServerRequestProxy *hostMemServerRequest = new MemServerRequestProxy(IfcNames_HostMemServerRequest);
	MMURequestProxy *dmap = new MMURequestProxy(IfcNames_HostMMURequest);
	DmaManager *dma = new DmaManager(dmap);
	MemServerIndication *hostMemServerIndication = new MemServerIndication(hostMemServerRequest, IfcNames_HostMemServerIndication);
	MMUIndication *hostMMUIndication = new MMUIndication(dma, IfcNames_HostMMUIndication);

	fprintf(stderr, "Main::allocating memory...\n");

	device = new FlashRequestProxy(IfcNames_FlashRequest);
	FlashIndication *deviceIndication = new FlashIndication(IfcNames_FlashIndication);
	
	srcAlloc = portalAlloc(srcAlloc_sz);
	dstAlloc = portalAlloc(dstAlloc_sz);
	srcBuffer = (unsigned int *)portalMmap(srcAlloc, srcAlloc_sz);
	dstBuffer = (unsigned int *)portalMmap(dstAlloc, dstAlloc_sz);

	fprintf(stderr, "dstAlloc = %x\n", dstAlloc); 
	fprintf(stderr, "srcAlloc = %x\n", srcAlloc); 
	
	pthread_mutex_init(&flashReqMutex, NULL);
	pthread_cond_init(&flashFreeTagCond, NULL);

	printf( "Done initializing hw interfaces\n" ); fflush(stdout);

	portalExec_start();
	printf( "Done portalExec_start\n" ); fflush(stdout);

	portalDCacheFlushInval(dstAlloc, dstAlloc_sz, dstBuffer);
	portalDCacheFlushInval(srcAlloc, srcAlloc_sz, srcBuffer);
	ref_dstAlloc = dma->reference(dstAlloc);
	ref_srcAlloc = dma->reference(srcAlloc);

	device->setDmaWriteRef(ref_dstAlloc);
	device->setDmaReadRef(ref_srcAlloc);
	for (int t = 0; t < NUM_TAGS; t++) {
		readTagTable[t].busy = false;
		writeTagTable[t].busy = false;
		int byteOffset = t * PAGE_SIZE;
		printf("byteOffset=%x\n", byteOffset); fflush(stdout);
		readBuffers[t] = dstBuffer + byteOffset/sizeof(unsigned int);
		writeBuffers[t] = srcBuffer + byteOffset/sizeof(unsigned int);
	}
	
	for (int node=0; node<NUM_NODES; node++) {
		for (int blk=0; blk<BLOCKS_PER_CHIP; blk++) {
			for (int c=0; c<CHIPS_PER_BUS; c++) {
				for (int bus=0; bus< CHIPS_PER_BUS; bus++) {
					flashStatus[node][bus][c][blk] = UNINIT;
				}
			}
		}
	}


	for (int t = 0; t < NUM_TAGS; t++) {
		for ( int i = 0; i < PAGE_SIZE/sizeof(unsigned int); i++ ) {
			readBuffers[t][i] = 0;
			writeBuffers[t][i] = 0;
		}
	}


	//Start ext aurora
	auroraifc_start(myid);

	device->start(0);
	device->setDebugVals(0,0); //flag, delay

	device->debugDumpReq(0);
	sleep(1);
	device->debugDumpReq(0);
	sleep(1);

	if (myid==0) {

		
		timespec start, now;
		double timeElapsed = 0;
		int node = myid;

		if (doerasewrites) {
			//test erases
			//for (int node=NUM_NODES-1; node >= 1; node--) 
			//for (int node=DST_NODE; node == DST_NODE; node++) 
				for (int blk = 0; blk < BLOCKS_PER_CHIP; blk++){
					for (int chip = 0; chip < CHIPS_PER_BUS; chip++){
						for (int bus = 0; bus < NUM_BUSES; bus++){
							eraseBlock(node, bus, chip, blk, waitIdleEraseTag());
						}
					}
				}

			while (true) {
				usleep(100);
				if ( getNumErasesInFlight() == 0 ) break;
			}


			//read back erased pages
			//for (int node=NUM_NODES-1; node >= 1; node--) 
			//for (int node=DST_NODE; node == DST_NODE; node++) 
				for (int blk = 0; blk < BLOCKS_PER_CHIP; blk++){
					for (int chip = 0; chip < CHIPS_PER_BUS; chip++){
						for (int bus = 0; bus < NUM_BUSES; bus++){
							int page = 0;
							readPage(node, bus, chip, blk, page, waitIdleReadBuffer());
						}
					}
				}

			while (true) {
				usleep(100);
				if ( getNumReadsInFlight() == 0 ) break;
			}
			

			//write pages
			//FIXME: in old xbsv, simulatneous DMA reads using multiple readers cause kernel panic
			//Issue each bus separately for now

			int pagesWritten = 0;
			clock_gettime(CLOCK_REALTIME, & start);
			//for (int node=NUM_NODES-1; node >= 1; node--) 
			//for (int node=DST_NODE; node == DST_NODE; node++) 
				for (int blk = 0; blk < BLOCKS_PER_CHIP; blk++){
					for (int chip = 0; chip < CHIPS_PER_BUS; chip++){
						for (int bus = 0; bus < NUM_BUSES; bus++){
							int page = 0;
							//get free tag
							int freeTag = waitIdleWriteBuffer();
							//fill write memory; REMOVE THIS FOR PERFORMANCE TESTING!
							for (int w=0; w<PAGE_SIZE/sizeof(unsigned int); w++) {
								writeBuffers[freeTag][w] = hashAddrToData(node, bus, chip, blk, w);
							}
							//send request
							writePage(node, bus, chip, blk, page, freeTag); 
							pagesWritten++;
						}
					}
				}
			while (true) {
				usleep(100);
				if ( getNumWritesInFlight() == 0 ) break;
			}

			clock_gettime(CLOCK_REALTIME, & now);
			timeElapsed = timespec_diff_sec(start, now);
			fprintf(stderr, "LOG: finished writing! time=%f, numPages=%d, bandwidth=%f MB/s\n", timeElapsed, pagesWritten, (pagesWritten*8)/timeElapsed/1024  );

		} //doerasewrites

	
		sleep(1);
	
		int pagesRead = 0;
		clock_gettime(CLOCK_REALTIME, & start);
		
	
		//for (int node=NUM_NODES-1; node >= 1; node--) {
		//for (int node=DST_NODE; node == DST_NODE; node++) {
		for (int repeat = 0; repeat < 10; repeat++){
			for (int blk = 0; blk < BLOCKS_PER_CHIP; blk++){
				for (int chip = 0; chip < CHIPS_PER_BUS; chip++){
					for (int bus = 0; bus < NUM_BUSES; bus++){
						pagesRead++;
						int page = 0;
						readPage(node, bus, chip, blk, page, waitIdleReadBuffer());
					}
				}
			}
		}
		//}

		while (true) {
			if ( getNumReadsInFlight() == 0 ) break;
			usleep(100);
		}

		clock_gettime(CLOCK_REALTIME, & now);
		timeElapsed = timespec_diff_sec(start, now);
		fprintf(stderr, "LOG: finished SEQUENTIAL reads! time=%f, numPages=%d, bandwidth=%f MB/s\n", timeElapsed, pagesRead, (pagesRead*8)/timeElapsed/1024  );

		sleep(1);

		pagesRead=0;
		clock_gettime(CLOCK_REALTIME, & start);
		for (int repeat = 0; repeat < 100000; repeat++){
			int bus = rand()%NUM_BUSES;
			int chip = rand()%CHIPS_PER_BUS;
			int blk = rand()%BLOCKS_PER_CHIP;
			int page = rand()%PAGES_PER_BLOCK;
			readPage(node, bus, chip, blk, page, waitIdleReadBuffer());
			pagesRead++;

		}

		while (true) {
			if ( getNumReadsInFlight() == 0 ) break;
			usleep(100);
		}

		clock_gettime(CLOCK_REALTIME, & now);
		timeElapsed = timespec_diff_sec(start, now);
		fprintf(stderr, "LOG: finished RANDOM reads! time=%f, numPages=%d, bandwidth=%f MB/s\n", timeElapsed, pagesRead, (pagesRead*8)/timeElapsed/1024  );




		device->debugDumpReq(0);
		sleep(1);
		


		for ( int t = 0; t < NUM_TAGS; t++ ) {
			for ( int i = 0; i < PAGE_SIZE/sizeof(unsigned int); i++ ) {
				fprintf(stderr,  "%x %x %x\n", t, i, readBuffers[t][i] );
			}
		}
		if (!verbose) {
			fprintf(stderr, "LOG: DONE! data check skipped\n");
		} 
		else if (testPass==1) {
			fprintf(stderr, "LOG: TEST PASSED!\n");
		}
		else {
			fprintf(stderr, "LOG: **ERROR: TEST FAILED!\n");
		}
		

	} 
	else {
		fprintf(stderr, "Sleeping infinitely...\n");
		while (true) {
		device->debugDumpReq(0);
		sleep(1);
		}
		sleep(1000000);
	}
}