/** Program start */ int main(int argc, char *argv[]) { int rank = 0; int np = 0; char hostname[MPI_MAX_PROCESSOR_NAME + 1]; int namelen = 0; MPI_Init(&argc, &argv); /* starts MPI */ MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Get process id */ MPI_Comm_size(MPI_COMM_WORLD, &np); /* Get number of processes */ MPI_Get_processor_name(hostname, &namelen); /* Get hostname of node */ printf("[Using Host:%s -- Rank %d out of %d]\n", hostname, rank, np); /* These tests use 16 processes */ if (np != 16) { printf("Error: np=%d. Please use 16 processes\n", np); } /** Test different sizes */ exit_on_fail( random_matrix_test(16, 16, 16, 4, 4, 1)); exit_on_fail( random_matrix_test(32, 32, 32, 4, 4, 1)); exit_on_fail( random_matrix_test(128, 128, 128, 4, 4, 1)); /* Test different shapes */ exit_on_fail( random_matrix_test(128, 32, 128, 4, 4, 1)); exit_on_fail( random_matrix_test(64, 32, 128, 4, 4, 1)); /* Test different process grids */ exit_on_fail( random_matrix_test(128, 128, 128, 8, 2, 1)); exit_on_fail( random_matrix_test(128, 128, 128, 2, 8, 1)); exit_on_fail( random_matrix_test(128, 128, 128, 1, 16, 1)); exit_on_fail( random_matrix_test(128, 128, 128, 16, 1, 1)); finalize: MPI_Finalize(); return 0; }
void __assert_failure( const char *condition, const char *file, unsigned int line, const char *function) { if(in_test()) { printf("Bail out! %s:%d assert failure `%s'\n", file, line, condition); exit_on_fail(); } else { printf("testbench %lu:%lu %s(`%s', `%s', %u, `%s')\n", L4_ThreadNo(L4_Myself()), L4_Version(L4_Myself()), __func__, condition, file, line, function); abort(); for(;;) { asm volatile("int $1"); } } }
void _fail_unless( int result, const char *file, int line, const char *expr, ...) { if(unlikely(!result)) { va_list ap; char buf[512]; va_start(ap, expr); const char *msg = va_arg(ap, char *); if(msg == NULL) msg = expr; vsnprintf(buf, sizeof(buf), msg, ap); va_end(ap); printf("Bail out! %s (`%s' in %s:%d)\n", buf, expr, file, line); flush_log(true); exit_on_fail(); }