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

problem with DSS Interface with multiple right hand side

$
0
0

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.


Viewing all articles
Browse latest Browse all 2652

Latest Images

Trending Articles



Latest Images

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