- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a subroutine that allocates a workspace for MKL routines, and I want to specify the alignment of the allocated buffer. I'm using the ATTRIBUTES ALIGN directive. This works for e.g. allocatable automatic variables, but doesn't want to work for allocatable dummy arguments. For example, this fails:
subroutine create_workspace ( this, work ) class(object), intent(in) :: this real(kind=DP), allocatable, intent(inout) :: work(:) !DIR$ ATTRIBUTES ALIGN:64 :: work allocate(work(10)) end subroutine create_workspace
The error is
error #6406: Conflicting attributes or multiple declaration of name. [WORK]
Am I doing something totally wrong here? Is there better way to accomplish this? I'm looking for something that works on both Windows and Linux. The compiler version is 64-bit, 14.0.1.139.
Cheers,
Ben
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting - this is something we didn't consider. I'm not sure how to resolve this because the data could be passed already allocated but not at the specified alignment.
I think the way we'd have to do it is with ASSUME_ALIGNED (this is its own directive, not part of ATTRIBUTES) and then apply that alignment if the variable gets allocated within the procedure. I will suggest this to the developers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve. What about allowing it if the dummy argument is declared INTENT(OUT)? This way, it's guaranteed that it will be unallocated - it will call deallocate if already allocated on entry. It's not a show-stopper, though; it's easy enough to workaround. I'll just use a type-bound function that returns the size of the allocation and do the allocation (and alignment) in the calling routine.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page