- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Have compiled the following program once as debug version (OK) and once as a Release Version (faulty) and get different results for the two dot products computed. Should give the same results.
Compiling with Intel(R) Visual Fortran Compiler XE 12.1.2.278 [Intel(R) 64]...
ifort /nologo /Os /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc100.pdb" /libs:static /threads /c /Qvc10 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin\amd64" "D:\Work\test_speed\problem_destilled.f90"
Linking...
Link /OUT:"x64\Release\test_speed.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"D:\Work\test_speed\test_speed\x64\Release\test_speed.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"D:\Work\test_speed\test_speed\x64\Release\test_speed.lib" "x64\Release\problem_destilled.obj"
Link: executing 'link'
Embedding manifest...
mt.exe /nologo /outputresource:"D:\Work\test_speed\test_speed\x64\Release\test_speed.exe;#1" /manifest "D:\Work\test_speed\test_speed\x64\Release\test_speed.exe.intermediate.manifest"
Program:
program problem_destilled
implicit none
integer, parameter :: MAX_NUMBER_STORAGE = 100000000
integer, parameter :: MAX_BLOCK_SIZE = 8*1024*1024
integer, parameter :: BLOCK_SIZE_I = MAX_BLOCK_SIZE/4
integer, parameter :: BLOCK_SIZE_R = MAX_BLOCK_SIZE/4
integer, parameter :: NUM_REP = 100
integer :: idxRep, idxBlock, idx, index
integer :: numBlocks, remainder
real, allocatable, dimension(:) :: vec1, vec2
real :: dot1(NUM_REP), dot2(NUM_REP)
real :: time, duration1, duration2, duration3
allocate( vec1(MAX_NUMBER_STORAGE) )
allocate( vec2(MAX_NUMBER_STORAGE) )
vec1 = 0.0
vec2 = 0.0
do idxRep = 1, NUM_REP
vec1(idxRep) = 1.0
vec2(idxRep) = 1.0
dot1(idxRep) = 0.0
do idx = 1, MAX_NUMBER_STORAGE
dot1(idxRep) = dot1(idxRep) + vec1(idx)*vec2(idx)
end do
end do
vec1(1:NUM_REP) = 0.0
vec2(1:NUM_REP) = 0.0
do idxRep = 1, NUM_REP
vec1(idxRep) = 1.0
vec2(idxRep) = 1.0
dot2(idxRep) = 0.0
numBlocks = MAX_NUMBER_STORAGE/BLOCK_SIZE_R
remainder = mod( MAX_NUMBER_STORAGE, BLOCK_SIZE_R )
! print*, BLOCK_SIZE_R, numBlocks, remainder
do idxBlock = 0, numBlocks-1
do idx = 1, BLOCK_SIZE_R
index = idxBlock*BLOCK_SIZE_R + idx
dot2(idxRep) = dot2(idxRep) + vec1(index)*vec2(index)
end do
end do
do idx = 1, remainder
index = numBlocks*BLOCK_SIZE_R + idx
dot2(idxRep) = dot2(idxRep) + vec1(index)*vec2(index)
end do
end do
do idxRep = 1, NUM_REP
print*, idxRep, dot1(idxRep), dot2(idxRep)
end do
deallocate( vec1 )
deallocate( vec2 )
end program problem_destilled
The content of dot1 and dot2 should be:
1.0 2.0 3.0 ... 100.0 but in this case dot2 is zero in all its components.
Can this be reproduced/explained?
Cheers
Dietmar
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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