Closed GoogleCodeExporter closed 9 years ago
To get it compiling I added the following files from the GpuClothAMD branch to
trunk:
src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/ComputeBounds.hlsl
src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/solveCollisionsAndUpdateVel
ocities.hlsl
src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/solveCollisionsAndUpdateVel
ocitiesSIMDBatched.hlsl
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCLSIMDAwa
re.cpp
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCLSIMDAwa
re.h
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverLinkData_OpenC
LSIMDAware.h
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverOutputCLtoGL.c
pp
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverOutputCLtoGL.h
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverVertexBuffer_O
penGL.h
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/ComputeBounds.cl
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/OutputToVertexArray.
cl
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/solveCollisionsAndUp
dateVelocities.cl
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/solveCollisionsAndUp
dateVelocitiesSIMDBatched.cl
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/SolvePositionsSIMDBa
tched.cl
I also added the cpps to the VS2008 projects to fix linker errors. It now
compiles and runs on trunk but there are now other issues that I'm not getting
in the 2.77 release.
They are
* In the DX cloth demo the flags are untextured
* The OpenCL cloth demo is either running really slow or isn't actually working.
But then I may have copied the wrong files or might be missing some other bits
and pieces required to make it work properly.
Original comment by cameron....@gmail.com
on 28 Feb 2011 at 3:58
Thanks for the feedback, I'll look into adding the missing files.
What kind of graphics card, and GPU driver/OpenCL SDK are you using?
Have you tried compiling the branches/GpuClothAMD? How does that perform?
Original comment by erwin.coumans
on 28 Feb 2011 at 5:26
I added the missing files in trunk, and also re-enabled texture loading from
relative paths. THe DX11 demo should have textures, if you use latest svn trunk
version.
It is not clear why your OpenCL demo is slow.
Can you send the console output, with OpenCL initialization and performance
stats (copy and paste it, after running the OpenCL cloth demo)
Instructions:
Compile bullet\msvc\2008_amd_opencl\BULLET_PHYSICS.sln
open a console (START run/cmd.exe)
Go to the Bullet root folder and type
AppOpenCLClothDemo_AMD.exe >info.txt
Please attach your info.txt (attached is mine, on a laptop with Radeon 5700 GPU)
Original comment by erwin.coumans
on 28 Feb 2011 at 5:51
Attachments:
It seems that the cloth demo is really slow when I run it from Visual Studio.
It might have something to do with some of the ATI Stream Profiler I have
installed, I'm not really sure. There is a speed difference for me though
between trunk and 2.77 for the OpenCL cloth demo.
2.77 is giving me around 250 fps but I'm sitting around 80 on trunk. I was
unable to open the 2008_amd_opencl_64 solution on the GpuClothAMD branch.
I've attached my system specs and log output from the CL cloth demo from trunk
and 2.77.
Also, capsule.h is still missing from the DX11ClothDemo on trunk.
Original comment by cameron....@gmail.com
on 28 Feb 2011 at 9:59
Attachments:
[deleted comment]
Ah, I think I've spotted a difference in the log. If I understand correctly,
2.77 isn't using the GPU on my machine.
Original comment by cameron....@gmail.com
on 1 Mar 2011 at 12:31
Thanks for the feedback! Added capsule.h now.
Apparently the 'getMaxFlopsDevice' doesn't work well, it chooses CPU instead of
GPU indeed.
We should improve the selection mechanism.
Can you help and check/debug the method btOclGetMaxFlopsDev in
bullet\Demos\SharedOpenCL\btOclUtils.cpp and figure out why the CPU comes in
faster than GPU?
Thanks,
Erwin
Original comment by erwin.coumans
on 4 Mar 2011 at 8:31
Original comment by erwin.coumans
on 11 Mar 2011 at 4:10
The file 'SolveCollisionsAndUpdateVelocities.cl' is still missing in the trunk
(r.2330):
[ 98%] Building CXX object
src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeFiles/BulletSoftBo
dySolvers_OpenCL_Mini.dir/__/btSoftBodySolver_OpenCL.o
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySo
lver_OpenCL.cpp:98:59: fatal error:
OpenCLC10/SolveCollisionsAndUpdateVelocities.cl: No such file or directory
compilation terminated.
make[2]: ***
[src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeFiles/BulletSoftB
odySolvers_OpenCL_Mini.dir/__/btSoftBodySolver_OpenCL.o] Error 1
make[1]: ***
[src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeFiles/BulletSoftB
odySolvers_OpenCL_Mini.dir/all] Error 2
make: *** [all] Error 2
Original comment by laurent....@gmail.com
on 11 Mar 2011 at 4:27
Ah, we never tested on non-Windows platforms, the case was wrong.
solveCollisionsAndUpdateVelocities.cl -> SolveCollisionsAndUpdateVelocities.cl
Can you try it again on latest trunk?
Original comment by erwin.coumans
on 11 Mar 2011 at 8:28
Now I have the files! Thx :-)
But I get problems related with the compilation:
In file included from
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySo
lver_OpenCL.cpp:94:0:
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/VS
olveLinks.cl:1:1: attention : deprecated conversion from string constant to
‘char*’
In file included from
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySo
lver_OpenCL.cpp:96:0:
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/Co
mputeBounds.cl:1:1: attention : deprecated conversion from string constant to
‘char*’
In file included from
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySo
lver_OpenCL.cpp:98:0:
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10/So
lveCollisionsAndUpdateVelocities.cl:1:1: attention : deprecated conversion from
string constant to ‘char*’
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySo
lver_OpenCL.cpp: In member function ‘virtual void
btOpenCLSoftBodySolver::optimize(btAlignedObjectArray<btSoftBody*>&, bool)’:
/home/lolo/Bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySo
lver_OpenCL.cpp:737:47: error: ‘UINT_MAX’ was not declared in this scope
To define UINT_MAX, I added "#include <climits>" on top of the 'file
btSoftBodySolver_OpenCL.cpp'.
And then,
[ 98%] Building CXX object
Demos/OpenCLClothDemo/MiniCL/CMakeFiles/AppOpenCLClothDemo_Mini.dir/__/cl_cloth_
demo.o
In file included from
/home/lolo/Bullet/Demos/OpenCLClothDemo/cl_cloth_demo.cpp:31:0:
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h: In member function ‘void
piece_of_cloth::draw()’:
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h:86:41: error:
‘glBindBuffer’ was not declared in this scope
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h:90:102: error:
‘glBufferData’ was not declared in this scope
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h: In member function ‘void
piece_of_cloth::create_buffers(int, int)’:
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h:253:28: error:
‘glGenBuffers’ was not declared in this scope
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h:254:41: error:
‘glBindBuffer’ was not declared in this scope
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h:256:102: error:
‘glBufferData’ was not declared in this scope
/home/lolo/Bullet/Demos/OpenCLClothDemo/cl_cloth_demo.cpp: In function ‘int
main(int, char**)’:
/home/lolo/Bullet/Demos/OpenCLClothDemo/cl_cloth_demo.cpp:553:11: error:
‘glewInit’ was not declared in this scope
make[2]: ***
[Demos/OpenCLClothDemo/MiniCL/CMakeFiles/AppOpenCLClothDemo_Mini.dir/__/cl_cloth
_demo.o] error 1
make[1]: ***
[Demos/OpenCLClothDemo/MiniCL/CMakeFiles/AppOpenCLClothDemo_Mini.dir/all] error
2
So, I added this line:
#include <GL/glew.h>
just before the line
#include "gl_win.h" //for OpenGL stuff
in the file 'cloth.h'.
In the file 'cl_cloth_demo.cpp', I commented the line #30:
//#include "gl_win.h"
Now, the result:
[ 99%] Building CXX object
Demos/OpenCLClothDemo/MiniCL/CMakeFiles/AppOpenCLClothDemo_Mini.dir/__/clstuff.o
/home/lolo/Bullet/Demos/OpenCLClothDemo/clstuff.cpp: In function 'void
initCL(void*, void*)':
/home/lolo/Bullet/Demos/OpenCLClothDemo/clstuff.cpp:56:2: error: 'printf' was
not declared in this scope
/home/lolo/Bullet/Demos/OpenCLClothDemo/clstuff.cpp:63:2: error: 'printf' was
not declared in this scope
So, in the file clstuff.cpp, I added:
#include <cstdio>
Yeah, now I can run the demo AppOpenCLClothDemo_Mini to see AMD and ATI flags!
Original comment by laurent....@gmail.com
on 11 Mar 2011 at 11:21
Hum, it's almost ok... I forgot to do 'make install' so I don't know what I was
running exactly. I have this error with the Flags demo:
ERROR: could not load bitmap, using placeholder
So the flags do not have a texture.
Original comment by laurent....@gmail.com
on 11 Mar 2011 at 11:26
We haven't tested the OpenCL work on non-Windows platforms, hence the include
issues.
Thanks for sorting them out and providing feedback. Do you have a patch (using
svn diff) ?
'installing' is not really supported. Did you use cmake to build the demos? It
should copy the bitmap texture next to the binary.
AppOpenCLClothDemo_Mini is the CPU emulated version running the OpenCL cloth
demo kernels, not using a 'real' OpenCL driver.
Original comment by erwin.coumans
on 11 Mar 2011 at 11:48
I don't see the printf in Bullet/Demos/OpenCLClothDemo/clstuff.cpp:63:2: error:
'printf' was not declared in this scope
Could it be an older file and not trunk?
Original comment by erwin.coumans
on 11 Mar 2011 at 11:54
Ok, I will take a look at doing a 'svn diff'.
I cleaned again the Bullet directory and everything is fine now. I was building
Bullet (and the demos) in the Bullet's directory directly.
I know that Mini_CL is an emulation but I think that my Nvidia card is too old
to support OpenCL.
The printf is added by the macro oclCHECKERROR.
Original comment by laurent....@gmail.com
on 12 Mar 2011 at 7:31
This is the patch that contains all my modifications.
This patch also contains a small fix specific to my machine that uses 64 bits
(and a Fedora 14):
- SET(CMAK_GLEW_LIBRARY /usr/lib/libGLEW.so )
+ SET(CMAK_GLEW_LIBRARY /usr/lib64/libGLEW.so )
This fix is not generic because on other linux distributions, libraries using
64 bits can be in the directory /usr/lib.
Original comment by laurent....@gmail.com
on 12 Mar 2011 at 7:51
Attachments:
I've had a proper look at btOclGetMaxFlopsDev on trunk now and have found a
couple of problems. See attached patch. The first problem is only a single
device is initialised in initCL, this depends on what kind of build it is (e.g.
CL_PLATFORM_AMD). Because of this calling btOclGetMaxFlopsDev is a bit
redundant.
The other problem is btOclGetMaxFlopsDev applies a SIMD multiplier, but it only
does this for the first device, not other devices in the while loop (assuming
btOclCommon::createContextFromType is called with CL_DEVICE_TYPE_ALL and there
are other devices).
After trying the code changes patch, my GPU still comes out on top, with a
flops of 18000 (5 compute units, 450 clock freq & 80 simd multiplier). My CPU
scores 55328 flops (8 compute units, 1729 clock freq & 4 simd multiplier).
I tried forcing it to use the CPU by calling btOclCommon::createContextFromType
with CL_DEVICE_TYPE_CPU but then it crashed in the atiocl.dll, so perhaps
something elsewhere is expecting a GPU or perhaps I created the context
incorrectly.
Original comment by cameron....@gmail.com
on 13 Mar 2011 at 9:03
Attachments:
[deleted comment]
It is needed to include 'cstdio' in 'cloth.h' to define sprintf:
[ 98%] Building CXX object
Demos/OpenCLClothDemo/MiniCL/CMakeFiles/AppOpenCLClothDemo_Mini.dir/__/cl_cloth_
demo.o
In file included from
/home/lolo/Bullet/Demos/OpenCLClothDemo/cl_cloth_demo.cpp:34:0:
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h: In member function 'void
piece_of_cloth::create_texture(std::string)':
/home/lolo/Bullet/Demos/OpenCLClothDemo/cloth.h:143:63: error: 'sprintf' was
not declared in this scope
make[2]: ***
[Demos/OpenCLClothDemo/MiniCL/CMakeFiles/AppOpenCLClothDemo_Mini.dir/__/cl_cloth
_demo.o] Error 1
make[1]: ***
[Demos/OpenCLClothDemo/MiniCL/CMakeFiles/AppOpenCLClothDemo_Mini.dir/all] Error
2
make: *** [all] Error 2
Original comment by laurent....@gmail.com
on 22 Mar 2011 at 6:59
the stdio.h has been included in cloth.h in latest trunk,
can you check http://code.google.com/p/bullet/source/detail?r=2355
(haven't checked/applied your patch yet)
Original comment by erwin.coumans
on 22 Mar 2011 at 9:43
Original issue reported on code.google.com by
cameron....@gmail.com
on 28 Feb 2011 at 3:34