You are not logged in.

#1 2012-07-21 06:29:18

sveitser
Member
Registered: 2011-07-06
Posts: 9

[solved] graphlab / graphlabapi, anyone get this to work?

edit3: I'm marking this as solved, as it basically seems to work for me for now. I decided not to upload the packages to the AUR because graphlab is broken with the current version of openmpi and depends on a libjson library that I'm not at all familiar with and nobody else here seems to use. If these aren't good reasons not to submit the packages I'll happily submit and maintain them. I'll maintain the PKGBUILDs on github for now https://github.com/sveitser/pkgbuilds .

I'm trying to use graphlabapi ( www.graphlab.org ) on arch linux. I'm planning on using this quite a bit in the future so my goal is to create an AUR package eventually. I managed to build it successfully but the compiled application does not seem to work properly. I posted an issue on their google code page ( http://code.google.com/p/graphlabapi/is … tail?id=41 ), but was wondering if anyone here managed to get it to work.

If anyone wants to give it a shot, AFAIK the following will install the necessary pacman dependencies:

pacman -S --needed apache-ant jdk7-openjdk mercurial cmake openmpi

edit: I also put a symlink named "python" to "python2" in my PATH before "/usr/bin" because otherwise the build system would detect python3 and the build failed at some point. Probably not a proper workaround but I think it seems to do the job for now.
edit2: Found a way to tell cmake to choose python2. See below.

Build instructions are basically:

hg clone https://code.google.com/p/graphlabapi/
cd graphlabapi
./configure -D PYTHON_EXECUTABLE=/usr/bin/python2
cd release # or "cd debug" for quicker build using less RAM
make -j 4

The release build needs a lot of memory so they suggest not to use more concurrent make threads than the system memory in GB. I also run into the same issue if I build the debug build. The build takes a long time due to all the dependencies that will be installed locally. At the moment they don't seem to check for an existing boost installation on the "default" branch so boost will be installed locally even if it is available system wide.

The tcmalloc dependency fails to build with glibc 2.16 so I patch the file

deps/tcmalloc/src/libtcmalloc/src/base/linuxthreads.cc

with respect to the graphlabapi base directory with

196c196
< static void SignalHandler(int signum, siginfo_t *si, void *data) {
---
> static void SignalHandler(int signum, siginfo *si, void *data) {

as suggested here http://code.google.com/p/gperftools/iss … akechanges and then run make again

 make -j 4 

Upon which the build succeeds. However when I try to run the examples or tests I mostly get no output and the programs just hang.

I've been struggling quite a bit and any help or pointers would be greatly appreciated. Thanks!

Last edited by sveitser (2012-07-24 06:39:18)

Offline

#2 2012-07-21 11:08:21

sveitser
Member
Registered: 2011-07-06
Posts: 9

Re: [solved] graphlab / graphlabapi, anyone get this to work?

Incompatibilities with openmpi 1.6 seem to be the culprit. After downgrading to openmpi 1.5.4-5 most of the tests complete successfully.

Offline

#3 2012-07-23 05:38:23

sveitser
Member
Registered: 2011-07-06
Posts: 9

Re: [solved] graphlab / graphlabapi, anyone get this to work?

edit: Unsetting CXXFLAGS before executing "make" seems to let the build complete. Not sure if that's a good idea but I 'think' cmake sets it appropriately anyway.

After successfully compiling the package I created a PKGBUILD that I thought should work but it aborts on error during the "make" step. When I run "make" from a terminal in the corresponding directory the compilation succeeds.
The PKGBUILD (also here https://github.com/sveitser/pkgbuilds/t … raphlab-hg ) is

# Maintainer: Mathis Antony <sveitser@gmail.com>
pkgname=graphlab-hg
pkgver=4197
pkgrel=1
pkgdesc="GraphLab is a new parallel framework for machine learning."
arch=('i686' 'x86_64')
url="http://www.graphlab.org"
license=('apache')
depends=('openmpi' 'python2' 'jdk7-openjdk' 'boost')
makedepends=('cmake' 'mercurial' 'apache-ant')
options=()
source=(tcmalloc.patch)
md5sums=('11bc88f68b4dcf214255a3b7de1f8ede')

_hgroot=https://code.google.com/p
_hgrepo=graphlabapi

build() {

   cd "$srcdir"
   msg "Connecting to Mercurial server...."
   if [[ -d "$_hgrepo" ]]; then
cd "$_hgrepo"
     hg pull -u
     msg "The local files are updated."
   else
hg clone "$_hgroot" "$_hgrepo"
   fi

msg "Mercurial checkout done or server timeout"
  msg "Starting build..."

  rm -rf "$srcdir/$_hgrepo-build"
  cp -r "$srcdir/$_hgrepo" "$srcdir/$_hgrepo-build"
  cd "$srcdir/$_hgrepo-build"

  ./configure -D PYTHON_EXECUTABLE=/usr/bin/python2 \
    --prefix=/usr
  cp "$startdir/tcmalloc.patch" patches/
  sed '/ExternalProject_Add(libtcmalloc/a \
PATCH_COMMAND patch -N -p0 -i ${GraphLab_SOURCE_DIR}/patches/tcmalloc.patch || true' \
    CMakeLists.txt > CMakeLists2.txt
  mv CMakeLists2.txt CMakeLists.txt
  
  cd release
  unset CXXFLAGS
  make
}

package() {
   cd "$srcdir/$_hgrepo-build"
   make DESTDIR="$pkgdir/" install
}

and the tcmalloc.patch file

--- src/base/linuxthreads.cc 2012-07-23 02:21:30.946086243 +0800
+++ src/base/linuxthreads.cc 2012-02-03 05:36:23.000000000 +0800
@@ -193,7 +193,7 @@
 /* Signal handler to help us recover from dying while we are attached to
  * other threads.
  */
-static void SignalHandler(int signum, siginfo_t *si, void *data) {
+static void SignalHandler(int signum, siginfo *si, void *data) {
   if (sig_pids != NULL) {
     if (signum == SIGABRT) {
       while (sig_num_threads-- > 0) {

The error I get when running makepkg is

[ 27%] Performing patch step for 'libjson'
patching file JSONOptions.h
patching file makefile
patching file Source/JSONDefs.h
[ 27%] No update step for 'libjson'
[ 28%] No configure step for 'libjson'
[ 28%] Performing build step for 'libjson'
makefile:173: *** recipe commences before first target.  Stop.
make[2]: *** [../deps/json/src/libjson-stamp/libjson-build] Error 2
make[1]: *** [CMakeFiles/libjson.dir/all] Error 2
make: *** [all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

I think the problematic makefile is src/graphlabapi-build/deps/json/src/libjson/makefile. Line 173 is:

170 # Usage check
171 ifdef CXXFLAGS
172 ifdef BUILD_TYPE
173   $(error CXXFLAGS and BUILD_TYPE are mutually exclusive)
174 endif
175 endif

but I'm thinking that if this were indeed to cause the error I should see the corresponding error message.

Last edited by sveitser (2012-07-23 09:38:15)

Offline

#4 2012-07-23 17:51:21

sveitser
Member
Registered: 2011-07-06
Posts: 9

Re: [solved] graphlab / graphlabapi, anyone get this to work?

In order to successfully compile the hello_world example one needs to have (at least) the headers of libjson from http://sourceforge.net/projects/libjson/ installed. I couldn't find a package for it, so I created a PKGBUILD for this too. However I wonder if it's even useful for other projects. I'm therefore unsure whether it makes sense to upload it to the AUR. If anyone wants to use graphlab it might come in handy though so here it is anyway:

# Maintainer: Mathis Antony <sveitser@gmail.com>
pkgname=libjson-headers
pkgver=7.6.1
pkgrel=1
epoch=
pkgdesc="A JSON reader and writer which is super-effiecient and usually runs
circles around other JSON libraries."
arch=('i686' 'x86_64')
url="http://sourceforge.net/projects/libjson"
license=('custom')
groups=()
depends=()
makedepends=('unzip')
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=(http://sourceforge.net/projects/libjson/files/libjson\_$pkgver.zip)
noextract=(libjson\_$pkgver.zip)
md5sums=('82f3fcbf9f8cf3c4e25e1bdd77d65164')

build() {
  cd $srcdir
  unzip -o "libjson_$pkgver.zip"
  cd libjson
  sed -i.bak '/#define JSON_LIBRARY/d' JSONOptions.h
  sed -i.bak '/#define JSON_BINARY/d' JSONOptions.h
  sed -i.bak '/#define JSON_EXPOSE_BASE64/d' JSONOptions.h
  sed -i.bak '/#ifdef JSON_DEBUG/,+17d' _internal/Source/JSONDefs.h
}

package() {
  cd "$srcdir/libjson"
  unset CXXFLAGS
  sed -i.bak '/cp -rv $(srcdir)\/Dependencies\/ $(include_path)\/$(libname_hdr)\/$(srcdir)/d' \
    makefile
   
  make install_headers prefix="$pkgdir/usr"

  ### To install shared/static libraries see below
  ### and change build() step accordingly

  # create directory for libjson.a
  # sed -i.bak '/mkdir -p $(objdir)/a\\tmkdir -p $(inst_path)\/libjson' makefile
  # make install prefix="$pkgdir/usr"
  # move libjson.a to avoid conflict with json-c
  # mv "$pkgdir/usr/lib/libjson.a" "$pkgdir/usr/lib/libjson/"
}

# vim:set ts=2 sw=2 et:

Offline

Board footer

Powered by FluxBB