Hi all,
i am working my way through the example zexample_sparse_rci_c.c. I have it working now for my matrix, BUT found a strange behaviour for the input arrays Aq and Sq:
when declaring them like this:
MKL_Complex16 Aq[M0SQUARE]; (where MOSquare is an integer) everything works fine.
When declaring them like
MKL_Complex16 *Sq = new MKL_Complex16[M0SQUARE];
the first call to zfeast_hrci fails with:
Thread #1 [feastTrial] 5489 [core: 2] (Suspended : Signal : SIGSEGV:Segmentation fault)
mkl_feast_zfeast_hrci() at 0x7ffff617fedf
zfeast_hrci_() at 0x7ffff7959141
testAddition() at feastTrial.cpp:251 0x4047da
0x0
. Strangely enough: when declaring workc and work with new .... no problems occur.
What am I missing here?
I want to have all memory on the heap in order to cope with LARGE matrices.
Link Copied
Hi Christian,
how do you declare the M0SQUARE? Could you please provide us one test case?
I use the zexample_sparse_rci_c.c -> covert to CPP file. with MKL_Complex16 *Sq = new MKL_Complex16[M0SQUARE];
It seems work fine. I attached the cpp code for your reference.
Best Regards,
Ying
Hello Ying,
MKL_INT M0;
if (dimension < 500)
{
M0=dimension*0.5;
}
else
{
M0=dimension*0.1;
}
int workSize = M0*dimension;
MKL_INT M0StartValue = M0;
MKL_INT M0SQUARE = M0*M0;
The values in my testcase are dimension=495, M0= 247 and so on.
One more thing I forgot to mention:
I use the gcc compiler, (4.8.4) on ubuntu linux.
Thanks for your help.
Christian
OK. It seems to me that cannot mix the declaration/allocation types with my version of gcc
(i.e. having
MKL_Complex16 Aq[M0SQUARE]; (where MOSquare is an integer) everything works fine.
and
MKL_Complex16 *Sq = new MKL_Complex16[M0SQUARE];
in the program
)
replacing all declarations with new [] helped.
BUT now comes the next problem:
When trying to delete those arrays, the program crashes when trying to delete [] Sq; claiming the pointer would be invalid.
Any ideas why this happens? All other pointers can be deleted properly.
Hi Christian,
is there any special compiler option in your CPP code? or is there any special code (for example, delete [] Sq in while loop) in your CPP code?
I add
printf( "Max of (conjugate transposed of X)*X-I %.15e \n", smax);
delete [] Sq;
return 0;
}
tried the command;
$source /opt/intel/compilers_and_libraries_2016.2.181/linux/mkl/bin/mklvars.sh intel64
$g++ zexample_sparse_rci_c.cpp -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm
hu5@ivb01-ub:~/Merry$ ./a.out
FEAST ZFEAST_HRCI EXAMPLE PROGRAM
Sparse matrix size 10
Search interval [ 2.000000000000000e+00, 1.200000000000000e+01 ]
Intel MKL Extended Eigensolvers: complex double precision driver
Intel MKL Extended Eigensolvers: List of input parameters fpm(1:64)-- if different from default
Intel MKL Extended Eigensolvers: fpm(1)=1
Intel MKL Extended Eigensolvers: fpm(6)=1
..
It run fines.
yhu5@ivb01-ub:~/Merry$ g++ --version
g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1.
Could you provide us a test main cpp file, so we can debug at our sides?
Regards,
Ying
For more complete information about compiler optimizations, see our Optimization Notice.