diff --git a/prod_mat_vec/bin/Debug/prod_mat_vec.exe b/prod_mat_vec/bin/Debug/prod_mat_vec.exe
index 7d4224c794774bd4bb59b11f23ddb626c5e0b9d2..8e88eef60cc0b0fed0ed4dcb12d5eef57bc02bca 100644
Binary files a/prod_mat_vec/bin/Debug/prod_mat_vec.exe and b/prod_mat_vec/bin/Debug/prod_mat_vec.exe differ
diff --git a/prod_mat_vec/main.c b/prod_mat_vec/main.c
index d2bf2f18a8edc9618d0d1f2935bdbd831dfe46c1..3092c580c465782b2c0b909db0e047a5dd317924 100644
--- a/prod_mat_vec/main.c
+++ b/prod_mat_vec/main.c
@@ -3,6 +3,8 @@
 #include <mpi.h>
 #include <time.h>
 
+#define DEBUG 0
+
 /*
 Commands :
 cd 'B:\Mes Documents\progra\calcInt\'
@@ -63,11 +65,13 @@ void prod_mat_vec(int width, int height, float * vector_res, float ** matrix, fl
 
 int main (int argc, char *argv[]) {
     int rank, size, size_prob, w_prob, h_prob, h_base;
-    float * vector;
-    float * vector_tot;
-    float * vector_res;
-    float * vector_res_tot;
-    float ** matrix=0;
+    float * vector; // processus' x vector
+    float * vector_tot; // x vector agregation from all the processus
+    float * vector_res; // product matrix vector's result of the current processus
+    float * vector_res_tot; // y vector agregation from all the processus
+    int * recvcounts; // number of element for each process
+    int * displs; // number of element for each process
+    float ** matrix;
 
     MPI_Status status;
 
@@ -76,62 +80,109 @@ int main (int argc, char *argv[]) {
     MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* get current process id */
     MPI_Comm_size(MPI_COMM_WORLD, &size); /* get number of processes */
 
+    if(DEBUG)
+        printf("proc %d :\n",rank);
+
+    /* Get the user input */
+    size_prob=size*2;
+    if(argc==2){
+        size_prob=atoi(argv[1]);
+        if(rank==0)
+            printf("You have set the size of the matrice at %d.\n",size_prob);
+        if(size_prob==0){
+            size_prob=size*2;
+            printf("You gave a wrong argument for the matrice's size, it has been set as %d by default.\n",size_prob);
+        }
+    }else{
+        if(rank==0)
+            printf("You didn't give any argument the size of the matrice has been set as %d by default.\n",size_prob);
+    }
 
-    printf("proc %d :\n",rank);
-
-    size_prob=8;
-
-    h_base=(size_prob/size)+1; //
+    /* Define the size of the problem */
+    h_base=(size_prob/size)+1; // h_base is the default height given to all the processus except the last one
     if(size_prob%size==0){
-        h_prob=size_prob/size;
+        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%size;
+            h_prob=size_prob%h_base;
         }
     }
-    w_prob=size_prob;
-    printf("height %d : %d\n",rank,h_prob);
+    w_prob=size_prob; // w_prob is not dependent of the number of processus.
+    if(DEBUG)
+        printf("height %d : %d\n",rank,h_prob);
 
-    vector=malloc(sizeof(float)*h_base);
+    /* Variables' allocation */
+    vector=malloc(sizeof(float)*h_prob);
     vector_tot=malloc(sizeof(float)*size_prob);
-    vector_res=malloc(sizeof(float)*h_base);
+    vector_res=malloc(sizeof(float)*h_prob);
     vector_res_tot=malloc(sizeof(float)*size_prob);
+    recvcounts=malloc(sizeof(int)*size);
+    displs=malloc(sizeof(int)*size);
 
