- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Which is faster, in place operations or not in place operations?
e.x.
c = a + b
or
a = a + b
How would I use Allocateso thatthe address of the first element of an arrayis divisible in bytes by 16, 32 or 64?
e.x.
c = a + b
or
a = a + b
How would I use Allocateso thatthe address of the first element of an arrayis divisible in bytes by 16, 32 or 64?
1 솔루션
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Your first question does not have a simple answer, other than "It depends". My advice is to write the code that is clearest to you and let the compiler worry about optimization. If you're talking scalars, I doubt you could ever detect a difference between these - with arrays, you might get into memory bandwidth issues with a separate target.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
링크가 복사됨
2 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Your first question does not have a simple answer, other than "It depends". My advice is to write the code that is clearest to you and let the compiler worry about optimization. If you're talking scalars, I doubt you could ever detect a difference between these - with arrays, you might get into memory bandwidth issues with a separate target.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
