Просмотр исходного кода

fix assert bug + reduce warning

Corentin Salingue лет назад: 12
Родитель
Сommit
fcae2dca11
3 измененных файлов с 23 добавлено и 14 удалено
  1. 4 4
      src/core/disk.c
  2. 9 5
      src/core/disk_ops/disk_stdio.c
  3. 10 5
      src/core/disk_ops/unistd/disk_unistd_global.c

+ 4 - 4
src/core/disk.c

@@ -123,7 +123,7 @@ _starpu_disk_free(unsigned node, void *obj, size_t size)
 
 /* src_node == disk node and dst_node == STARPU_MAIN_RAM */
 int 
-_starpu_disk_read(unsigned src_node, unsigned dst_node, void *obj, void *buf, off_t offset, size_t size, void * async_channel)
+_starpu_disk_read(unsigned src_node, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, void *obj, void *buf, off_t offset, size_t size, void * async_channel)
 {
 	int pos = get_location_with_node(src_node);
         int values = -1;
@@ -150,13 +150,13 @@ _starpu_disk_read(unsigned src_node, unsigned dst_node, void *obj, void *buf, of
 	return -EAGAIN;
 }
 
-int _starpu_disk_full_read(unsigned src_node, unsigned dst_node, void * obj, void ** ptr, size_t * size)
+int _starpu_disk_full_read(unsigned src_node, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, void * obj, void ** ptr, size_t * size)
 {
 	int pos = get_location_with_node(src_node);
         return disk_register_list[pos]->functions->full_read(src_node, disk_register_list[pos]->base, obj, ptr, size);
 }
 
-int _starpu_disk_full_write(unsigned src_node, unsigned dst_node, void * obj, void * ptr, size_t size)
+int _starpu_disk_full_write(unsigned src_node STARPU_ATTRIBUTE_UNUSED, unsigned dst_node, void * obj, void * ptr, size_t size)
 {
 	int pos = get_location_with_node(dst_node);
         return disk_register_list[pos]->functions->full_write(dst_node, disk_register_list[pos]->base, obj, ptr, size);
@@ -164,7 +164,7 @@ int _starpu_disk_full_write(unsigned src_node, unsigned dst_node, void * obj, vo
 
 /* src_node == STARPU_MAIN_RAM and dst_node == disk node */
 int 
-_starpu_disk_write(unsigned src_node, unsigned dst_node, void *obj, void *buf, off_t offset, size_t size, void * async_channel)
+_starpu_disk_write(unsigned src_node STARPU_ATTRIBUTE_UNUSED, unsigned dst_node, void *obj, void *buf, off_t offset, size_t size, void * async_channel)
 {
 	int pos = get_location_with_node(dst_node);
         int values = -1;

+ 9 - 5
src/core/disk_ops/disk_stdio.c

@@ -198,7 +198,7 @@ starpu_stdio_close (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, size_t size S
 
 /* read the memory disk */
 static int 
-starpu_stdio_read (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, void *buf, off_t offset, size_t size, void * async_channel)
+starpu_stdio_read (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, void *buf, off_t offset, size_t size, void * async_channel STARPU_ATTRIBUTE_UNUSED)
 {
 	struct starpu_stdio_obj * tmp = (struct starpu_stdio_obj *) obj;
 		
@@ -236,7 +236,7 @@ starpu_stdio_async_read (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, void *bu
 }
 
 static int
-starpu_stdio_full_read(unsigned node, void *base, void * obj, void ** ptr, size_t * size)
+starpu_stdio_full_read(unsigned node, void *base STARPU_ATTRIBUTE_UNUSED, void * obj, void ** ptr, size_t * size)
 {
 	struct starpu_stdio_obj * tmp = (struct starpu_stdio_obj *) obj;
 
@@ -247,7 +247,7 @@ starpu_stdio_full_read(unsigned node, void *base, void * obj, void ** ptr, size_
 
 /* write on the memory disk */
 static int 
-starpu_stdio_write (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, const void *buf, off_t offset, size_t size, void * async_channel)
+starpu_stdio_write (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, const void *buf, off_t offset, size_t size, void * async_channel STARPU_ATTRIBUTE_UNUSED)
 {
 	struct starpu_stdio_obj * tmp = (struct starpu_stdio_obj *) obj;
 
@@ -283,7 +283,7 @@ starpu_stdio_async_write (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, void *b
 }
 
 static int
-starpu_stdio_full_write (unsigned node, void * base, void * obj, void * ptr, size_t size)
+starpu_stdio_full_write (unsigned node, void * base STARPU_ATTRIBUTE_UNUSED, void * obj, void * ptr, size_t size)
 {
 	struct starpu_stdio_obj * tmp = (struct starpu_stdio_obj *) obj;
 	
@@ -299,7 +299,11 @@ starpu_stdio_full_write (unsigned node, void * base, void * obj, void * ptr, siz
 			int val = ftruncate(tmp->descriptor,size);
 #endif
 
-			STARPU_ASSERT_MSG(val < 0,"StarPU Error to truncate file in STDIO full_write function");
+			STARPU_ASSERT_MSG(val >= 0,"StarPU Error to truncate file in STDIO full_write function");
+		}
+		else
+		{
+			STARPU_ASSERT_MSG(0, "Can't allocate size %u on the disk !", (int) size); 
 		}
 	}	
 	return _starpu_disk_write(STARPU_MAIN_RAM, node, obj, ptr, 0, tmp->size, NULL);

+ 10 - 5
src/core/disk_ops/unistd/disk_unistd_global.c

@@ -162,7 +162,7 @@ starpu_unistd_global_close (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, size_
 
 /* read the memory disk */
  int 
-starpu_unistd_global_read (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, void *buf, off_t offset, size_t size, void * async_channel)
+starpu_unistd_global_read (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, void *buf, off_t offset, size_t size, void * async_channel STARPU_ATTRIBUTE_UNUSED)
 {
 	struct starpu_unistd_global_obj * tmp = (struct starpu_unistd_global_obj *) obj;
 
@@ -201,7 +201,7 @@ starpu_unistd_global_async_read (void *base STARPU_ATTRIBUTE_UNUSED, void *obj,
 }
 
 int
-starpu_unistd_global_full_read(unsigned node, void *base, void * obj, void ** ptr, size_t * size)
+starpu_unistd_global_full_read(unsigned node, void *base STARPU_ATTRIBUTE_UNUSED, void * obj, void ** ptr, size_t * size)
 {
         struct starpu_unistd_global_obj * tmp = (struct starpu_unistd_global_obj *) obj;
 
@@ -213,7 +213,7 @@ starpu_unistd_global_full_read(unsigned node, void *base, void * obj, void ** pt
 
 /* write on the memory disk */
  int 
-starpu_unistd_global_write (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, const void *buf, off_t offset, size_t size, void * async_channel)
+starpu_unistd_global_write (void *base STARPU_ATTRIBUTE_UNUSED, void *obj, const void *buf, off_t offset, size_t size, void * async_channel STARPU_ATTRIBUTE_UNUSED)
 {
 	struct starpu_unistd_global_obj * tmp = (struct starpu_unistd_global_obj *) obj;
 
@@ -251,7 +251,7 @@ starpu_unistd_global_async_write (void *base STARPU_ATTRIBUTE_UNUSED, void *obj,
 }
 
 int
-starpu_unistd_global_full_write (unsigned node, void * base, void * obj, void * ptr, size_t size)
+starpu_unistd_global_full_write (unsigned node, void * base STARPU_ATTRIBUTE_UNUSED, void * obj, void * ptr, size_t size)
 {
         struct starpu_unistd_global_obj * tmp = (struct starpu_unistd_global_obj *) obj;
 
@@ -267,8 +267,13 @@ starpu_unistd_global_full_write (unsigned node, void * base, void * obj, void *
                         int val = ftruncate(tmp->descriptor,size);
 #endif
 
-                        STARPU_ASSERT_MSG(val < 0,"StarPU Error to truncate file in STDIO full_write function");
+                        STARPU_ASSERT_MSG(val >= 0,"StarPU Error to truncate file in UNISTD full_write function");
                 }
+                else
+                {
+                        STARPU_ASSERT_MSG(0, "Can't allocate size %u on the disk !", (int) size);
+                }
+
         }
 	return _starpu_disk_write(STARPU_MAIN_RAM, node, obj, ptr, 0, tmp->size, NULL);
 }