Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Problems with alignment with allocatable arrays passed into subroutines

$
0
0

Hi, 

I'm having some problems getting allocatable arrays in my code to align correctly. The error message seems similar to that mentioned: https://software.intel.com/en-us/forums/topic/506377

My test code is as follows

program test_align
  implicit none
  integer :: cmax
  integer, dimension(:, :), allocatable :: map
  cmax = 10

  allocate(map(-cmax:cmax,1:3))
  call mytest_sub(map,cmax)
  deallocate(map)

end program test_align


subroutine mytest_sub(map,cmax)
  implicit none
  integer, intent(in) :: cmax
  integer, intent(in) :: map(-cmax:cmax,1:3)
  integer, dimension(-cmax:cmax,1:3):: mapinternal
  integer, dimension(-cmax:cmax) :: i


!DIR$ ATTRIBUTES ALIGN: 64 :: i
!DIR$ ATTRIBUTES ALIGN: 64 :: map
!DIR$ ATTRIBUTES ALIGN: 64 :: mapinternal
!DIR$ ASSUME_ALIGNED i:64

end subroutine mytest_sub

When I compile this I get the following error: 

ifort -O2 test_align.f90 -vec-report=6
test_align.f90(23): error #6406: Conflicting attributes or multiple declaration of name.   [MAP]
!DIR$ ATTRIBUTES ALIGN: 64 :: map
------------------------------^
compilation aborted for test_align.f90 (code 1)

Any ideas as to what the problem is here or indeed if there's any work around in the pipeline. Whilst I can clearly just take a copy of the map and make that local to the subroutine and align that array I'd like to avoid having to create lots of temporary arrays. 

Many thanks.

Fiona

 


Viewing all articles
Browse latest Browse all 5691

Trending Articles



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