/** 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; }
int main(int argc, char *argv[]) { random_matrix_test(); return EXIT_SUCCESS; }