Bläddra i källkod

perfmodel: rename starpu_initialize_model to starpu_perfmodel_init and starpu_initialize_model_with_file to starpu_perfmodel_init_with_file

Nathalie Furmento 12 år sedan
förälder
incheckning
2c40adf4a1

+ 5 - 6
examples/cholesky/cholesky_models.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@
  */
 
 /*
- *	Number of flops of Gemm 
+ *	Number of flops of Gemm
  */
 
 #include <starpu.h>
@@ -127,15 +127,14 @@ double cuda_chol_task_22_cost(struct starpu_task *task, struct starpu_perfmodel_
 	return PERTURBATE(cost);
 }
 
-void initialize_chol_model(struct starpu_perfmodel* model, char * symbol, 
-		double (*cpu_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned), 
+void initialize_chol_model(struct starpu_perfmodel* model, char * symbol,
+		double (*cpu_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned),
 		double (*cuda_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned))
 {
+	starpu_perfmodel_init(model);
 	model->symbol = symbol;
 	model->type = STARPU_HISTORY_BASED;
-	starpu_initialize_model(model);
 	model->per_arch[STARPU_CPU_WORKER][0][0][0].cost_function = cpu_cost_function;
 	if(starpu_worker_get_count_by_type(STARPU_CUDA_WORKER) != 0)
 		model->per_arch[STARPU_CUDA_WORKER][0][0][0].cost_function = cuda_cost_function;
 }
-

+ 9 - 10
examples/heat/lu_kernels_model.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -24,7 +24,7 @@
  */
 
 /*
- *	Number of flops of Gemm 
+ *	Number of flops of Gemm
  */
 
 /* #define USE_PERTURBATION	1 */
@@ -36,7 +36,7 @@
 #define PERTURBATE(a)	(a)
 #endif
 
-/* 
+/*
  *
  *	Generic models
  *
@@ -95,7 +95,7 @@ double task_22_cost(struct starpu_task *task, unsigned nimpl)
 	return PERTURBATE(cost);
 }
 
-/* 
+/*
  *
  *	Models for CUDA
  *
@@ -155,7 +155,7 @@ double task_22_cost_cuda(struct starpu_task *task, struct starpu_perfmodel_arch*
 	return PERTURBATE(cost);
 }
 
-/* 
+/*
  *
  *	Models for CPUs
  *
@@ -214,17 +214,16 @@ double task_22_cost_cpu(struct starpu_task *task, struct starpu_perfmodel_arch*
 	return PERTURBATE(cost);
 }
 
-void initialize_lu_kernels_model(struct starpu_perfmodel* model, char * symbol, 
-		double (*cost_function)(struct starpu_task *, unsigned), 
-		double (*cpu_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned), 
+void initialize_lu_kernels_model(struct starpu_perfmodel* model, char * symbol,
+		double (*cost_function)(struct starpu_task *, unsigned),
+		double (*cpu_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned),
 		double (*cuda_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned))
 {
+	starpu_perfmodel_init(model);
 	model->type = STARPU_HISTORY_BASED;
 	model->symbol = symbol;
-	starpu_initialize_model(model);
 	model->cost_function = cost_function;
 	model->per_arch[STARPU_CPU_WORKER][0][0][0].cost_function = cpu_cost_function;
 	if(starpu_worker_get_count_by_type(STARPU_CUDA_WORKER) != 0)
 		model->per_arch[STARPU_CUDA_WORKER][0][0][0].cost_function = cuda_cost_function;
 }
-

+ 2 - 2
include/starpu_perfmodel.h

@@ -132,8 +132,8 @@ struct starpu_perfmodel
 	starpu_pthread_rwlock_t model_rwlock;
 };
 
-void starpu_initialize_model(struct starpu_perfmodel *model);
-void starpu_initialize_model_with_file(FILE*f, struct starpu_perfmodel *model);
+void starpu_perfmodel_init(struct starpu_perfmodel *model);
+void starpu_perfmodel_init_with_file(FILE*f, struct starpu_perfmodel *model);
 
 struct starpu_perfmodel_arch* starpu_worker_get_perf_archtype(int workerid);
 

+ 5 - 6
sc_hypervisor/examples/cholesky/cholesky_models.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@
  */
 
 /*
- *	Number of flops of Gemm 
+ *	Number of flops of Gemm
  */
 
 #include <starpu.h>
@@ -126,14 +126,13 @@ double cuda_chol_task_22_cost(struct starpu_task *task, struct starpu_perfmodel_
 	return PERTURBATE(cost);
 }
 
-void initialize_chol_model(struct starpu_perfmodel* model, char * symbol, 
-		double (*cpu_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned), 
+void initialize_chol_model(struct starpu_perfmodel* model, char * symbol,
+		double (*cpu_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned),
 		double (*cuda_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch*, unsigned))
 {
-	starpu_initialize_model(model);
+	starpu_perfmodel_init(model);
 	model->type = STARPU_HISTORY_BASED;
 	model->symbol = symbol;
 	model->per_arch[STARPU_CPU_WORKER][0][0][0].cost_function = cpu_cost_function;
 	model->per_arch[STARPU_CUDA_WORKER][0][0][0].cost_function = cuda_cost_function;
 }
-

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

@@ -651,7 +651,7 @@ static void initialize_model_with_file(FILE*f, struct starpu_perfmodel *model)
 	}
 }
 
