Przeglądaj źródła

src/core/perfmodel/perfmodel_history.c: make sure a model is only registered once in the registered_models list

Nathalie Furmento 11 lat temu
rodzic
commit
0e25d8e0ab
1 zmienionych plików z 10 dodań i 10 usunięć
  1. 10 10
      src/core/perfmodel/perfmodel_history.c

+ 10 - 10
src/core/perfmodel/perfmodel_history.c

@@ -645,6 +645,16 @@ void starpu_perfmodel_init(FILE *f, struct starpu_perfmodel *model)
 	if(f)
 	if(f)
 		parse_model_file(f, model, 0);
 		parse_model_file(f, model, 0);
 
 
+	/* add the model to a linked list */
+	struct _starpu_perfmodel_list *node = (struct _starpu_perfmodel_list *) malloc(sizeof(struct _starpu_perfmodel_list));
+
+	node->model = model;
+	//model->debug_modelid = debug_modelid++;
+
+	/* put this model at the beginning of the list */
+	node->next = registered_models;
+	registered_models = node;
+
 	model->state->is_init = 1;
 	model->state->is_init = 1;
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 }
 }
@@ -690,16 +700,6 @@ int _starpu_register_model(struct starpu_perfmodel *model)
 		return 0;
 		return 0;
 	}
 	}
 
 
-	/* add the model to a linked list */
-	struct _starpu_perfmodel_list *node = (struct _starpu_perfmodel_list *) malloc(sizeof(struct _starpu_perfmodel_list));
-
-	node->model = model;
-	//model->debug_modelid = debug_modelid++;
-
-	/* put this model at the beginning of the list */
-	node->next = registered_models;
-	registered_models = node;
-
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 	return 1;
 	return 1;
 }
 }