2 * Block Matrix Multiplication example
7 #include "Matrix_init.h"
11 /*int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
12 int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
20 XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi,
21 "Messages specific for this msg example");
25 int main(int argc, char ** argv)
28 size_t m = 1024 , n = 1024 , k = 1024;
30 size_t Block_size = k/NB_Block ;
31 size_t NB_groups = 1, group = 0, key = 0;
40 size_t row, col, size_row, size_col; //description: vitual processor topology
44 MPI_Init(&argc, &argv);
46 /* Find out my identity in the default communicator */
48 MPI_Comm_rank ( MPI_COMM_WORLD, &myrank );
49 MPI_Comm_size ( MPI_COMM_WORLD, &NB_proc );
52 for (size_col=NB_proc/2; NB_proc%size_col; size_col--);
56 size_row = NB_proc/size_col;
57 if (size_row > size_col){
59 size_row = NB_proc/size_col;
72 //get the parameter from command line
73 while ((opt = getopt(argc, argv, "hr:c:M:N:K:B:G:g:k:P:")) != -1) {
77 "Usage: mxm_cblas_test [options]\n"
78 " -M I M size (default: %zu)\n"
79 " -N I N size (default: %zu)\n"
80 " -K I K size (default: %zu)\n"
81 " -B I Block size on the k dimension(default: %zu)\n"
82 " -G I Number of processor groups(default: %zu)\n"
83 " -g I group index(default: %zu)\n"
84 " -k I group rank(default: %zu)\n"
85 " -r I processor row size (default: %zu)\n"
86 " -c I processor col size (default: %zu)\n"
88 m, n, k, Block_size, NB_groups, group, key, row, col);
100 Block_size = atoi(optarg);
103 NB_groups = atoi(optarg);
106 group = atoi(optarg);
112 size_row = atoi(optarg);
115 size_col = atoi(optarg);
118 str_mask = strdup(optarg);
129 // Defined the device if we use the GPU
130 //TODO explain parameters
133 two_dot_five( m, k, n, Block_size, group, key,
134 size_row, size_col, NB_groups);
136 // close properly the pragram
137 MPI_Barrier(MPI_COMM_WORLD);