Sfoglia il codice sorgente

Initialize buffers explicitly, to make sure the memory is really allocated before measuring bandwidth & latency.

Samuel Thibault 11 anni fa
parent
commit
4818717708
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      src/core/disk_ops/disk_stdio.c

+ 6 - 2
src/core/disk_ops/disk_stdio.c

@@ -273,7 +273,7 @@ static int get_stdio_bandwidth_between_disk_and_main_ram(unsigned node)
 	struct timeval end;
 
 	srand (time (NULL));
-	char * buf = calloc(1, SIZE_DISK_MIN);
+	char * buf = malloc(SIZE_DISK_MIN);
 	STARPU_ASSERT(buf != NULL);
 
 	/* allocate memory */
@@ -283,6 +283,8 @@ static int get_stdio_bandwidth_between_disk_and_main_ram(unsigned node)
 		return 0;
 	struct starpu_stdio_obj * tmp = (struct starpu_stdio_obj *) mem;
 
+	memset(buf, 0, SIZE_DISK_MIN);
+
 	/* Measure upload slowness */
 	gettimeofday(&start, NULL);
 	for (iter = 0; iter < NITER; ++iter)
@@ -306,9 +308,11 @@ static int get_stdio_bandwidth_between_disk_and_main_ram(unsigned node)
 	/* free memory */
 	free(buf);
 
-	buf = calloc(1, sizeof(char));
+	buf = malloc(1, sizeof(char));
 	STARPU_ASSERT(buf != NULL);
 
+	*buf = 0;
+
 	/* Measure latency */
 	gettimeofday(&start, NULL);
 	for (iter = 0; iter < NITER; ++iter)