cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

denis
Adept I

OpenCL program crash

Hello to everyone,

I am trying to figure out why my opencl program crash and it seem very strange I made these test

#define TTPROGRAMDATA  __global struct TProgramData

...

// WORK OK

int Testparseg1(TTPROGRAMDATA *ProgramData,float sprec,vec3 pos)

{

int cnt=0;

int i,ni=ProgramData->NumIstructions;//,imin;

float v,vmin;

bool fnd=false;

float MaxDistVoxel=ProgramData->VoxelData.VoxelRadius*2.0f;

float vraddia=ProgramData->VoxelData.VoxelRadius;

i=0;

while (i<ni&&(!fnd))

    {

    v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1 );  

    if (v<=vraddia)

        fnd=true;

    i++;

    }

if (fnd)

    {

    vraddia*=3.0f;

    for (i=0;i<ni;i++)

        {

        v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1 );    //ONLY 1 CALL

        if (v<=vraddia)

            cnt++;

        }

    }

return cnt;

}

// KO

int Testparseg1(TTPROGRAMDATA *ProgramData,float sprec,vec3 pos)

{

int cnt=0;

int i,ni=ProgramData->NumIstructions;//,imin;

float v,vmin;

bool fnd=false;

float MaxDistVoxel=ProgramData->VoxelData.VoxelRadius*2.0f;

float vraddia=ProgramData->VoxelData.VoxelRadius;

i=0;

while (i<ni&&(!fnd))

    {

    v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1 );  

    if (v<=vraddia)

        fnd=true;

    i++;

    }

if (fnd)

    {

    vraddia*=3.0f;

     // ----different rows---

    i=0;

    v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1 );  

    if (v<=vraddia)

        cnt++;

    //-----------------------------

    for (i=1;i<ni;i++)

        {

        v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1 );  

        if (v<=vraddia)

            cnt++;

        }

    }

return cnt;

}

...

__kernel void Build_testg1(__constant struct TInputData *InputData,TTPROGRAMDATA *ProgramData,

                                TVOXELSPTR Voxels)

{

int    iVoxel=get_global_id(0);

#ifdef _DEBUG

if (iVoxel>=MAXNUMVOXELS)

    return ;

#endif

float3    vp=GetVoxelPnt(ProgramData,iVoxel);

Voxels[iVoxel].ListPtr=Testparseg1(ProgramData,InputData->ExtSPrec,vp);

}

The function Testparseg1 work and the only difference from the second one is an external call before the for cycle.

Both the function works when ProgramData->NumIstructions < 2000 , when the for have less than about 2000 cycles.

Suggestion ?

Thank you,

Denis.

Messaggio modificato da Denis A.

In attach there is an example of crashing driver program .
The sample is build using Visual Studio 2010 .
Into the folder bin there is a precompiled version with all the files required by the sample.
To compile the project you need boost 1.55 and glm 0.9.4.6 .
I Hope this can help to discover where the problem is .

Thank you ,
Denis.

0 Likes
1 Solution
denis
Adept I

I found the solution ( different from restructuring all to removing one nested cycle level )

View solution in original post

0 Likes
11 Replies