In the last poster I mentioned I selected ublas from boost C++ library for matrix inversion and other linear algebra operations. In my case, ublas is a quick solution by sacrificing performance. To further improve the performance, LAPACK is a better solution. The AMD vendor implementation of LAPACK, i.e., ACML can take advantage of the system processor and improve the performance dramatically.
With ubuntu 11.04, the workable ACML version shall be 4.4.0, and I installed it following this blog. Here I made a note for myself.
Step 1: Visit AMD download archives (link） and download version 4.4.0 for 64bit linux.
Step 2: tar -zxvf acml-4-4-0-gfortran-64bit.tgz
Step 3: Press enter to read the licence agreement (this is proprietary software)
and then type ‘accept’ when the prompt comes.
Enter /usr/local/lib/acml as the alternative path for the library.
Step 4: Configure acml as the default path. To do this, we will use the alternatives system in debian. It allows us to set up symbolic links to prioritize the packages that provide a particular library or executable interface. We are going to tell Ubuntu to use the multithreaded ACML to provide LAPACK and BLAS.
sudo update-alternatives –install /usr/lib/libblas.so.3gf libblas.so.3gf /usr/local/lib/acml/gfortran64_mp/lib/libacml_mp.so 60
sudo update-alternatives –install /usr/lib/liblapack.so.3gf liblapack.so.3gf /usr/local/lib/acml/gfortran64_mp/lib/libacml_mp.so 60
Step 5: “Lastly, libacml_mv.so is used by libacml_mp.so, so it needs to be loadable in your path. You could add /usr/local/lib/acml/gfortran64_mp/lib to the path, but that’s a little bit tricky. Since we are already using symbolic links, we will make a symbolic ink to it in your /usr/local/lib so it can be loaded dynamically. ”
sudo ln -s /usr/local/lib/acml/gfortran64_mp/lib/libacml_mv.so /usr/local/lib/libacml_mv.so
Step 6: Not there yet! If your system LD_LIBRARY_PATH does not include /usr/local/lib, you should add it. In my case, I added one file “acml.conf” under /etc/ld.so.conf.d/. The content of acml.conf is just the path of the ACML library. In this case, /usr/local/lib/acml/gfortran64_mp/lib. After that, remember typing “sudo ldconfig”
Step 7: I tested in Octave by running the examples from the blog blog. Checking the CPU info from top, I did observe that B=A*A occupied both cores 100%.