-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[c++/python] Build flow improvements #496
Conversation
This pull request has been linked to Shortcut Story #22584: Some centralization of R/C++ and Python/C++ builds. |
895e5ee
to
bfdfd22
Compare
bfdfd22
to
4ba0d1e
Compare
Looks fabulous at a first glance. Will test-drive after dinner. Love the |
@@ -1,6 +1,9 @@ | |||
import pyarrow as pa | |||
from typeguard.importhook import install_import_hook | |||
|
|||
# avoid typeguard by importing before calling install_import_hook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
libtiledbsoma/README.md
Outdated
cd TileDB-SOMA | ||
``` | ||
--- | ||
## Setup a Python Virtual Environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Set up a ...
libtiledbsoma/README.md
Outdated
|
||
Remove old build files: | ||
--- | ||
## Python Only Development |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Python-only Development
BUILD_TYPE=${1:-Release} # default to Release build | ||
if [ ! -z "$LIBTILEDBSOMA_DEBUG_BUILD" ]; then | ||
echo | ||
echo ================================================================ | ||
echo LIBTILEDBSOMA SCRIPTS/BLD BUILD_TYPE ${BUILD_TYPE} | ||
echo ================================================================ | ||
else | ||
echo "Building ${BUILD_TYPE} build" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the output from this verbose setup far easier to parse -- while it lasted. :(
👋 ✌️ 🖖
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found all of the debug messages made the code harder to modify/maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gspowley which I knew would happen hence 🖖
|
||
# - incrementally compile and install the c++ code | ||
# - copy the shared objects on top of the python dev build | ||
.PHONY: update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linux error:
$ make update
make[1]: /tmp/pip-build-env-imfu1ozp/overlay/local/lib/python3.10/dist-packages/cmake/data/bin/cmake: No such file or directory
make[1]: *** [Makefile:180: cmake_check_build_system] Error 127
make: *** [Makefile:9: update] Error 2
MacOS error:
johnkerl@Kerl-MBP[prod][gspowley/sc-22584/build-flow-improvements][TileDB-SOMA]$ make update
[ 50%] Built target ep_spdlog
[ 56%] Performing configure step for 'libtiledbsoma'
-- Using default install prefix /Users/johnkerl/git/single-cell-data/TileDB-SOMA/dist. To control CMAKE_INSTALL_PREFIX, set OVERRIDE_INSTALL_PREFIX=OFF
-- Install prefix is /Users/johnkerl/git/single-cell-data/TileDB-SOMA/dist.
-- Skipping search for TileDB, building it as an external project. To use system TileDB, set FORCE_BUILD_TILEDB=OFF
-- Starting TileDB-SOMA regular build.
-- Performing Test HAVE_AVX2
-- Performing Test HAVE_AVX2 - Success
-- Starting TileDB-SOMA build.
-- Found TileDB: TILEDB_LIB-NOTFOUND
-- Building with commit hash 4ba0d1e
CMake Warning at src/CMakeLists.txt:57 (message):
Building TileDB without deprecation warnings
CMake Error at src/pyapi/CMakeLists.txt:3 (find_package):
Could not find a package configuration file provided by "pybind11" with any
of the following names:
pybind11Config.cmake
pybind11-config.cmake
Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
"pybind11_DIR" to a directory containing one of the above files. If
"pybind11" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
See also "/Users/johnkerl/git/single-cell-data/TileDB-SOMA/build/libtiledbsoma/CMakeFiles/CMakeOutput.log".
See also "/Users/johnkerl/git/single-cell-data/TileDB-SOMA/build/libtiledbsoma/CMakeFiles/CMakeError.log".
make[3]: *** [libtiledbsoma-prefix/src/libtiledbsoma-stamp/libtiledbsoma-configure] Error 1
make[2]: *** [CMakeFiles/libtiledbsoma.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [update] Error 2
Note this happened on MacOS even after pip install -r apis/python/requirements_dev.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make[1]: /tmp/pip-build-env-imfu1ozp/overlay/local/lib/python3.10/dist-packages/cmake/data/bin/cmake: No such file or directory
make[1]: *** [Makefile:180: cmake_check_build_system] Error 127
make: *** [Makefile:9: update] Error 2
The Linux error is definitely cause by running something like this (because I've seen this before):
pip install -e apis/python
make update
Here's what happens:
pip install
creates an overlay environment (/tmp/pip-build-env-imfu1ozp/overlay), where it install cmake and builds the code.make update
tries to call the cmake from the overlay environment, but it is no longer there.
The MacOS error may be caused by the same sequence of commands.
The libtiledbsoma/README.md
describes two dev modes (Python-only
and Python and C++
) and which build commands should be used in each.
Maybe we should have just one developer mode that uses the Makefile
and avoid the confusion?
# - run the clean rule | ||
# - build the c++ static library for r | ||
.PHONY: r-build | ||
r-build: clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
Makefile
Outdated
# - run c++ unit tests | ||
# - run pytests | ||
.PHONY: test | ||
test: test/soco |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The make r-build
target is close in that it gets the desired static library and the core headers -- but it misses the externals/
header directory we need for span
under C++17.
cmake >= 3.23 makes this easier to support. Does this install tree capture everything?
|
Thanks, I noticed the change late last eve but I will need a newer Edit Sorry, it is also missing the two arrow headers we should move to a different directory. They are currently 'hiding' with the two Python headers but are not Python-specific. The R package needs them too. Edit 2 Plus the |
Iff the additional headers are added we can build, and link, and load. Note that in the what I quote below we now only compile the r-api source files (for now all starting with And the R package does a full 'does it turn on?' test by trying to load at the penultimate step so this really is good. (But I did have to add extra headers in directory edd@rob:~/git/tiledb-soma/apis/r(gspowley/sc-22584/build-flow-improvements)$ ./cleanup
edd@rob:~/git/tiledb-soma/apis/r(gspowley/sc-22584/build-flow-improvements)$ install.r # simple wrapper to R CMD INSTALL
* installing *source* package found in current working directory ...
* installing *source* package ‘tiledbsoma’ ...
** using staged installation
** updated src/Makevars for system library via pkg-config
** libs
ccache g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include/ -I/usr/local/include -I/usr/local/lib/R/site-library/arch/include -DR_BUILD -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppSpdlog/include' -I'/usr/local/lib/R/site-library/arch/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c RcppExports.cpp -o RcppExports.o
ccache g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include/ -I/usr/local/include -I/usr/local/lib/R/site-library/arch/include -DR_BUILD -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppSpdlog/include' -I'/usr/local/lib/R/site-library/arch/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c rinterface.cpp -o rinterface.o
ccache g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include/ -I/usr/local/include -I/usr/local/lib/R/site-library/arch/include -DR_BUILD -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppSpdlog/include' -I'/usr/local/lib/R/site-library/arch/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c riterator.cpp -o riterator.o
ccache g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include/ -I/usr/local/include -I/usr/local/lib/R/site-library/arch/include -DR_BUILD -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppSpdlog/include' -I'/usr/local/lib/R/site-library/arch/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c rutilities.cpp -o rutilities.o
ccache g++ -std=gnu++17 -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o tiledbsoma.so RcppExports.o rinterface.o riterator.o rutilities.o -L/usr/local/lib -ltiledb libtiledbsoma.a -L/usr/lib/R/lib -lR
if [ "" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ] && [ -f ../inst/tiledb/lib/libtiledb.dylib ] && [ -f tiledbsoma.so ]; then install_name_tool -change libz.1.dylib @rpath/libz.1.dylib ../inst/tiledb/lib/libtiledb.dylib; install_name_tool -add_rpath @loader_path/../tiledb/lib tiledbsoma.so; fi
installing to /usr/local/lib/R/site-library/00LOCK-r/00new/tiledbsoma/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (tiledbsoma)
edd@rob:~/git/tiledb-soma/apis/r(gspowley/sc-22584/build-flow-improvements)$ |
d89e062
to
02a4b63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I should have some time this afternoon to check again on libtiledbsoma.a
use and headers.
…m:single-cell-data/TileDB-SingleCell into gspowley/sc-22584/build-flow-improvements
Gave it another two spins to ascertain that
So 🚢 from me! Nice work. |
A number of build flow improvements based on developer feedback:
tiledbsoma
, including after pulling the latest source code.Makefile
to automate build commands.libtiledbsoma
static library for R.Example C++ dev commands:
R build command:
# requires cmake >= 3.21 make r-build