Commit e944c04
authored
Fix OOM in geotiff dask read, sieve memory, and reproject GPU fallback (#1183)
Three performance fixes from the Phase 2 sweep targeting WILL OOM
verdicts under 30TB workloads:
geotiff: read_geotiff_dask() was reading the entire file into RAM just
to extract metadata before building the lazy dask graph. Now uses
_read_geo_info() which parses only the IFD via mmap -- O(1) memory
regardless of file size. Peak memory during dask setup dropped from
4.41 MB to 0.21 MB at 512x512 (21x reduction).
sieve: region_val_buf was allocated at rows*cols (16 GB for a 46K x 46K
raster) when the actual region count is typically orders of magnitude
smaller. Now counts regions first, allocates at actual size. Also reuses
the dead rank array as root_to_id, saving another 4 bytes/pixel. Memory
guard fixed from a misleading 5x multiplier to an accurate 28
bytes/pixel estimate.
reproject: _reproject_dask_cupy pre-allocated the full output on GPU via
cp.full(out_shape), which OOMs for large outputs. Now checks available
GPU memory and falls back to the existing map_blocks path (with
is_cupy=True) when the output exceeds VRAM. Fast path preserved for
outputs that fit.1 parent f2af4b9 commit e944c04
File tree
4 files changed
+97
-48
lines changed- xrspatial
- geotiff
- reproject
4 files changed
+97
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1031 | 1031 | | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | | - | |
| 1034 | + | |
1035 | 1035 | | |
1036 | 1036 | | |
1037 | 1037 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
121 | 128 | | |
| 129 | + | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
| |||
128 | 136 | | |
129 | 137 | | |
130 | 138 | | |
131 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
132 | 143 | | |
133 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
134 | 150 | | |
135 | 151 | | |
136 | 152 | | |
| |||
873 | 889 | | |
874 | 890 | | |
875 | 891 | | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
881 | 895 | | |
882 | 896 | | |
883 | 897 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
965 | 965 | | |
966 | 966 | | |
967 | 967 | | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
982 | 980 | | |
983 | 981 | | |
984 | 982 | | |
| |||
999 | 997 | | |
1000 | 998 | | |
1001 | 999 | | |
1002 | | - | |
| 1000 | + | |
| 1001 | + | |
1003 | 1002 | | |
1004 | 1003 | | |
1005 | 1004 | | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
| 1005 | + | |
1012 | 1006 | | |
1013 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
1014 | 1023 | | |
1015 | 1024 | | |
1016 | 1025 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
134 | 156 | | |
135 | 157 | | |
136 | | - | |
137 | | - | |
| 158 | + | |
| 159 | + | |
138 | 160 | | |
139 | 161 | | |
140 | 162 | | |
| |||
319 | 341 | | |
320 | 342 | | |
321 | 343 | | |
322 | | - | |
323 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
324 | 349 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
330 | 355 | | |
331 | 356 | | |
332 | 357 | | |
| |||
338 | 363 | | |
339 | 364 | | |
340 | 365 | | |
341 | | - | |
| 366 | + | |
| 367 | + | |
342 | 368 | | |
343 | 369 | | |
344 | 370 | | |
345 | 371 | | |
346 | | - | |
| 372 | + | |
347 | 373 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
353 | 379 | | |
354 | 380 | | |
355 | 381 | | |
| |||
0 commit comments