I have a simple example as follows:
int n = 5;
std::vector<int> ia(6);
for(unsigned i=0;i<ia.size();_i++)ia[i]=_i;
std::vector<int> ja(5);
for(unsigned _=0_i<_ja.size();i++)ja[_i]=_i;
std::vector<double> a(5,1.);
If I call padrsio_setenv to set PARDISO_OOC_FILE_NAME, it crashes during the numerical factorization. However, if I use a different example,
int n = 8;
int nrhs = 2;
int _ia[9] = { 1, 5, 8, 10, 12, 15, 17, 18, 19};
int _ja[18] =
{ 1, 3, 6, 7,
2, 3, 5,
3, 8,
4, 7,
5, 6, 7,
6, 8,
7,
8
};
for(int i = 0; i <9; i++) _ia[i]--;
for(int i = 0; i<18; i++) _ja[i]--;
double _a[18] =
{ 7.0, 1.0, 2.0, 7.0,
4.0, 8.0, 2.0,
1.0, 5.0,
7.0, 9.0,
5.0, 1.0, 5.0,
1.0, 5.0,
11.0,
5.0
};
std::vector<int> ia (_ia, _ia + sizeof(_ia) / sizeof(int) );
std::vector<int> ja (_ja, _ja + sizeof(_ja) / sizeof(int) );
std::vector<double> a (_a, _a + sizeof(_a) / sizeof(double) );
It works fine. Here is how I call pardiso:
for (int i = 0; i < 64; i++) {
iparm[i] = 0;
}
iparm[0] = 1; /* No solver default */
iparm[1] = 2; /* Fill-in reordering from METIS */
/* Numbers of processors, value of OMP_NUM_THREADS */
iparm[2] = 1;
iparm[3] = 0; /* No iterative-direct algorithm */
iparm[4] = 0; /* No user fill-in reducing permutation */
iparm[5] = 0; /* Write solution into x */
iparm[6] = 0; /* Not in use */
//iparm[7] = 0; /* Max numbers of iterative refinement steps */
iparm[8] = 0; /* Not in use */
iparm[9] = 13; /* Perturb the pivot elements with 1E-13 */
iparm[10] = 1; /* Use nonsymmetric permutation and scaling MPS */
iparm[11] = 0; /* Not in use */
iparm[12] = 1; /* Maximum weighted matching algorithm is switched-on (default for non-symmetric) */
iparm[13] = 0; /* Output: Number of perturbed pivots */
iparm[14] = 0; /* Not in use */
iparm[15] = 0; /* Not in use */
iparm[16] = 0; /* Not in use */
iparm[17] = -1; /* Output: Number of nonzeros in the factor LU */
iparm[18] = -1; /* Output: Mflops for LU factorization */
iparm[19] = 0; /* Output: Numbers of CG Iterations */
iparm[27] = 0;
iparm[34] = 1;
iparm[59] = 1; // 0: in-core; 1: in-core first; then OOC if not enough memory; 2: ooc
maxfct = 1; /* Maximum number of numerical factorizations. */
mnum = 1; /* Which factorization to use. */
error = 0; /* Initialize error flag */
for (int i = 0; i < 64; i++) {
pt[i] = 0;
}
std::string fname = this->tmpDir + "/" + ooc_prefix;
PARDISO_ENV_PARAM param = PARDISO_OOC_FILE_NAME;
pardiso_setenv(pt, ¶m, fname.c_str());
phase = 11;
callPARDISO(pt, &maxfct, &mnum, &mtype, &phase,
&n, (AT*)&a[0], (int*)&ia[0], (int*)&ja[0], &idum, &idum,
iparm, &mkl_msglvl, &ddum, &ddum, &error);
phase = 22;
callPARDISO (pt, &maxfct, &mnum, &mtype, &phase,
&n, (AT*)&a[0], (int*)&ia[0], (int*)&ja[0], &idum, &idum,
iparm, &mkl_msglvl, &ddum, &ddum, &error);
By the way, I tried to modify the mkl example pardiso_sym_0_based.c to reproduce this problem but got compiling error
./source/pardiso_sym_0_based.c: In function ‘main’:
./source/pardiso_sym_0_based.c:120: error: ‘PARDISO_ENV_PARAM’ undeclared (first use in this function)
./source/pardiso_sym_0_based.c:120: error: (Each undeclared identifier is reported only once
./source/pardiso_sym_0_based.c:120: error: for each function it appears in.)
./source/pardiso_sym_0_based.c:120: error: expected ‘;’ before ‘param’
./source/pardiso_sym_0_based.c:121: error: stray ‘@’ in program
./source/pardiso_sym_0_based.c:121: error: ‘param’ undeclared (first use in this function)
As an workaround, I set the OOC file name using the configuration file.
I am using MKL 11.1.0
Major version: 11
Minor version: 1
Update version: 0
Product status: Product
Build: n20130711