nona GPU for remapping : seg fault

Bug #1362170 reported by Roumano
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Hugin
Fix Released
Undecided
Unassigned

Bug Description

If i activate the GPU for remapping, it's always crash :

===========================================================================
*************** Panorama makefile generated by Hugin ***************
===========================================================================
System information
===========================================================================
Operating system: GNU/Linux
Release: 3.14.14-gentoo
Kernel version: #1 SMP Thu Aug 14 21:23:51 CEST 2014
Machine: x86_64
Disc usage
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
/dev/sda2 23G 19G 3,1G 86% /
devtmpfs 3,9G 0 3,9G 0% /dev
tmpfs 3,9G 320K 3,9G 1% /dev/shm
tmpfs 3,9G 1,1M 3,9G 1% /run
tmpfs 3,9G 0 3,9G 0% /sys/fs/cgroup
tmpfs 3,9G 2,1M 3,9G 1% /tmp
/dev/sda3 212G 173G 28G 87% /home
/dev/sdb2 816G 677G 98G 88% /Backup
/dev/sdc2 241G 136G 93G 60% /home/roumano/Musique
/dev/sdc3 1,3T 1,2T 17G 99% /home/roumano/Vidéos
tmpfs 796M 52K 796M 1% /run/user/500
Memory usage
             total used free shared buffers cached
Mem: 7956 5647 2308 28 117 820
-/+ buffers/cache: 4710 3245
Swap: 3906 1775 2130
===========================================================================
Output options
===========================================================================
Hugin Version: 2014.0.0.51ff237f209e
Project file: /tmp/huginpto_L9TZUg
Output prefix: test
Projection: Cylindrical (1)
Field of view: 124 x 57
Canvas dimensions: 6491 x 3246
Crop area: (235,872) - (6306,3122)
Output exposure value: 13.82
Output stacks minimum overlap: 0.700
Output layers maximum Ev difference: 0.50
Selected outputs
Normal panorama
* Blended panorama
Using GPU for remapping
===========================================================================
Input images
===========================================================================
Number of images in project file: 3
Number of active images: 3
Image 0: /home/roumano/raw/pano/2014-08-06--17.48.49.CR2.tif
Image 0: Size 5196x3462, Exposure: 13.95
Image 1: /home/roumano/raw/pano/2014-08-06--17.48.51.CR2.tif
Image 1: Size 5196x3462, Exposure: 13.80
Image 2: /home/roumano/raw/pano/2014-08-06--17.48.53.CR2.tif
Image 2: Size 5196x3462, Exposure: 13.72
===========================================================================
Testing programs
===========================================================================
Checking nona...[OK]
Checking enblend...[OK]
Checking enfuse...[OK]
Checking hugin_hdrmerge...[OK]
Checking exiftool...[OK]
===========================================================================
Stitching panorama
===========================================================================
nona -g -z LZW -r ldr -m TIFF_m -o test -i 0 /tmp/huginpto_L9TZUg
nona: using graphics card: ATI Technologies Inc. AMD Radeon HD 7900 Series
make: *** [test0000.tif] Erreur de segmentation
make: *** Suppression du fichier « test0000.tif »

