When some code is linked with both arpack and lapack library, the arpack routine dsaupd exits with error code -9999, which indicates the routine could not build an Arnoldi factorization. However the value of iparam[4] indicates all the requested eigenvalues are successfully converged. This behaviour seemingly caused by symbol duplication problem described in following website. http://mathema.tician.de/node/373 After applying the patch provided at the site, I found the code successfully finds all the requested eigen values. How-To-Repeat: # cd /usr/ports/math/arpack # make install WITH_ATLAS=YES $ gcc44 -v Using built-in specs. Target: i386-portbld-freebsd8.0 Configured with: ./../gcc-4.4-20090915/configure --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --with-gmp=/usr/local --program-suffix=44 --libdir=/usr/local/lib/gcc44 --libexecdir=/usr/local/libexec/gcc44 --with-gxx-include-dir=/usr/local/lib/gcc44/include/c++/ --disable-rpath --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc44 --build=i386-portbld-freebsd8.0 Thread model: posix gcc version 4.4.2 20090915 (prerelease) (GCC) $ gcc44 arpack.c -oa.out -Wall -I/usr/local/include -L/usr/local/lib -L. -llapack -lcblas -lf77blas -latlas -lm -lgfortran -larpack $ ./a.out Error with dsaupd, info = -9999 Check documentation in dsaupd 3/3 eigen value(s) are successfully converged. ================================ arpack.c ======================================= #include <stdio.h> #include <stdlib.h> #include <string.h> #include <cblas.h> int dsaupd_(long *ido, char *bmat, long *n, char *which, long *nev, double *tol, double *resid, long *ncv, double *v, long *ldv, long *iparam, long *ipntr, double *workd, double *workl, long *lworkl, long *info); int dseupd_(long *rvec, char *howmny, long *select, double *d, double *z, long *ldz, double *sigma, char *bmat, long *n, char *which, long *nev, double *tol, double *resid, long *ncv, double *v, long *ldv, long *iparam, long *ipntr, double *workd, double *workl, long *lworkl, long *info); /*********************************************************************************/ /* wrapper for arpack routine */ /*********************************************************************************/ long dsaupd_lm_wrap(long n, const double *H, double *Z, double *s, long nev){ long dbuf_len; double *dbuf; long ibuf_len; long *ibuf; /* dsaupd */ long ido = 0; char bmat[2] = "I"; /* standerd eigen problem */ char which[3] = "LM"; /* Largest Magnitude */ double tol = 0.0; long ldv; double *resid, *v, *d; double *workd, *workl; long ncv, lworkl, info, *iparam, *ipntr; /* dsaupd */ long rvec = 1; char howmny[2] = "A"; long *select, ierr; double sigma; /* number of the lanczos vector */ ncv = nev*2; if(ncv > n){ ncv = n; } ldv = n; lworkl = ncv*ncv + 8*ncv; dbuf_len = n + n*ncv + 3*n + lworkl + n; dbuf = (double *)malloc(dbuf_len*sizeof(double)); resid = dbuf; v = resid + n; workd = v + n*ncv; workl = workd + 3*n; d = workl + lworkl; ibuf_len = 11 + 11 + ncv; ibuf = (long *)malloc(ibuf_len*sizeof(long)); iparam = ibuf; ipntr = iparam + 11; select = ipntr + 11; iparam[0] = 1; iparam[2] = 3*n; /* max iteration */ iparam[6] = 1; /* standerd eigen problem */ /* initialize */ info = 0; do { /* reverse communication */ dsaupd_(&ido, bmat, &n, which, &nev, &tol, resid, &ncv, v, &ldv, iparam, ipntr, workd, workl, &lworkl, &info); if ((ido == 1) || (ido == -1)){ /* y = H*x */ cblas_dsymv(CblasColMajor, CblasLower, n, 1.0, H, n, workd+(ipntr[0]-1), 1, 0.0, workd+(ipntr[1]-1), 1); /* z = B*x = x */ if(ido == 1){ memcpy(workd+(ipntr[2]-1), workd+(ipntr[0]-1), n*sizeof(double)); } } else if (ido != 99){ fprintf(stderr, "Error with (dsaupd_lm_wrap), ido = %ld \n", ido); fprintf(stderr, "Check documentation in dsaupd\n\n"); } }while ((ido == 1) || (ido == -1)); if (info < 0) { fprintf(stderr, "Error with dsaupd, info = %ld \n", info); fprintf(stderr, "Check documentation in dsaupd\n"); if(info == -9999){ fprintf(stderr, "%ld/%ld eigen value(s) are successfully converged. \n", iparam[4], nev); } fprintf(stderr, "\n"); exit(1); } else { dseupd_(&rvec, howmny, select, s, Z, &ldv, &sigma, bmat, &n, which, &nev, &tol, resid, &ncv, v, &ldv, iparam, ipntr, workd, workl, &lworkl, &ierr); if (ierr!=0) { fprintf(stderr, "Error with dseupd, info = %ld\n", ierr); fprintf(stderr, "Check the documentation of dseupd.\n\n"); } else if (info==1) { fprintf(stderr, "Maximum number of iterations reached.\n\n"); } else if (info==3) { fprintf(stderr, "No shifts could be applied during implicit\n"); fprintf(stderr, "Arnoldi update, try increasing NCV.\n\n"); } } free(dbuf); free(ibuf); return 0; } int main(int argc, char *argv[]) { int i; long nR, rank, buf_len; double *R, *Z, *s, *buf; nR = 8; rank = 3; buf_len = nR*nR + rank*nR + rank; buf = (double *)malloc(buf_len*sizeof(double)); R = buf; Z = R + nR*nR; s = Z + rank*nR; /* The Rosser Matrix (8x8, Column Major) */ R[0] = 611; R[1] = 196; R[9] = 899; R[2] = -192; R[10] = 113; R[18] = 899; R[3] = 407; R[11] = -192; R[19] = 196; R[27] = 611; R[4] = -8; R[12] = -71; R[20] = 61; R[28] = 8; R[36] = 411; R[5] = -52; R[13] = -43; R[21] = 49; R[29] = 44; R[37] = -599; R[45] = 411; R[6] = -49; R[14] = -8; R[22] = 8; R[30] = 59; R[38] = 208; R[46] = 208; R[7] = 29; R[15] = -44; R[23] = 52; R[31] = -23; R[39] = 208; R[47] = 208; R[54] = 99; R[55] = -911; R[63] = 99; /* Solve eigen problem of the Rosser matrix using arpack */ dsaupd_lm_wrap(nR, R, Z, s, rank); /* Display eigen values */ for(i=0; i< rank; i++){ printf("%lf ", s[i]); } printf("\n"); free(buf); return 0; }
Maintainer of math/arpack, Please note that PR ports/147487 has just been submitted. If it contains a patch for an upgrade, an enhancement or a bug fix you agree on, reply to this email stating that you approve the patch and a committer will take care of it. The full text of the PR can be found at: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/147487 -- Edwin Groothuis via the GNATS Auto Assign Tool edwin@FreeBSD.org
State Changed From-To: open->feedback Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Sorry ! I forgot to attach the patch - here it is. Regards, Eijiro Shibusawa <ej-sib@ice.uec.ac.jp>
Dear Eijiro Shibusawa, Can you tell me which file you used in http://mathema.tician.de/node/373? I can get arpack-arscnd-2.patch.gz to apply cleanly, but I cannot do the same with arpack-arscnd-3.patch.gz. I have attached a patch to the actual port. Can you tell me if this works? Thanks, Stephen
Dear Stephen Montgomery-Smith, maintainer of math/arpack, For fixing the problem, only arpack-arscnd-2.patch.gz is needed. I have tested your patch, and I found the library including the patch produced a desired result. Thank you very much for taking care of the PR. After sent the PR I just noticed I had forgotten to attach my own patch, and it had been already sent. However your patch is simpler than it, hence your patch should be merged to the ports tree. Thanks, Eijiro Shibusawa <ej-sib@ice.uec.ac.jp>
OK, now that Eijiro has submitted his patch, I can see that his patch and the one I proposed are essentially identical. I do think that mine is slightly cleaner, but I don't care which patch ultimately is used. PORTREVISION will have to be bumped. Anyway, I approve the PR.
Would someone please commit this PR? I think that consensus has been reached on this PR. Prof. Montgomery-Smith, the maintainer of math/arpack, kindly dealt with the problem, and proposed a patch fixing the problem. I have confirmed his patch works fine, and I agree that it is cleaner than my own patch. If the problem is fixed before the ports freeze for 8.1R starts, I would be grateful. Thanks in advance, Eijiro Shibusawa
Responsible Changed From-To: freebsd-ports-bugs->stefan Take.
State Changed From-To: feedback->closed Fix committed, thanks!
stefan 2010-07-01 19:52:49 UTC FreeBSD ports repository Modified files: math/arpack Makefile distinfo Log: Fix a problem with symbol duplication when code is linked with both the arpack and lapack libraries. PR: 147487 Submitted by: Eijiro Shibusawa <ej-sib@ice.uec.ac.jp> Approved by: Stephen Montgomery-Smith <stephen@missouri.edu> (maintainer) Feature safe: yes Revision Changes Path 1.20 +5 -2 ports/math/arpack/Makefile 1.5 +3 -0 ports/math/arpack/distinfo _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"