MATLAB Answers

Undefined symbol errors while calling magma from mex file ?

6 views (last 30 days)
Srinidhi Ganeshan
Srinidhi Ganeshan on 26 Mar 2019
Commented: Walter Roberson on 26 Mar 2019
versions: intel/2018.3, cuda/10.0.130, magma/2.4.0, matlab/2018b
Below, I have added my mex-magma file 'my_magma.c'
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "mex.h"
#include <cuda.h> // for CUDA_VERSION
// includes, project
#include "flops.h"
#include "magma_v2.h"
//#include "magma_lapack.h"
#include "testings.h"
/*#if defined(_OPENMP)
#include <omp.h>
#include "../control/magma_threadsetting.h" // internal header
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,const mxArray *prhs[])
// Get input variables from Matlab (host variables).
double *A;
// Get dimensions of input variables from Matlab.
int m, n,k;
const mwSize *Adims;
Adims = mxGetDimensions(prhs[0]);
m = Adims[0];
n = Adims[1];
//k = Adims[2];
A = mxGetPr(prhs[0]);
k = (int)*mxGetPr(prhs[1]);
magma_init() ;
real_Double_t gflops, magma_perf, magma_time, cublas_perf=0, cublas_time=0, cpu_perf, cpu_time;
double magma_error, cublas_error, magma_error2, cublas_error2;
double *h_A, *h_R, *h_Amagma, *tau, *h_work, tmp[1], unused[1];
double *d_A, *dtau_magma, *dtau_cublas;
double **dA_array = NULL;
double **dtau_array = NULL;
magma_queue_t queue = NULL ;
magma_int_t dev =0;
magma_queue_create (dev ,& queue );
magma_int_t *dinfo_magma, *dinfo_cublas;
magma_int_t M, N, lda, ldda, lwork, n2, info, min_mn;
magma_int_t ione = 1;
magma_int_t ISEED[4] = {0,0,0,1};
int status = 0;
magma_int_t batchCount;
magma_int_t column;
//magma_opts opts( MagmaOptsBatched );
//opts.parse_opts( argc, argv );
batchCount = k;
When I compile it,
>>mex my_magma.c -DADD_ -lmagma_sparse -lmagma -lcublas -lcudart
Building with 'gcc'.
Warning: You are using gcc version '7.3.0'. The version of gcc is not supported. The version currently supported with MEX is '6.3.x'. For a list of currently supported compilers see:
MEX completed successfully.
After compiling, I am calling from matlab (example.m), that has the lines below,
When I do this, I got the following error
>> example
Invalid MEX-file '/home/my_magma.mexa64':
/cvmfs/ undefined symbol:
To solve this error, I used
export LD_PRELOAD=//cvmfs/
After solving this error, i again got " undefined symbol" error, which is stated below
Invalid MEX-file '/home/naveen/Matlab/Mexcuda2019-03-16/mex_magma_qr.mexa64':
/cvmfs/ undefined symbol: __svml_copysignf4.
Can anyone provide me with a solution to this issue.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by