xiangaodielian / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

AMD OpenCVL support?? #610

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I'm using Ubuntu 11.10, with an  AMD Radeon 6800 video card. During the 
installation,  INTEL OPENCL NOT FOUND,  NVidia OPENCL NOT FOUND

What is the expected output? What do you see instead?
Expecting bullet is also able to support AMD under Linux, rather than Windows.

What version of the product are you using? On what operating system?
I'm using bullet-2.80-rev2531

Please provide any additional information below.
I successfully tested bullet under Windows7, on exactly the same hardware, with 
AMD OpenCL support. However, under Windows, there is even no option for me to 
select AMD OPENCL, but only INTEL OPENCL and NVidia OPENCL is afforded.

Please help.

Best Regards
Pei

Original issue reported on code.google.com by jp4w...@gmail.com on 20 Mar 2012 at 7:18

GoogleCodeExporter commented 9 years ago
Problem seems to be solved.
Around line 195 of file CMakeList.txt, add AMD related lines.

IF (MSVC OR APPLE)
    OPTION(BUILD_MINICL_OPENCL_DEMOS "Build OpenCL demos for MiniCL (Generic CPU)"  ON)
ELSE()
    OPTION(BUILD_MINICL_OPENCL_DEMOS "Build OpenCL demos for MiniCL (Generic CPU)" OFF)

        FIND_PATH(AMD_OPENCL_INCLUDES CL/cl.h)
        FIND_PATH(AMD_OPENCL_ICD_CFG amdocl32.icd /etc/OpenCL/vendors)
        FIND_LIBRARY(AMD_OPENCL_LIBRARIES OpenCL PATH /usr/lib)
        IF (AMD_OPENCL_INCLUDES AND AMD_OPENCL_LIBRARIES AND AMD_OPENCL_ICD_CFG)
                MESSAGE("AMD OPENCL SDK FOUND")
                MESSAGE(${AMD_OPENCL_LIBRARIES})
                OPTION(BUILD_AMD_OPENCL_DEMOS "Build OpenCL demos for AMD (CPU)"        ON)
        ELSE ()
                MESSAGE("AMD OPENCL NOT FOUND")
                OPTION(BUILD_AMD_OPENCL_DEMOS "Build OpenCL demos for AMD (CPU)"        OFF)
        ENDIF ()

        FIND_PATH(INTEL_OPENCL_INCLUDES CL/cl.h)
        FIND_PATH(INTEL_OPENCL_ICD_CFG intelocl64.icd /etc/OpenCL/vendors)
        FIND_LIBRARY(INTEL_OPENCL_LIBRARIES OpenCL PATH /usr/lib64)
        IF (INTEL_OPENCL_INCLUDES AND INTEL_OPENCL_LIBRARIES AND INTEL_OPENCL_ICD_CFG)
                MESSAGE("INTEL OPENCL SDK FOUND")
                MESSAGE(${INTEL_OPENCL_LIBRARIES})
                OPTION(BUILD_INTEL_OPENCL_DEMOS "Build OpenCL demos for Intel (CPU)"        ON)
        ELSE ()
                MESSAGE("INTEL OPENCL NOT FOUND")
                OPTION(BUILD_INTEL_OPENCL_DEMOS "Build OpenCL demos for Intel (CPU)"        OFF)
        ENDIF ()

    FIND_PATH(NVIDIA_OPENCL_INCLUDES CL/cl.h)
        FIND_PATH(NVIDIA_OPENCL_ICD_CFG nvidia.icd /etc/OpenCL/vendors)
        FIND_LIBRARY(NVIDIA_OPENCL_LIBRARIES OpenCL PATH /usr/lib64 /usr/local/lib)
        IF (NVIDIA_OPENCL_INCLUDES AND NVIDIA_OPENCL_LIBRARIES AND NVIDIA_OPENCL_ICD_CFG)
                MESSAGE("NVidia OPENCL FOUND")
        MESSAGE(${NVIDIA_OPENCL_LIBRARIES})
        OPTION(BUILD_NVIDIA_OPENCL_DEMOS "Build OpenCL demos for NVidia (GPU)"  ON)
    ELSE ()
                MESSAGE("NVidia OPENCL NOT FOUND")
        OPTION(BUILD_NVIDIA_OPENCL_DEMOS "Build OpenCL demos for NVidia (GPU)"  OFF)
    ENDIF ()

ENDIF()

Original comment by jp4w...@gmail.com on 20 Mar 2012 at 7:34

GoogleCodeExporter commented 9 years ago
In addition,
CL_GL_CONTEXT_KHR and CL_WGL_HDC_KHR are defined in ./include/CL/cl_gl.h
for AMD OpenCL, so better to modify "Demos/SharedOpenCL/btOpenCLUtils.cpp"
around line 50:

#ifndef CL_PLATFORM_MINI_CL
//#ifdef _WIN32
#include "CL/cl_gl.h"
//#endif //_WIN32
#endif

Original comment by jp4w...@gmail.com on 20 Mar 2012 at 7:50

