fastFM-core icon indicating copy to clipboard operation
fastFM-core copied to clipboard

Cannot build on Ubuntu/16.04

Open lucidfrontier45 opened this issue 7 years ago • 5 comments

Hi. I would like to make some modification on fastfm but I couldn't compile this fastfm-core module. I'm using Ubuntu/16.04 with gcc 5.4.0 .

Here is my compile error log. Looks it is a OpenBlas problem though.

$ make                            
( cd externals/CXSparse ; make library )
make[1]: Entering directory '/home/du/workspace/fastFM/fastFM-core/externals/CXSparse'
( cd Lib ; make )
make[2]: Entering directory '/home/du/workspace/fastFM/fastFM-core/externals/CXSparse/Lib'
make[2]: Nothing to be done for 'default'.
make[2]: Leaving directory '/home/du/workspace/fastFM/fastFM-core/externals/CXSparse/Lib'
make[1]: Leaving directory '/home/du/workspace/fastFM/fastFM-core/externals/CXSparse'
( export USE_THREAD=0; cd externals/OpenBLAS ; make libs)
make[1]: Entering directory '/home/du/workspace/fastFM/fastFM-core/externals/OpenBLAS'
getarch_2nd.c: In function ‘main’:
getarch_2nd.c:12:35: error: ‘SGEMM_DEFAULT_UNROLL_M’ undeclared (first use in this function)
     printf("SGEMM_UNROLL_M=%d\n", SGEMM_DEFAULT_UNROLL_M);
                                   ^
getarch_2nd.c:12:35: note: each undeclared identifier is reported only once for each function it appears in
getarch_2nd.c:13:35: error: ‘SGEMM_DEFAULT_UNROLL_N’ undeclared (first use in this function)
     printf("SGEMM_UNROLL_N=%d\n", SGEMM_DEFAULT_UNROLL_N);
                                   ^
getarch_2nd.c:14:35: error: ‘DGEMM_DEFAULT_UNROLL_M’ undeclared (first use in this function)
     printf("DGEMM_UNROLL_M=%d\n", DGEMM_DEFAULT_UNROLL_M);
                                   ^
getarch_2nd.c:15:35: error: ‘DGEMM_DEFAULT_UNROLL_N’ undeclared (first use in this function)
     printf("DGEMM_UNROLL_N=%d\n", DGEMM_DEFAULT_UNROLL_N);
                                   ^
getarch_2nd.c:19:35: error: ‘CGEMM_DEFAULT_UNROLL_M’ undeclared (first use in this function)
     printf("CGEMM_UNROLL_M=%d\n", CGEMM_DEFAULT_UNROLL_M);
                                   ^
getarch_2nd.c:20:35: error: ‘CGEMM_DEFAULT_UNROLL_N’ undeclared (first use in this function)
     printf("CGEMM_UNROLL_N=%d\n", CGEMM_DEFAULT_UNROLL_N);
                                   ^
getarch_2nd.c:21:35: error: ‘ZGEMM_DEFAULT_UNROLL_M’ undeclared (first use in this function)
     printf("ZGEMM_UNROLL_M=%d\n", ZGEMM_DEFAULT_UNROLL_M);
                                   ^
getarch_2nd.c:22:35: error: ‘ZGEMM_DEFAULT_UNROLL_N’ undeclared (first use in this function)
     printf("ZGEMM_UNROLL_N=%d\n", ZGEMM_DEFAULT_UNROLL_N);
                                   ^
getarch_2nd.c:69:50: error: ‘SGEMM_DEFAULT_Q’ undeclared (first use in this function)
     printf("#define SLOCAL_BUFFER_SIZE\t%ld\n", (SGEMM_DEFAULT_Q * SGEMM_DEFAULT_UNROLL_N * 4 * 1 *  sizeof(float)));
                                                  ^
getarch_2nd.c:70:50: error: ‘DGEMM_DEFAULT_Q’ undeclared (first use in this function)
     printf("#define DLOCAL_BUFFER_SIZE\t%ld\n", (DGEMM_DEFAULT_Q * DGEMM_DEFAULT_UNROLL_N * 2 * 1 *  sizeof(double)));
                                                  ^
getarch_2nd.c:71:50: error: ‘CGEMM_DEFAULT_Q’ undeclared (first use in this function)
     printf("#define CLOCAL_BUFFER_SIZE\t%ld\n", (CGEMM_DEFAULT_Q * CGEMM_DEFAULT_UNROLL_N * 4 * 2 *  sizeof(float)));
                                                  ^
getarch_2nd.c:72:50: error: ‘ZGEMM_DEFAULT_Q’ undeclared (first use in this function)
     printf("#define ZLOCAL_BUFFER_SIZE\t%ld\n", (ZGEMM_DEFAULT_Q * ZGEMM_DEFAULT_UNROLL_N * 2 * 2 *  sizeof(double)));
                                                  ^
make[1]: *** [getarch_2nd] Error 1
Makefile:123: *** OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail..  Stop.
make[1]: Leaving directory '/home/du/workspace/fastFM/fastFM-core/externals/OpenBLAS'
Makefile:3: recipe for target 'lib' failed
make: *** [lib] Error 2

By the way, the doc says I have to install OpenBLAS with apt-get but the makefile code looks just using extrenals/OpenBLAS, not system OpenBLAS. Is this build procedure correct?

lucidfrontier45 avatar Oct 04 '17 02:10 lucidfrontier45

I think our travis-ci runs 16.04, so this should really work.

Please make sure that you use --recursive in

git clone --recursive https://github.com/ibayer/fastFM-core.git

I assume you are building from the latest master?

the doc says I have to install OpenBLAS with apt-get but

Where? This is not correct anymore (OpenBLAS is included as sub-module).

Here is my compile error log. Looks it is a OpenBlas problem though.

Just tested again, this works for me on 16.04:

cd /tmp/
git clone --recursive https://github.com/ibayer/fastFM-core.git
cd fastFM-core
make
cd demo
make
make demo_lib

ibayer avatar Oct 04 '17 06:10 ibayer

Makefile:123: *** OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail.. Stop.

This was the direct cause. My CPU is Core-i7 7700k Kaby Lake and OpenBLAS failed to auto-detect its architecture. I added TARGET=HASWELL to my env and make was successful. Maybe we should notice it in the doc.

the doc says I have to install OpenBLAS with apt-get but

Where? This is not correct anymore (OpenBLAS is included as sub-module).

Sorry, what the fastfm-core doc says to install was atlas (for cblas interface I suppose), not openblas. https://github.com/ibayer/fastFM-core#installation

# Install cblas (Linux only).
$ sudo apt-get install libatlas-base-dev

But the doc of fastfm itself still says to install openblas. (for cblas I suppose) https://github.com/ibayer/fastFM#installation

# Install cblas and python-dev header (Linux only).
# - cblas can be installed with libatlas-base-dev or libopenblas-dev (Ubuntu)
$ sudo apt-get install python-dev libopenblas-dev

lucidfrontier45 avatar Oct 04 '17 14:10 lucidfrontier45

Looks like a special case to me OpenBLAS: Detecting CPU failed. but adding a note to the README is a good idea.

We don't install OpenBLAS or ATLAS on our build machine https://github.com/ibayer/fastFM/blob/master/.travis.yml .

I believe neither is needed, but we should double check on a clean machine.

Thanks for reporting the issues. Feel free to open a PR to fix the docs.

ibayer avatar Oct 04 '17 18:10 ibayer

FYI, the same openblas issue was reported in the official repo.

https://github.com/xianyi/OpenBLAS/issues/1006

lucidfrontier45 avatar Oct 05 '17 01:10 lucidfrontier45

Thanks, that very good to know. So we should put a note in the README and update the OpenBLAS version as soon as a new release comes out (problem fixed in dev master).

ibayer avatar Oct 05 '17 06:10 ibayer