Quantcast
Channel: Intel® Many Integrated Core Architecture
Viewing all articles
Browse latest Browse all 1347

Offload example in fortran

$
0
0

Hi,

I'm trying this simple fortran offload example and I don't understand why it gives me this error :

main_offload1.f90(26): warning #8535: A procedure called in an OFFLOAD region must have the OFFLOAD:TARGET attribute.   [SQUAROOT]

        call squaroot(a,b,c,N)

-------------^

main_offload1.f90(26): warning #8535: *MIC* A procedure called in an OFFLOAD region must have the OFFLOAD:TARGET attribute.   [SQUAROOT]

        call squaroot(a,b,c,N)

-------------^

Here is the code:

!dir$ attributes offload:mic :: squaroot

        SUBROUTINE squaroot(a,b,c,N)

        REAL, DIMENSION(N,N) :: a, b, c

        INTEGER :: N

        DO j = 1, N

                DO i = 1, N

                        a(i,j) = SQRT( b(i,j) * c(i,j) )

                        write (*,*) a(i,j)

                END DO

        END DO

        END

        PROGRAM MAIN

!dir$ attributes offload:mic ::   a, b, c

        REAL, DIMENSION(:,:), ALLOCATABLE :: a, b, c

        INTEGER :: N

        N = 10

        ALLOCATE (a(N,N), b(N,N), c(N,N))

        DO j = 1, N

                DO i = 1, N

                        c(i,j) = (i+j*N)

                        b(i,j) = c(i,j)

                END DO

        END DO

!dir$ offload target(mic) in(a,b:length(N*N)) inout(c:length(N*N))

        call squaroot(a,b,c,N)

        DEALLOCATE (a,b,c)

        END

Thanks you.


Viewing all articles
Browse latest Browse all 1347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>