소스 검색

perf_model: move back field is_init to struct starpu_perfmodel

Nathalie Furmento 10 년 전
부모
커밋
bd12a1ab38
3개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 0
      include/starpu_perfmodel.h
  2. 0 1
      src/core/perfmodel/perfmodel.h
  3. 5 5
      src/core/perfmodel/perfmodel_history.c

+ 1 - 0
include/starpu_perfmodel.h

@@ -140,6 +140,7 @@ struct starpu_perfmodel
 
 
 	unsigned is_loaded;
 	unsigned is_loaded;
 	unsigned benchmarking;
 	unsigned benchmarking;
+	unsigned is_init;
 
 
 	starpu_perfmodel_state_t state;
 	starpu_perfmodel_state_t state;
 };
 };

+ 0 - 1
src/core/perfmodel/perfmodel.h

@@ -45,7 +45,6 @@ struct _starpu_perfmodel_state
 	struct starpu_perfmodel_per_arch** per_arch; /*STARPU_MAXIMPLEMENTATIONS*/
 	struct starpu_perfmodel_per_arch** per_arch; /*STARPU_MAXIMPLEMENTATIONS*/
 	int** per_arch_is_set; /*STARPU_MAXIMPLEMENTATIONS*/
 	int** per_arch_is_set; /*STARPU_MAXIMPLEMENTATIONS*/
 
 
-	unsigned is_init;
 	starpu_pthread_rwlock_t model_rwlock;
 	starpu_pthread_rwlock_t model_rwlock;
 	int *nimpls;
 	int *nimpls;
 	int ncombs;  /* The number of combinations currently used by the model */
 	int ncombs;  /* The number of combinations currently used by the model */

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

@@ -608,7 +608,7 @@ void starpu_perfmodel_init(FILE *f, struct starpu_perfmodel *model)
 	STARPU_ASSERT(model);
 	STARPU_ASSERT(model);
 
 
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&registered_models_rwlock);
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&registered_models_rwlock);
-	already_init = model->state && model->state->is_init;
+	already_init = model->is_init;
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 
 
 	if (already_init)
 	if (already_init)
@@ -619,7 +619,7 @@ void starpu_perfmodel_init(FILE *f, struct starpu_perfmodel *model)
 	STARPU_PTHREAD_RWLOCK_WRLOCK(&registered_models_rwlock);
 	STARPU_PTHREAD_RWLOCK_WRLOCK(&registered_models_rwlock);
 
 
 	/* Was the model initialized since the previous test ? */
 	/* Was the model initialized since the previous test ? */
-	if (model->state && model->state->is_init)
+	if (model->is_init)
 	{
 	{
 		STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 		STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 		return;
 		return;
@@ -654,7 +654,7 @@ void starpu_perfmodel_init(FILE *f, struct starpu_perfmodel *model)
 	node->next = registered_models;
 	node->next = registered_models;
 	registered_models = node;
 	registered_models = node;
 
 
-	model->state->is_init = 1;
+	model->is_init = 1;
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 }
 }
 
 
@@ -756,7 +756,7 @@ void _starpu_initialize_registered_performance_models(void)
 
 
 void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model)
 void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model)
 {
 {
-	if(model->state && model->state->is_init && model->state->per_arch != NULL)
+	if(model->is_init && model->state && model->state->per_arch != NULL)
 	{
 	{
 		int ncombs = model->state->ncombs;
 		int ncombs = model->state->ncombs;
 		int comb, impl;
 		int comb, impl;
@@ -806,7 +806,7 @@ void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model)
 		model->state->ncombs = 0;
 		model->state->ncombs = 0;
 	}
 	}
 
 
-	if (model->state) model->state->is_init = 0;
+	model->is_init = 0;
 	model->is_loaded = 0;
 	model->is_loaded = 0;
 }
 }