浏览代码

prefix public macro with STARPU_

Nathalie Furmento 12 年之前
父节点
当前提交
bd4c14b6c9

+ 1 - 3
configure.ac

@@ -1015,9 +1015,7 @@ if test x$enable_memory_stats = xyes; then
         AC_DEFINE(STARPU_MEMORY_STATS, [1], [enable memory stats])
 fi
 
-AC_CHECK_HEADERS([glpk.h])
-STARPU_HAVE_LIBRARY(GLPK, [glpk])
-AM_CONDITIONAL([STARPU_HAVE_GLPK], [test "x$build_sched_ctx_hypervisor" = "xyes"])
+AC_CHECK_HEADERS([glpk.h], [AC_DEFINE([STARPU_HAVE_GLPK_H], [1], [Define to 1 if you have the <glpk.h> header file.])])
 AC_CHECK_HEADERS([Ayudame.h])
 
 ###############################################################################

+ 1 - 2
include/starpu_config.h.in

@@ -75,8 +75,7 @@
 #undef STARPU_NMAX_SCHED_CTXS
 #undef STARPU_MAXIMPLEMENTATIONS
 #undef STARPU_USE_SCHED_CTX_HYPERVISOR
-/* Define to 1 if you have the <glpk.h> header file. */
-#undef HAVE_GLPK_H
+#undef STARPU_HAVE_GLPK_H
 
 #undef STARPU_HAVE_LIBNUMA
 

+ 3 - 2
sched_ctx_hypervisor/src/hypervisor_policies/lp2_policy.c

@@ -14,6 +14,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
+#include <starpu_config.h>
 #include "lp_tools.h"
 #include <math.h>
 
@@ -315,7 +316,7 @@ static void _starpu_get_tasks_times(int nw, int nt, double times[nw][nt], int *w
 /*
  * GNU Linear Programming Kit backend
  */
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 #include <glpk.h>
 static double _glp_resolve(int ns, int nw, int nt, double tasks[nw][nt], double tmax, double w_in_s[ns][nw], int *in_sched_ctxs, int *workers)
 {
@@ -591,4 +592,4 @@ struct hypervisor_policy lp2_policy = {
 	.name = "lp2"
 };
 
-#endif /* HAVE_GLPK_H */
+#endif /* STARPU_HAVE_GLPK_H */

+ 3 - 2
sched_ctx_hypervisor/src/hypervisor_policies/lp_policy.c

@@ -15,6 +15,7 @@
  */
 
 #include "lp_tools.h"
+#include <starpu_config.h>
 
 
 static void lp_handle_poped_task(unsigned sched_ctx, int worker)
@@ -84,7 +85,7 @@ static void lp_size_ctxs(int *sched_ctxs, int ns, int *workers, int nworkers)
 	pthread_mutex_unlock(&act_hypervisor_mutex);
 }
 
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 struct hypervisor_policy lp_policy = {
 	.size_ctxs = lp_size_ctxs,
 	.handle_poped_task = lp_handle_poped_task,
@@ -97,4 +98,4 @@ struct hypervisor_policy lp_policy = {
 	.name = "lp"
 };
 
-#endif /* HAVE_GLPK_H */
+#endif /* STARPU_HAVE_GLPK_H */

+ 6 - 5
sched_ctx_hypervisor/src/hypervisor_policies/lp_tools.c

@@ -16,8 +16,9 @@
 
 #include <math.h>
 #include "lp_tools.h"
+#include <starpu_config.h>
 
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 
 static double _glp_get_nworkers_per_ctx(int ns, int nw, double v[ns][nw], double flops[ns], double res[ns][nw], int  total_nw[nw])
 {
@@ -171,12 +172,12 @@ static double _glp_get_nworkers_per_ctx(int ns, int nw, double v[ns][nw], double
 	return vmax;
 }
 
-#endif //HAVE_GLPK_H
+#endif //STARPU_HAVE_GLPK_H
 
 double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers])
 {
 	int *sched_ctxs = sched_ctx_hypervisor_get_sched_ctxs();
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 	double v[nsched_ctxs][ntypes_of_workers];
 	double flops[nsched_ctxs];
 #endif
@@ -185,7 +186,7 @@ double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double r
 	for(i = 0; i < nsched_ctxs; i++)
 	{
 		sc_w = sched_ctx_hypervisor_get_wrapper(sched_ctxs[i]);
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 		v[i][0] = 200.0;//_get_velocity_per_worker_type(sc_w, STARPU_CUDA_WORKER);
 		v[i][1] = 20.0;//_get_velocity_per_worker_type(sc_w, STARPU_CPU_WORKER);
 		flops[i] = sc_w->remaining_flops/1000000000; //sc_w->total_flops/1000000000; /* in gflops*/
@@ -193,7 +194,7 @@ double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double r
 #endif
 	}
 
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 	return 1/_glp_get_nworkers_per_ctx(nsched_ctxs, ntypes_of_workers, v, flops, res, total_nw);
 #else
 	return 0.0;

+ 4 - 2
sched_ctx_hypervisor/src/hypervisor_policies/lp_tools.h

@@ -15,12 +15,14 @@
  */
 
 #include "policy_tools.h"
+#include <starpu_config.h>
+
 /*
  * GNU Linear Programming Kit backend
  */
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 #include <glpk.h>
-#endif //HAVE_GLPK_H
+#endif //STARPU_HAVE_GLPK_H
 
 /* returns tmax, and computes in table res the nr of workers needed by each context st the system ends up in the smallest tmax*/
 double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers]);

