[GRASS-dev] Re: [GRASS GIS] #224: cache bug in DGLib

GRASS GIS trac at osgeo.org
Thu Oct 28 06:02:40 EDT 2010


#224: cache bug in DGLib
----------------------+-----------------------------------------------------
  Reporter:  martinl  |       Owner:  grass-dev@…              
      Type:  defect   |      Status:  reopened                 
  Priority:  major    |   Milestone:  6.4.1                    
 Component:  Vector   |     Version:  6.4.0                    
Resolution:           |    Keywords:  dglib, cache, v.net.path 
  Platform:  All      |         Cpu:  All                      
----------------------+-----------------------------------------------------

Comment(by huhabla):

 I have tested v.net.path with a large dataset (460000 lines and 100 check
 points) with and without cache support.
 The results are identical.
 Computing without cache enabled needs twice as long as with cache enabled,
 here the bash terminal output:

 {{{
 ##############################################################################
 ########################## Cache enabled benchmark
 ###########################
 ##############################################################################

 GRASS 6.5.svn (Niedersachsen_Lambert):~/grassdata/Niedersachsen_Lambert >
 v.info test
 +----------------------------------------------------------------------------+
  | Layer:           test
 |
  | Mapset:          PERMANENT
 |
  | Location:        Niedersachsen_Lambert
 |
  | Database:        /home/soeren/grassdata
 |
  | Title:
 |
  | Map scale:       1:1
 |
  | Map format:      native
 |
  | Name of creator: institut
 |
  | Organization:
 |
  | Source date:     Tue Oct 05 09:42:49 2010
 |
 |----------------------------------------------------------------------------|
  |   Type of Map:  vector (level: 2)
 |
  |
 |
  |   Number of points:       0               Number of areas:      0
 |
  |   Number of lines:        464452          Number of islands:    0
 |
  |   Number of boundaries:   0               Number of faces:      0
 |
  |   Number of centroids:    0               Number of kernels:    0
 |
  |
 |
  |   Map is 3D:              No
 |
  |   Number of dblinks:      1
 |
  |
 |
  |         Projection: x,y
 |
  |               N:      2658319.4974    S:      2365859.4479
 |
  |               E:         108601.19    W:      -222120.0652
 |
  |
 |
  |   Digitization threshold: 0
 |
  |   Comments:
 |
  |
 |
 +----------------------------------------------------------------------------+


 GRASS 6.5.svn (Niedersachsen_Lambert):~/grassdata/Niedersachsen_Lambert >
 time v.net.path input=test output=test_paths_100_cache_enabled type=line
 afcolumn=t_time_min file=NS_Sources_SinksPath_test.txt --o
 Building graph...
 Registering arcs...
  100%
 Flattening the graph...
 Graph was built
  100%
 WARNING: Point -217249.204900,2624762.857300 is not reachable from point
          -27264.284444,2373360.000000
 WARNING: Point 25376.264700,2602749.415200 is not reachable from point
          -27264.284444,2373360.000000
 WARNING: Point -130178.530600,2612861.471700 is not reachable from point
          -27264.284444,2373360.000000
 WARNING: 3 destination(s) unreachable (including points out of threshold)
 Building topology for vector map <test_paths_100_cache_enabled>...
 Registering primitives...
 97 primitives registered
 106646 vertices registered
 Building areas...
  100%
 0 areas built
 0 isles built
 Attaching islands...
 Attaching centroids...
  100%
 Number of nodes: 98
 Number of primitives: 97
 Number of points: 0
 Number of lines: 97
 Number of boundaries: 0
 Number of centroids: 0
 Number of areas: 0
 Number of isles: 0

 real    3m16.618s
 user    3m5.422s
 sys     0m8.607s

 ##############################################################################
 ########################## Cache disabled benchmark
 ##########################
 ##############################################################################

 GRASS 6.5.svn (Niedersachsen_Lambert):~/grassdata/Niedersachsen_Lambert >
 time v.net.path input=test output=test_paths_100_cache_disabled type=line
 afcolumn=t_time_min file=NS_Sources_SinksPath_test.txt --o
 Building graph...
 Registering arcs...
  100%
 Flattening the graph...
 Graph was built
  100%
 WARNING: Point -217249.204900,2624762.857300 is not reachable from point
          -27264.284444,2373360.000000
 WARNING: Point 25376.264700,2602749.415200 is not reachable from point
          -27264.284444,2373360.000000
 WARNING: Point -130178.530600,2612861.471700 is not reachable from point
          -27264.284444,2373360.000000
 WARNING: 3 destination(s) unreachable (including points out of threshold)
 Building topology for vector map <test_paths_100_cache_disabled>...
 Registering primitives...
 97 primitives registered
 106646 vertices registered
 Building areas...
  100%
 0 areas built
 0 isles built
 Attaching islands...
 Attaching centroids...
  100%
 Number of nodes: 98
 Number of primitives: 97
 Number of points: 0
 Number of lines: 97
 Number of boundaries: 0
 Number of centroids: 0
 Number of areas: 0
 Number of isles: 0

 real    6m12.256s
 user    6m1.214s
 sys     0m10.338s

 }}}

 Here is a spearfish example which (hopefully) generates a dataset
 following the suggestion of Markus:

 {{{
 g.region vect=roads
 d.mon start=x0
 d.erase
 g.copy vect=roads,roads_path --o
 v.db.addcol roads_path col="forward double precision, backward double
 precision"

 # define traveling costs as inverse of speed limit:
 v.db.update roads_path col=forward val=1/50
 v.db.update roads_path col=backward val=1/50
 v.db.update roads_path col=forward val=1/75 where="label='interstate'"
 v.db.update roads_path col=backward val=1/75 where="label='interstate'"
 v.db.update roads_path col=forward val=1/5 where="label='unimproved road'"
 v.db.update roads_path col=backward val=1/5 where="label='unimproved
 road'"
 v.db.update roads_path col=forward val=1/25 where="label='light-duty road,
 improved surface'"
 v.db.update roads_path col=backward val=1/25 where="label='light-duty
 road, improved surface'"
 v.db.select roads_path

 #    cat      x                y               x               y
 echo "1 601241.63900415 4914234.39834025 592750.64315353 4925991.16182573"
 > /tmp/input.txt
 echo "2 601241.63900415 4914234.39834025 591866.59045237 4926913.56316479"
 >> /tmp/input.txt
 echo "3 601241.63900415 4914234.39834025 595808.58921162 4926703.69294606"
 >> /tmp/input.txt
 echo "4 601241.63900415 4914234.39834025 596038.555971 4926823.06308527"
 >> /tmp/input.txt
 echo "5 601241.63900415 4914234.39834025 604507.406639 4915125.06224066"
 >> /tmp/input.txt
 echo "6 601241.63900415 4914234.39834025 605057.73125402 4915511.07087975"
 >> /tmp/input.txt
 echo "9 601241.63900415 4914234.39834025 590791.18257261 4926614.62655602"
 >> /tmp/input.txt
 echo "10 601241.63900415 4914234.39834025 590761.78330618
 4926783.71536375" >> /tmp/input.txt

 v.net.path roads_path afcol=forward abcol=backward out=mypath type=line
 dmax=50 file=/tmp/input.txt --o

 d.vect map=roads_path at user1 color=255:0:0 lcolor=0:0:0 fcolor=170:170:170
 display=shape type=point,line,boundary,area icon=basic/circle size=5
 width=4 layer=1 lsize=8 xref=left yref=center llayer=1

 d.vect map=mypath at user1 color=0:0:0 lcolor=0:0:0 fcolor=170:170:170
 display=shape type=point,line,boundary,area icon=basic/circle size=5
 width=2 layer=1 lsize=8 xref=left yref=center llayer=1
 }}}

 Results are correct.

 Well done Markus!!!

 I think we can close this ticked when the changes are backported to 6.4.1.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/224#comment:19>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list