Hi:
I try to use mkl_dss to solve a complex symmetric linear algebra. And the c++ code is:
#include<iostream>
#include<iterator>
#include<complex>
#include<vector>
#include<mkl_dss.h>
int main()
{
_MKL_DSS_HANDLE_t handle;
int opt{MKL_DSS_DEFAULTS};
dss_create(handle,opt);
std::vector<int>rowIndex{1,5,9,13,17,21,25,27,29,30},columns{1,3,7,8,2,3,8,9,3,7,8,9,4,6,7,8,5,6,8,9,6,7,8,9,7,8,8,9,9};
int sym{MKL_DSS_SYMMETRIC_COMPLEX},nRows{rowIndex.size()-1},nCols{nRows},nNonZeros{columns.size()};
dss_define_structure(handle,sym,rowIndex.data(),nRows,nCols,columns.data(),nNonZeros);
dss_reorder(handle,opt,0);
int type{MKL_DSS_INDEFINITE};
std::vector<std::complex<double>>values{14,{-1,-0.05},{-1,-0.05},{-3,-0.15},14,{-1,-0.05},{-3,-0.15},{-1,-0.05},16,{-2,-0.1},{-4,-0.2},{-2,-0.1},14,{-1,-0.05},{-1,-0.05},{-3,-0.15},14,{-1,-0.05},{-3,-0.15},{-1,-0.05},16,{-2,-0.1},{-4,-0.2},{-2,-0.1},16,{-4,-0.2},71,{-4,-0.2},16};
dss_factor_complex(handle,type,values.data());
int nRhs{10};
std::vector<std::complex<double>>rhs(nRows*nRhs,{1,0.05}),solValues(rhs.size());
std::cout<<dss_solve_complex(handle,opt,rhs.data(),nRhs,solValues.data())<<std::endl;
std::copy(solValues.cbegin(),solValues.cend(),std::ostream_iterator<std::complex<double>>{std::cout," "});
dss_delete(handle,opt);
std::cout<<std::endl;
}
the weird stuff is if I just set nRhs less than 6, then it works fine and the answer is correct. However, if I set nRhs greater than 7 then, it will print:
0
segmentation fault
it seems that there is something wrong with dss_solve_complex, it can not deal with multiple right hand side correctly.
I use g++-4.9 and the compile command is g++-4.9 -std=c++11 source.cpp -lmkl_rt, os: linux64
I already check that, if I use the pardiso interface then it works fine.
連結已複製
I install form l_psxe_online_p_2.1.3.020.sh. I know that I can use icc -V or icpc -V to check the version of icc or icpc. But I do not know how to check the version of mkl. Could you tell me how to do that?
One can usually tell the version of MKL from the path of the directory where the MKL files are installed. Or, you can compile and run the following program:
#include <mkl.h>
#include <stdio.h>
int main(){
char version[200];
mkl_get_version_string(version,200);
puts(version);
}