2 * Block Matrix Multiplication example
9 #include "Matrix_init.h"
13 /*int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
14 int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
22 XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi,
23 "Messages specific for this msg example");
27 int main(int argc, char ** argv)
30 size_t m = 1024 , n = 1024 , k = 1024;
32 size_t Block_size = k/NB_Block ;
33 size_t NB_groups = 1, group = 0, key = 0;
42 size_t row, col, size_row, size_col; //description: vitual processor topology
46 MPI_Init(&argc, &argv);
48 /* Find out my identity in the default communicator */
50 MPI_Comm_rank ( MPI_COMM_WORLD, &myrank );
51 MPI_Comm_size ( MPI_COMM_WORLD, &NB_proc );
54 for (size_col=NB_proc/2; NB_proc%size_col; size_col--);
58 size_row = NB_proc/size_col;
59 if (size_row > size_col){
61 size_row = NB_proc/size_col;
72 char *conf_file = NULL;
75 //get the parameter from command line
76 while ((opt = getopt(argc, argv, "hdf:r:c:M:N:K:B:G:g:k:P:")) != -1) {
80 "Usage: mxm_cblas_test [options]\n"
81 " -M I M size (default: %zu)\n"
82 " -N I N size (default: %zu)\n"
83 " -K I K size (default: %zu)\n"
84 " -B I Block size on the k dimension(default: %zu)\n"
85 " -G I Number of processor groups(default: %zu)\n"
86 " -g I group index(default: %zu)\n"
87 " -k I group rank(default: %zu)\n"
88 " -r I processor row size (default: %zu)\n"
89 " -c I processor col size (default: %zu)\n"
90 " -f {Filename} provide the file with the configuration\n"
91 " -d display the configuration file on the stderr\n"
93 m, n, k, Block_size, NB_groups, group, key, row, col);
105 Block_size = atoi(optarg);
108 NB_groups = atoi(optarg);
111 group = atoi(optarg);
117 size_row = atoi(optarg);
120 size_col = atoi(optarg);
123 str_mask = strdup(optarg);
126 conf_file = strdup(optarg);
134 print_conf(MPI_COMM_WORLD, myrank,NULL,NULL);
135 MPI_Barrier(MPI_COMM_WORLD);
142 if(conf_file == NULL){
143 conf = get_conf(MPI_COMM_WORLD, "default_conf", -1);
145 conf = get_conf(MPI_COMM_WORLD, conf_file, -1);
146 //conf_all = get_conf_all(conf_file);
150 "No configuration for me inside the file\n");
155 /* Get my group number from the config file */
156 group = (size_t)atoi(conf[4]);
165 // Defined the device if we use the GPU
166 //TODO explain parameters
169 two_dot_five( m, k, n, Block_size, group, key,
170 size_row, size_col, NB_groups);
172 // close properly the pragram
173 MPI_Barrier(MPI_COMM_WORLD);