Getting scif_unregister failed with err 6 and 22

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
hiteshkahale
Posts: 2
Joined: Wed May 27, 2015 6:39 am

Getting scif_unregister failed with err 6 and 22

Post by hiteshkahale » Wed May 27, 2015 6:51 am

I am trying to use LU decomposition method by calling magma_degsv_mic() using magma-1.3.1 on Intel Xeon Phi Co-processor. But on runnig my code I got the following error: scif_unregister failed with err 6 and 22. I am attaching my code snippet. Thanks for help in advance.

Code: Select all

#include <math.h>
#include <stdio.h>
#include<stdlib.h>

#include "flops.h"
#include <magma.h>
#include "magma_lapack.h"
#include "magma_types.h"
#include "testings.h"

real_Double_t t0(real_Double_t space,real_Double_t v)
{
return space/(1+exp((1/(4*v))*(pow(space,2))-0.25));
}

struct node
{
     float function;
   float time;
    float space;
};



int main()

{


magma_init();
magma_device_t device;

    magma_int_t num = 0;


    magma_int_t err;
  magma_queue_t queue;

    err = magma_get_devices( &device, 1, &num );
    if ( err != MAGMA_SUCCESS or num < 1 ) {
        fprintf( stderr, "magma_get_devices failed: %d\n", (int) err );
        exit(-1);
    }
    err = magma_queue_create( device, &queue );
    if ( err != MAGMA_SUCCESS ) {
        fprintf( stderr, "magma_queue_create failed: %d\n", (int) err );
        exit(-1);
    }
 real_Double_t dx=0.1;
    real_Double_t dt=0.1;
    real_Double_t v=1;
    real_Double_t a=0.0;
    real_Double_t b=8.0;
    real_Double_t time=1;
    magma_int_t tti,tsi;
    tti=(time/dt)+1;
    tsi=((b-a)/dx)+1;


    struct node xxx[tti][tsi];
magma_int_t      i,j,k;
    for (i = 0; i < tti; i++)
    {

        for (j = 0; j < tsi; j++)
        {
                if(i==0)
                {
                        xxx[i][j].function=t0(a+j*dx,v);
                        xxx[i][j].space=a+j*dx;
                        xxx[i][j].time=i*dt;
 }
                else
                {
                        if(j==0)
                        {
                                xxx[i][j].function=0;
                                xxx[i][j].space=a;
                                xxx[i][j].time=i*dt;

                        }
                        if(j==tsi-1)
                        {
                                xxx[i][j].function=0;
                                xxx[i][j].space=a+(j)*dx;
                                xxx[i][j].time=i*dt;

                        }
                        else
                        {
                                xxx[i][j].function=0;
                                xxx[i][j].space=a+j*dx;
                                xxx[i][j].time=i*dt;
 }

                }

        }
    }

printf("\n\n1\n\n\n");

    for (i = 0; i < tti; i++)
    {
        for (k = 0; k < tsi; k++)
        {
                printf("\t%f\t",xxx[i][j].function);

                }
        printf("\n");

        }
magma_int_t *piv,rows,columns;
rows=columns=tsi;
    magma_int_t  matrix_size,vector_size;
    matrix_size=tsi*tsi;
    vector_size=tsi;
    double *h_B,h_X[tti][tsi];

        double *h_A;

    double *d_A,*d_B;


    TESTING_MALLOC_HOST(h_B,double,vector_size);
    TESTING_MALLOC_HOST(h_A,double,matrix_size);
    TESTING_MALLOC_HOST(piv,magma_int_t,rows);

    TESTING_MALLOC_DEV(d_A,double,matrix_size);
    TESTING_MALLOC_DEV(d_B,double,vector_size);
for (k = 1; k < tti; k++)
    {
//      magma_int_t *piv;
        magma_int_t info;
printf("\n\n3\n\n\n");

        for (i = 0; i <tsi; i++)
                 {
                                float der2;

                                if(i==0 || i==(columns -1))
                                {
                                        der2 = xxx[k][i].function;
                                }
                                else
                                {
                                        float temp=xxx[k-1][i].function;
                                        der2=pow(temp,2)/dx;
                                        der2+=temp/dt;
                                }

                                h_B[i]=der2;
 h_X[k][i]=0;
                                //this was for h_B and h_X vectors

                                for (j = 0; j < tsi ; ++j)
                     {
                         float p =(-v)/pow(dx,2);
                         float temp2=xxx[k-1][i].function;
                         float der1=(1/dt) -(2* p) + (temp2/dx);

                         if(i==0 && j==0)
                         {
                                 h_A[i*tsi+j]=1;
                         }
                         else if(i==rows-1 && j==columns-1)
                         {

                                 h_A[i*tsi+j]=1;
                         }

                         else
                         {
                             if(i!=0 && i!=rows-1)
                             {
         h_A[i*tsi+j]=1;
                         }

                         else
                         {
                             if(i!=0 && i!=rows-1)
                             {

                                 h_A[i*tsi+i-1]=p;

                                 h_A[i*tsi+i+1]=p;

                                 h_A[i*tsi+i]=der1;
                             }
                         }
                     }
                 }

        printf("\n\n4\n\n\n");

                magma_dsetmatrix(rows,columns,h_A,0,rows,d_A,0,rows,queue);

                magma_dsetvector(rows,h_B,rows,d_B,rows,queue);

                magma_dgesv_mic(rows,1,d_A,0,rows,piv,d_B,0,rows,&info,queue);

                magma_dgetvector(rows,d_B,rows,h_X[k],rows,queue);



}

printf("\n\n5\n\n\n");

    for (i = 0; i < tti; i++)
   {
                for (k = 0; k < tsi; k++)
                {
                        printf("\t%f\t",h_X[i][j]);

                }
                printf("\n");

        }

printf("\n\n6\n\n\n");

          TESTING_FREE_HOST( h_A );
            TESTING_FREE_HOST( h_B );
            TESTING_FREE_HOST( h_X );
           TESTING_FREE_HOST(piv );





    TESTING_FREE_DEV(d_A);
    TESTING_FREE_DEV(d_B);





  magma_queue_destroy( queue );
    magma_finalize();

printf("\n\n7\n\n\n");



return 0;
}





luszczek
Posts: 3
Joined: Fri Jul 17, 2015 10:25 am

Re: Getting scif_unregister failed with err 6 and 22

Post by luszczek » Fri Jul 17, 2015 10:28 am

Does the error still exist in version 1.4.0?

Post Reply