airair / graphlabapi

Automatically exported from code.google.com/p/graphlabapi
0 stars 0 forks source link

GraphLab does not compile on some 32-bit systems #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

In 32-bit mode, at least an older GCC (4.1.2) does not properly detect the type 
of 
processor and does not link properly atomic instructions:

/home/ec2-user/graphlab/graphlabapi/src/graphlab/parallel/atomic.hpp:18: 
undefined reference to `__sync_add_and_fetch_4'
/home/ec2-user/graphlab/graphlabapi/src/graphlab/schedulers/support/binary_verte
x_task_set.hpp:59: undefined reference to `__sync_fetch_and_or_4'

This can be fixed by adding flag -march=pentium to compilation flags (tested).

More info
http://stackoverflow.com/questions/130740/link-error-when-compiling-gcc-atomic-o
peration-in-32-bit-mode

Original issue reported on code.google.com by akyrola...@gmail.com on 14 Mar 2011 at 3:51

GoogleCodeExporter commented 9 years ago
There are various issues here:

1) On some 32-bit virtualized systems (linode in particular), it seems that the 
packages are compiled with for i486. 486 did not have the 64-bit atomics, and 
it will be necessary to compile with -march=pentium, and possibly delete 
-mfpmath=sse -msse2

2) If GCC is compiled for / detects an even more generic system (i386), even 
more of the atomic instructions will be unavailable (in particular XADD and 
CMPXCHG) which will result in the error above.

I somehow doubt anyone would try to run GraphLab on a 386/486 system anymore. 
It will be nice to force -march=pentium or higher if GCC detects 386/486. 

Solutions:
 - Introduce a CMake script which will test the compilation of a few atomic instructions and determine if -march=pentium is necessary.
 - I am not sure if there is an easy way to probe for existence of SSE and SSE2. 
   Do we in fact need -mfpmath=sse -msse2 ? Can we assume the compiler has sane defaults?

Yucheng

Original comment by yucheng...@gmail.com on 17 Jun 2011 at 6:39