|
@@ -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;
|
|
|
}
|