MATLAB Answers

Undefined symbol errors while calling magma from mex file ?

7 ビュー (過去 30 日間)
Srinidhi Ganeshan
Srinidhi Ganeshan 2019 年 3 月 26 日
コメント済み: Walter Roberson 2019 年 3 月 26 日
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
#endif*/
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() ;
magma_print_environment();
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,
A=rand(10,10);
A=my_magma(A);
When I do this, I got the following error
>> example
Invalid MEX-file '/home/my_magma.mexa64':
/cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/ifort/2018.3.222/compilers_and_libraries_2018.3.222/linux/compiler/lib/intel64/libirng.so: undefined symbol:
__intel_skx_avx512_memcpy.
To solve this error, I used
export LD_PRELOAD=//cvmfs/soft.computecanada.ca/easybuild/software/2017/Core/ifort/2018.3.222/compilers_and_libraries_2018.3.222/linux/compiler/lib/intel64/libirc.so
After solving this error, i again got " undefined symbol" error, which is stated below
>>example
Invalid MEX-file '/home/naveen/Matlab/Mexcuda2019-03-16/mex_magma_qr.mexa64':
/cvmfs/soft.computecanada.ca/easybuild/software/2017/avx2/CUDA/intel2018.3/cuda10.0/magma/2.4.0/lib/libmagma.so: undefined symbol: __svml_copysignf4.
Can anyone provide me with a solution to this issue.

  1 件のコメント

Walter Roberson
Walter Roberson 2019 年 3 月 26 日

サインイン to comment.

回答 (0 件)

サインイン してこの質問に回答します。


Translated by