On 01/11/17 16:47, Szabolcs Nagy wrote:
> On 01/11/17 16:26, Jakub Jelinek wrote:
>> On Wed, Nov 01, 2017 at 04:23:11PM +0000, Szabolcs Nagy wrote:
>>> is there a way to get vectorized math functions in fortran?
>>>
>>> in c code there is attribute simd declarations or openmp
>>> declare simd pragma to tell the compiler which functions
>>> have simd variant, but i see no such thing in fortran.
>>
>> !$omp declare simd should work fine in fortran (with -fopenmp
>> or -fopenmp-simd).
>>
> 
> 1) i don't want to change the fortran.
> 
> 2) it does not work for me.
> 
> i want this to call vector powf in libmvec:
> 
> subroutine foo(a,b,c)
>   real(4) a(8000),b(8000),c(8000)
>   do j=1,8000
>     a(j)=b(j)**c(j)
>   end do
> end
> 
> where do i put
> 
> !$omp declare simd (powf)
> 
> ?

to answer my question..

it seems fortran cannot express the type signature
of mathematical functions because arguments are
passed by reference.

so there is no way to declare math interfaces
and then add omp declare simd to them to get
simd versions.

(it's not clear to me how omp declare simd is
supposed to work in fortran, but it is not useful
for vectorizing loops with math functions.)

so gfortran will need a different mechanism to
do the vectorization, e.g. an option like
-mveclibabi=glibc, but the list of available
vector functions need to be specified somewhere.

Reply via email to