Re: [eigen] The horrors of an XLC port/compatibility

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2010/1/22 Aron Ahmadia <aja2111@xxxxxxxxxxxx>:
> Hi all,
>
> From browsing the Eigen source, it appears that up to now you have not
> paid a large price in keeping the Eigen software compatible across
> various vendors, which is a great thing.

Yes, indeed: GCC and Intel's ICC are very compatible. MSVC is a bit
different. Old versions of GCC can be a bit of pain too.

> Even the IBM compilers do a
> lot of work to try and import GNU features, unfortunately, I don't
> think they do as great of a job as we would like.

If you have problems with us using GNU features, this can definitely
be worked around: for example MSVC doesn't do anything about importing
GNU features and we still support it. See e.g. src/Core/util/Macros.h,
we have lots of compatibility stuff there. EDIT -- I can see from your
patch that you've found that.

> I've been massaging

"make massages, not nuclear war" ? Sounds good.

> the Eigen code this afternoon trying to help XLC
> get through some of the fancier template/template arguments and friend
> template arguments called by Eigen.  As far as I can tell, everything
> is 'doable', but it will make the Eigen code base a fair amount uglier
> to include this sort of compatibility.
>
> I've generated a patch file here (good for a month):
> http://pastebin.com/m17b12fcb which show a portion of the edits which
> will be required for XLC compatibility.
>
> The most common edits are regarding template template arguments:
> -template<typename Derived> struct AnyMatrixBase
> +template<template <typename, typename> class Derived> struct AnyMatrixBase
>
> The XLC compiler does not accept template template arguments if they
> are not parametrized (i.e., you cannot put in "typename Derived" if
> Derived is actually a template class).

Sorry I don't get it. From your diff:

-template<typename UnaryOp, typename MatrixType>
+template<typename UnaryOp, template <typename, typename> class Derived>

First, i wouldn't call this template parameter Derived here. We call
them Derived when we have a CRTP,
http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern

Second, I really don't understand why the template template parameter
here is taking _2_ template parameters?

Actually I don't understand the problem. Here, MatrixType is just a
class. It's true that we often specialize this template with
MatrixType = some specialization of a template, but AFAIK we never try
to pass a template template parameter here. So I'm confused! As to why
you could possibly need to do a change like this. Here's a
simplification of this situation:

Eigen code:
template<typename M>
class Foo { .... };

Foo<MatrixXd> foo1;
Foo<Matrix<float,3,5> > foo2;

The fact that we're specializing Foo with M = Matrix<float,3,5>
doesn't mean that we're trying to pass Foo a template template
parameter. It shouldn't matter that M happens to be a specialization
of the template Matrix, as long of course as it's a full
specialization (which it is), not a partial specialization.


> I don't know how deep the rabbit hole goes as I've just spent a few
> hours looking at this.  I do know that adding XLC portability would
> broadly affect the Eigen source tree.

Let's first get the above issue resolved. It might just be a
misunderstanding of compiler errors ;)

> Since this is my first real
> interaction with an open source project, I'm not sure of the etiquette
> on how to proceed here.  Do I generate a branch that compiles and runs
> on BGP and report that back?  Should I be working against development
> or stable?

Work against the version that you are interested in using with XLC. I
hope that you are interested in the development version: that is what
would benefit the Eigen project the most as a whole. XLC support would
definitely be welcome in the development version.

If you are intersted in 2.0, obviously I don't mind you porting Eigen
2.0 to XLC, it's just that I'm not sure that we would want to push
large intrusive changes to the 2.0 branch that is supposed to be quite
stable at this stage.

In any case: create yourself an account on bitbucket.org and click on
"fork" the eigen project. Somewhere there's an option to choose the
branch you're forking. Any subsequent hg pull on the mainline eigen
repository will anyway pull both branches, so most forks have both
branches.

I guess you've found this:
http://eigen.tuxfamily.org/index.php?title=Developer%27s_Corner#Mercurial_workflow

>
> I am interested in seeing Eigen ported to IBM BlueGene and other IBM
> high-performance platforms.

This is great!

> I'm happy to help support this with my
> own coding efforts and getting support from my University.  As of now,
> this isn't an official project for me so it is getting worked on in my
> spare time.

Welcome to the club :) I don't think that any of us, so far, has been
paid for work on Eigen. On the other hand, Eigen experience just
helped me a lot in my job application process ;)

Benoit



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/