2 * Block Matrix Multiplication example
4 * Authors: Quintin Jean-Noël
10 #include "Matrix_init.h"
14 /*int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
15 int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
23 XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi,
24 "Messages specific for this msg example");
28 int main(int argc, char ** argv)
31 size_t m = 1024 , n = 1024 , k = 1024;
33 size_t Block_size = k/NB_Block ;
34 size_t NB_groups = 1, group = 0, key = 0;
43 size_t row, col, size_row, size_col; //description: vitual processor topology
47 MPI_Init(&argc, &argv);
49 /* Find out my identity in the default communicator */
51 MPI_Comm_rank ( MPI_COMM_WORLD, &myrank );
52 MPI_Comm_size ( MPI_COMM_WORLD, &NB_proc );
55 for (size_col=NB_proc/2; NB_proc%size_col; size_col--);
59 size_row = NB_proc/size_col;
60 if (size_row > size_col){
62 size_row = NB_proc/size_col;
73 char *conf_file = NULL;
76 //get the parameter from command line
77 while ((opt = getopt(argc, argv, "hdf:r:c:M:N:K:B:G:g:k:P:")) != -1) {
81 "Usage: mxm_cblas_test [options]\n"
82 " -M I M size (default: %zu)\n"
83 " -N I N size (default: %zu)\n"
84 " -K I K size (default: %zu)\n"
85 " -B I Block size on the k dimension(default: %zu)\n"
86 " -G I Number of processor groups(default: %zu)\n"
87 " -g I group index(default: %zu)\n"
88 " -k I group rank(default: %zu)\n"
89 " -r I processor row size (default: %zu)\n"
90 " -c I processor col size (default: %zu)\n"
91 " -f {Filename} provide the file with the configuration\n"
92 " -d display the configuration file on the stderr\n"
94 m, n, k, Block_size, NB_groups, group, key, row, col);
106 Block_size = atoi(optarg);
109 NB_groups = atoi(optarg);
112 group = atoi(optarg);
118 size_row = atoi(optarg);
121 size_col = atoi(optarg);
124 str_mask = strdup(optarg);
127 conf_file = strdup(optarg);
135 print_conf(MPI_COMM_WORLD, myrank,NULL,NULL);
136 MPI_Barrier(MPI_COMM_WORLD);
143 if(conf_file == NULL){
144 conf = get_conf(MPI_COMM_WORLD, "default_conf", -1);
146 conf = get_conf(MPI_COMM_WORLD, conf_file, -1);
147 //conf_all = get_conf_all(conf_file);
151 "No configuration for me inside the file\n");
156 /* Get my group number from the config file */
157 group = (size_t)atoi(conf[4]);
166 // Defined the device if we use the GPU
167 //TODO explain parameters
170 two_dot_five( m, k, n, Block_size, group, key,
171 size_row, size_col, NB_groups);
173 // close properly the pragram
174 MPI_Barrier(MPI_COMM_WORLD);