Function vectorizing

In my program,I am trying to vectorize a function that consumes a great deal of the program’s execution time. I believe that I have done this on the function itself which I will call Function A.

However, another function is called inside of Function A’s vectorized code area. This Function B will be inlined during the compile stage. However, it is raw c source code, not any vectorized code at all. Will this Function B have to be vectorized or not?

If Function B must be vectorized how does one do it? Since Function A already has a vectorized section that will now contain an unvectorized section,Function B, and only part of Function B can be vectorized in the best circumstances. Is it acceptable to have a large section of unvectorized code in a vectorized code section?

This is confusing.

Any help appreciated.

THX 1138

HI,

is your question related to OpenACC or to vectorization in general? OpenACC currently does not support function calls within a accelerator region (except if it can be inlined).

Generally it is a good idea to write the code in a way such that the compiler can auto-vectorize the code for you. Hence, it strongly depends on the code of function B if it can be vectorized or not.

Moreover, it is not a good idea to have non-vectorized sections within vectorized sections because this would require the CPU to move the registers from the vector-registers (i.e. ymm (looking at Intel’s AVX)) to the non-vector-registers.

Can you show small code snippets such that we can help you to vectorize your code.

Did you have a look at the assembly code to verify that the code has been vectorized?

Hope this helps.
Best,
Paul