Skip to content
Snippets Groups Projects
Commit 28249166 authored by Nicolas Fley's avatar Nicolas Fley
Browse files

Dispatching matrix size optimised

parent 37a8dabd
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -3,7 +3,7 @@
#include <mpi.h>
#include <time.h>
#define DEBUG 0
#define DEBUG 1
/*
Commands :
......@@ -11,25 +11,6 @@ cd 'B:\Mes Documents\progra\calcInt\'
C:\MPICH2\bin\mpiexec.exe -localonly 10
*/
/*
* The reference book says we should use all_gather and all_gatherv to make all the processors
* access the x vector.
* BUT, what fonction should we use to get the entire . Moreover
* the website http://mpitutorial.com say that MPI_Allgather should be used "only"
* if all the processes contains a part of the data and EACH ONE want the entire data
* dispatched through the processes.
* This image :http://mpitutorial.com/tutorials/mpi-scatter-gather-and-allgather/allgather.png
* Show this point.
* More over according to the problematic given MPI_Scatter and MPI_Gather seems to be
* more usable in this specific context of a dense matrix vector product.
*
* Moreover, it is said that we should use allgatherv to get the final matrix but, if we consider
* this stackoverflow answer :
* http://stackoverflow.com/questions/15049190/difference-between-mpi-allgather-and-mpi-alltoall-functions#answer-34113431
* We see that using all gatherv will duplicate the data through each processor.
* Using gather seems more appropriated.
*/
void printMatrix(int width, int height, float **matrix){
for(int i=0; i!=height; i++){
for(int j=0; j!=width; j++){
......@@ -104,10 +85,9 @@ int main (int argc, char *argv[]) {
h_prob=size_prob/size; // h_prob is the processus' problem height
h_base=h_prob;
}else{
if(rank!=size-1)
h_prob=(size_prob/size)+1;
else{
h_prob=size_prob%h_base;
h_prob=(size_prob/size);
if(rank<size_prob%h_base-1){
h_prob+=1;
}
}
w_prob=size_prob; // w_prob is not dependent of the number of processus.
......
No preview for this file type
# depslib dependency file v1.0
1488910513 source:b:\mes documents\progra\calcint\prod_mat_vec\main.c
1488995164 source:b:\mes documents\progra\calcint\prod_mat_vec\main.c
<stdio.h>
<stdlib.h>
<mpi.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment