A list of software and libraries

1. OpenCV source code 3.0.0-dev

2. FFTW 3.3.4

3. Eigen 3.2.2

4. Boost 1.56

5. TBB 4.2

6. MKL 11

7. OpenBLAS 0.2.10

8. Lapack 3.5.0

9. CUDA 5.5

10. opencvblobslib

11. Java JRE 1.8.0

12. Libsvm

13. Orwell DevCpp 5.7.1

14. MiKTeX 2.9

15. Firefox 28.0

16. Zotero 4.0.18.1

17. Unikey 4.2 RC1

18. GCC 4.9.1

19. OpenOffice 4.1.1

Building some open source libraries with VS 2012

Today, after upgrading from VS 2010 to Visual Studio  2012 (with VS 2012 Update 4), I build some open source libraries (Boost 1.55, OpenCV 3.0.0-dev, FLANN 1.8.4, and Point Cloud Library 1.7.1-PCL) and here are some notes for ones who may find them useful.

0. Some thoughts on VS 2012: much bigger than VS 2010, without blend and other options, I just checked the MFC option but the memory required was more than 7 Gbs. The installation has less option as compared with VS 2010 (no option to exclude VB, Web support or C#, SQL Server … like in VS 2010). After update to Update 4, there is another option for MFC or Win32 project with targeting to v110-xp, this is due to the fact that VS 2012 compiled programs (before Update 4) could not run on XP. And the folder C:\ProgramData\Package Cache contains all the packages from VS 2012 installation (about 1.7 Gb, I wonders if this can be deleted). In my feelings, VS 2012 is not slower than VS 2010, it may be faster on stronger machine with 4 or 8 CPU cores. It’s a suprise that VS 2012 include the DirectX library in the C:\Program Files\Windows Kits\8.0 folder, so you can write DirectX based program without any further installation. One of the big improvement of VS 2012 is it is a true multicore compiler which can uses multicore for compiling a project, not a parallel compiler as VS 2010 (see more details from this address).

1. Hardware and software platform: Windows 7 SP1 32 bit on a laptop Core 2 Duo 2.4 Ghz with 3 Gb Ram, VS 2012 Update 4. Some required libraries are: Eigen 3.2 (for PCL), TBB 4.2 Update 2 (for OpenCV) and CMake 2.8.12.1, CUDA 5.5.2 32 bit. For details of building OpenCV with TBB, please read ref 1 or ref 2. The path to CMake’s bin directory is mandatory added to the PATH environment variable.

2. Building OpenCV 3.0.0-dev. I remove matlab, python and java building options from the file CMakeLists.txt of OpenCV and keep only the CUDA code version >=2.0 (in the file OpenCVDetectCUDA.cmake) to make the process faster. Then cmake-gui is used to generate the VS 2012’s solution and project files. On my machine, this ran for 4 hours and a folder of about 7 GBs was generated, but the install folder was only about 330 Mbs (other files and folders from the build folder can be delete after). The reason for the 4 hours duration may be caused by the /GL building option which was set for all the OpenCV projects.

3. Building Boost 1.55(which is also required by PCL): just run the bootstrap.bat from the command line and .\b2 command after but remember to add the VS 2012 path to the PATH environment variable.

4. Building FLANN 1.8.4: I used cmake-gui to create the solution file and build with VS 2012 without any problem (some python projects were not built, but I don’t need them).

5. Building PCL 1.7.1: Again, cmake-gui was used to generate the solution file, I had to set variables manually for boost and FLANN. Be careful with /GL building option because the whole optimization can caused failed build even your machine (64 bit) may have up to 16 GB of RAM, especially with pcl_feature project. This process took about 2 hours with 2.5 Gb build folder and no error was raised.

CVMLib 7.0-Đối thủ xứng tầm của Armadillo và Eigen

Sau một thời gian chờ đợi khá lâu từ phiên bản 6.1, ngày 6-1-2013 vừa qua CVMLIB 7.0, một thư viện rất mạnh hỗ trợ các thao tác trên ma trận được viết bởi tác giả Sergei Nikolaev, đã được tung ra. Phiên bản mới này hỗ trợ thư viện Intel MKL Intel 11.0 Update 1 cũng như các thư viện khác như ACML và lapack (bản 3.4.2). Người sử dụng có thể tự build từ source code trên máy của mình hoặc download bản precompiled về sử dụng. So với ArmadilloEigen, CVMLIB nhanh hơn (với đa số các thao tác trên ma trận). Sau đây là một ví dụ rất đơn giản cho các thao tác là nhân hai ma trận, SVD và EIG trên ma trận sử dụng CVMLIB:


// A simple example using CVM library

#include <cvm.h>
#include <ctime>
#include <iostream>

using namespace cvm;
using namespace std;

int main(int argc, char * argv[])
{
int n, m;
float *a, *b;
int i;
clock_t st, et;

if(argc==3)
{
n = atoi(argv[1]);
m = atoi(argv[2]);
}else
{
n = m = 1000;
}
a = new float[n*m];
b = new float[n*m];
srand(time(NULL));
for(i=0;i<n*m;i++)
{
a[i] = (float)rand()/INT_MAX;
b[i] = (float)rand()/INT_MAX;
}

basic_rmatrix ma(a, n, m);
basic_rmatrix mb(b, n, m);
basic_rmatrix mc(n, m);
basic_rmatrix asvd(a,n,m);
basic_srmatrix u(n);
basic_srsmatrix ms(n);
basic_srmatrix em(n);
basic_rvector ev(n);

st = clock();
mc = ma*mb;
et = clock();
cout << “Time for matrix multiplication is:” << (float)(et-st)/CLK_TCK;

st = clock();
ev = asvd.svd(u,em);
et = clock();
cout << “Time for SVD is:” << (float)(et-st)/CLK_TCK;

st = clock();
ev.eig(ms, em);
et = clock();
cout << “Time for EIG is:” << (float)(et-st)/CLK_TCK;

delete [] a;
delete [] b;
system(“pause”);
return 0;
}

Backup cơ sở dữ liệu của Zotero sang máy khác

Trong bài viết Zotero Tutorial – Hướng dẫn sử dụng Zotero để quản lý tài liệu tham khảo và viết tài liệu khoa học (paper, poster and thesis) tôi đã hướng dẫn cách dùng Zotero với Firefox, Word và LaTeX, tuy nhiên còn một yêu cầu nữa mà chúng ta đôi khi vẫn phải dùng đến, đó là làm thế nào để backup CSDL của Zotero sang một máy tính khác để làm việc và đề phòng những khi máy tính chẳng may phải cài lại hoàn toàn mà quên lưu dự phòng. Để thực hiện việc này, có 3 cách:

Cách 1: Copy toàn bộ thư mục chứa dữ liệu của Zotero sang đúng vị trí của máy đích, đối với Windows 7, thư mục đó là “C:\Users\<User Name>\AppData\Roaming\Mozilla\Firefox\Profiles\<randomstring>\zotero”. Bạn nên Zip lại copy cho nhanh, lưu ý là trong thư mục này có thể có một vài file .bak là file backup của sqllite (ví dụ như zotero.sqlite.bak), file này khá lớn và không cần thiết. Khi copy sang máy đích, cần ghi đè toàn bộ thư mục của máy đó nếu được hỏi. Cách này là chính xác nhất và ngon lành nhất.

Cách 2: Export cơ sở dữ liệu của Zotero (giống như khi export để dùng với LaTeX) nhưng chọn format (định dạng) export là Zotero RDF:

Sau đó copy toàn bộ thư mục tương ứng với tên được đặt sang máy đích và sử dụng tính năng import của Zotero. Cách này không đảm bảo như cách 1 vì: tôi đã thử và bị báo lỗi Javascript (nhiều người cũng bị lỗi này), và tác giả của Zotero cũng khuyến cáo không nên dùng cách này.

Cách 3: hai cách trên đảm bảo cả file gốc (file bài báo .pdf) sẽ được copy sang máy đích nhưng nếu bạn chỉ muốn lấy CSDL metadata của Zotero thì có thể thực hiện theo cách 3, rất đơn giản và nhanh gọn. Làm tương tự như cách 2 nhưng bỏ chọn Export file:

Khi đó bạn chỉ có 1 file .rdf duy nhất (kích thước rất nhỏ), copy file này sang máy đích và chọn chức năng import của Zotero là xong.

Có thể xem thêm về chủ đề này ở trang chủ của Zotero: http://www.zotero.org/support/zotero_data

How to upgrade to Qt Creator 2.5.2 from Qt Creator 2.4.1

Today I decided to upgrade from Qt Creator 2.4.1 with SDK 1.2.1 (Qt 4.8.0) to Qt Creator 2.5.2. But I still want to use SDK 1.2.1, just Qt Creator 2.5.2. I did not found any normal way to upgrade from Qt Creator 2.4.1 (like Chrome or Firefox etc …). So I must do it for myself. I downloaded Qt Creator 2.5.2 from Nokia website. Then I deleted the Qt Creator 2.4.1 folder from SDK 1.2.1 (C:\QtSDK\QtCreator) and installed Qt Creator 2.5.2 into that folder. Ha ha, the shortcut to Qt Creator program is the same, the folders and files are the same and the new version run smoothly, without any bug. And the maintenance tool of Qt SDK still think that it is Qt Creator 2.4.1, it is ok for me. But there was a problem with the Boost 1.5.1 that I had updated before. That was:
main.obj:-1: error: LNK2019: unresolved external symbol “void __cdecl boost::filesystem::path_traits: ….
After a while, I found that Qt Creator used a configuration file (C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\mkspecs\win32-msvc2010\qmake.conf) to build its projects. So I opened that file and changed the line:
QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t-
to:
QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t
And now it works.