Specify vectorization length

58 views
Skip to first unread message

yy.wayne

unread,
Feb 23, 2023, 1:09:07 AM2/23/23
to deal.II User Group
Hi,
is it possible to specify vectorization length(<deafult)? 
I'm running same code on local computer and server, whose cpu supports SSE2+4.10GHz
and AVX512+2.60GHz respectively. The speed up for iteration time is only 2 on server, which should be 8*2.6 / 2*4.1 > 2.5 times. Therefore I'd like to run code with different
vectorization length on same computer to test Vectorization's power.

I replace all FEEvaluation, MatrixFree and VectorizedArray construction with a VectorizedArray<number, width>, but make returns some intricate error. Is specify vectorization length possible? I think I've seen one in dealii/test ...

Peter Munch

unread,
Feb 23, 2023, 3:00:43 AM2/23/23
to deal.II User Group
Hi Wayne,

What is you error message?

> I replace all FEEvaluation, MatrixFree and VectorizedArray construction with a VectorizedArray<number, width>, but make returns some intricate error. Is specify vectorization length possible? I think I've seen one in dealii/test ...

Yes, it is possible and the to specify the additional template argument is the right approach.

I have introduced this template parameter for the hyper.deal project: https://github.com/hyperdeal/hyperdeal, where we create a tensor product of MatrixFree instances (where one is vectorized and the other is not).


The important aspect is that the vector length has to match the ones supported by given ISA. See table 1 in the release paper of deal.II 9.2: https://dealii.org/deal92-preprint.pdf

Peter

Martin Kronbichler

unread,
Feb 23, 2023, 5:42:45 AM2/23/23
to dea...@googlegroups.com

Dear Wayne,

To add a remark on the speedup you observed and your expectation, you should keep in mind that vectorization only helps in case there are no other bottlenecks in the code, like bandwidth from main memory or from a particular cache level, how large the proportion of time is when accessing the solution vectors via indirect addressing (VectorizedArray::gather), and similar bottlenecks. Finally, not all CPUs have the same number of AVX-512 execution units than scalar/SSE2 execution units. You need to look up these specifications, too.

Your approach to check more of the spectrum in vectorization is a step in the direction of building a performance model that helps you understand performance.

Best,
Martin

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/767b397f-7847-4e5b-ac63-95b2aad49da2n%40googlegroups.com.

yy.wayne

unread,
Feb 23, 2023, 5:43:07 AM2/23/23
to deal.II User Group
Thanks you Peter,

The error message is quite long and tricky (beyond my terminal can show) when I set
VectorizedArray<double, width> with width=1.
Knowing that deal.II do support this function is great. I‘ll try debug the code first and came back with
further progress or questions :)

Best,
Wayne

yy.wayne

unread,
Feb 23, 2023, 9:13:42 AM2/23/23
to deal.II User Group
I think the problem exists for vector-valued problem.
I modified the vectorization length of step-37 and it works fine.
But for vector value problem, on line 6090 of deal.II/matrix_free/fe_evaluation.h:
  • val_in[comp] * weight * jac[comp][comp]
The jac is defined as const Tensor<2, dim, dealii::VectorizedArray<Number>>, which doesn't
match customized VectorizedArrayType.

Similar on line 6101
  • transpose(invert(inv_t_jac))
where inv_t_jac is also dealii::VectorizedArray<Number> type data.

Peter Munch

unread,
Feb 23, 2023, 9:16:47 AM2/23/23
to deal.II User Group
What version of deal.II are you using. I thought we fixed the vector-valued version: https://github.com/dealii/dealii/commit/6351f255d16c3cf465752e2ce943726df6bf4ea4

Peter

yy.wayne

unread,
Feb 23, 2023, 9:20:14 AM2/23/23
to deal.II User Group
I'm using deal.II 9.4.0. It seems bug are fixed...

Peter Munch

unread,
Feb 23, 2023, 9:21:50 AM2/23/23
to deal.II User Group
It should be part of the 9.4.1 point release.

Peter

yy.wayne

unread,
Feb 23, 2023, 9:22:39 AM2/23/23
to deal.II User Group
Great! Thank you Peter.

Best,
Wayne

Reply all
Reply to author
Forward
0 new messages