+ 5 - 4
sched_ctx_hypervisor/src/sched_ctx_hypervisor.c

@@ -16,6 +16,7 @@
 
 #include <sched_ctx_hypervisor_intern.h>
 #include <common/uthash.h>
+#include <starpu_config.h>
 
 unsigned imposed_resize = 0;
 struct starpu_performance_counters* perf_counters = NULL;
@@ -30,20 +31,20 @@ static void notify_submitted_job(struct starpu_task *task, unsigned footprint);
 extern struct hypervisor_policy idle_policy;
 extern struct hypervisor_policy app_driven_policy;
 extern struct hypervisor_policy gflops_rate_policy;
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 extern struct hypervisor_policy lp_policy;
 extern struct hypervisor_policy lp2_policy;
-#endif
+#endif // STARPU_HAVE_GLPK_H
 
 
 static struct hypervisor_policy *predefined_policies[] =
 {
         &idle_policy,
 	&app_driven_policy,
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 	&lp_policy,
 	&lp2_policy,
-#endif
+#endif // STARPU_HAVE_GLPK_H
 	&gflops_rate_policy
 };
 

+ 10 - 10
src/profiling/bound.c

@@ -26,9 +26,9 @@
 #include <profiling/bound.h>
 #include <core/jobs.h>
 
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 #include <glpk.h>
-#endif /* HAVE_GLPK_H */
+#endif /* STARPU_HAVE_GLPK_H */
 
 /* TODO: output duration between starpu_bound_start and starpu_bound_stop */
 
@@ -887,7 +887,7 @@ void starpu_bound_print_mps(FILE *output)
 /*
  * Solve bound system thanks to GNU Linear Programming Kit backend
  */
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 static glp_prob *_starpu_bound_glp_resolve(int integer)
 {
 	struct bound_task_pool * tp;
@@ -1018,12 +1018,12 @@ static glp_prob *_starpu_bound_glp_resolve(int integer)
 
 	return lp;
 }
-#endif /* HAVE_GLPK_H */
+#endif /* STARPU_HAVE_GLPK_H */
 
 /* Print the computed bound as well as the optimized distribution of tasks */
 void starpu_bound_print(FILE *output, int integer __attribute__ ((unused)))
 {
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 	if (recorddeps)
 	{
 		fprintf(output, "Not supported\n");
@@ -1066,15 +1066,15 @@ void starpu_bound_print(FILE *output, int integer __attribute__ ((unused)))
 		fprintf(stderr, "Simplex failed\n");
 	}
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
-#else /* HAVE_GLPK_H */
+#else /* STARPU_HAVE_GLPK_H */
 	fprintf(output, "Please rebuild StarPU with glpk installed.\n");
-#endif /* HAVE_GLPK_H */
+#endif /* STARPU_HAVE_GLPK_H */
 }
 
 /* Compute and return the bound */
 void starpu_bound_compute(double *res, double *integer_res __attribute__ ((unused)), int integer __attribute__ ((unused)))
 {
-#ifdef HAVE_GLPK_H
+#ifdef STARPU_HAVE_GLPK_H
 	double ret;
 
 	if (recorddeps)
@@ -1096,7 +1096,7 @@ void starpu_bound_compute(double *res, double *integer_res __attribute__ ((unuse
 		ret = 0.;
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
 	*res = ret;
-#else /* HAVE_GLPK_H */
+#else /* STARPU_HAVE_GLPK_H */
 	*res = 0.;
-#endif /* HAVE_GLPK_H */
+#endif /* STARPU_HAVE_GLPK_H */
 }