Wiki‎ > ‎

Install gnina and Caffe

posted Dec 19, 2017, 2:09 PM by Dong Xu   [ updated Jan 5, 2018, 8:09 PM ]
git clone https://github.com/gnina/gnina.git
cd gnina

Tip: vi CMakeCache.txt to debug

Create conda env gnina with python2.7 and install openbabel-2.4.1, rdkit 2017.09.2
Compile using cuda8.0 with patch, make sure cuda8.0 is in PATH and LD_LIBRARY_PATH

export PATH=/garlic/apps/cmake-3.8.0-Linux-x86_64/bin:$PATH
export ANACONDA_PY_HOME=/garlic/apps/anaconda3/envs/gnina

requires gcc-5.4, so use the compiled version
export PATH=/garlic/apps/gcc-build-5.4.0/bin:$PATH
export LD_LIBRARY_PATH=/garlic/apps/gcc-build-5.4.0/lib64:$LD_LIBRARY_PATH

cp -s /garlic/apps/gcc-build-5.4.0/bin/gcc /garlic/apps/gcc-build-5.4.0/bin/gcc-5.4
cp -s /garlic/apps/gcc-build-5.4.0/bin/g++ /garlic/apps/gcc-build-5.4.0/bin/g++-5.4

Also need to edit /garlic/apps/cuda8.0/include/host_config.h line 117 comment out gcc-5 check

/* #if __GNUC__ > 5

#error -- unsupported GNU version! gcc versions later than 5 are not supported!

#endif */ /* __GNUC__ > 5 */




It seems that gnina and Caffe code prefers to see libs installed at these locations: /usr/local/lib

libgflags and liblmdb are installed here by "make install".
openbabel, atlas and python2.7 libs need to be linked into this folder

lrwxrwxrwx  1 root root   28 Dec 19 19:05 libinchi.so -> /usr/lib64/libinchi.so.0.3.1
lrwxrwxrwx  1 root root   32 Dec 19 19:05 libopenbabel.so -> /usr/lib64/libopenbabel.so.4.0.1
lrwxrwxrwx  1 root root   33 Dec 20 12:45 libtatlas.so -> /usr/lib64/atlas/libtatlas.so.3.0
lrwxrwxrwx  1 root root   33 Dec 20 12:46 libtatlas.so.3 -> /usr/lib64/atlas/libtatlas.so.3.0
lrwxrwxrwx  1 root root   53 Dec 20 13:55 libpython2.7.so -> /garlic/apps/anaconda3/envs/gnina/lib/libpython2.7.so

I installed rdkit=2017.03.1 in the gnina env, the libs are in
/garlic/apps/anaconda3/envs/gnina/lib/

1. Need to take "RDKit" out of the lib filenames
eg. libRDKitSmilesParse.so => libSmilesParse.so

for i in $(ls -1 *.so.1.2017.03.1);
do
name=`basename $i .so.1.2017.03.1`;
namef=`echo $name | sed 's/RDKit//g'`;
sudo ln -s /garlic/apps/anaconda3/envs/gnina/lib/$i /usr/local/lib/${namef}.so;
done
2. link all .so libs into /usr/local/lib


Compile and install gflags, lmdb
# gflags
wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make && make install
# lmdb
git clone https://github.com/LMDB/lmdb
cd lmdb/libraries/liblmdb
make && make install

yast2 install:

glog
protobuf
(removed from conda, causing conflict with system protobuf libs)
libprotobuf (removed from conda, causing conflict with system protobuf libs)
atlas3 and atlas3-devel
doxygen
git
libboost_atomic1_53_0
openbabel, openbabl-devel
libeigen3-devel



Working camke line
mkdir build
cd build

source activate gnina
cmake -DPYTHON_EXECUTABLE=$ANACONDA_PY_HOME/bin/python -DPYTHON_INCLUDE_DIR=$ANACONDA_PY_HOME/include/python2.7 -DPYTHON_LIBRARY=$ANACONDA_PY_HOME/lib/libpython2.7.so -DRDKIT_INCLUDE_DIR=$ANACONDA_PY_HOME/include/rdkit -DCUDA_ARCH_NAME=All  -DCMAKE_INSTALL_PREFIX=/garlic/apps/gnina ..

