Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Liblapacke linker errors : eigenvectors computing
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 07-01-2014, 01:36 PM #1 Luxey LQ Newbie   Registered: Jul 2014 Posts: 3 Rep: Liblapacke linker errors : eigenvectors computing Hi there ! I'm very new to this forum, but I have been reading it for quite a long time. As I always found the answers to what I was looking for, I never had to register, but this time is OVER, and this is all due to the LAPACK lib that makes me want to crush my computer into pieces. Anyway, let's get to it : I'm developping some math heavy C++ software using matrices, where I need to compute eigenvectors on a big symetric non-sparse matrix (currently 500x500, but it will be something like 10000x10000 later). As I use Point CLoud Library, which is shipped with the Eigen lib, I tried using its eigenvectors algorithm, but the result is really slow : ~5min to compute the vectors. Furthermore, it computes all 500 eigenvectors, whereas I would only need the 5 or 10 most important ones. I know Matlab eig(...) function works really well, and I saw it used LAPACK algorithm. But I started crying when I learned the LAPACK library was coded in Fortran. Currently working on a Mint 15 x64, I saw liblapacke-dev in the repository, and installed it. It came alongside with libblas3, libblas-dev, liblapack3, liblapack-dev, and liblapacke . Now here's a test program : Code: ```#include #include #include #include #include using namespace std; int main(int argc, char** argv) { char jobz = 'V'; char uplo = 'U'; int n = 3; int lda = n; int matrix_order = n; float *a, *w; a = new float[n * n]; w = new float[n]; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { a[i*n + j] = rand() % 10 / 10.f; a[j*n + i] = a[i*n + j]; } } LAPACKE_ssyev(matrix_order, jobz, uplo, n, a, lda, w); return 0; }``` And here is my compile line and its output : Code: ```\$ g++ -o lapacke_test -llapacke -llapack -lblas -g -Wall main.cpp /tmp/ccYj3pGz.o: In function `main': /pat_to_my_code/main.cpp:27: undefined reference to `LAPACKE_ssyev' collect2: error: ld returned 1 exit status make: *** [all] Error 1``` I tried adding -L/usr/lib/liblapacke.so or -L/usr/lib/liblapacke.a or -L/usr/lib/liblapack.a (and .so), didn't work (the files are there). the lapacke.h file and its friends are also in /usr/include . I also tried calling ldconfig, just in case. The linker is always so mean to me ! Why ?! Still, in my wraith I uninstalled all the packages I listed above, and tried to compile LAPACK on my own. I used cmake, installed gfortran, generated the makefiles ok, but then came a looooong list of undefined references : Code: ```[ 2%] Built target tmglib Linking Fortran executable ../../bin/xlintstc CMakeFiles/xlintstc.dir/cchkhe_rook.f.o: In function `cchkhe_rook_': cchkhe_rook.f:(.text+0x8db): undefined reference to `chetrf_rook_' cchkhe_rook.f:(.text+0xbba): undefined reference to `chetri_rook_' cchkhe_rook.f:(.text+0x1d03): undefined reference to `chetrs_rook_' cchkhe_rook.f:(.text+0x21b3): undefined reference to `checon_rook_' CMakeFiles/xlintstc.dir/cchksy_rook.f.o: In function `cchksy_rook_': cchksy_rook.f:(.text+0x926): undefined reference to `csytrf_rook_' cchksy_rook.f:(.text+0xc05): undefined reference to `csytri_rook_' cchksy_rook.f:(.text+0x1ffe): undefined reference to `csytrs_rook_' cchksy_rook.f:(.text+0x24ae): undefined reference to `csycon_rook_' CMakeFiles/xlintstc.dir/cdrvhe_rook.f.o: In function `cdrvhe_rook_': cdrvhe_rook.f:(.text+0x8c4): undefined reference to `chetrf_rook_' cdrvhe_rook.f:(.text+0x969): undefined reference to `chetri_rook_' cdrvhe_rook.f:(.text+0xc75): undefined reference to `chesv_rook_'``` I find so little documentation on this lib, plus I don't know anything about Fortran (and was very happy with that). If anybody has a suggestion to set it right, it would make my day. For example, if you know any eigenvectors algorithm to retreive only the most important ones, that could be paralellized (I have good clusters at work), that don't require to install libraries from the Ancient Times, that would be great ! Thanks ! Adrien EDIT : I did finally manage to compile LAPACKE with LAPACK + BLAS using cmake, but the error I get is still the same. I really don't know how to fix this. Last edited by Luxey; 07-02-2014 at 09:32 AM.
 07-05-2014, 04:44 AM #2 Tim Abracadabra Member   Registered: May 2014 Location: USA, Wherever I may Roam Distribution: Debian w/Xfce, LFS 7.9, ++ Posts: 117 Rep: Hi Luxey and Welcome. Please forgive me if I am misinterpreting your question or code but: Did you consider adjusting your source? "LAPACKE_ssyev(matrix_order, jobz, uplo, n, a, lda, w);" You might want to google the Fortran/Linear Algebra lib alternatives and see if they suit your needs, or just use an appropriate C(++) lib. Maybe this link to C Interface Conventions helps? Just my \$0.02 ! Hope that helps, Tim Last edited by Tim Abracadabra; 07-05-2014 at 05:40 AM. Reason: Highlight where source change may be made

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post smeezekitty Programming 2 09-19-2009 02:21 AM kpachopoulos Programming 3 01-22-2007 04:02 AM Ankit mittal Programming 1 09-30-2005 03:05 PM MarcReing Programming 1 07-20-2005 07:44 AM daveyboy685 Linux - Software 1 03-25-2004 12:25 PM

LinuxQuestions.org

All times are GMT -5. The time now is 06:52 AM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -