Temporary arrays on large grids -> seg-fault

Bug #1665294 reported by Nick Papior
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Siesta
Fix Released
Medium
Nick Papior
4.0
Fix Released
Medium
Nick Papior
4.1
Fix Released
Medium
Nick Papior
libGridXC
Fix Released
Undecided
Nick Papior

Bug Description

In certain calculations when the mesh-grid is extensively big a seg-fault will occur.

By tracking down it happens here:

        do iPart = 1,nParts
          partSize = sizeSum(iPart) - sizeSum(iPart-1)
          trsfBuff(sizeSum(iPart-1)+1:sizeSum(iPart)) = &
            reshape( srcData(srcComBox(1,1,iPart):srcComBox(2,1,iPart), &
                             srcComBox(1,2,iPart):srcComBox(2,2,iPart), &
                             srcComBox(1,3,iPart):srcComBox(2,3,iPart),:), &
                     (/partSize/) )
        end do ! iPart

(line 2617 of mesh3d.F90)

It is because the reshape creates a temporary array upon copy.

If all processors hit this point at the same time (unlikely, but may occur), the mesh grid will be duplicated which may turn out to be too much memory.

I think that all array assignments should be made into explicit loops to circumvent possible array-temporaries.

Related branches

Nick Papior (nickpapior)
Changed in libgridxc:
assignee: nobody → Nick Papior (nickpapior)
Nick Papior (nickpapior)
Changed in siesta:
assignee: nobody → Nick Papior (nickpapior)
importance: Undecided → Medium
status: New → In Progress
milestone: none → 4.0.1
Nick Papior (nickpapior)
Changed in siesta:
status: In Progress → Fix Committed
Nick Papior (nickpapior)
Changed in libgridxc:
status: New → Fix Committed
Nick Papior (nickpapior)
Changed in siesta:
status: Fix Committed → Fix Released
Revision history for this message
Alberto Garcia (albertog) wrote :

A fix was released with libgridxc-0.7.1

Changed in libgridxc:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.