-void starpu_initialize_model(struct starpu_perfmodel *model)
+void starpu_perfmodel_init(struct starpu_perfmodel *model)
 {
 	STARPU_ASSERT(model && model->symbol);
 
@@ -682,7 +682,7 @@ void starpu_initialize_model(struct starpu_perfmodel *model)
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 }
 
-void starpu_initialize_model_with_file(FILE*f, struct starpu_perfmodel *model)
+void starpu_perfmodel_init_with_file(FILE*f, struct starpu_perfmodel *model)
 {
 	STARPU_ASSERT(model && model->symbol);
 
@@ -737,7 +737,7 @@ int _starpu_register_model(struct starpu_perfmodel *model)
 {
 	STARPU_ASSERT(model);
 	STARPU_ASSERT(model->symbol);
-	starpu_initialize_model(model);
+	starpu_perfmodel_init(model);
 
 	/* If the model has already been loaded, there is nothing to do */
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&registered_models_rwlock);
@@ -960,14 +960,14 @@ void _starpu_load_per_arch_based_model(struct starpu_perfmodel *model)
 {
 	STARPU_ASSERT(model);
 	STARPU_ASSERT(model->symbol);
-	starpu_initialize_model(model);
+	starpu_perfmodel_init(model);
 }
 
 void _starpu_load_common_based_model(struct starpu_perfmodel *model)
 {
 	STARPU_ASSERT(model);
 	STARPU_ASSERT(model->symbol);
-	starpu_initialize_model(model);
+	starpu_perfmodel_init(model);
 }
 
 /* We first try to grab the global lock in read mode to check whether the model
@@ -978,7 +978,7 @@ void _starpu_load_history_based_model(struct starpu_perfmodel *model, unsigned s
 {
 	STARPU_ASSERT(model);
 	STARPU_ASSERT(model->symbol);
-	starpu_initialize_model(model);
+	starpu_perfmodel_init(model);
 
 	STARPU_PTHREAD_RWLOCK_WRLOCK(&model->model_rwlock);
 
@@ -1111,7 +1111,7 @@ int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *mo
 	FILE *f = fopen(path, "r");
 	STARPU_ASSERT(f);
 
-	starpu_initialize_model_with_file(f, model);
+	starpu_perfmodel_init_with_file(f, model);
 	rewind(f);
 
 	parse_model_file(f, model, 1);

+ 4 - 4
tests/sched_policies/simple_cpu_gpu_sched.c

@@ -85,12 +85,12 @@ gpu_task_gpu(struct starpu_task *task,
 	return 1.0;
 }
 
-static struct starpu_perfmodel model_cpu_task = 
+static struct starpu_perfmodel model_cpu_task =
 {
 	.type = STARPU_PER_ARCH,
 	.symbol = "model_cpu_task"
 };
-static struct starpu_perfmodel model_gpu_task = 
+static struct starpu_perfmodel model_gpu_task =
 {
 	.type = STARPU_PER_ARCH,
 	.symbol = "model_gpu_task"
@@ -101,8 +101,8 @@ init_perfmodels(void)
 {
 	unsigned devid, ncore;
 
-	starpu_initialize_model(&model_cpu_task);
-	starpu_initialize_model(&model_gpu_task);
+	starpu_perfmodel_init(&model_cpu_task);
+	starpu_perfmodel_init(&model_gpu_task);
 
 	if(model_cpu_task.per_arch[STARPU_CPU_WORKER] != NULL)
 	{