Browse Source

examples/worker_collections/worker_tree_example.c: skip example when hwloc is not enabled

Nathalie Furmento 11 years ago
parent
commit
470cf0725c
1 changed files with 28 additions and 19 deletions
  1. 28 19
      examples/worker_collections/worker_tree_example.c

+ 28 - 19
examples/worker_collections/worker_tree_example.c

@@ -1,22 +1,30 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.                                                                                                                                            
- *                                                                                                                                                                                                                 
- * Copyright (C) 2010-2013  Université de Bordeaux 1                                                                                                                                                               
- * Copyright (C) 2010-2013  Centre National de la Recherche Scientifique                                                                                                                                           
- *                                                                                                                                                                                                                 
- * StarPU is free software; you can redistribute it and/or modify                                                                                                                                                  
- * it under the terms of the GNU Lesser General Public License as published by                                                                                                                                     
- * the Free Software Foundation; either version 2.1 of the License, or (at                                                                                                                                         
- * your option) any later version.                                                                                                                                                                                 
- *                                                                                                                                                                                                                 
- * StarPU is distributed in the hope that it will be useful, but                                                                                                                                                   
- * WITHOUT ANY WARRANTY; without even the implied warranty of                                                                                                                                                      
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                                                                                                                                            
- *                                                                                                                                                                                                                 
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.                                                                                                                                     
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2010-2013  Université de Bordeaux 1
+ * Copyright (C) 2010-2014  Centre National de la Recherche Scientifique
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
 #include <starpu.h>
 
+#if !defined(STARPU_HAVE_HWLOC)
+#warning hwloc is not enabled. Skipping test
+int main(int argc, char **argv)
+{
+	return 77;
+}
+#else
+
 int main()
 {
 	starpu_init(NULL);
@@ -49,7 +57,7 @@ int main()
         long diff_us = end_time.tv_usec  - start_time.tv_usec;
 
 	float timing = (float)(diff_s*1000000 + diff_us)/1000;
-	
+
 	int i;
 	for(i = 0; i < ncpus; i++)
 	{
@@ -60,14 +68,14 @@ int main()
 	struct starpu_sched_ctx_iterator it;
         if(co->init_iterator)
                 co->init_iterator(co, &it);
-	
+
 	int pu;
 	while(co->has_next(co, &it))
 	{
 		pu = co->get_next(co, &it);
 		printf("pu = %d out of %d workers \n", pu, co->nworkers);
 	}
-	
+
 	for(i = 0; i < 6; i++)
 	{
 		co->remove(co, i);
@@ -79,9 +87,10 @@ int main()
 		pu = co->get_next(co, &it);
 		printf("pu = %d out of %d workers \n", pu, co->nworkers);
 	}
-	
+
 	printf("timing init = %lf \n", timing);
 
 	co->deinit(co);
 	starpu_shutdown();
 }
+#endif