Esempio n. 1
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dtrexc( double *t, double *t_i, double *q, double *q_i,
                           lapack_int ifst, lapack_int ifst_i, lapack_int ilst,
                           lapack_int ilst_i, lapack_int info,
                           lapack_int info_i, char compq, lapack_int ldq,
                           lapack_int ldt, lapack_int n )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < ldt*n; i++ ) {
        failed += compare_doubles(t[i],t_i[i]);
    }
    if( LAPACKE_lsame( compq, 'v' ) ) {
        for( i = 0; i < ldq*n; i++ ) {
            failed += compare_doubles(q[i],q_i[i]);
        }
    }
    failed += (ifst == ifst_i) ? 0 : 1;
    failed += (ilst == ilst_i) ? 0 : 1;
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 2
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dsbtrd( double *ab, double *ab_i, double *d, double *d_i,
                           double *e, double *e_i, double *q, double *q_i,
                           lapack_int info, lapack_int info_i, lapack_int ldab,
                           lapack_int ldq, lapack_int n, char vect )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < ldab*n; i++ ) {
        failed += compare_doubles(ab[i],ab_i[i]);
    }
    for( i = 0; i < n; i++ ) {
        failed += compare_doubles(d[i],d_i[i]);
    }
    for( i = 0; i < (n-1); i++ ) {
        failed += compare_doubles(e[i],e_i[i]);
    }
    if( LAPACKE_lsame( vect, 'u' ) || LAPACKE_lsame( vect, 'v' ) ) {
        for( i = 0; i < ldq*n; i++ ) {
            failed += compare_doubles(q[i],q_i[i]);
        }
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 3
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dstebz( lapack_int m, lapack_int m_i, lapack_int nsplit,
                           lapack_int nsplit_i, double *w, double *w_i,
                           lapack_int *iblock, lapack_int *iblock_i,
                           lapack_int *isplit, lapack_int *isplit_i,
                           lapack_int info, lapack_int info_i, lapack_int n )
{
    lapack_int i;
    int failed = 0;
    failed += (m == m_i) ? 0 : 1;
    failed += (nsplit == nsplit_i) ? 0 : 1;
    for( i = 0; i < n; i++ ) {
        failed += compare_doubles(w[i],w_i[i]);
    }
    for( i = 0; i < n; i++ ) {
        failed += (iblock[i] == iblock_i[i]) ? 0 : 1;
    }
    for( i = 0; i < n; i++ ) {
        failed += (isplit[i] == isplit_i[i]) ? 0 : 1;
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 4
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dsterf( double *d, double *d_i, double *e, double *e_i,
                           lapack_int info, lapack_int info_i, lapack_int n )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < n; i++ ) {
        failed += compare_doubles(d[i],d_i[i]);
    }
    for( i = 0; i < (n-1); i++ ) {
        failed += compare_doubles(e[i],e_i[i]);
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 5
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_ztrrfs( double *ferr, double *ferr_i, double *berr,
                           double *berr_i, lapack_int info, lapack_int info_i,
                           lapack_int nrhs )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < nrhs; i++ ) {
        failed += compare_doubles(ferr[i],ferr_i[i]);
    }
    for( i = 0; i < nrhs; i++ ) {
        failed += compare_doubles(berr[i],berr_i[i]);
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 6
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dgeqrf( double *a, double *a_i, double *tau, double *tau_i,
                           lapack_int info, lapack_int info_i, lapack_int lda,
                           lapack_int m, lapack_int n )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < lda*n; i++ ) {
        failed += compare_doubles(a[i],a_i[i]);
    }
    for( i = 0; i < (MIN(m,n)); i++ ) {
        failed += compare_doubles(tau[i],tau_i[i]);
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 7
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_zhpcon( double rcond, double rcond_i, lapack_int info,
                           lapack_int info_i )
{
    int failed = 0;
    failed += compare_doubles(rcond,rcond_i);
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 8
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dsygst( double *a, double *a_i, lapack_int info,
                           lapack_int info_i, lapack_int lda, lapack_int n )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < lda*n; i++ ) {
        failed += compare_doubles(a[i],a_i[i]);
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 9
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dormqr( double *c, double *c_i, lapack_int info,
                           lapack_int info_i, lapack_int ldc, lapack_int n )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < ldc*n; i++ ) {
        failed += compare_doubles(c[i],c_i[i]);
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 10
0
/* Return value: 0 - test is passed, non-zero - test is failed */
static int compare_dsptrf( double *ap, double *ap_i, lapack_int *ipiv,
                           lapack_int *ipiv_i, lapack_int info,
                           lapack_int info_i, lapack_int n )
{
    lapack_int i;
    int failed = 0;
    for( i = 0; i < (n*(n+1)/2); i++ ) {
        failed += compare_doubles(ap[i],ap_i[i]);
    }
    for( i = 0; i < n; i++ ) {
        failed += (ipiv[i] == ipiv_i[i]) ? 0 : 1;
    }
    failed += (info == info_i) ? 0 : 1;
    if( info != 0 || info_i != 0 ) {
        printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
    }

    return failed;
}
Esempio n. 11
0
int main(int argc, char* argv[])
{
    if ((argc > 1) && ( 0==strncmp("-h",argv[1],2) ||
                        0==strncmp("--h",argv[1],3) ) ) {
        printf("./driver.x <nelem> [<niter> [<nwarm>]]\n");
        exit(0);
    }

#ifndef STATIC_ALLOCATION
    size_t nelem = (argc > 1) ? atol(argv[1]) : 1000;
#endif
    size_t niter = (argc > 2) ? atol(argv[2]) : 10;
    size_t nwarm = (argc > 3) ? atol(argv[3]) : niter/5;

    printf("SIMD memtest\n");
    printf("number of elements      = %zu\n", nelem);
    printf("number of iterations    = %zu\n", niter);
    printf("number of warmups       = %zu\n", nwarm);

    size_t bytes = nelem * sizeof(double);
    // the number of bytes actually allocated are padded out by 7 * max_stride
    // to provide a buffer for non-power of true stides which read slightly beyond
    // the end of the array
    size_t alloc_bytes = (nelem + 7 * 64) * sizeof(double);

    if (nelem >= 1024*1024) {
        printf("number of bytes         = %zu MiB\n", bytes/(1024*1024));
    } else {
        printf("number of bytes         = %zu\n", bytes);
    }

    printf("OpenMP threads = %d\n", omp_get_max_threads() );

#ifndef STATIC_ALLOCATION
    double * a = (double*)mymalloc(alloc_bytes);
    double * b = (double*)mymalloc(alloc_bytes);
    printf("allocation finished\n");
#endif

    //set_doubles(nelem, 7777.3333, a);
    init_doubles(nelem, a);

    int numtest = setup();

    for (int i=0; i<numtest; i++) {
        if (testfns[i] != NULL) {

            set_doubles(nelem, 1111.9999, b);

            double t0=0., t1=0.;
            for (size_t j = 0; j<niter; j++) {
                if (j == nwarm) t0 = omp_get_wtime();
                testfns[i](nelem, a, b);
            }
            t1 = omp_get_wtime();
            testtime[i] = t1-t0;
            testtime[i] /= (niter-nwarm);

            size_t testerrs = compare_doubles(nelem, a, b);

            if (testerrs != 0 || getenv("JEFFDEBUG") ) {
                printf("====== %s ======\n", testname[i]);
                printf("There were %zu errors!\n", testerrs);
                print_doubles_2(nelem, a, b);
            } else {
                //printf("There were no errors.\n");
                printf("%20s Time = %lf seconds Bandwidth = %lf GB/s\n",
                       testname[i], testtime[i], (2.e-9*bytes)/testtime[i]);
            }
        }
    }

    int numtest2 = setup_stride();

    int strides[13] = {1,2,3,4,5,6,7,8,12,16,24,32,64};
    for (int j=0; j<(int)(sizeof(strides)/sizeof(strides[0])); j++) {
        int s = strides[j];
        for (int i=0; i<numtest2; i++) {
            if (testfns2[i] != NULL) {

                double v = 1111.9999;
                set_doubles(nelem, v, b);

                double t0=0., t1=0.;
                for (size_t j = 0; j<niter; j++) {
                    if (j == nwarm) t0 = omp_get_wtime();
                    testfns2[i](nelem, a, b, s);
                }
                t1 = omp_get_wtime();
                testtime2[i] = t1-t0;
                testtime2[i] /= (niter-nwarm);

                size_t testerrs = compare_doubles_stride_holes(nelem, a, b, s, v);

                if (testerrs != 0 || getenv("JEFFDEBUG") ) {
                    printf("====== %s (stride=%d) ======\n", testname2[i], s);
                    printf("There were %zu errors!\n", testerrs);
                    //print_doubles_2(nelem, a, b);
                    print_compare_doubles_stride_holes(nelem, a, b, s, v);
                    if (testerrs != 0) { exit(1); }
                } else {
                    //printf("There were no errors.\n");
                    printf("%20s (stride=%2d) Time = %lf seconds Bandwidth = %lf GB/s\n",
                           testname2[i], s, testtime2[i], (2.e-9*bytes)/s/testtime2[i]);
                }
            }
        }
    }

#ifndef STATIC_ALLOCATION
    free(a);
    free(b);
#endif

    return 0;
}
Esempio n. 12
0
int account_compare(Client *a, Client *b)
{
    int bigger = compare_doubles(a->accountBalance, b->accountBalance);
    return bigger;
}
Esempio n. 13
0
 static bool C_T(std::shared_ptr<Row> a, std::shared_ptr<Row> b) {  // COPY_T: copy time
     return compare_doubles(a->cells[3]->getDoubVal(), b->cells[3]->getDoubVal());
 }
Esempio n. 14
0
 static bool R_T(std::shared_ptr<Row> a, std::shared_ptr<Row> b) {  // REC_T: recursive time
     return compare_doubles(a->cells[2]->getDoubVal(), b->cells[2]->getDoubVal());
 }
Esempio n. 15
0
 /* descending order comparator used to sort rows */
 static bool TIME(std::shared_ptr<Row> a, std::shared_ptr<Row> b) {  // TOT_T: total time
     return compare_doubles(a->cells[0]->getDoubVal(), b->cells[0]->getDoubVal());
 }
static int compare_doubles_ascending( const void* a, const void* b )
{
    return compare_doubles(a,b,1);
}