Objet : Developers list for StarPU
Archives de la liste
- From: George Russell <george@codeplay.com>
- To: starpu-devel@lists.gforge.inria.fr
- Subject: Re: [Starpu-devel] Building StarPU from SVN on OSX [patch]
- Date: Thu, 24 Feb 2011 15:21:58 +0100
- List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
- List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>
Hi, I have attached a patch to get StarPU OpenCL working (partly!) on OSX 10.6 This patch primarily does two things; it fixed the include paths for the CL headers in C code (these are, for some reason, different on OSX), and it ifdefs out the cpu_set_t code on OSX (as is done on Windows) as that type seems not to be supported on OSX. (it also fixed some compilation errors re INT_MAX by including limits.h) Note that the changes I have made to configure.ac are essentially broken; It needs to conditionally handle OSX (which I don't know how to do, especially). However, there are ~3 things to note: The header test needed to be changed, which I have done; but it should test the CL/cl.h on non OSX, and OpenCL/opencl.h on OSX. I did not get the library check to work on OSX; I just forced the enable_opencl to be on. At least for OSX 10.6, OpenCL is supplied with the OS, and in a fixed location. So, OpenCL could be enabled on OSX 10.6 by default, unless explicitly disabled. I did however, add the "-framework OpenCL" to the LD_FLAGS to get it to link. Again, this should be OSX specific. I forced the target to i686 to get the pthread configure check to pass; I believe this results in the compilation of a 32bit executable. I guess StarPU will simply not build for X86_64? Now, the bad part: It seems broken, in the same way as the ATI CPU OpenCL was e.g. it appears to hang/deadlock in the same place. ./configure --target=i686-apple-darwin10 --with-opencl-include-dir=/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers/ imac:StarPU grrussel$ examples/basic_examples/vector_scal BEFORE : First element was 1.000000 [starpu][_starpu_opencl_init] Initialising OpenCL [starpu][_starpu_opencl_init] Platforms detected: 1 [starpu][_starpu_opencl_init] Platform: Apple - Apple [starpu][_starpu_opencl_init] 1 devices detected Current configuration does not match the performance model (OpenCL: (stored) 0 != (current) 1), recalibrating...[starpu][benchmark_all_gpu_devices] Benchmarking the speed of the bus [starpu][_starpu_opencl_init_context] Initialising context for dev 0 [starpu][_starpu_opencl_deinit_context] De-initialising context for dev 0 [starpu][_starpu_opencl_init_context] Initialising context for dev 0 [starpu][_starpu_opencl_deinit_context] De-initialising context for dev 0 [starpu][measure_bandwidth_between_host_and_dev] BANDWIDTH GPU 0 CPU 0 - htod 16782.898438 - dtoh 15493.679688 - 22841.186270 [starpu][measure_bandwidth_between_host_and_dev] BANDWIDTH GPU 0 CPU 1 - htod 15700.906250 - dtoh 15363.750000 - 21967.322803 [starpu][measure_bandwidth_between_host_and_dev] BANDWIDTH GPU 0 BEST CPU 0 [starpu][benchmark_all_gpu_devices] Benchmarking the speed of the bus is done. done [starpu][load_sched_policy] Use eager scheduler (greedy policy) [starpu][_starpu_launch_drivers] initialising worker 0 [starpu][_starpu_opencl_init_context] Initialising context for dev 0 [starpu][_starpu_opencl_get_device_name] Device 0 : [GeForce 9400] [starpu][_starpu_opencl_worker] OpenCL (GeForce 9400) dev id 0 thread is ready to run on CPU 0 ! [starpu][_starpu_opencl_locate_file] Trying to locate <examples/basic_examples/vector_scal_opencl_kernel.cl> [starpu][starpu_opencl_load_opencl_from_file] Source file name : <examples/basic_examples/vector_scal_opencl_kernel.cl> [starpu][_starpu_opencl_load_program_source] OpenCL kernel </* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2010 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. */ __kernel void vector_mult_opencl(__global float* val, int nx, float factor) { const int i = get_global_id(0); if (i < nx) { val[i] *= factor; } } > ^C Cheers, George On 23/02/2011 21:47, George Russell wrote: 4D657251.3070402@codeplay.com"> Hi, |
===================================================================
--- include/starpu_opencl.h (revision 3238)
+++ include/starpu_opencl.h (working copy)
@@ -19,7 +19,11 @@
#define __STARPU_OPENCL_H__
#ifdef STARPU_USE_OPENCL
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
+#endif
#ifdef __cplusplus
extern "C" {
Index: src/core/workers.h
===================================================================
--- src/core/workers.h (revision 3238)
+++ src/core/workers.h (working copy)
@@ -79,8 +79,10 @@
char name[32];
#ifndef STARPU_HAVE_WINDOWS
+#ifndef __APPLE__
cpu_set_t initial_cpu_set;
cpu_set_t current_cpu_set;
+#endif /* __APPLE__ */
#endif /* STARPU_HAVE_WINDOWS */
#ifdef STARPU_HAVE_HWLOC
hwloc_cpuset_t initial_hwloc_cpu_set;
@@ -96,7 +98,9 @@
int combined_workerid[STARPU_NMAXWORKERS];
#ifndef STARPU_HAVE_WINDOWS
+#ifndef __APPLE__
cpu_set_t cpu_set;
+#endif /* __APPLE__ */
#endif /* STARPU_HAVE_WINDOWS */
#ifdef STARPU_HAVE_HWLOC
hwloc_cpuset_t hwloc_cpu_set;
Index: src/core/topology.c
===================================================================
--- src/core/topology.c (revision 3238)
+++ src/core/topology.c (working copy)
@@ -723,11 +723,13 @@
workerarg->memory_node = memory_node;
#ifndef STARPU_HAVE_WINDOWS
+#ifndef __APPLE__
/* Save the initial cpuset */
CPU_ZERO(&workerarg->initial_cpu_set);
CPU_SET(workerarg->bindid, &workerarg->initial_cpu_set);
CPU_ZERO(&workerarg->current_cpu_set);
CPU_SET(workerarg->bindid, &workerarg->current_cpu_set);
+#endif /* __APPLE__ */
#endif /* STARPU_HAVE_WINDOWS */
#ifdef STARPU_HAVE_HWLOC
Index: src/core/combined_workers.c
===================================================================
--- src/core/combined_workers.c (revision 3238)
+++ src/core/combined_workers.c (working copy)
@@ -114,7 +114,9 @@
/* Note that we maintain both the cpu_set and the hwloc_cpu_set so
that
* the application is not forced to use hwloc when it is available. */
#ifndef STARPU_HAVE_WINDOWS
+#ifndef __APPLE__
CPU_ZERO(&combined_worker->cpu_set);
+#endif
#endif /* STARPU_HAVE_WINDOWS */
#ifdef STARPU_HAVE_HWLOC
@@ -125,6 +127,7 @@
{
int id = workerid_array[i];
#ifndef STARPU_HAVE_WINDOWS
+#ifndef __APPLE__
#ifdef CPU_OR
CPU_OR(&combined_worker->cpu_set,
&combined_worker->cpu_set,
@@ -136,6 +139,7 @@
CPU_SET(j, &combined_worker->cpu_set);
}
#endif
+#endif /* __APPLE__ */
#endif /* STARPU_HAVE_WINDOWS */
#ifdef STARPU_HAVE_HWLOC
Index: src/datawizard/copy_driver.h
===================================================================
--- src/datawizard/copy_driver.h (revision 3238)
+++ src/datawizard/copy_driver.h (working copy)
@@ -30,8 +30,12 @@
#endif
#ifdef STARPU_USE_OPENCL
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
#endif
+#endif
struct starpu_data_request_s;
struct starpu_data_replicate_s;
Index: src/drivers/opencl/driver_opencl.h
===================================================================
--- src/drivers/opencl/driver_opencl.h (revision 3238)
+++ src/drivers/opencl/driver_opencl.h (working copy)
@@ -24,7 +24,11 @@
#ifdef STARPU_USE_OPENCL
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
+#endif
extern
int _starpu_opencl_init_context(int devid);
Index: tests/datawizard/increment_redux_v2.c
===================================================================
--- tests/datawizard/increment_redux_v2.c (revision 3238)
+++ tests/datawizard/increment_redux_v2.c (working copy)
@@ -20,8 +20,12 @@
#include <cuda.h>
#endif
#ifdef STARPU_USE_OPENCL
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
#endif
+#endif
static unsigned var = 0;
Index: tests/datawizard/write_only_tmp_buffer.c
===================================================================
--- tests/datawizard/write_only_tmp_buffer.c (revision 3238)
+++ tests/datawizard/write_only_tmp_buffer.c (working copy)
@@ -26,7 +26,13 @@
starpu_data_handle v_handle;
#ifdef STARPU_USE_OPENCL
+
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
+#endif
+
#include <starpu_opencl.h>
static void opencl_codelet_null(void *descr[], __attribute__ ((unused)) void
*_args)
Index: tests/datawizard/sync_and_notify_data_opencl.c
===================================================================
--- tests/datawizard/sync_and_notify_data_opencl.c (revision 3238)
+++ tests/datawizard/sync_and_notify_data_opencl.c (working copy)
@@ -17,7 +17,12 @@
#include <starpu.h>
#include <starpu_opencl.h>
+
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
+#endif
extern struct starpu_opencl_program opencl_code;
Index: tests/datawizard/manual_reduction.c
===================================================================
--- tests/datawizard/manual_reduction.c (revision 3238)
+++ tests/datawizard/manual_reduction.c (working copy)
@@ -19,8 +19,12 @@
#include <cuda.h>
#endif
#ifdef STARPU_USE_OPENCL
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
#endif
+#endif
#define INIT_VALUE 42
#define NTASKS 10000
Index: tests/datawizard/increment_redux.c
===================================================================
--- tests/datawizard/increment_redux.c (revision 3238)
+++ tests/datawizard/increment_redux.c (working copy)
@@ -21,8 +21,12 @@
#include <cuda.h>
#endif
#ifdef STARPU_USE_OPENCL
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
#endif
+#endif
static unsigned var = 0;
Index: configure.ac
===================================================================
--- configure.ac (revision 3238)
+++ configure.ac (working copy)
@@ -258,6 +258,7 @@
AC_HAVE_LIBRARY([cuda],[],[have_valid_cuda=no])
+
# To detect if we have a recent enough CUDA lib
AC_HAVE_LIBRARY([cudart],[],[have_valid_cuda=no])
@@ -443,7 +444,7 @@
# do we have a valid OpenCL setup ?
have_valid_opencl=yes
- AC_CHECK_HEADER([CL/cl.h],,[have_valid_opencl=no])
+ AC_CHECK_HEADER([OpenCL/opencl.h],,[have_valid_opencl=no])
# we are looking for the proper option in LDFLAGS, so we save the
# current value of LDFLAGS so that we can add new things in it and
@@ -456,7 +457,7 @@
fi
if test -d "$opencl_lib_dir"; then
- LDFLAGS="${SAVED_LDFLAGS} -L$opencl_lib_dir "
+ LDFLAGS="${SAVED_LDFLAGS} -L$opencl_lib_dir -framework OpenCL"
fi
AC_HAVE_LIBRARY([OpenCL],[],[have_valid_opencl=no])
@@ -466,7 +467,8 @@
fi
# now we enable OpenCL if and only if a proper setup is available
- enable_opencl=$have_valid_opencl
+ #enable_opencl=$have_valid_opencl
+ enable_opencl=yes
fi
AC_MSG_CHECKING(whether OpenCL should be used)
Index: autogen.sh
===================================================================
--- autogen.sh (revision 3238)
+++ autogen.sh (working copy)
@@ -16,7 +16,7 @@
#
# See the GNU Lesser General Public License in COPYING.LGPL for more details.
-if ! libtool --version > /dev/null
+if ! glibtool --version > /dev/null
then
echo "Libtool is missing, please install it."
exit 1
Index: examples/cholesky/cholesky_implicit.c
===================================================================
--- examples/cholesky/cholesky_implicit.c (revision 3238)
+++ examples/cholesky/cholesky_implicit.c (working copy)
@@ -17,7 +17,7 @@
*/
#include "cholesky.h"
-
+#include <limits.h>
/*
* Create the codelets
*/
Index: examples/mult/sgemm.c
===================================================================
--- examples/mult/sgemm.c (revision 3238)
+++ examples/mult/sgemm.c (working copy)
@@ -14,6 +14,6 @@
*
* See the GNU Lesser General Public License in COPYING.LGPL for more
details.
*/
-
+#include <limits.h>
#include "simple.h"
#include "xgemm.c"
Index: examples/mult/xgemm.c
===================================================================
--- examples/mult/xgemm.c (revision 3238)
+++ examples/mult/xgemm.c (working copy)
@@ -15,7 +15,7 @@
*
* See the GNU Lesser General Public License in COPYING.LGPL for more
details.
*/
-
+#include <limits.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
Index: examples/mandelbrot/mandelbrot.c
===================================================================
--- examples/mandelbrot/mandelbrot.c (revision 3238)
+++ examples/mandelbrot/mandelbrot.c (working copy)
@@ -14,7 +14,7 @@
*
* See the GNU Lesser General Public License in COPYING.LGPL for more
details.
*/
-
+#include <limits.h>
#include <starpu.h>
#ifdef STARPU_USE_OPENCL
#include <starpu_opencl.h>
Index: examples/incrementer/incrementer_kernels_opencl.c
===================================================================
--- examples/incrementer/incrementer_kernels_opencl.c (revision 3238)
+++ examples/incrementer/incrementer_kernels_opencl.c (working copy)
@@ -17,8 +17,11 @@
#include <starpu.h>
#include <starpu_opencl.h>
+#ifdef __APPLE__
+#include <OpenCL/opencl.h>
+#else
#include <CL/cl.h>
-
+#endif
extern struct starpu_opencl_program opencl_program;
void opencl_codelet(void *descr[], void *_args)
{
- [Starpu-devel] Building StarPU from SVN on OSX, George Russell, 23/02/2011
- Re: [Starpu-devel] Building StarPU from SVN on OSX, George Russell, 23/02/2011
- Re: [Starpu-devel] Building StarPU from SVN on OSX [patch], George Russell, 24/02/2011
- Re: [Starpu-devel] Building StarPU from SVN on OSX [patch], Cédric Augonnet, 24/02/2011
- Re: [Starpu-devel] Building StarPU from SVN on OSX [patch], George Russell, 24/02/2011
- Re: [Starpu-devel] Building StarPU from SVN on OSX, George Russell, 23/02/2011
Archives gérées par MHonArc 2.6.19+.