On 24/02/2011 15:21, George Russell wrote:
4D666986.3040704@codeplay.com">
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.
Thanks a lot for that patch, i'll try to integrate this
modifications as soon as possible. Samuel, do you know what should
be our strategy concerning libtool vs. glibtool ?
4D666986.3040704@codeplay.com"> 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?
The point about having an explicit arch was to have the intrisics
functions for atomic operations. These functions were not available
on i386, I don't know what's the best strategy, perhaps we can use
sizeof(void *) to make a decision that would not break on a 64bit
machine (we already add a -m64 flag in some case).
4D666986.3040704@codeplay.com">
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.
I'm also trying to get an ATI GPU to work on OpenCL (on Linux) right
now. I managed to remove some deadlock by avoiding asynchronous data
transfers (perhaps i can make my best to detect whether we are
running on ATI OpenCL and disable them automatically).
Unfortunately, it looks their OpenCL driver is pretty bad, so that
it actually crashes my X server when I launch an OpenCL kernel. As
usual, StarPU uses a lot of driver features somebody coding by hand
would not do ... so we might hit a certain number of bugs.
Best,
Cédric
4D666986.3040704@codeplay.com">
./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,
as a follow up to this;
The autogen.sh script invokes libtool on OSX, but that should
(on OSX) be glibtool
The OpenCL checks don't work on OSX, for two reasons; the
includes are different, and the library linking system is also
different.
The includes in C code to use OpenCL should be
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
The command to compile (and link) the code uses OSX's framework
switch to gcc e.g. gcc -o
foo foo.c -framework OpenCL
Knowing that, however, is not much help to me in getting a
working configure.ac ;-)
Cheers,
George
On 23/02/2011 17:31, George Russell wrote:
4D653678.7080007@codeplay.com">
Hi,
I was also attempting to build StarPU from SVN on OSX.
However, on running the autogen.sh, I get the following
output:
imac:StarPU grrussel$ sh autogen.sh
libtool: unknown option character `-' in: --version
Usage: libtool -static [-] file [...] [-filelist
listfile[,dirname]] [-arch_only arch] [-sacLT]
Usage: libtool -dynamic [-] file [...] [-filelist
listfile[,dirname]] [-arch_only arch] [-o output]
[-install_name name] [-compatibility_version #]
[-current_version #] [-seg1addr 0x#] [-segs_read_only_addr
0x#] [-segs_read_write_addr 0x#] [-seg_addr_table
<filename>] [-seg_addr_table_filename
<file_system_path>] [-all_load] [-noall_load]
Libtool is missing, please install it.
It looks like I have the wrong libtool installed? It would
be the default from the OSX developer tools.
Is there any special care needed in compiling on OSX?
Cheers,
George
|