Explorar o código

Checkpoint files code style StarPU compliant.

Romain LION %!s(int64=5) %!d(string=hai) anos
pai
achega
c822d6afa9
Modificáronse 2 ficheiros con 76 adicións e 67 borrados
  1. 74 64
      mpi/src/starpu_mpi_checkpoint.c
  2. 2 3
      mpi/tests/checkpoints.c

+ 74 - 64
mpi/src/starpu_mpi_checkpoint.c

@@ -20,74 +20,84 @@
 
 #include <starpu_mpi_checkpoint.h>
 
-int _starpu_mpi_checkpoint_template_register(starpu_mpi_checkpoint_template* cp_template, va_list varg_list) {
-
-    int i = 0;
-    int arg_type;
-
-    starpu_mpi_checkpoint_template _cp_template;
-    _STARPU_MALLOC(_cp_template, sizeof(struct _starpu_mpi_checkpoint_template));
-
-    va_list varg_list_copy;
-    va_copy(varg_list_copy, varg_list);
-
-    while ((arg_type = va_arg(varg_list_copy, int)) != 0) {
-
-        if (i == CHECKPOINT_STRUCTURE_MAX_SIZE) {
-            STARPU_ABORT_MSG("Unable to treat more data (CHECKPOINT_STRUCTURE_MAX_SIZE == %d.\n", \
-                   CHECKPOINT_STRUCTURE_MAX_SIZE);
-        }
-
-        if (arg_type & STARPU_COMMUTE) {
-            STARPU_ABORT_MSG("Unable to checkpoint non sequential task flow.\n");
-        } else if (arg_type==STARPU_R) {
-            _cp_template->items[i].type = STARPU_R;
-            _cp_template->items[i].ptr = va_arg(varg_list_copy, void*);
-            _cp_template->items[i].backup_rank = va_arg(varg_list_copy, int);
-        } else if (arg_type==STARPU_VALUE) {
-            _cp_template->items[i].type = STARPU_VALUE;
-            _cp_template->items[i].ptr = va_arg(varg_list_copy, void*);
-            _cp_template->items[i].count = va_arg(varg_list_copy, int);
-            _cp_template->items[i].backup_rank = va_arg(varg_list_copy, int);
-        } else if (arg_type==STARPU_DATA_ARRAY) {
-
-        } else {
-            STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", \
-                   arg_type);
-        }
-
-        i ++;
-    };
-    va_end(varg_list_copy);
-
-    _cp_template->size = i;
-    _cp_template->checkpoint_id = 50909;
-
-    *cp_template = _cp_template;
-
-    return 0;
+int _starpu_mpi_checkpoint_template_register(starpu_mpi_checkpoint_template*
+cp_template, va_list varg_list)
+{
+	int i = 0;
+	int arg_type;
+
+	starpu_mpi_checkpoint_template _cp_template;
+	_STARPU_MALLOC(_cp_template, sizeof(struct _starpu_mpi_checkpoint_template));
+
+	va_list varg_list_copy;
+	va_copy(varg_list_copy, varg_list);
+
+	while ((arg_type = va_arg(varg_list_copy, int)) != 0) {
+
+		if (i == CHECKPOINT_STRUCTURE_MAX_SIZE)
+		{
+			STARPU_ABORT_MSG("Unable to treat more data (CHECKPOINT_STRUCTURE_MAX_SIZE == %d.\n",
+			                 CHECKPOINT_STRUCTURE_MAX_SIZE);
+		}
+
+		if (arg_type & STARPU_COMMUTE)
+		{
+			STARPU_ABORT_MSG("Unable to checkpoint non sequential task flow.\n");
+		}
+		else if (arg_type==STARPU_R)
+		{
+			_cp_template->items[i].type = STARPU_R;
+			_cp_template->items[i].ptr = va_arg(varg_list_copy, void*);
+			_cp_template->items[i].backup_rank = va_arg(varg_list_copy, int);
+		}
+		else if (arg_type==STARPU_VALUE)
+		{
+			_cp_template->items[i].type = STARPU_VALUE;
+			_cp_template->items[i].ptr = va_arg(varg_list_copy,void*);
+			_cp_template->items[i].count = va_arg(varg_list_copy, int);
+			_cp_template->items[i].backup_rank = va_arg(varg_list_copy, int);
+		}
+		else if (arg_type==STARPU_DATA_ARRAY)
+		{
+
+		}
+		else
+		{
+			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);
+		}
+
+		i ++;
+	};
+	va_end(varg_list_copy);
+
+	_cp_template->size = i;
+	_cp_template->checkpoint_id = 50909;
+
+	*cp_template = _cp_template;
+
+	return 0;
 }
 
 int starpu_mpi_checkpoint_template_register(starpu_mpi_checkpoint_template* cp_template, ...) {
-    va_list varg_list;
-    va_start(varg_list, cp_template);
-    int ret = _starpu_mpi_checkpoint_template_register(cp_template, varg_list);
-    va_end(varg_list);
-    return ret;
+	va_list varg_list;
+	va_start(varg_list, cp_template);
+	int ret = _starpu_mpi_checkpoint_template_register(cp_template, varg_list);
+	va_end(varg_list);
+	return ret;
 }
 
 int starpu_mpi_checkpoint_template_print(starpu_mpi_checkpoint_template cp_template) {
-    int val;
-    for (int i=0 ; i< cp_template->size ; i++) {
-        fprintf(stderr,"Item %2d: ", i);
-        if (cp_template->items[i].type == STARPU_VALUE) {
-            printf("STARPU_VALUE - Value=%d\n", (*(int *)(cp_template->items[i].ptr)));
-        } else if (cp_template->items[i].type == STARPU_R) {
-            val = *(int*)starpu_data_handle_to_pointer(*(starpu_data_handle_t*)(cp_template->items[i].ptr), 0);
-            printf("STARPU_R - Value=%d\n", val);
-        } else {
-            printf("Unrecognized type.\n");
-        }
-    }
-    return 0;
+	int val;
+	for (int i=0 ; i< cp_template->size ; i++) {
+		fprintf(stderr,"Item %2d: ", i);
+		if (cp_template->items[i].type == STARPU_VALUE) {
+			printf("STARPU_VALUE - Value=%d\n", (*(int *)(cp_template->items[i].ptr)));
+		} else if (cp_template->items[i].type == STARPU_R) {
+			val = *(int*)starpu_data_handle_to_pointer(*(starpu_data_handle_t*)(cp_template->items[i].ptr), 0);
+			printf("STARPU_R - Value=%d\n", val);
+		} else {
+			printf("Unrecognized type.\n");
+		}
+	}
+	return 0;
 }

+ 2 - 3
mpi/tests/checkpoints.c

@@ -17,9 +17,8 @@
 #include <starpu_mpi.h>
 #include "helper.h"
 
-int main(int argc, char* argv[]) {
-
-
+int main(int argc, char* argv[])
+{
     starpu_data_handle_t h;
     starpu_mpi_checkpoint_template cp_template;
     int val = 42;