Registered Member
|
Hi guys,
Quick question. I'm writing a finite element code that works both in 2d and 3d, and using Eigen for matrix/vector multiplication. For those who aren't familiar: an important part of the finite element algorithm includes calculating the jacobian of a coordinate transform. In practice, this involves multiplication of terms with a 2x2 (in 2 dimensions) or 3x3 (in 3 dimensions) matrix. I see that 2x2 matrices are fixed-sized vectorizable, while 3x3 matrices are not. Does this mean I will see better performance by using fixed-size matrices in the 2d code, and using dynamically generated matrices in the 3d code? As an added detail: any dynamic allocation is performed pre-time loop (i.e. in the non-performance critical part of the program), and all the multiplication is carried out within the time loop (where performance is critical). Thanks for any help or suggestions! Mike. |
Moderator
|
Fixed size matrices matrices will always be faster for 2x2 and 3x3 matrices. Regarding vectorization for the 3x3 case, you might try with a 4x3 matrix but don't expect much gain, especially with double precision without AVX.
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft