[eigen] Eigens Parallellism

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


Hi all,

 

I am seeking a better understand of Eigen’s parallelism logic….

 

-           My understanding is that Eigen “Knows” and understands OpenMP..I believe I read somewhere that enabling OpenMP is simply a matter of including –fopenmp on the compile line…Is this really all there is to it?

-          To what degree does the code get auto-magically transformed into an OpenMP directive?   For example…In the code below.

-          Are there any plans for the future to incorporate not only OpenMP but also some MPI implementation?

-          Are there plans for Eigen to use some form of GPU processing?

 

 

Example Code

-----------------------

 

// Source Matrix

Eigen::MatriXd source_matrix;

source_matrix(source_num_rows, source_num_columns);

 

// Imaginary source matrix populating routine..Result is a grid of values, in this case temperature’s across a grid at 4 km resolution

::populate_source_matrix( source_matrix);

 

 

// Let’s assume that we have a dynamic matrix size to some run-time number of rows and columns.  The matrix will contain temperatures at 1km resolution when complete.

Eigen::MatrixXd my_temperature;

my_temperature.resize(num_rows, num_cols);

 

// In this case Eigen will do the correct thing, i.e.. Fork some number of worker threads to do an initialization.  In this case the only statement is an Eigen statement.

for( int y=0; y < num_rows; ++y )

{

  for( int x=0; x<num_cols; ++x )

  {

    my_temperature(y,x)= std::numeric_limits < double >::quiet_NaN();

  }

}

 

// Assume now that I need to do some “other” that is not Eigen Related.

// In this case I need to calculate a lat-lon from an y-x value and then given that lat-lon calculate a y-x value in a different grid.

 

// In both cases an imaginary routine is called and is assumed to be thread-safe

 

// The open questions are:

// (1) Is the entire outer and inner loop parallelized automatically?

// (2) Do I need to explicitly declare non Eigen stuff to be shared or private as needed?  My assumption is I would need to do so.

// (3) Do I need to declare Eigen Stuff as shared?  In the case below my_temperature could by asynchronously updated which I believe is safe since Eigen implicitly “knows”

//       about OpenMP

 

double ret_the_lat;

double ret_the_lon;

double resultant_row;

double resultant_column;

 

for( int y=0; y < num_rows; ++y )

{

  for( int x=0; x<num_cols; ++x )

  {

 

      // Imaginary y-x to lat-lon conversion routine..Not Eigen Related

      my_output_nav->lat_lon_from_ij(static_cast < double >(y), static_cast < double >(x), ret_the_lat, ret_the_lon,

                                        invert_y);

 

     // Imaginary lat-lon to y-x conversion routine..Not Eigen Related

     my_input_nav->ij_from_lat_lon(ret_the_lat, ret_the_lon, row, column, invert_y);

 

     my_temperature(y,x)=source_matrix(resultant_row, resultant_column;

  }

}

 

Thanks for all assistance,

Bill

 

++++

 

William Cassanova | Senior GFS Developer | The Weather Channel | 770.226.2368 | bcassanova@xxxxxxxxxxx

 



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