gnina / libmolgrid

Comprehensive library for fast, GPU accelerated molecular gridding for deep learning workflows
https://gnina.github.io/libmolgrid/
Apache License 2.0
145 stars 48 forks source link

Troubles compiling libmolgrid #37

Closed wquc closed 4 years ago

wquc commented 4 years ago

Working platform:

Below is the output when I just cmake in the build directory.

-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- The CUDA compiler identification is NVIDIA 9.0.176
-- Check for working C compiler: /usr/local/gcc-6.2/bin/gcc
-- Check for working C compiler: /usr/local/gcc-6.2/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/gcc-6.2/bin/g++
-- Check for working CXX compiler: /usr/local/gcc-6.2/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Found Git: /usr/bin/git
-- Current git revision is
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "9.0")
-- Boost  found.
-- Found Boost components:
   regex;unit_test_framework;program_options;system;filesystem;iostreams
-- Found Open Babel include files at /usr/local/include/openbabel3
-- Found Open Babel library at /lib64/libopenbabel.so
Setting openbabel found TRUE
-- Found PythonLibs: /usr/lib64/libpython3.6m.so (found version "3.6.8")
-- Found PythonInterp: /usr/bin/python3.6 (found version "3.6.8")
CMake Error at /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:120 (find_package):
  Could not find a package configuration file provided by "boost_python3"
  (requested version 1.72.0) with any of the following names:

    boost_python3Config.cmake
    boost_python3-config.cmake

  Add the installation prefix of "boost_python3" to CMAKE_PREFIX_PATH or set
  "boost_python3_DIR" to a directory containing one of the above files.  If
  "boost_python3" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:185 (boost_find_component)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:261 (find_package)
  python/CMakeLists.txt:14 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/wangqi/wangqi/downloads/libmolgrid-master/build/CMakeFiles/CMakeOutput.log".
See also "/home/wangqi/wangqi/downloads/libmolgrid-master/build/CMakeFiles/CMakeError.log".

I believe Boost was properly installed since the following files are found in my /usr/local/lib:

libboost_python3.a
libboost_python3.so
libboost_python36.a
libboost_python36.so
libboost_python36.so.1
libboost_python36.so.1.72
libboost_python36.so.1.72.0

After some research, I added set(Boost_NO_BOOST_CMAKE true) to CMakeLists.txt (everything else is untouched) to make it go through:

-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- The CUDA compiler identification is NVIDIA 9.0.176
-- Check for working C compiler: /usr/local/gcc-6.2/bin/gcc
-- Check for working C compiler: /usr/local/gcc-6.2/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/gcc-6.2/bin/g++
-- Check for working CXX compiler: /usr/local/gcc-6.2/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Found Git: /usr/bin/git
-- Current git revision is
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "9.0")
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:40 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:40 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:40 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:40 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:40 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:40 (find_package)

-- Boost version: 1.72.0
-- Found the following Boost libraries:
--   regex
--   unit_test_framework
--   program_options
--   system
--   filesystem
--   iostreams
-- Found Open Babel include files at /usr/local/include/openbabel3
-- Found Open Babel library at /lib64/libopenbabel.so
Setting openbabel found TRUE
-- Found PythonLibs: /usr/lib64/libpython3.6m.so (found version "3.6.8")
-- Found PythonInterp: /usr/bin/python3.6 (found version "3.6.8")
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  python/CMakeLists.txt:14 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  python/CMakeLists.txt:14 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  python/CMakeLists.txt:14 (find_package)

-- Boost version: 1.72.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   python3
-- Found NumPy: /usr/local/lib64/python3.6/site-packages/numpy/core/include (found version "1.18.3")
CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  test/CMakeLists.txt:5 (find_package)

CMake Warning at /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  test/CMakeLists.txt:5 (find_package)

-- Boost version: 1.72.0
-- Found the following Boost libraries:
--   unit_test_framework
--   system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wangqi/wangqi/downloads/libmolgrid-master/build

So I assume I can continue with the compilation. However, when I run make command, the following error was given:

Scanning dependencies of target libmolgrid_static
[  1%] Building CXX object src/CMakeFiles/libmolgrid_static.dir/libmolgrid.cpp.o
[  2%] Building CXX object src/CMakeFiles/libmolgrid_static.dir/atom_typer.cpp.o
[  4%] Building CXX object src/CMakeFiles/libmolgrid_static.dir/example.cpp.o
[  5%] Building CXX object src/CMakeFiles/libmolgrid_static.dir/exampleref_providers.cpp.o
[  7%] Building CXX object src/CMakeFiles/libmolgrid_static.dir/example_extractor.cpp.o
[  8%] Building CXX object src/CMakeFiles/libmolgrid_static.dir/example_provider.cpp.o
[ 10%] Building CXX object src/CMakeFiles/libmolgrid_static.dir/grid_maker.cpp.o
[ 11%] Building CUDA object src/CMakeFiles/libmolgrid_static.dir/grid_maker.cu.o
/usr/local/include/boost/core/noncopyable.hpp(42): error: defaulted default constructor cannot be constexpr because the corresponding implicitly declared default constructor would not be constexpr

1 error detected in the compilation of "/tmp/tmpxft_00007b2b_00000000-9_grid_maker.compute_70.cpp1.ii".
make[2]: *** [src/CMakeFiles/libmolgrid_static.dir/grid_maker.cu.o] Error 1
make[1]: *** [src/CMakeFiles/libmolgrid_static.dir/all] Error 2
make: *** [all] Error 2

