eigen


#1

I noticed that eigen can be used within 1.8, the questions are:

which version: Eigen 3.0.4?
where to drop eigen folder: ./panda3d/thirdparty/win-libs-vc9/eigen?


Error C2197 with interrogate
#2

This is the brand-spanking-new code I’m working on right now, so if you enable it in your build you do so at your own risk. However, as it happens, I think I’m done, so I can recommend you give it a try.

Version 3.0.4 is what I used to develop with. Unpack the eigen tarball into panda3d/thirdparty/win-libs-vc9/eigen/include, eliminating the parent directory name, so that there exists a file panda3d/thirdparty/win-libs-vc9/eigen/include/Eigen/Dense .

The bad news is that as a large template library, Eigen dramatically slows down Panda’s compilation time. On my computers, I’m now getting more than 3 hours for a clean build, where it use to compile in about 45 minutes. (This reminds me again one reason why I dislike template libraries so much. Still, at least it’s not as bad as Boost.)

The good news is that the resulting compiled binary is noticeably faster, especially for computing animations.

Edit: I should add that you will want to empty your model-cache and/or re-bamify any models in order to take full advantage of the new SSE2 enhancements provided by Eigen. (Your bam files need to have the proper 16-byte alignment baked in at bam generation time.)

David


#3

good news!
I’m going to give it right now a try and will let you know.
jean-claude

BTW. since I’m quite regularly compiling Panda with Intel Parallel Optimized Compiler, I think that Intel SSE4 + vectorization and //ization will provide an additional boost too.


#4

FYI. Some problems while building 1.8 with eigen

Compiling on Windows with :

(1) Issue with Bullet

(2) If I remove bullet from the build (–no-bullet), then some alignment problems… (alignment is obviously key for SSEx optimization!)

(3) Still pursuing the build.


#5

Your compiler is indeed faster than mine. You’ve passed my poor Windows computer by, it hasn’t gotten to that part of the tree yet.

(1) The solution here is to replace pvector with epvector, but only for those vectors which are generating errors. This is a special Eigen-provided pvector specialization that avoids this Windows library bug. I’ll try to make guesses as to which pvectors need to be replaced from the error messages you report.

(2) This happens when someone mistakenly passes a lvec object by value instead of by reference, e.g. foo(LColorf color) instead foo(const LColorf &color). The solution is to correct the prototype to pass these in by reference correctly. I’ve just committed changes to particlesystem to do this.

David


#6

Next: changes to be made in .\panda\src\physics\baseIntegrator.I

INLINE const epvector< LMatrix4 > &BaseIntegrator::
get_precomputed_linear_matrices() const {
  return _precomputed_linear_matrices;
}

//////////////////////////////////////////////////////////
// Function : get_precomputed_angular_matrices
//   Access : protected
//////////////////////////////////////////////////////////
INLINE const epvector< LMatrix4 > &BaseIntegrator::
get_precomputed_angular_matrices() const {

to cope with :


#7

in daematerials.cxx and daematerials.h

make change to:

same in ftltheader.h and fltheader.cxx

in maxeggloader.cxx (have a closer look at this one)

need to have a look too to .\panda3d\pandatool\src\vrmlegg\indexedFaceSet.h
class VrmlPolygon {
public:
EggPolygon _attrib;
epvector _verts;
}; ???

… and so on

At this point let me switch to --no-pandatool and try to pursue…

… almost done, but for whatever reason pzip is giving problems while compressing models (first time I see this…)


#8

I am interested to test this out too. :slight_smile:

I think odeBody has the same issue with the set_quaternion function. After making the suggested change the build continues. Will see where it ends up in the morning.


#9

pzip is generating crashes at the end of the build
this seems to be related to compress_stream.cxx in libpandaexpress.dll

here is the call stack:


#10

Make sure too that
.\panda3d\thirdparty\win-libs-vc9\eigen\include\Eigen directory is moved to build/include


#11

I’ve committed the suggested changes to the repository, thanks for that.

I’ll be able to investigate the runtime crash in a couple of hours. My apologies for these unexpected issues; I hadn’t actually tried to run this thing on Windows yet (I’ve been doing most of my development on OSX and Linux).

Edit: the pzip crash appears to be intermittent. I saw it happen once, but now I can’t get it to happen again. Still investigating. . .

David


#12

Go David go! :stuck_out_tongue:


#13

Almost ok, but still getting pzip.exe and flt2egg.exe crashing at the very end of the build

build launched with

1>**Number of tasks left 31 out of [T1] Compressing  497built/models/misc/fade_sphere.egg.pz 
1> starting tasksbuilt/bin/flt2egg -ps keep -o built/models/misc/fade_sphere.egg dmodels/src/misc/fade_sphere.flt
1>Reading dmodels/src/misc/camera.fltReading dmodels/src/misc/fade.flt
1>Writing built/models/misc/camera.egg
1>Writing built/models/misc/fade.egg
1>built/bin/pzip built/models/misc/camera.egg
1>built/models/misc/camera.egg.pz
1>The following command returned a non-zero value: built/bin/flt2egg -ps keep -o built/models/misc/fade_sphere.egg dmodels/src/misc/fade_sphere.flt
1>Storing dependency cache.
1>The following command returned a non-zero value: built/bin/pzip built/models/misc/camera.egg
1>The following command returned a non-zero value: built/bin/flt2egg -ps keep -o built/models/misc/fade.egg dmodels/src/misc/fade.flt
1>Elapsed Time: 1 hours 9 min
1>Build process aborting.
1>Build terminated.
1>Build log was saved at "file://c:\Users\jc\Desktop\PANDA_BUILD_BOT\Source MAJ\panda3d\built\BuildLog.htm"
1>makepanda - 0 error(s), 235 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

#14

I get the same thing. If I keep running the build repeatedly it eventually makes it to then end, but the resulting build crashes.


#15

I think I found it. It was a problem with our underlying ptmalloc2 scheme, which didn’t like being asked to provide 16-byte alignment for some reason. I fixed it by not using that scheme anymore; it turns out not be the performance advantage it used to be anyway.

Let me know if you’re still seeing these crashes. My own Windows build seems to be stable.

David


#16

too bad, something new is popping up :


#17

Whoops, sorry, there are lots of different build options, and I missed a case. :frowning:

Please try it again.

David


#18

ok, restarting!

btw. where is LINMATH_ALIGN defined?

edit: DONE! Thank you once more David !


#19

In makepanda.py. It’s hardcoded on by default.

David


#20

I was able to build successfully, but got a bit of a snag here:

from panda3d.core import *
from direct.showbase.ShowBase import ShowBase

class Game(ShowBase):
    def __init__(self):
        """Get the game ready to play."""
        ShowBase.__init__(self)
        self.node = render
        self.model = self.loader.loadModel('smiley')
        self.model.reparentTo(self.node)
        
        shaderdata = Mat4(0, 0, 0, 0,
                          0, 0, 0, 0,
                          0, 0, 0, 0,
                          0, 0, 0, 0)
        self.model.setShaderInput('shaderdata', shaderdata)

game = Game()
game.run()
Assertion failed: sizeof(mat(0, 0)) * mat.size() == pta.size() * sizeof(pta[0]) at line 338 of c:\work\panda3d\built\include\shader.I
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    game = Game()
  File "test.py", line 16, in __init__
    self.model.setShaderInput('shaderdata', shaderdata)
AssertionError: sizeof(mat(0, 0)) * mat.size() == pta.size() * sizeof(pta[0]) at line 338 of c:\work\panda3d\built\include\shader.I