GoogleCodeExporter commented 9 years ago
Thanks for the help. Do you mind creating a patch?

By the way, does that CL/cl_gl.h header also exist on Mac OSX?

Original comment by erwin.coumans on 20 Mar 2012 at 7:55

GoogleCodeExporter commented 9 years ago

A first-step patch is attached. I'm now facing other problems described in 
issue 611.

Original comment by jp4w...@gmail.com on 20 Mar 2012 at 8:41

Attachments:

GoogleCodeExporter commented 9 years ago
Please keep all the OpenCL related build issues in this issue. I'm merging 
them. Note that all the OpenCL code is very experimental, so discussion in the 
Bullet forums might be a better way.

Original comment by erwin.coumans on 20 Mar 2012 at 10:46

GoogleCodeExporter commented 9 years ago
Issue 611 has been merged into this issue.

Original comment by erwin.coumans on 20 Mar 2012 at 10:47

GoogleCodeExporter commented 9 years ago
Some progress has been made, attached as patch2.txt (specifically for AMD 
OpenCL Ubuntu 11.10), but to be confirmed.

However, with this patch2.txt, I still have some errors while building bullet 
under Ubuntu 11.10 (BTW, Windows 7 + Visual Studio 2010 + AMD OpenCL works fine 
for me. )

inking CXX executable makesdna
cd /home/peij/Downloads/bullet-2.80-rev2532/build/Extras/Serialize/makesdna && 
/usr/bin/cmake -E cmake_link_script CMakeFiles/makesdna.dir/link.txt --verbose=1
/usr/bin/c++   -O3 -DNDEBUG    CMakeFiles/makesdna.dir/makesdna.o  -o makesdna 
-rdynamic 
CMakeFiles/makesdna.dir/makesdna.o: In function 
`btAlignedObjectArray<int>::clear()':
makesdna.cpp:(.text._ZN20btAlignedObjectArrayIiE5clearEv[btAlignedObjectArray<in
t>::clear()]+0x44): undefined reference to `btAlignedFreeInternal(void*)'
CMakeFiles/makesdna.dir/makesdna.o: In function 
`btTriangleInfoMap::~btTriangleInfoMap()':
makesdna.cpp:(.text._ZN17btTriangleInfoMapD2Ev[_ZN17btTriangleInfoMapD5Ev]+0xd4)
: undefined reference to `btAlignedFreeInternal(void*)'
makesdna.cpp:(.text._ZN17btTriangleInfoMapD2Ev[_ZN17btTriangleInfoMapD5Ev]+0xe4)
: undefined reference to `btAlignedFreeInternal(void*)'
makesdna.cpp:(.text._ZN17btTriangleInfoMapD2Ev[_ZN17btTriangleInfoMapD5Ev]+0xf4)
: undefined reference to `btAlignedFreeInternal(void*)'
makesdna.cpp:(.text._ZN17btTriangleInfoMapD2Ev[_ZN17btTriangleInfoMapD5Ev]+0x104
): undefined reference to `btAlignedFreeInternal(void*)'
CMakeFiles/makesdna.dir/makesdna.o:makesdna.cpp:(.text._ZN17btTriangleInfoMapD2E
v[_ZN17btTriangleInfoMapD5Ev]+0x122): more undefined references to 
`btAlignedFreeInternal(void*)' follow
CMakeFiles/makesdna.dir/makesdna.o:(.rodata._ZTV17btTypedConstraint[vtable for 
btTypedConstraint]+0x30): undefined reference to 
`btTypedConstraint::serialize(void*, btSerializer*) const'
collect2: ld returned 1 exit status
make[2]: *** [Extras/Serialize/makesdna/makesdna] Error 1
make[2]: Leaving directory `/home/peij/Downloads/bullet-2.80-rev2532/build'
make[1]: *** [Extras/Serialize/makesdna/CMakeFiles/makesdna.dir/all] Error 2
make[1]: Leaving directory `/home/peij/Downloads/bullet-2.80-rev2532/build'
make: *** [all] Error 2

Original comment by jp4w...@gmail.com on 20 Mar 2012 at 11:04

Attachments:

GoogleCodeExporter commented 9 years ago

Thanks for the work. I haven't tested any of the OpenCL work on Linux yet, but 
I do have a Linux machine with OpenCL, so I could try it out soon.

makesdna.cpp should never be compiled except by me, when I modify the 
serialization structures.

Did you manually enable the updating of serialization structures setting?

Original comment by erwin.coumans on 21 Mar 2012 at 1:45

GoogleCodeExporter commented 9 years ago
Wow, Yes, Sorry. I've got no idea what is internal serialization, but yes, I 
did enable it. I'll try it soon without it enabled.

Cheers
Pei

Original comment by jp4w...@gmail.com on 21 Mar 2012 at 4:03

GoogleCodeExporter commented 9 years ago
AMD OpenCL SDK support for Linux works now:
https://code.google.com/p/bullet/source/detail?r=2576
Thanks for your report!

Original comment by erwin.coumans on 12 Sep 2012 at 4:55