So I was wondering:

  1. Is adding set(Boost_NO_BOOST_CMAKE true) to CMakeLists.txt the correct way to make it work?
  2. What could be the cause of the /usr/local/include/boost/core/noncopyable.hpp(42): error?
  3. Actually I've also tried GCC 4.8 and 9.0 but neither worked. What are the versions of GCC, CUDA, Boost, Python and CMake were you using upon the publication of the Gnina paper?
dkoes commented 4 years ago

Boost_NO_BOOST_CMAKE should be okay. That error looks like an incompatibility between your gcc version and your boost version. CMake must be recent (e.g. 3.12.4). Otherwise, we are using the default versions from Ubuntu 18.04: gcc 7.5.0 boost 1.65 python 3.6.9 CUDA 10.2 (anything >=9 should work)

wquc commented 4 years ago

Thank you. I decided to use Ubuntu in docker and try to reproduce the same setup as much as possible. But when I was trying to cmake gnina, the following error was given:

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- The CUDA compiler identification is NVIDIA 10.2.89
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda-10.2/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-10.2/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-10.2 (found suitable version "10.2", minimum required is "9.0")
-- Found libmolgrid include files at /usr/local/include
-- Found libmolgrid library at /usr/local/lib/libmolgrid.so
-- Found libmolgrid: /usr/local/include
CMake Error at CMakeLists.txt:42 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/openbabel3/OpenBabel3Config.cmake

  but it set OpenBabel3_FOUND to FALSE so package "OpenBabel3" is considered
  to be NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing: maeparser
  coordgen

-- Configuring incomplete, errors occurred!
See also "/root/pkgs/gnina-master/build/CMakeFiles/CMakeOutput.log".
See also "/root/pkgs/gnina-master/build/CMakeFiles/CMakeError.log".

However, I already have Openbabel installed:

root@a10f8226d816:~/pkgs/gnina-master/build# obabel
No input file or format spec or possibly a misplaced option.
Most options must come after the input files. (-i -o -O -m can be anywhwere.)

Open Babel 3.0.0 -- May  8 2020 -- 19:37:54
Usage:
obabel [-i<input-type>] <infilename> [-o<output-type>] -O<outfilename> [Options]
Try  -H option for more information.
root@a10f8226d816:~/pkgs/gnina-master/build#
root@a10f8226d816:~/pkgs/gnina-master/build# which obabel
/usr/local/bin/obabel

How to tell gnina the location of openbabel?

dkoes commented 4 years ago

You can specify the location to the OpenBabel3 cmake file with this cmake option, although it is a bit surprising it wasn't installed in the standard place when you installed OB3: -DOpenBabel3_DIR=/net/pulsar/home/koes/dkoes/local/lib/cmake/openbabel3

wquc commented 4 years ago

Thank you. But the error still exists:

root@a10f8226d816:~/pkgs/gnina-master/build# cmake -DOpenBabel3_DIR=/usr/local/lib/cmake/openbabel3 ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- The CUDA compiler identification is NVIDIA 10.2.89
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda-10.2/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-10.2/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-10.2 (found suitable version "10.2", minimum required is "9.0")
-- Found libmolgrid include files at /usr/local/include
-- Found libmolgrid library at /usr/local/lib/libmolgrid.so
-- Found libmolgrid: /usr/local/include
CMake Error at CMakeLists.txt:45 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/openbabel3/OpenBabel3Config.cmake

  but it set OpenBabel3_FOUND to FALSE so package "OpenBabel3" is considered
  to be NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing: maeparser
  coordgen

-- Configuring incomplete, errors occurred!
See also "/root/pkgs/gnina-master/build/CMakeFiles/CMakeOutput.log".
See also "/root/pkgs/gnina-master/build/CMakeFiles/CMakeError.log".
root@a10f8226d816:~/pkgs/gnina-master/build#
root@a10f8226d816:~/pkgs/gnina-master/build#
root@a10f8226d816:~/pkgs/gnina-master/build#
root@a10f8226d816:~/pkgs/gnina-master/build# ls /usr/local/lib/cmake/openbabel3
OpenBabel3Config.cmake  OpenBabel3ConfigVersion.cmake  OpenBabel3_EXPORTS.cmake  OpenBabel3_EXPORTS-release.cmake

Did I specify the correct directory?

dkoes commented 4 years ago

Sorry, I didn't read your original error message carefully enough. It is looking for maeparser and coordgen. Probably the easiest thing to do is remove all references to these libraries from the files in /usr/local/lib/cmake/openbabel3/. They aren't important dependencies. I suspect this is related to this issue: https://github.com/openbabel/openbabel/issues/2197

Alternatively, you can configure and build openbabel with -DWITH_MAEPARSER=NO -DWITH_COORDGEN=NO which will remove the references from the cmake files for you.

If for some reason you need support for these formats, you'll need to figure out why the libraries aren't being found by cmake.

wquc commented 4 years ago

Thank you for the help. It worked and I can finish the installation of gnina. Moreover, I also noticed there was already a gnina container on Docker Hub, which could save so much time if I know this in the first place. So I think it's a good idea to notify future users by adding that link to README(s).