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

segmentation fault

$
0
0

Hello everyone,

I am new usint MKL and get an "segmentation fault" error with my first MKL-programm. Can anyone help me?

My program computes:

A = alpha * B + beta * C

It should be very easy.  Segmentation fault happens at the function MKL_Domatadd.

Thanks,

Bo

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <omp.h>
#include <time.h>
#include "mkl.h"

int rows = 200;
int cols = 200;
double alphaB = 0.69;
double alphaC = 0.53;
//double alphaD = 0.34;

int main() {
    double *A, *B, *C;
    int i, r;

    A = (double *) mkl_malloc( rows * cols * sizeof( double ), 64);
    B = (double *) mkl_malloc( rows * cols * sizeof( double ), 64);
    C = (double *) mkl_malloc( rows * cols * sizeof( double ), 64);

    for ( i=0; i<rows * cols; i++) {
        B[i] = (double) i;
        C[i] = (double) sqrt(i);
//        D[i] = (double) (i * i);
    }
    printf("after init \n");
    MKL_Domatadd ('r', 'n', 'n', rows, cols, alphaB, B, cols + 1, alphaC, C, cols + 1, A, cols + 1);
//    MKL_Domatadd ('r', 'n', 'n', rows, cols, 1, A, cols, alphaD, D, cols, A, cols);

    srand( time( NULL ) );
    r = rand() % (rows * cols);
    printf(" Value %g \n", A[ r ]);

    return 0;
}

 


Viewing all articles
Browse latest Browse all 2652

Trending Articles



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