Hi all,
I’m a newbie in Openacc. Currently, i’m trying to use structure with FOR LOOP openacc, then i got some errors:
call to cuStreamSynchronize returned error 700: Illegal address during kernel execution
call to cuMemFreeHost returned error 700: Illegal address during kernel execution
My code:
typedef struct tagMuHistogram
{
int nWidth;
int nHeight;
int nOffset;
int mushift;
int dim;
float **muData;
} MU_HIST;
typedef struct {
int imageW, imageH, imageMarginSize;
int calcAddr( int x, int y ) {
return ((y-imageMarginSize) * (imageW-imageMarginSize*2) + (x-imageMarginSize));
}
void setHogPattern( int x, int y, int val ) {
pHogPatterns[ calcAddr(x,y) ]= val;
}
void setHogValue( int x, int y, int val ) {
pHogValues[ calcAddr(x,y) ]= val;
}
} MakeMuHistContext;
void calLBP(IplImage *img, LPMU_HIST muHist, int offset, ADJUSTMKHIST adjust, MakeMuHistContext *pCtx, int musize)
{
unsigned char *imgPtr, *imgAbovePtr, *imgBelowPtr;
float ** muDATA = muHist->muData;
#pragma acc data copy(muDATA[0:muHist->nWidth * muHist->nHeight][0:muHist->dim], img->imageData[0:c*(h*w)]) create(imgPtr[0:1], imgAbovePtr[0:1], imgBelowPtr[0:1])
{
#pragma acc parallel loop private(lbpVal, histVal, x,y,dim,imgHeightMinOne, imgWidthMinOne, musize)
for (y = MARGIN_SIZE; y < img->height - MARGIN_SIZE; y++)
{
//#pragma acc parallel loop
for (x = MARGIN_SIZE; x < img->width - MARGIN_SIZE; x++,imgPtr++)
{
imgAbovePtr = imgPtr - ws;
imgBelowPtr = imgPtr + ws;
....
muDATA[muIdx][voteIdx] += (float)histVal;
//if( pCtx!=(MakeMuHistContext *)NULL ) {
// pCtx->setHogPattern( x,y, lbpVal );
// pCtx->setHogValue( x,y, histVal );
//}
}
}
}
}
Please help me:
-
copy(muDATA[0:muHist->nWidth * muHist->nHeight][0:muHist->dim]) ===> Is it wrong?
If i replace muDATA[muIdx][voteIdx] += (float)histVal; by int tmp = muDATA[muIdx][voteIdx];, the code can run. I don’t know why. -
How to copy pCtx, MakeMuHistContext to GPU?
Thank you!