cmake -DCMAKE_C_COMPILER=gcc-5.4 -DCMAKE_CXX_COMPILER=g++-5.4 -DPYTHON_EXECUTABLE=$ANACONDA_PY_HOME/bin/python -DPYTHON_INCLUDE_DIR=$ANACONDA_PY_HOME/include/python2.7 -DPYTHON_LIBRARY=$ANACONDA_PY_HOME/lib/libpython2.7.so -DRDKIT_INCLUDE_DIR=$ANACONDA_PY_HOME/include/rdkit -DCUDA_ARCH_NAME=All  -DCMAKE_INSTALL_PREFIX=/garlic/apps/gnina ..

cmake -DPYTHON_EXECUTABLE=$ANACONDA_PY_HOME/bin/python -DPYTHON_INCLUDE_DIR=$ANACONDA_PY_HOME/include/python2.7 -DPYTHON_LIBRARY=$ANACONDA_PY_HOME/lib/libpython2.7.so -DRDKIT_INCLUDE_DIR=$ANACONDA_PY_HOME/include/rdkit -DCUDA_ARCH_NAME=All  -DCMAKE_INSTALL_PREFIX=/garlic/apps/Downloads/gnina_01042018/gnina ..

cmake -DCMAKE_C_COMPILER=gcc-5.4 -DCMAKE_CXX_COMPILER=g++-5.4 -DPYTHON_EXECUTABLE=$ANACONDA_PY_HOME/bin/python -DPYTHON_INCLUDE_DIR=$ANACONDA_PY_HOME/include/python2.7 -DPYTHON_LIBRARY=$ANACONDA_PY_HOME/lib/libpython2.7.so -DRDKIT_INCLUDE_DIR=$ANACONDA_PY_HOME/include/rdkit -DCUDA_ARCH_NAME=All -DCMAKE_INSTALL_PREFIX=/garlic/apps/Downloads/gnina_01042018/gnina ..

make 
make install
Not working
cmake -DPYTHON_EXECUTABLE=$ANACONDA_PY_HOME/bin/python -DPYTHON_INCLUDE_DIR=$ANACONDA_PY_HOME/include/python2.7 -DPYTHON_LIBRARY=$ANACONDA_PY_HOME/lib/libpython2.7.so -DAtlas_BLAS_LIBRARY=/usr/lib64/atlas/libtatlas.so.3 -DAtlas_CBLAS_LIBRARY=/usr/lib64/atlas/libtatlas.so.3 -DAtlas_LAPACK_LIBRARY=/usr/lib64/atlas/libtatlas.so.3 -DAtlas_CBLAS_INCLUDE_DIR=/usr/include/atlas -DAtlas_CLAPACK_INCLUDE_DIR=/usr/include/atlas -DRDKIT_LIBRARIES=$ANACONDA_PY_HOME/lib -DRDKIT_INCLUDE_DIR=$ANACONDA_PY_HOME/include/rdkit  -DOPENBABEL2_INCLUDE_DIR=/usr/include/openbabel-2.0   -DOPENBABEL2_LIBRARIES=/usr/lib64 ..


Needs boost 1.63.0, but yast only installs 1.53.0, gnina env lib folder has 1.56.0, but this is only for building the visualizer,  probably no biggie.
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: warning: libboost_thread.so.1.63.0, needed by /usr/local/lib/libFileParsers.so, may conflict with libboost_thread.so.1.53.0
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: warning: libboost_thread.so.1.63.0, needed by /usr/local/lib/libFileParsers.so, may conflict with libboost_thread.so.1.53.0
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: warning: libboost_system.so.1.63.0, needed by /usr/local/lib/libFileParsers.so, may conflict with libboost_system.so.1.53.0
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: warning: libboost_system.so.1.63.0, needed by /usr/local/lib/libFileParsers.so, may conflict with libboost_system.so.1.53.0

To run train.py in python gnina env, need to install the following packages in /garlic/apps/gnina/python/requirements.txt

Also for importing compiled caffe in python    export PYTHONPATH=/garlic/apps/gnina/python:$PYTHONPATH

then ran into this
ImportError: /garlic/apps/anaconda3/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /garlic/apps/anaconda3/envs/gnina/lib/python2.7/site-packages/matplotlib/_path.so)

Fix:
cd /garlic/apps/anaconda3/lib
sudo mv libstdc++.so.6 libstdc++.so.6.old
sudo mv libstdc++.so libstdc++.so.old

Install system libstdc++.so.6 into /usr/lib64 and let python use that version.

Also need: gui tk
before import caffe

Otherwise it shows error: QXcbConnection: Could not connect to display


Comments