Opened 12 years ago

Closed 12 years ago

#4840 closed defect (fixed)

OpenCL: Segmentation fault while calling to gdalwarp with validity masks

Reported by: ajuvolkov Owned by: warmerdam
Priority: normal Milestone: 1.9.2
Component: Algorithms Version:
Severity: normal Keywords: opencl warp
Cc:

Description

Hello

I got a segmentation fault message while I call to this command:

gdalwarp -srcnodata -9999 -dstnodata -9999 -r cubic -tr 30 -30  -t_srs "+proj=gnom  +lon_0=0   +lat_0=0   +ellps=WGS84 +datum=WGS84 +units=m" -overwrite aster-gdem/ASTGTM2_S38W013_dem.tif  aster-gdem-prewarped/ASTGTM2_S38W013_dem.tif

I built gdal with OpenCL support from the https://svn.osgeo.org/gdal/trunk/gdal, revision 24990.

My OS is Ubuntu 12.04.

configure options:

--with-opencl --with-opencl-include=/opt/tools/nvc-sdk/OpenCL/common/inc --with-opencl-lib="-L/opt/tools/nvc-sdk/OpenCL/common/lib -loclUtil_x86_64 -lOpenCL" --with-python=/usr/bin/python2.7

Backtrace from the core dump file:

t
#0  0x00007f7e30990672 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f7e272b7396 in ?? () from /usr/lib/libcuda.so
#2  0x00007f7e353f8321 in set_dst_data (warper=0x2b62d80, dstDensityCL=0x7fff84f24d08, dstValidCL=<optimized out>, dstNoDataRealCL=0x7fff84f24cf8, dstDensity=0x0, dstValid=0x7f7e35bde010, ds
tNoDataReal=0x7f7e231ee000) at gdalwarpkernel_opencl.c:1563
#3  0x00007f7e353fa67e in GDALWarpKernelOpenCL_runResamp (warper=0x2b62d80, unifiedSrcDensity=0x7fff84f24d00, unifiedSrcValid=0x7fff84f24cf8, dstDensity=<optimized out>, dstValid=<optimized
out>, dfXScale=<optimized out>, dfYScale=<optimized out>, dfXFilter=<optimized out>, dfYFilter=<optimized out>, nXRadius=<optimized out>, nYRadius=2, nFiltInitX=-1, nFiltInitY=-1) at gdalwar
pkernel_opencl.c:2279
#4  0x00007f7e353ef82d in GWKOpenCLCase (poWK=<optimized out>) at gdalwarpkernel.cpp:2826
#5  GDALWarpKernel::PerformWarp (this=0x7fff84f24f60) at gdalwarpkernel.cpp:848
#6  0x00007f7e353fdad1 in GDALWarpOperation::WarpRegionToBuffer (this=0x7fff84f25430, nDstXOff=<optimized out>, nDstYOff=<optimized out>, nDstXSize=664485904, nDstYSize=1, pDataBuf=<optimize
d out>, eBufDataType=GDT_Int16, nSrcXOff=0, nSrcYOff=0, nSrcXSize=3601, nSrcYSize=2084, dfProgressBase=<optimized out>, dfProgressScale=<optimized out>) at gdalwarpoperation.cpp:1769
#7  0x00007f7e353fe5ce in GDALWarpOperation::WarpRegion (this=0x7fff84f25430, nDstXOff=<optimized out>, nDstYOff=<optimized out>, nDstXSize=3839, nDstYSize=3563, nSrcXOff=<optimized out>, nS
rcYOff=0, nSrcXSize=3601, nSrcYSize=2084, dfProgressBase=<optimized out>, dfProgressScale=<optimized out>) at gdalwarpoperation.cpp:1329
#8  0x00007f7e353ff116 in GDALWarpOperation::ChunkAndWarpImage (this=0x7fff84f25430, nDstXOff=<optimized out>, nDstYOff=<optimized out>, nDstXSize=3839, nDstYSize=<optimized out>) at gdalwar
poperation.cpp:701
#9  0x000000000040572e in main (argc=<optimized out>, argv=0x1be4520) at gdalwarp.cpp:1363

Attachments (3)

ASTGTM2_S38W013_dem.rar (219.6 KB ) - added by ajuvolkov 12 years ago.
ticket4840.patch (2.5 KB ) - added by Even Rouault 12 years ago.
Proposed fix
opencl_error.diff (3.5 KB ) - added by ajuvolkov 12 years ago.

Download all attachments as: .zip

Change History (8)

by ajuvolkov, 12 years ago

Attachment: ASTGTM2_S38W013_dem.rar added

comment:1 by ajuvolkov, 12 years ago

Component: defaultAlgorithms
Milestone: 2.0.0
Version: unspecifiedsvn-trunk

comment:2 by Even Rouault, 12 years ago

I'm attaching a patch with a few changes : I think that the main error that caused the crash was passing a validity mask for source whereas it was expected to be for destination buffer. I've also fixed a few errouneous buffer size computations that could result in 1-byte +/- differences.

Important note: those fixes only come from code review. I have not even compiled or tested it. Please test extensively and report.

by Even Rouault, 12 years ago

Attachment: ticket4840.patch added

Proposed fix

comment:3 by ajuvolkov, 12 years ago

Thanks, your patch fixed the problem. I launched a test that extensively checks for the patched version. The results I'll report soon. I encountered a new problem with OpenCL:

ERROR 1: Error at file gdalwarpkernel_opencl.c line 1426: CL_INVALID_IMAGE_SIZE
ERROR 1: Error at file gdalwarpkernel_opencl.c line 1426: CL_INVALID_IMAGE_SIZE
ERROR 1: Error at file gdalwarpkernel_opencl.c line 2330: CL_INVALID_IMAGE_SIZE
ERROR 1: Error at file gdalwarpkernel_opencl.c line 1426: CL_INVALID_IMAGE_SIZE
ERROR 1: OpenCL routines reported failure (-40) on line 2831.

I fix it by little changes in the alg/gdalwarpkernel_opencl.c. (I'm attaching a patch with your and my changes)

by ajuvolkov, 12 years ago

Attachment: opencl_error.diff added

comment:4 by ajuvolkov, 12 years ago

Nvidia driver version is 295.41

comment:5 by Even Rouault, 12 years ago

Keywords: opencl warp added
Milestone: 2.0.01.9.2
Resolution: fixed
Status: newclosed
Summary: Segmentation fault while calling to gdalwarpOpenCL: Segmentation fault while calling to gdalwarp with validity masks
Version: svn-trunk

Fixed in trunk (r25069) and branches/1.9 (r25070)

Note: See TracTickets for help on using tickets.