Page 1 of 1

"Trace/BPT trap: 5" when do resize() sometime. Only with: --with-opencl. MacOS X with NVidia GTX 980 G1.

Posted: 2017-08-19T07:06:56-07:00
by Airon65
I'm using:

Code: Select all

Mac OS X 10.12.5
NVidia GTX 980
CUDA-Z sees my GPU without any problem.

$ magick --version
Version: ImageMagick 7.0.6-7 Q16 x86_64 2017-08-12 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules 
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:46_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
I use following code for testes:

Code: Select all

#include <Magick++.h>
#include <iostream>

int main( int argc, char **argv ) {
	
	Magick::InitializeMagick( *argv );
	//Magick::EnableOpenCL(); // When I build with: --with-opencl flag I uncomment this line!
	
	Magick::Image image( "data/images/1.png" );
	for ( unsigned int i = 0; i < 10; i++ ) { // yeah, ten times, why not? :)
		std::cout << "\t" << i << ":\n";
		image.resize( "30x30!" );
	}
	std::cout << image.columns() << "x" << image.rows() << "\n";

	return 0;
	
}
It works as expected!

I build with these flags:

Code: Select all

$ Magick++-config --cppflags --cxxflags --ldflags --libs
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.0.6-7/include/ImageMagick-7
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.0.6-7/include/ImageMagick-7
-L/usr/local/Cellar/imagemagick/7.0.6-7/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI
-L/usr/local/Cellar/imagemagick/7.0.6-7/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI
But if I compile ImageMagick with the flag: --with-opencl + uncomment EnableOpenCL + run that program again I get following output:

Code: Select all

$ for i in {1..20}; do ./test-image-magick.o; done;
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
Trace/BPT trap: 5
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
Trace/BPT trap: 5
	0:
Trace/BPT trap: 5
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
Trace/BPT trap: 5
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
Trace/BPT trap: 5
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
Trace/BPT trap: 5
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30
	0:
	1:
	2:
	3:
	4:
	5:
	6:
	7:
	8:
	9:
30x30

Look at this. It happens with any images I tried. And yeah. When I build without opencl - the bug disappears. resize() sometime doesn't work and sometime work. And looks like my GPU doesn't work in ANY time when I use Magick::EnableOpenCL(); and compile imagemagick with opencl support. Looks it doesn't work for me :(

Why does it happen to be?

Re: "Trace/BPT trap: 5" when do resize() sometime. Only with: --with-opencl. MacOS X with NVidia GTX 980 G1.

Posted: 2017-08-19T18:10:48-07:00
by magick
We ran your demo over 10,000 times and did not get any faults. We're using ImageMagick 7.0.6-8 and gcc 7.1.1 under Fedora and CentOS. You could try building ImageMagick without enabling OpenMP (e.g. ./configure --disable-openmp). What is the width and height of your 1.png image?

Re: "Trace/BPT trap: 5" when do resize() sometime. Only with: --with-opencl. MacOS X with NVidia GTX 980 G1.

Posted: 2017-08-21T02:58:37-07:00
by Airon65
Thanks for the reply. I built it with "./configure --disable-openmp" but I had no luck. Width/height are: 720x1280, 300x400, 700x600 :) I tested many images. There's no any problem with those images :)

BUT: It looks like the problem with my system only. Looks like CUDA driver in MacOS is broken. So I think it's not a bug in the first message. Looks like a problem in CUDA driver which works strange.

Re: "Trace/BPT trap: 5" when do resize() sometime. Only with: --with-opencl. MacOS X with NVidia GTX 980 G1.

Posted: 2017-09-06T12:55:30-07:00
by dlemstra
Can you reproduce the issue with Imagemagick 6 or does this only happen with ImageMagick 7?