Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / teshsuite / smpi / type-hvector / type-hvector.c
index ef277ac..b303b8d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014. The SimGrid Team.
+/* Copyright (c) 2012-2023. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -9,7 +9,7 @@
 #define SIZE 4
 
 int main(int argc, char **argv) {
-  int rank, i, j;
+  int rank;
   double a[SIZE][SIZE] = {{0}};
 
   MPI_Datatype columntype;
@@ -20,18 +20,17 @@ int main(int argc, char **argv) {
   MPI_Type_hvector(SIZE, 1, SIZE*sizeof(double), MPI_DOUBLE, &columntype);
   MPI_Type_commit(&columntype);
 
-
     if (rank == 0) {
-      for(i=0; i <SIZE;i++)
-        for(j=0; j <SIZE;j++)
-          a[i][j] = i*SIZE+j;
+      for (int i = 0; i < SIZE; i++)
+        for (int j = 0; j < SIZE; j++)
+          a[i][j] = i * SIZE + j;
     }
 
-    /* only one column is send this is an exemple for non-contignous data*/
+    /* only one column is sent this is an example for non-contiguous data*/
     MPI_Bcast(a, 1, columntype, 0, MPI_COMM_WORLD);
 
-    for(i=0; i<SIZE; i++){
-      for (j=0; j < SIZE; j++) {
+    for (int i = 0; i < SIZE; i++) {
+      for (int j = 0; j < SIZE; j++) {
         printf("rank= %d, a[%d][%d]=%f\n", rank, i, j, a[i][j]);
       }
       printf("\n");
@@ -41,4 +40,3 @@ int main(int argc, char **argv) {
   MPI_Finalize();
   return 0;
 }
-