Esempio n. 1
0
bool
Table::ProfileClass()
{
	TableTestNode	testNode;
#if defined(_ARMOR)
	Time 		startTicks = gos_GetHiResTime();
#endif
	Test_Message("Table::ProfileClass\n");
	testNode.RunProfile();
	SPEW((
			 GROUP_STUFF_TEST,
			 "Table::ProfileClass elapsed = %f",
			 gos_GetHiResTime() - startTicks
		 ));
	return true;
}
Esempio n. 2
0
void
	Tree::ProfileClass()
{
	TreeTestNode	testNode;
	#if defined(_ARMOR)
		Time 		startTicks = gos_GetHiResTime();
	#endif

	Test_Message("Tree::ProfileClass \n");

	testNode.RunProfile();

	SPEW((
		GROUP_STUFF_TEST,
		"Tree::ProfileClass elapsed = %d",
		gos_GetHiResTime() - startTicks
	));
}
Esempio n. 3
0
void
	SafeChain::ProfileClass()
{
	SafeChainTestNode testNode;
	#if defined(_ARMOR)
		Time startTicks = gos_GetHiResTime();
	#endif

	Test_Message("SafeChain::ProfileClass");

	testNode.RunProfile();

	SPEW((
		GROUP_STUFF_TEST,
		"SafeChain::ProfileClass elapsed = %f",
		gos_GetHiResTime() - startTicks
	));
}
Esempio n. 4
0
int main(int argc, char **argv)
{
	int datasize;
	int *sbuf, *rbuf;
	int rank, size;
	int sendcount, *recvcounts, *displs;
	int i, j, k, *p;
	char errmsg[200];
	int bufsize;

	MPI_Init(&argc, &argv);
	Test_Init_No_File();

	MPI_Comm_size(MPI_COMM_WORLD, &size);
	MPI_Comm_rank(MPI_COMM_WORLD, &rank);

	/* is the buffersize specified? */
	if (argc == 2) {
		datasize = atoi(argv[1]);
		if (datasize == 0) {
			fprintf(stderr, "Invalid data size!\n");
			MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
		}
	} else {
		datasize = DATASIZE;
	}

	/* Create the buffers */
	sbuf = (int *) malloc((rank + 1) * datasize * sizeof(int));

	rbuf = (int *) malloc( (size * (size+1) / 2 * datasize  + (size-1)) * sizeof(int) );
	recvcounts = (int *) malloc(size * sizeof(int));
	displs     = (int *) malloc(size * sizeof(int));
	if (!sbuf || !rbuf || !recvcounts || !displs) {
		fprintf(stderr, "Could not allocate buffers!\n");
		MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
	}

	/* Load up the buffers */
	for (i = 0; i < rank + 1; i++) {
		for (j = 0; j < datasize; j++)
			sbuf[i * datasize + j] = i + 100 * rank;
	}
	for (i = 0; i < size * (size + 1) / 2 * datasize + (size-1); i++) {
		rbuf[i] = -(i + 1);
	}

	/* Create the arguments to MPI_Allgatherv() */
	sendcount = (rank + 1) * datasize;
	j = 0;
	for (i = 0; i < size; i++) {
		recvcounts[i] = (i + 1) * datasize;
		displs[i] = j;
		j += (i + 1) * datasize + 1;
	}

	MPI_Allgatherv(sbuf, sendcount, MPI_INT,
				   rbuf, recvcounts, displs, MPI_INT, MPI_COMM_WORLD);

	/* Check rbuf */
	p = rbuf;
	for (i = 0; i < size; i++) {
		for (j = 0; j < i + 1; j++) {
			for (k = 0; k < datasize; k++) {
				if (p[j * datasize + k] != j + 100 * i) {
					sprintf(errmsg, "[%d] got %d expected %d for %dth\n", rank, p[j * datasize + k], j + 100 * i, j * datasize + k);
					Test_Message( errmsg );
					Test_Failed( NULL );
				}
			}
		}
		p += (i + 1) * datasize + 1;
	}

	free(rbuf);
	free(sbuf);
	free(recvcounts);
	free(displs);

	Test_Waitforall();
	Test_Global_Summary();

	MPI_Finalize();
	exit( EXIT_SUCCESS );
}
Esempio n. 5
0
int main(int argc, char **argv)
{
	int datasize;
	int *sbuf, *rbuf;
	int rank, size;
	int i, j, *p;
	char errmsg[200];

	MPI_Init(&argc, &argv);
	Test_Init_No_File();

	MPI_Comm_size(MPI_COMM_WORLD, &size);
	MPI_Comm_rank(MPI_COMM_WORLD, &rank);

	/* is the buffersize specified? */
	if (argc == 2) {
		datasize = atoi(argv[1]);
		if (datasize <= 0) {
			fprintf(stderr, "Invalid data size!\n");
			MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
		}
	} else {
		datasize = DATASIZE;
	}

	/* Create the buffers */
	sbuf = (int *) malloc(datasize * sizeof(int));
	rbuf = (int *) malloc(size * datasize * sizeof(int));
	if (!sbuf || !rbuf) {
		fprintf(stderr, "Could not allocate buffers!\n");
		MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
	}

	/* Load up the buffers */
	for (i = 0; i < datasize; i++) {
		sbuf[i] = i + 100 * rank;
	}
	for (i = 0; i < size * datasize; i++) {
		rbuf[i] = -(i + 1);
	}

	MPI_Allgather(sbuf, datasize, MPI_INT, rbuf, datasize, MPI_INT, MPI_COMM_WORLD);

	/* Check rbuf */
	for (i = 0; i < size; i++) {
		p = rbuf + i * datasize;
		for (j = 0; j < datasize; j++) {
			if (p[j] != j + 100 * i) {
				sprintf(errmsg, "[%d] got %d expected %d for %dth\n", rank, p[j], j + 100 * i, i * datasize + j);
				Test_Message( errmsg );
				Test_Failed( NULL );
			}
		}
	}

	free(rbuf);
	free(sbuf);

	Test_Waitforall();
	Test_Global_Summary();

	MPI_Finalize();
	exit( EXIT_SUCCESS );
}
Esempio n. 6
0
int main(int argc, char **argv)
{
	int rank, size;
	int i, j, k;
	int **table, *buffer;
	int begin_row, end_row, send_count, *recv_counts, *displs;
	char errmsg[200];

	MPI_Init( &argc, &argv );
	Test_Init_No_File();
	
	MPI_Comm_rank( MPI_COMM_WORLD, &rank );
	MPI_Comm_size( MPI_COMM_WORLD, &size );

	/* get buffer space and init table */
	buffer      = (int *) malloc( (size * BLOCKSIZE) * (size * BLOCKSIZE) * sizeof(int) );
	table       = (int **)malloc( (size * BLOCKSIZE) * sizeof(int *) );
	recv_counts = (int *) malloc( size * sizeof(int) );
	displs      = (int *) malloc( size * sizeof(int) );
	if( !buffer || !table || !recv_counts || !displs ) {
		fprintf( stderr, "Out of memory error!\n" );
		MPI_Abort( MPI_COMM_WORLD, EXIT_FAILURE );
	}
	for( i = 0; i < size * BLOCKSIZE; i++ )
		table[i] = &(buffer[i*size*BLOCKSIZE]);

	/* Determine what rows are my responsibility */
	begin_row = rank * BLOCKSIZE;
	end_row   = (rank + 1) * BLOCKSIZE;
	send_count = BLOCKSIZE * size * BLOCKSIZE;
	for( i = 0; i < size; i++ ) {
		recv_counts[i] = BLOCKSIZE * size * BLOCKSIZE;
		displs[i]      = i * BLOCKSIZE * size * BLOCKSIZE;
	}

	/* Paint my rows my color */
	for( i = begin_row; i < end_row ; i++ )
		for( j = 0; j < size * BLOCKSIZE; j++ )
			table[i][j] = rank + 10;

	/* Gather everybody's result together - sort of like an */
	/* inefficient allgather */
	for (i = 0; i < size; i++)
		MPI_Gatherv(table[begin_row], send_count, MPI_INT,
					table[0], recv_counts, displs, MPI_INT, i,
					MPI_COMM_WORLD);

	/* Everybody should have the same table now. */
	for( i = 0; i < size; i++ )
		for( j = 0; j < BLOCKSIZE; j++ )
			for( k = 0; k < size * BLOCKSIZE; k++ )
				if( table[i*BLOCKSIZE+j][k] != i + 10 ) {
					sprintf(errmsg, "[%d] got %d expected %d for %dth entry in row %d\n",
							rank, table[i*BLOCKSIZE+j][k], i + 10, k, i*BLOCKSIZE + j);
					Test_Message( errmsg );
					Test_Failed( NULL );
				}
	
	Test_Waitforall();
	Test_Global_Summary();

	free( buffer );
	free( table );
	free( recv_counts );
	free( displs );

	MPI_Finalize();
	exit( EXIT_SUCCESS );
}