My card it's a ATI 7950 ( lspci : AMD/ATI] Tahiti PRO [Radeon HD 7950/8950 OEM / R9 280] )
Driver used : ati-drivers-14.6_beta1
on another exemple, OpenCL on my computer is working great (much faster than via the pcu ) via darktable
Debug information from darktable : ( if it's can help )
[opencl_init] device 0 `Tahiti' supports image sizes of 16384 x 16384
[opencl_init] device 0 `Tahiti' allows GPU memory allocations of up to 1024MB
[opencl_init] device 0: Tahiti
     GLOBAL_MEM_SIZE: 2392MB
     MAX_WORK_GROUP_SIZE: 256
     MAX_WORK_ITEM_DIMENSIONS: 3
     MAX_WORK_ITEM_SIZES: [ 256 256 256 ]
     DRIVER_VERSION: 1526.3 (VM)
     DEVICE_VERSION: OpenCL 1.2 AMD-APP (1526.3)

Don't known how to provide more information :
- I have recompiled higin with debug information (no more information in the GUI)
- don't known how to test nona from the commande line

Tags: nona
Revision history for this message
tmodes (tmodes) wrote :

Save your project and run the same command as in the log:
nona -g -z LZW -r ldr -m TIFF_m -o test -i 0 /tmp/huginpto_L9TZUg
Replace the temporary filename with the path and name of your saved project file:
nona -g -z LZW -r ldr -m TIFF_m -o test -i 0 project.pto

Add additional the switch -d:
nona -g -z LZW -r ldr -m TIFF_m -o test -i 0 -d /tmp/huginpto_L9TZUg
This will print more details.

PS: OpenCL has nothing to do with OpenGL. So this information is not helpful.

Revision history for this message
Roumano (roumano-k) wrote :
Download full text (11.3 KiB)

nona version 2014.0.0.51ff237f209e

nona -g -z LZW -r ldr -m TIFF_m -o test -i 0 -d ~/raw/pano/test.pto

nona: using graphics card: ATI Technologies Inc. AMD Radeon HD 7900 Series
destStart=[2719, 862]
destEnd=[6263, 3092]
destSize=[(3544, 2230)]
srcSize=[(5200, 3462)]
srcBuffer=0x7f92f5e40010
srcAlphaBuffer=0x7f92f1851010
destBuffer=0x7f92f3107010
destAlphaBuffer=0x7f92f297d010
destGLInternalFormat=GL_RGBA16
destGLFormat=GL_RGB
destGLType=GL_UNSIGNED_SHORT
srcGLInternalFormat=GL_RGBA16
srcGLFormat=GL_RGB
srcGLType=GL_UNSIGNED_SHORT
srcAlphaGLType=GL_UNSIGNED_BYTE
destAlphaGLType=GL_UNSIGNED_BYTE

warparound=0
needsAtanWorkaround=1
maxTextureSize=16384
Source chunks:
    [(0, 0) to (5200, 3462) = (5200x3462)]
Dest chunks:
    [(0, 0) to (1772, 2230) = (1772x2230)]
    [(1772, 0) to (3544, 2230) = (1772x2230)]
Total GPU memory used: 455759320
Interpolator chunks:
    [(0, 0) to (4, 4) = (4x4)]
#version 110
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect SrcTexture;
float sinh(in float x) { return (exp(x) - exp(-x)) / 2.0; }
float cosh(in float x) { return (exp(x) + exp(-x)) / 2.0; }
float atan2_xge0(const in float y, const in float x) {
    if (abs(y) > x) {
        return sign(y) * (1.5707963267948965580 - atan(x, abs(y)));
    } else {
        return atan(y, x);
    }
}
float atan2_safe(const in float y, const in float x) {
    if (x >= 0.0) return atan2_xge0(y, x);
    else return (sign(y) * 3.1415926535897931160) - atan2_xge0(y, -x);
}
float atan_safe(const in float yx) {
    if (abs(yx) > 1.0) {
        return sign(yx) * (1.5707963267948965580 - atan(1.0/abs(yx)));
    } else {
        return atan(yx);
    }
}
void main(void)
{
    float discardA = 1.0;
    float discardB = 0.0;
    vec2 src = gl_TexCoord[0].st;
    src -= vec2(3220.0000000000000000, 1610.0000000000000000);

    // erect_pano(2975.6840327762110974)
    src.t = 2975.6840327762110974 * atan_safe(src.t / 2975.6840327762110974);

    // rotate_erect(9348.3870967741931963, -1350.3225806451612243)
    {
        src.s += -1350.3225806451612243;
        float w = (abs(src.s) > 9348.3870967741931963) ? 1.0 : 0.0;
        float n = (src.s < 0.0) ? 0.5 : -0.5;
        src.s += w * -18696.774193548386393 * ceil(src.s / 18696.774193548386393 + n);
    }

    // sphere_tp_erect(2975.6840327762110974)
    {
        float phi = src.s / 2975.6840327762110974;
        float theta = -src.t / 2975.6840327762110974 + 1.5707963267948965580;
        if (theta < 0.0) {
            theta = -theta;
            phi += 3.1415926535897931160;
        }
        if (theta > 3.1415926535897931160) {
            theta = 3.1415926535897931160 - (theta - 3.1415926535897931160);
            phi += 3.1415926535897931160;
        }
        float s = sin(theta);
        vec2 v = vec2(s * sin(phi), cos(theta));
        float r = length(v);
        theta = 2975.6840327762110974 * atan2_safe(r, s * cos(phi));
        src = v * (theta / r);
    }

    // persp_sphere(2975.6840327762110974)
    {
        mat3 m = mat3(0.99971408939535111315, 0.023855460075879894588, -0.0016298739190327593985,
                      -0.023911074095988301552, 0.99738888563214511684, -0.068144488794355015382,
   ...

Revision history for this message
tmodes (tmodes) wrote :

I can't see anything strange in the output. It seems the image is remapped on the GPU, but crashing when saving the image to disc.

Could you post your pto file (with images)? So I could try if I can reproduce the crash.

Revision history for this message
Roumano (roumano-k) wrote :

Hi,

I put them here :
http://roumano.com/temp/nona.zip
i hope it's will help but not sure at all ...

Regards

Revision history for this message
tmodes (tmodes) wrote :

Thanks for test files.
I can reproduce the issue. It happens only on Linux, not on Windows.
I will have a look on it, but I can't promise anything.

Changed in hugin:
status: New → Confirmed
Revision history for this message
tmodes (tmodes) wrote :

One step further. The crash seems to be related to a bug in freeglut3, the library nona is using for GPU support: see http://sourceforge.net/p/freeglut/bugs/206/

There is no release with the bug.
I have yet not found a workaround.

Revision history for this message
Roumano (roumano-k) wrote :

A patch it's available on the bug http://sourceforge.net/p/freeglut/bugs/206/ :

+
+ /* This forces AMD Catalyst drivers to initialize and register a shutdown
+ * function, which must be done before our own call to atexit to prevent
+ * a crash if glutMainLoop is not called or is not exited cleanly.
+ * (http://sourceforge.net/p/freeglut/bugs/206/)
+ */
+ glXQueryExtensionsString( fgDisplay.pDisplay.Display,
+ DefaultScreen( fgDisplay.pDisplay.Display ));

It"s "only" 2line of modificationn, it's impossible to use this patch ?

Revision history for this message
tmodes (tmodes) wrote :

The patch applies to the freeglut source (it is accessing some internal variables which are not accessible from outside.). So would apply the patch to the freeglut sources and recompile freeglut and install the new compiled freeglut.

PS: There is a second bug report with a similar problem. But noone from the freeglut team responded to it: http://sourceforge.net/p/freeglut/bugs/201/

Revision history for this message
tmodes (tmodes) wrote :

I was able to port the patch to Hugin source code base. Unfortunately it does not help. I still get the seg fault. So I assume there is another glitch in freeglut (see bug 201).

Revision history for this message
tmodes (tmodes) wrote :

Hugin does not use freeglut any more (only default branch). This hopefully fixes also this segfault.

Changed in hugin:
status: Confirmed → Fix Committed
tmodes (tmodes)
Changed in hugin:
milestone: none → 2016.0beta1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.