Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5772 closed defect (fixed)

OpenCL not working with Nvidia GRID K520

Reported by: mojodna Owned by: warmerdam
Priority: normal Milestone: 1.11.2
Component: Algorithms Version: unspecified
Severity: normal Keywords: opencl warp
Cc:

Description

GDAL built per https://gist.github.com/mojodna/6f3d8eaa56fffa687a98 using https://aws.amazon.com/marketplace/pp/B00FYCDDTE on a g2.2xlarge.

This is the output from:

sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/gdalwarp -q -wo "USE_OPENCL=TRUE" -t_srs "EPSG:3857" -tr 10 10 -tap -multi -co "TILED=YES" -co compress=lzw -r lanczos /vsizip/data/n43w125.zip/n43w125/floatn43w125_13.flt test.tiff

(n43w125.zip is available from http://ned.stamen.com.s3.amazonaws.com/13arcsec/n43w125.zip)

ERROR 1: Error: Failed to build program executable! Build Log: :55:20: error: cannot decrement value of type 'float attribute((address_space(1)))' dstPtr[iDstOffset] --;

ERROR 1: Error at file gdalwarpkernel_opencl.c line 2325: CL_BUILD_PROGRAM_FAILURE ERROR 1: OpenCL routines reported failure (-11) on line 3250. ERROR 1: Error: Failed to build program executable! Build Log: :55:20: error: cannot decrement value of type 'float attribute((address_space(1)))' dstPtr[iDstOffset] --;

ERROR 1: Error at file gdalwarpkernel_opencl.c line 2325: CL_BUILD_PROGRAM_FAILURE ERROR 1: OpenCL routines reported failure (-11) on line 3250.

Change History (4)

comment:1 by Even Rouault, 9 years ago

Can you try the following change:

Index: alg/gdalwarpkernel_opencl.c
===================================================================
--- alg/gdalwarpkernel_opencl.c	(révision 28173)
+++ alg/gdalwarpkernel_opencl.c	(copie de travail)
@@ -593,7 +593,7 @@
         "if (dstPtr[iDstOffset] == dstMinVal)\n"
             "dstPtr[iDstOffset] = dstMinVal + 1;\n"
         "else\n"
-            "dstPtr[iDstOffset] --;\n"
+            "dstPtr[iDstOffset] = dstPtr[iDstOffset] - 1;\n"
     "}\n"
 "}\n"
 "#endif\n"

comment:2 by mojodna, 9 years ago

Success!

Non-benchmark-worthy timing:

# OpenCL-enabled
$ time $(sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/gdalwarp -q -wo "USE_OPENCL=TRUE" -t_srs "EPSG:3857" -r lanczos /vsizip/n43w125.zip/n43w125/floatn43w125_13.flt test-gpu.tiff)

real	0m26.536s
user	0m22.908s
sys	0m3.664s

# single-core CPU
$ time $(sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/gdalwarp -q -wo "USE_OPENCL=FALSE" -t_srs "EPSG:3857" -r lanczos /vsizip/n43w125.zip/n43w125/floatn43w125_13.flt test-cpu.tiff)

real	0m56.892s
user	0m55.180s
sys	0m1.404s

# multi-processor CPU
$ nproc
8

$ time $(sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/gdalwarp -q -wo "USE_OPENCL=FALSE" -t_srs "EPSG:3857" -multi -r lanczos /vsizip/n43w125.zip/n43w125/floatn43w125_13.flt test-cpu-multi.tiff)

real	0m45.119s
user	0m55.120s
sys	0m1.720s

# multi-processor, OpenCL-enabled
$ time $(sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/gdalwarp -q -t_srs "EPSG:3857" -multi -r lanczos /vsizip/n43w125.zip/n43w125/floatn43w125_13.flt test-cpu.tiff)

real	0m13.018s
user	0m14.896s
sys	0m3.696s

I've been using watch nvidia-smi to ensure that the GPU is actually in use.

comment:3 by Even Rouault, 9 years ago

Component: defaultAlgorithms
Keywords: opencl warp added
Milestone: 1.11.2
Resolution: fixed
Status: newclosed

For CPU-only computation, you might also want to try -wo NUM_THREADS=ALL_CPUS (see http://www.gdal.org/structGDALWarpOptions.html#a0ed77f9917bb96c7a9aabd73d4d06e08) which will spread the computation, whereas -multi only spreads I/O and computation.

trunk r28300, branches/1.11 r28301 "OpenCL warper: fix OpenCL code compilation with NVIDIA OpenCL (#5772)"

comment:4 by mojodna, 9 years ago

Great, will do!

Thanks!

Note: See TracTickets for help on using tickets.