-    matrix = (int **)malloc(w_prob * sizeof(float*));
-    for(int i=0;i<h_base;i++){
-        matrix[i]=malloc(sizeof(float)*w_prob);
+    matrix = (float **)malloc(h_prob * sizeof(float));
+    for(int i=0;i<h_prob;i++){
+        matrix[i]=(float *)malloc(sizeof(float)*w_prob);
+    }
+    /* Main variables initialisation */
+    initProb(w_prob, h_prob, matrix, vector, rank);
+    MPI_Allgather(&h_prob, 1, MPI_INT, recvcounts, 1, MPI_INT, MPI_COMM_WORLD); // let's get this information from all the processus (it's more flexible as a block)
+    int displ = 0;
+    for(int i=0;i!=rank;i++)
+        displ+=recvcounts[i];
+    MPI_Allgather(&displ, 1, MPI_INT, displs, 1, MPI_INT, MPI_COMM_WORLD); // let's get this information from all the processus (it's more flexible as a block)
+
+    /* Show some debug informations to check this initialisation */
+    if(DEBUG)
+        printMatrix(w_prob, h_prob, matrix);
+    if(DEBUG)
+        printVector(h_prob, vector);
+    if(rank==0){
+        if(DEBUG){
+            printf("buf_count_all : \n");
+            for(int i=0;i!=size;i++){
+                printf("%d - ",recvcounts[i]);
+                printf("%d\n",displs[i]);
+            }
+        }
+    }
+    /* Share the x vector through all trhe processus */
+    MPI_Allgatherv(vector,h_prob,MPI_FLOAT,vector_tot,recvcounts,displs,MPI_FLOAT, MPI_COMM_WORLD);
+    if(DEBUG){
+        printf("Vector total %d : \n",rank);
+        printVector(size_prob,vector_tot);
     }
-    initProb(w_prob,h_prob,matrix,vector,rank);
-
-    printMatrix(w_prob,h_prob,matrix);
-    printVector(h_prob,vector);
-
-    MPI_Allgather(vector,h_prob,MPI_FLOAT,vector_tot,h_base,MPI_FLOAT, MPI_COMM_WORLD);
-    printf("Vector total %d : \n",rank);
-    printVector(size_prob,vector_tot);
 
+    /* Perform the product vector matrix */
     prod_mat_vec(w_prob,h_prob,vector_res,matrix,vector_tot);
 
-    printf("Vector res %d : \n",rank);
-    printVector(h_prob,vector_res);
-
-    MPI_Allgather(vector_res,h_prob,MPI_FLOAT,vector_res_tot,h_base,MPI_FLOAT, MPI_COMM_WORLD);
+    if(DEBUG){
+        printf("Vector res %d : \n",rank);
+        printVector(h_prob,vector_res);
+    }
 
+    /* Gather the result product vector matrix's result through all the processus */
+    MPI_Allgatherv(vector_res,h_prob,MPI_FLOAT,vector_res_tot,recvcounts,displs,MPI_FLOAT, MPI_COMM_WORLD);
+    /* And show only one time the final vector */
     if(rank==0){
-        printf("prod_vec_matrice = \n");
+        printf("final vector tot : \n");
         printVector(size_prob,vector_res_tot);
     }
 
-    /*MPI_Send(&test,1,MPI_DOUBLE,0,10,MPI_COMM_WORLD);
-    MPI_Recv(&test,1,MPI_DOUBLE,0,10,MPI_COMM_WORLD,&status);*/
-
+    /* Let's free all the memory allocated */
     free(vector);
+    free(vector_tot);
+    free(vector_res);
+    free(vector_res_tot);
+    free(recvcounts);
+    free(displs);
     for(int i=0;i<h_prob;i++){
         free(matrix[i]);
     }
+    free(matrix);
 
+    /* And finalize */
     MPI_Finalize();
 }
diff --git a/prod_mat_vec/obj/Debug/main.o b/prod_mat_vec/obj/Debug/main.o
index 4cd9353604a54bfa8653c73455f2280b0073cb72..3c48403841ef68315b839812c08864bf2315d703 100644
Binary files a/prod_mat_vec/obj/Debug/main.o and b/prod_mat_vec/obj/Debug/main.o differ
diff --git a/prod_mat_vec/prod_mat_vec.depend b/prod_mat_vec/prod_mat_vec.depend
index 7b8e971c1c8efe7c88a297db341595e25c41c688..20a876c193fc5550e669aba3d822d90c675ff4cc 100644
--- a/prod_mat_vec/prod_mat_vec.depend
+++ b/prod_mat_vec/prod_mat_vec.depend
@@ -1,5 +1,5 @@
 # depslib dependency file v1.0
-1488577259 source:b:\mes documents\progra\calcint\prod_mat_vec\main.c
+1488910513 source:b:\mes documents\progra\calcint\prod_mat_vec\main.c
 	<stdio.h>
 	<stdlib.h>
 	<mpi.h>
diff --git a/prod_mat_vec/prod_mat_vec.layout b/prod_mat_vec/prod_mat_vec.layout
new file mode 100644
index 0000000000000000000000000000000000000000..151bf45d1ca4213a6cc568c23f371b32a3ff6b09
--- /dev/null
+++ b/prod_mat_vec/prod_mat_vec.layout
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_layout_file>
+	<FileVersion major="1" minor="0" />
+	<ActiveTarget name="Debug" />
+	<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="184" topLine="115" />
+		</Cursor>
+	</File>
+</CodeBlocks_layout_file>