Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

random malloc error in d_commit_trig_transform

$
0
0

Greetings,

I'm experiencing a random malloc error in d_commit_trig_transform.  It's persistent, but happens at different times during the code execution as this routine is called repeatedly.  I'm currently testing on a Mac using the latest available Intel C++ compiler and MKL versions.  The routine that contains the d_commit_trig_transform call is given below.  The error occurs regardless of the number of cores used, but usually after a few thousand calls.  Does anything look suspicious in the code below?  Any advice would be appreciated.

 

void TwoDCylRZPotSolver::RHSVectorDST()
{
    /*
     This method performs the discrete sine transform of the first kind (DST-I) on
     rhsvector in preparation to solve the linear tridiagonal system.  The transform
     is performed in chunk sizes of nz.  Due to the manner in which the DST is
     calculated, an input array (a) of size nz+2 must be used with a[0]=a[nz+1]=0,
     and a[1 to nz]=data.  A normalization factor of sqrt(2/(nz+1)) must be applied
     when copying the transformed data back into rhsvector.
     */
    
    double normfac=sqrt(2/double(nz+1));
    
#pragma omp parallel for
    for(int i=0; i<nrad; i++)
    {
        int error, ipar[128],n=nz+1,tt_type=0;
        double dpar[5*(nz+2)/2+2];
        DFTI_DESCRIPTOR_HANDLE handle = 0; //data structures used in transform
        
        double datatemp[nz+2];
        datatemp[0]=0;
        datatemp[nz+1]=0;
       
        d_init_trig_transform(&n,&tt_type,ipar,dpar,&error);
        d_commit_trig_transform(datatemp,&handle,ipar,dpar,&error);
 
        //copy data from rhsvector
        for(int j=0; j<nz; j++)
            datatemp[j+1]=rhsvector[i*nz+j];
        
        
        //perform transformation
        d_backward_trig_transform(datatemp,&handle,ipar,dpar,&error);
        
        //copy transformed data back to rhsvector
        for(int j=0; j<nz; j++)
            rhsvector[i*nz+j]=normfac*datatemp[j+1];
        
        free_trig_transform(&handle,ipar,&error);

        if(error != 0)
            cout<<"Error = "<<error<<" in free_trig_transform in method RHSVectorDST."<<endl;
    }
}


Viewing all articles
Browse latest Browse all 2652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>