예제 #1
0
파일: Main.cpp 프로젝트: CarlEbeling/OpenHT
int main(int argc, char **argv)
{
	CHtHif *pHtHif = new CHtHif();
	CHtSuUnit *pSuUnit = new CHtSuUnit(pHtHif);

	printf("#AUs = %d\n", pHtHif->GetUnitCnt());
	fflush(stdout);

	for (int i = 0; i < CNT; i++)
		arr[i] = i;


	for (int i = 0; i < THREADS; i += 1)
		while (!pSuUnit->SendCall_htmain((uint64_t)&arr)) ;

	// wait for return
	uint32_t err;
	uint32_t errCnt = 0;

	for (int i = 0; i < THREADS; i += 1) {
		while (!pSuUnit->RecvReturn_htmain(err))
			usleep(1000);
		errCnt += err;
	}

	delete pHtHif;

	if (err)
		printf("FAILED: detected %d issues!\n", err);
	else
		printf("PASSED\n");

	return err;
}
예제 #2
0
파일: Main.cpp 프로젝트: mdjamoos/OpenHT
int main(int argc, char **argv)
{
	for (int i = 0; i < CNT; i++) {
		arr[i * 2] = i;
		arr[i * 2 + 1] = 0xdeadbeefdeadbeefLL;
	}

	CHtHifParams htHifParams;
	htHifParams.m_bHtHifHugePage = true;

	CHtHif *pHtHif;
	try {
		pHtHif = new CHtHif(&htHifParams);
	}
	catch (CHtException &htException) {
		printf("new CHtHif threw an exception: '%s'\n", htException.GetMsg().c_str());
		exit(1);
	}

	CHtSuUnit *pUnit = new CHtSuUnit(pHtHif);

	printf("#AUs = %d\n", pHtHif->GetUnitCnt());
	fflush(stdout);

	pHtHif->SendAllHostMsg(SU_ARRAY_ADDR, (uint64_t)&arr);
	//pUnit->SendHostMsg(SU_ARRAY_ADDR, (uint64_t)&arr);

	pUnit->SendCall_htmain(CNT);

	// wait for return
	uint32_t rtn_elemCnt;
	while (!pUnit->RecvReturn_htmain(rtn_elemCnt))
		usleep(1);

	delete pUnit;
	delete pHtHif;

	printf("RTN: elemCnt = %d\n", rtn_elemCnt);

	// check results
	int err_cnt = 0;
	for (unsigned i = 0; i < CNT; i++) {
		if (arr[i * 2 + 1] != i + 1) {
			printf("arr[%d] is %lld, should be %d\n",
			       i, (long long)arr[i * 2 + 1], i + 1);
			err_cnt++;
		}
	}

	if (err_cnt)
		printf("FAILED: detected %d issues!\n", err_cnt);
	else
		printf("PASSED\n");

	return err_cnt;
}
예제 #3
0
파일: Main.cpp 프로젝트: CarlEbeling/OpenHT
int main(int argc, char **argv)
{
	CHtHif *pHtHif = new CHtHif();
	CHtSuUnit *pSuUnit = new CHtSuUnit(pHtHif);

	printf("#AUs = %d\n", pHtHif->GetUnitCnt());
	fflush(stdout);

	pSuUnit->SendCall_htmain();

	// wait for return
	while (!pSuUnit->RecvReturn_htmain())
		usleep(1000);

	delete pHtHif;

	printf("PASSED\n");

	return 0;
}