Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add a test with an intentional leak for previous feature.
authorAugustin Degomme <adegomme@gmail.com>
Sun, 14 Mar 2021 22:37:51 +0000 (23:37 +0100)
committerAugustin Degomme <adegomme@gmail.com>
Sun, 14 Mar 2021 22:39:01 +0000 (23:39 +0100)
Will probably need to be added to suppressions.. but that will wait tomorrow

teshsuite/smpi/CMakeLists.txt
teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.c [new file with mode: 0644]
teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.tesh [new file with mode: 0644]

index e5aa7b1..388983b 100644 (file)
@@ -6,7 +6,7 @@ if(enable_smpi)
   endif()
 
   include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
-  foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast
+  foreach(x coll-allgather coll-allgatherv coll-allreduce coll-allreduce-with-leaks coll-alltoall coll-alltoallv coll-barrier coll-bcast
             coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong
             type-hvector type-indexed type-struct type-vector bug-17132 gh-139 timers privatization 
             io-simple io-simple-at io-all io-all-at io-shared io-ordered topo-cart-sub)
@@ -35,7 +35,7 @@ if(enable_smpi)
   endif()
 endif()
 
-foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast
+foreach(x coll-allgather coll-allgatherv coll-allreduce coll-allreduce-with-leaks coll-alltoall coll-alltoallv coll-barrier coll-bcast
     coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong
     type-hvector type-indexed type-struct type-vector bug-17132 gh-139 timers privatization
     macro-shared auto-shared macro-partial-shared macro-partial-shared-communication
@@ -68,7 +68,7 @@ if(enable_smpi)
     ADD_TESH_FACTORIES(tesh-smpi-macro-partial-shared-communication "*" --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/macro-partial-shared-communication --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/macro-partial-shared-communication macro-partial-shared-communication.tesh)
   endif()
 
-  foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast
+  foreach(x coll-allgather coll-allgatherv coll-allreduce coll-allreduce-with-leaks coll-alltoall coll-alltoallv coll-barrier coll-bcast
             coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong
            type-hvector type-indexed type-struct type-vector bug-17132 timers io-simple io-simple-at io-all io-all-at io-shared io-ordered topo-cart-sub)
     ADD_TESH_FACTORIES(tesh-smpi-${x} "*" --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/${x} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/${x} ${x}.tesh)
diff --git a/teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.c b/teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.c
new file mode 100644 (file)
index 0000000..bd2f2a0
--- /dev/null
@@ -0,0 +1,60 @@
+/* Copyright (c) 2009-2021. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "mpi.h"
+
+int main(int argc, char *argv[])
+{
+  int rank;
+  int size;
+  int i;
+  int status;
+  int mult=1;
+
+  MPI_Init(&argc, &argv);
+  int maxlen = argc >= 2 ? atoi(argv[1]) : 1;
+
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Comm dup;
+  MPI_Comm_dup(MPI_COMM_WORLD, &dup);
+  MPI_Comm_size(MPI_COMM_WORLD, &size);
+  MPI_Comm_set_errhandler(dup, MPI_ERRORS_RETURN);
+
+  if (maxlen > 1)
+    mult = maxlen > size ? size : maxlen;
+  int* sb = xbt_new0(int, size * maxlen);
+  int* rb = xbt_new0(int, size * maxlen);
+
+  for (i = 0; i < size *maxlen; ++i) {
+    sb[i] = rank*size + i;
+    rb[i] = 0;
+  }
+
+  printf("[%d] sndbuf=[", rank);
+  for (i = 0; i < size *mult; i++)
+    printf("%d ", sb[i]);
+  printf("]\n");
+  status = MPI_Allreduce(sb, rb, size *maxlen, MPI_INT, MPI_SUM, dup);
+
+  printf("[%d] rcvbuf=[", rank);
+  for (i =  0; i < size *mult; i++)//do not print everything
+    printf("%d ", rb[i]);
+  printf("]\n");
+
+  if (rank == 0 && status != MPI_SUCCESS) {
+    printf("all_to_all returned %d\n", status);
+    fflush(stdout);
+  }
+  //Do not free dup
+  xbt_free(sb);
+  xbt_free(rb);
+  MPI_Finalize();
+  return (EXIT_SUCCESS);
+}
diff --git a/teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.tesh b/teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.tesh
new file mode 100644 (file)
index 0000000..4aa5c72
--- /dev/null
@@ -0,0 +1,61 @@
+# Smpi Allreduce collectives tests
+! output sort
+
+p Test allreduce
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allreduce-with-leaks --log=smpi_config.thres:warning --cfg=smpi/display-analysis:yes --cfg=smpi/simulate-computation:no --log=smpi_coll.thres:error --log=smpi_mpi.thres:error --log=smpi_pmpi.thres:error
+> [rank 0] -> Tremblay
+> [rank 1] -> Tremblay
+> [rank 2] -> Tremblay
+> [rank 3] -> Tremblay
+> [rank 4] -> Jupiter
+> [rank 5] -> Jupiter
+> [rank 6] -> Jupiter
+> [rank 7] -> Jupiter
+> [rank 8] -> Fafard
+> [rank 9] -> Fafard
+> [rank 10] -> Fafard
+> [rank 11] -> Fafard
+> [rank 12] -> Ginette
+> [rank 13] -> Ginette
+> [rank 14] -> Ginette
+> [rank 15] -> Ginette
+> If this is too much, consider sharing allocations for computation buffers.
+> Largest allocation at once from a single process was 64 bytes, at sysdep.h:87. It was called 32 times during the whole simulation.
+> Running smpirun with -wrapper "valgrind --leak-check=full" can provide more information
+> This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
+> [0.023768] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 31 unfreed MPI handles : display types and addresses (n max) with --cfg=smpi/list-leaks:n.
+> [0.023768] [smpi_utils/INFO] Memory Usage: Simulated application allocated 2048 bytes during its lifetime through malloc/calloc calls.
+> [0] sndbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]
+> [1] sndbuf=[16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [2] sndbuf=[32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 ]
+> [3] sndbuf=[48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ]
+> [4] sndbuf=[64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ]
+> [5] sndbuf=[80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ]
+> [6] sndbuf=[96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 ]
+> [7] sndbuf=[112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 ]
+> [8] sndbuf=[128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 ]
+> [9] sndbuf=[144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 ]
+> [10] sndbuf=[160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 ]
+> [11] sndbuf=[176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 ]
+> [12] sndbuf=[192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 ]
+> [13] sndbuf=[208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 ]
+> [14] sndbuf=[224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 ]
+> [15] sndbuf=[240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ]
+> [0] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [1] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [2] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [3] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [4] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [5] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [6] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [7] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [8] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [9] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [10] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [11] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [12] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [13] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [14] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [15] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> 
+