Browse Source

Clean printf and assert no similar checkpoints registered( i.e. same id)

Romain LION 5 years ago
parent
commit
d00aa88160
1 changed files with 5 additions and 2 deletions
  1. 5 2
      mpi/src/starpu_mpi_checkpoint.c

+ 5 - 2
mpi/src/starpu_mpi_checkpoint.c

@@ -36,14 +36,12 @@ int _starpu_mpi_checkpoint_template_register(starpu_mpi_checkpoint_template* cp_
 	int backup_rank;
 	int backup_rank;
 
 
 	starpu_mpi_checkpoint_template _cp_template = _starpu_mpi_checkpoint_template_new(cp_id);
 	starpu_mpi_checkpoint_template _cp_template = _starpu_mpi_checkpoint_template_new(cp_id);
-	fprintf(stderr, "cpid: %d\n", cp_id);
 
 
 	va_list varg_list_copy;
 	va_list varg_list_copy;
 	va_copy(varg_list_copy, varg_list);
 	va_copy(varg_list_copy, varg_list);
 
 
 	while ((arg_type = va_arg(varg_list_copy, int)) != 0) {
 	while ((arg_type = va_arg(varg_list_copy, int)) != 0) {
 
 
-		fprintf(stderr, "argtype: %d\n", arg_type);
 		STARPU_ASSERT_MSG(!(arg_type & STARPU_COMMUTE), "Unable to checkpoint non sequential task flow.\n");
 		STARPU_ASSERT_MSG(!(arg_type & STARPU_COMMUTE), "Unable to checkpoint non sequential task flow.\n");
 
 
 		switch(arg_type)
 		switch(arg_type)
@@ -70,6 +68,11 @@ int _starpu_mpi_checkpoint_template_register(starpu_mpi_checkpoint_template* cp_
 	_starpu_mpi_checkpoint_template_freeze(_cp_template);
 	_starpu_mpi_checkpoint_template_freeze(_cp_template);
 
 
 	starpu_pthread_mutex_lock(&cp_template_mutex);
 	starpu_pthread_mutex_lock(&cp_template_mutex);
+	for (int i=0 ; i<cp_template_number ; i++)
+	{
+		STARPU_ASSERT_MSG(cp_template_array[i]->cp_template_id != _cp_template->cp_template_id, "A checkpoint with id %d has already been registered.\n", _cp_template->cp_template_id);
+	}
+
 	cp_template_array[cp_template_number] = _cp_template;
 	cp_template_array[cp_template_number] = _cp_template;
 	cp_template_number++;
 	cp_template_number++;
 	starpu_pthread_mutex_unlock(&cp_template_mutex);
 	starpu_pthread_mutex_unlock(&cp_template_mutex);