From 621509652723a12ce477278ba2a233ec960a3dee Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Tue, 26 Feb 2019 00:27:42 +0300 Subject: [PATCH 01/24] configure circleci --- .circleci/config.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..5ca95d5 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,9 @@ +version: 2 +jobs: + build: + docker: + - image: ubuntu + - name: dev + steps: + - checkout + - run: echo 'Hello, World!' From 02af3a0428a6c4619386f23de35b7eebe156f2b5 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Tue, 26 Feb 2019 00:30:08 +0300 Subject: [PATCH 02/24] configure circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ca95d5..d9be3bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: ubuntu + - image: library/ubuntu - name: dev steps: - checkout From 44c8c0a2cec44cfd1de0ebb58257770466471ab6 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Tue, 26 Feb 2019 00:31:36 +0300 Subject: [PATCH 03/24] configure circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d9be3bf..0668ef9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: library/ubuntu + - image: circleci/node - name: dev steps: - checkout From a5b892fd14d96e80131b81148a46bfc1073eb8fe Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Tue, 26 Feb 2019 19:46:47 +0300 Subject: [PATCH 04/24] configure circleci --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0668ef9..87e1529 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,8 +2,7 @@ version: 2 jobs: build: docker: - - image: circleci/node - - name: dev + - image: circleci/node:latest steps: - checkout - run: echo 'Hello, World!' From 4a1b895b349537a1cbe57793b46dfaf502027280 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Tue, 26 Feb 2019 19:49:32 +0300 Subject: [PATCH 05/24] configure circleci --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 87e1529..77e49a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: circleci/node:latest + - image: library/ubuntu:latest steps: - checkout - - run: echo 'Hello, World!' + - run: echo 'Hello, World! From 400323b29bcd9d04ccb974ba093fc92bf9a46a30 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Tue, 26 Feb 2019 19:51:36 +0300 Subject: [PATCH 06/24] configure circleci --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 77e49a7..df2ac80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,4 +5,7 @@ jobs: - image: library/ubuntu:latest steps: - checkout - - run: echo 'Hello, World! + - run: echo 'Hello, World!' \ + && apt update \ + && apt install clang \ + && ls From 862b6bfcd848d5c4adc99ab119afcad838c62e01 Mon Sep 17 00:00:00 2001 From: Dmitrii Kamaldinov Date: Sun, 3 Mar 2019 01:18:56 +0300 Subject: [PATCH 07/24] define code generation --- pysdsl/types/int_vectors.h | 7 +++++ pysdsl/types/intvector.hpp | 54 ++++++++------------------------------ 2 files changed, 18 insertions(+), 43 deletions(-) create mode 100644 pysdsl/types/int_vectors.h diff --git a/pysdsl/types/int_vectors.h b/pysdsl/types/int_vectors.h new file mode 100644 index 0000000..7c3072a --- /dev/null +++ b/pysdsl/types/int_vectors.h @@ -0,0 +1,7 @@ +DEF_INC_VECTOR(4, uint8_t) +DEF_INC_VECTOR(8, uint8_t) +DEF_INC_VECTOR(16, uint16_t) +DEF_INC_VECTOR(24, uint32_t) +DEF_INC_VECTOR(32, uint32_t) +DEF_INC_VECTOR(48, uint64_t) +DEF_INC_VECTOR(64, uint64_t) diff --git a/pysdsl/types/intvector.hpp b/pysdsl/types/intvector.hpp index 46ed5d4..c33e453 100644 --- a/pysdsl/types/intvector.hpp +++ b/pysdsl/types/intvector.hpp @@ -208,49 +208,17 @@ inline auto add_int_vectors(py::module& m) py::arg("size") = 0, py::arg("default_value") = false) .def("flip", &sdsl::int_vector<1>::flip, "Flip all bits of bit_vector", - py::call_guard()), - - add_int_class, uint16_t>( - m, int_vectors_dict, 4, "Int4Vector") - .def(py::init( - [](size_t size, uint8_t default_value) { - return sdsl::int_vector<4>(size, default_value, 4); }), - py::arg("size") = 0, py::arg("default_value") = 0), - - add_int_class, uint16_t>( - m, int_vectors_dict, 8, "Int8Vector") - .def(py::init( - [](size_t size, uint8_t default_value) { - return sdsl::int_vector<8>(size, default_value, 8); }), - py::arg("size") = 0, py::arg("default_value") = 0), - - add_int_class, uint16_t>( - m, int_vectors_dict, 16, "Int16Vector") - .def(py::init( - [](size_t size, uint16_t default_value) { - return sdsl::int_vector<16>(size, default_value, 16); }), - py::arg("size") = 0, py::arg("default_value") = 0), - - add_int_class, uint32_t>( - m, int_vectors_dict, 24, "Int24Vector") - .def(py::init( - [](size_t size, uint32_t default_value) { - return sdsl::int_vector<24>(size, default_value, 24); }), - py::arg("size") = 0, py::arg("default_value") = 0), - - add_int_class, uint32_t>( - m, int_vectors_dict, 32, "Int32Vector") - .def(py::init( - [](size_t size, uint32_t default_value) { - return sdsl::int_vector<32>(size, default_value, 32); }), - py::arg("size") = 0, py::arg("default_value") = 0), - - add_int_class, uint64_t>( - m, int_vectors_dict, 64, "Int64Vector") - .def(py::init( - [](size_t size, uint64_t default_value) { - return sdsl::int_vector<64>(size, default_value, 64); }), - py::arg("size") = 0, py::arg("default_value") = 0) + py::call_guard()) + +#define DEF_INC_VECTOR(width, value_type) ,\ + add_int_class, value_type>( \ + m, int_vectors_dict, width, "Int" #width "Vector") \ + .def(py::init( \ + [](size_t size, value_type default_value) { \ + return sdsl::int_vector(size, default_value, width); }), \ + py::arg("size") = 0, py::arg("default_value") = 0) +#include "int_vectors.h" +#undef DEF_INC_VECTOR ); } From 5b9f755c7950be7cf9720a8fdb050430a471fbf4 Mon Sep 17 00:00:00 2001 From: Dmitrii Kamaldinov Date: Sun, 3 Mar 2019 18:56:42 +0300 Subject: [PATCH 08/24] make_int_vectors --- pysdsl/types/intvector.hpp | 77 +++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/pysdsl/types/intvector.hpp b/pysdsl/types/intvector.hpp index c33e453..91b92cb 100644 --- a/pysdsl/types/intvector.hpp +++ b/pysdsl/types/intvector.hpp @@ -168,15 +168,21 @@ inline auto add_int_class(py::module& m, py::dict& dict, KEY_T key, return cls; } +template +auto add_int_vector(py::module& m, py::dict& int_vectors_dict) { + size_t width = VectorT::fixed_int_width; + std::string name = "Int" + std::to_string(width) + "Vector"; + return add_int_class( + m, int_vectors_dict, width, name.c_str()) + .def(py::init( + [width](size_t size, typename VectorT::value_type default_value) { + return VectorT(size, default_value, width); }), + py::arg("size") = 0, py::arg("default_value") = 0); +} -inline auto add_int_vectors(py::module& m) -{ - py::dict int_vectors_dict; - - m.attr("int_vector") = int_vectors_dict; - - return std::make_tuple( - add_int_class>( +template<> +auto add_int_vector>(py::module& m, py::dict& int_vectors_dict) { + return add_int_class>( m, int_vectors_dict, "dynamic", "IntVector", doc_int_vector) .def( py::init([](size_t size, @@ -198,9 +204,12 @@ inline auto add_int_vectors(py::module& m) [](sdsl::int_vector<0> &self) { sdsl::util::bit_compress(self); }, doc_bit_compress, - py::call_guard()), + py::call_guard()); +} - add_int_class, bool>( +template <> +auto add_int_vector>(py::module& m, py::dict& int_vectors_dict) { + return add_int_class, bool>( m, int_vectors_dict, 1ul , "BitVector") .def(py::init( [](size_t size, bool default_value) { @@ -208,17 +217,41 @@ inline auto add_int_vectors(py::module& m) py::arg("size") = 0, py::arg("default_value") = false) .def("flip", &sdsl::int_vector<1>::flip, "Flip all bits of bit_vector", - py::call_guard()) - -#define DEF_INC_VECTOR(width, value_type) ,\ - add_int_class, value_type>( \ - m, int_vectors_dict, width, "Int" #width "Vector") \ - .def(py::init( \ - [](size_t size, value_type default_value) { \ - return sdsl::int_vector(size, default_value, width); }), \ - py::arg("size") = 0, py::arg("default_value") = 0) -#include "int_vectors.h" -#undef DEF_INC_VECTOR - ); + py::call_guard()); +} + + +template +auto make_int_vectors(py::module& m, py::dict& int_vectors_dict) { + return std::make_tuple(add_int_vector(m, int_vectors_dict)...); +} + + +inline auto add_int_vectors(py::module& m) +{ + py::dict int_vectors_dict; + + m.attr("int_vector") = int_vectors_dict; + + return make_int_vectors, + sdsl::int_vector<1>, + sdsl::int_vector<4>, + sdsl::int_vector<8>, + sdsl::int_vector<16>, + sdsl::int_vector<24>, + sdsl::int_vector<32>, + sdsl::int_vector<48>, + sdsl::int_vector<64>>(m, int_vectors_dict); + +// #define DEF_INC_VECTOR(width, value_type) ,\ +// add_int_class, value_type>( \ +// m, int_vectors_dict, width, "Int" #width "Vector") \ +// .def(py::init( \ +// [](size_t size, value_type default_value) { \ +// return sdsl::int_vector(size, default_value, width); }), \ +// py::arg("size") = 0, py::arg("default_value") = 0) +// #include "int_vectors.h" +// #undef DEF_INC_VECTOR +// ); } From 28907398f545728bab2184146d2320dedf89294a Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 19:06:55 +0300 Subject: [PATCH 09/24] configure circleci --- .circleci/config.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df2ac80..b007dc0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,10 +2,9 @@ version: 2 jobs: build: docker: - - image: library/ubuntu:latest + - image: ivigns/nice-ubuntu:0.0.1 steps: - checkout - - run: echo 'Hello, World!' \ - && apt update \ - && apt install clang \ - && ls + - run: + name: Build libary(WIP) + command: ls From d75b63e5f0a5226692fd130d7e5277d8891bef6a Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 19:08:57 +0300 Subject: [PATCH 10/24] configure circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b007dc0..d6e4a63 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,4 +7,4 @@ jobs: - checkout - run: name: Build libary(WIP) - command: ls + command: ls -aR From 7377eefb7dd4ccc80b7c51aef1636c8983be172d Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 20:20:53 +0300 Subject: [PATCH 11/24] configure circleci --- .circleci/config.yml | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d6e4a63..ca282df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,8 +3,40 @@ jobs: build: docker: - image: ivigns/nice-ubuntu:0.0.1 + resource_class: xlarge steps: - checkout - run: - name: Build libary(WIP) - command: ls -aR + name: Update submodules + command: | + git submodule sync + git submodule update --init --recursive + git submodule update --recursive + - run: + name: Build pysdsl + command: | + cd /work/sdsl-lite + bash unsinstall.sh /usr + cd /tmp + rm -rf sdsl-lite-build + rm -rf libdivsufsort-build + mkdir sdsl-lite-build + mkdir libdivsufsort-build + export CC=clang + export CXX=clang++ + export CFLAGS="-O3 -pipe -fPIC" + export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" + cd /tmp/libdivsufsort-build + cmake /work/libdivsufsort + make install + export CXXFLAGS="${CXXFLAGS} -DNOCROSSCONSTRUCTORS" + cd /tmp/sdsl-lite-build + cmake /work/sdsl-lite + make install + cd /work/pybind11 + pip install --no-binary :all: --no-cache-dir . --verbose + # cd /work + # pip install --no-binary :all: --no-cache-dir . --verbose + - run: + name: Show + command: cd /work && ls -aR From 2ea1a693b0de228428f83ba9309fc36f33b8edce Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 20:22:49 +0300 Subject: [PATCH 12/24] configure circleci --- .circleci/config.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca282df..39e1fa6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,14 +7,11 @@ jobs: steps: - checkout - run: - name: Update submodules + name: Build pysdsl command: | git submodule sync git submodule update --init --recursive git submodule update --recursive - - run: - name: Build pysdsl - command: | cd /work/sdsl-lite bash unsinstall.sh /usr cd /tmp From 2fe4680758a6a80a2315bfb784640de24a733beb Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 20:25:52 +0300 Subject: [PATCH 13/24] configure circleci --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 39e1fa6..b630868 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,6 +4,7 @@ jobs: docker: - image: ivigns/nice-ubuntu:0.0.1 resource_class: xlarge + working_directory: /work steps: - checkout - run: From 77972fff91de72dafeaef3d6b584fd207b775019 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 20:27:58 +0300 Subject: [PATCH 14/24] configure circleci --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b630868..79c7f90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,10 +10,12 @@ jobs: - run: name: Build pysdsl command: | + cd /work git submodule sync git submodule update --init --recursive git submodule update --recursive cd /work/sdsl-lite + ls bash unsinstall.sh /usr cd /tmp rm -rf sdsl-lite-build From dbbe92f724481560241b6ab56610ba51e06beb11 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 20:29:03 +0300 Subject: [PATCH 15/24] configure circleci --- .circleci/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 79c7f90..20c3d7f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,13 +10,11 @@ jobs: - run: name: Build pysdsl command: | - cd /work git submodule sync git submodule update --init --recursive git submodule update --recursive cd /work/sdsl-lite - ls - bash unsinstall.sh /usr + bash uninstall.sh /usr cd /tmp rm -rf sdsl-lite-build rm -rf libdivsufsort-build From a6c4eae90087d4de7d77630ed0ae23568871bf7d Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 20:32:23 +0300 Subject: [PATCH 16/24] configure circleci --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 20c3d7f..02e85e5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,8 +33,8 @@ jobs: make install cd /work/pybind11 pip install --no-binary :all: --no-cache-dir . --verbose - # cd /work - # pip install --no-binary :all: --no-cache-dir . --verbose + cd /work + pip install --no-binary :all: --no-cache-dir . --verbose - run: name: Show command: cd /work && ls -aR From b02abfabbf0d7e8f3e09d6579605a8e67fb1ccea Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 21:12:00 +0300 Subject: [PATCH 17/24] partial build: only int_vectors --- .circleci/__init__.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .circleci/__init__.cpp diff --git a/.circleci/__init__.cpp b/.circleci/__init__.cpp new file mode 100644 index 0000000..fa929b8 --- /dev/null +++ b/.circleci/__init__.cpp @@ -0,0 +1,78 @@ +#define NOCROSSCONSTRUCTORS + + +#include +#include +#include +#include + +#define assert(x) if(!x) {throw std::runtime_error("assertion failed");} + +#include + +#include + +#include "docstrings.hpp" +#include "operations/creation.hpp" +#include "types/bitvector.hpp" +#include "types/encodedvector.hpp" +#include "types/intvector.hpp" +#include "types/suffixarray.hpp" +#include "types/wavelet.hpp" + +namespace py = pybind11; + + +PYBIND11_MODULE(pysdsl, m) +{ + m.doc() = "sdsl-lite bindings for python"; + + auto iv_classes = add_int_vectors(m); + + py::class_>& bit_vector_cls = std::get<1>(iv_classes); + + auto bit_vector_classes = std::make_tuple(bit_vector_cls); + + // auto tmp = add_bitvectors(m, bit_vector_cls); + // auto compressed_bit_vector_classes = std::get<0>(tmp); + // auto cbv_propagate = std::get<1>(tmp); + + // auto enc_classes = add_encoded_vectors(m); + + // auto wavelet_classes = add_wavelet(m, cbv_propagate); + + // auto csa_classes = add_csa(m); + + for_each_in_tuple(iv_classes, make_inits_many_functor(iv_classes)); + // for_each_in_tuple(iv_classes, make_inits_many_functor(enc_classes)); + // for_each_in_tuple(iv_classes, + // make_inits_many_functor(compressed_bit_vector_classes)); + // for_each_in_tuple(iv_classes, make_inits_many_functor(wavelet_classes)); + + // for_each_in_tuple(enc_classes, make_inits_many_functor(iv_classes)); +// #ifndef NOCROSSCONSTRUCTORS + // for_each_in_tuple(enc_classes, make_inits_many_functor(enc_classes)); + //for_each_in_tuple(enc_classes, make_inits_many_functor(wavelet_classes)); +// #endif + + // for_each_in_tuple(compressed_bit_vector_classes, + // make_inits_many_functor(bit_vector_classes)); +// #ifndef NOCROSSCONSTRUCTORS + // for_each_in_tuple(compressed_bit_vector_classes, make_inits_many_functor(compressed_bit_vector_classes)); +// #endif + + // for_each_in_tuple(wavelet_classes, make_inits_many_functor(iv_classes)); +// #ifndef NOCROSSCONSTRUCTORS + // for_each_in_tuple(wavelet_classes, make_inits_many_functor(enc_classes)); + // for_each_in_tuple(wavelet_classes, + // make_inits_many_functor(wavelet_classes)); +// #endif + + for_each_in_tuple(iv_classes, make_pysequence_init_functor()); + // for_each_in_tuple(enc_classes, make_pysequence_init_functor()); + //for_each_in_tuple(compressed_bit_vector_classes, + // make_pysequence_init_functor()); + + // for_each_in_tuple(wavelet_classes, make_pysequence_init_functor()); + // for_each_in_tuple(csa_classes, make_pysequence_init_functor()); +} From 125386b2c1641e24696e4e6ffc4e32fbf7eb0647 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 21:18:05 +0300 Subject: [PATCH 18/24] configure circleci --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 02e85e5..3b717db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,9 @@ jobs: - run: name: Build pysdsl command: | + #-- partial build --- + cp .circleci/__init__.cpp pysdsl/__init__.cpp + #-------------------- git submodule sync git submodule update --init --recursive git submodule update --recursive From 2adf7694c2760c6fb4d7c604915c125300e0307d Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Sun, 3 Mar 2019 23:36:42 +0300 Subject: [PATCH 19/24] Revert "Merge branch 'feature/circleci' into feature/circleci" This reverts commit ee4768f18c473d2cee38ace8177ebb61a0c45791, reversing changes made to 50fd59953d4f27283a619307c9a9ea1828d1658c. --- pysdsl/types/int_vectors.h | 7 --- pysdsl/types/intvector.hpp | 97 +++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 56 deletions(-) delete mode 100644 pysdsl/types/int_vectors.h diff --git a/pysdsl/types/int_vectors.h b/pysdsl/types/int_vectors.h deleted file mode 100644 index 7c3072a..0000000 --- a/pysdsl/types/int_vectors.h +++ /dev/null @@ -1,7 +0,0 @@ -DEF_INC_VECTOR(4, uint8_t) -DEF_INC_VECTOR(8, uint8_t) -DEF_INC_VECTOR(16, uint16_t) -DEF_INC_VECTOR(24, uint32_t) -DEF_INC_VECTOR(32, uint32_t) -DEF_INC_VECTOR(48, uint64_t) -DEF_INC_VECTOR(64, uint64_t) diff --git a/pysdsl/types/intvector.hpp b/pysdsl/types/intvector.hpp index 91b92cb..46ed5d4 100644 --- a/pysdsl/types/intvector.hpp +++ b/pysdsl/types/intvector.hpp @@ -168,21 +168,15 @@ inline auto add_int_class(py::module& m, py::dict& dict, KEY_T key, return cls; } -template -auto add_int_vector(py::module& m, py::dict& int_vectors_dict) { - size_t width = VectorT::fixed_int_width; - std::string name = "Int" + std::to_string(width) + "Vector"; - return add_int_class( - m, int_vectors_dict, width, name.c_str()) - .def(py::init( - [width](size_t size, typename VectorT::value_type default_value) { - return VectorT(size, default_value, width); }), - py::arg("size") = 0, py::arg("default_value") = 0); -} -template<> -auto add_int_vector>(py::module& m, py::dict& int_vectors_dict) { - return add_int_class>( +inline auto add_int_vectors(py::module& m) +{ + py::dict int_vectors_dict; + + m.attr("int_vector") = int_vectors_dict; + + return std::make_tuple( + add_int_class>( m, int_vectors_dict, "dynamic", "IntVector", doc_int_vector) .def( py::init([](size_t size, @@ -204,12 +198,9 @@ auto add_int_vector>(py::module& m, py::dict& int_vectors_di [](sdsl::int_vector<0> &self) { sdsl::util::bit_compress(self); }, doc_bit_compress, - py::call_guard()); -} + py::call_guard()), -template <> -auto add_int_vector>(py::module& m, py::dict& int_vectors_dict) { - return add_int_class, bool>( + add_int_class, bool>( m, int_vectors_dict, 1ul , "BitVector") .def(py::init( [](size_t size, bool default_value) { @@ -217,41 +208,49 @@ auto add_int_vector>(py::module& m, py::dict& int_vectors_di py::arg("size") = 0, py::arg("default_value") = false) .def("flip", &sdsl::int_vector<1>::flip, "Flip all bits of bit_vector", - py::call_guard()); -} + py::call_guard()), + add_int_class, uint16_t>( + m, int_vectors_dict, 4, "Int4Vector") + .def(py::init( + [](size_t size, uint8_t default_value) { + return sdsl::int_vector<4>(size, default_value, 4); }), + py::arg("size") = 0, py::arg("default_value") = 0), -template -auto make_int_vectors(py::module& m, py::dict& int_vectors_dict) { - return std::make_tuple(add_int_vector(m, int_vectors_dict)...); -} + add_int_class, uint16_t>( + m, int_vectors_dict, 8, "Int8Vector") + .def(py::init( + [](size_t size, uint8_t default_value) { + return sdsl::int_vector<8>(size, default_value, 8); }), + py::arg("size") = 0, py::arg("default_value") = 0), + add_int_class, uint16_t>( + m, int_vectors_dict, 16, "Int16Vector") + .def(py::init( + [](size_t size, uint16_t default_value) { + return sdsl::int_vector<16>(size, default_value, 16); }), + py::arg("size") = 0, py::arg("default_value") = 0), -inline auto add_int_vectors(py::module& m) -{ - py::dict int_vectors_dict; + add_int_class, uint32_t>( + m, int_vectors_dict, 24, "Int24Vector") + .def(py::init( + [](size_t size, uint32_t default_value) { + return sdsl::int_vector<24>(size, default_value, 24); }), + py::arg("size") = 0, py::arg("default_value") = 0), - m.attr("int_vector") = int_vectors_dict; + add_int_class, uint32_t>( + m, int_vectors_dict, 32, "Int32Vector") + .def(py::init( + [](size_t size, uint32_t default_value) { + return sdsl::int_vector<32>(size, default_value, 32); }), + py::arg("size") = 0, py::arg("default_value") = 0), - return make_int_vectors, - sdsl::int_vector<1>, - sdsl::int_vector<4>, - sdsl::int_vector<8>, - sdsl::int_vector<16>, - sdsl::int_vector<24>, - sdsl::int_vector<32>, - sdsl::int_vector<48>, - sdsl::int_vector<64>>(m, int_vectors_dict); - -// #define DEF_INC_VECTOR(width, value_type) ,\ -// add_int_class, value_type>( \ -// m, int_vectors_dict, width, "Int" #width "Vector") \ -// .def(py::init( \ -// [](size_t size, value_type default_value) { \ -// return sdsl::int_vector(size, default_value, width); }), \ -// py::arg("size") = 0, py::arg("default_value") = 0) -// #include "int_vectors.h" -// #undef DEF_INC_VECTOR -// ); + add_int_class, uint64_t>( + m, int_vectors_dict, 64, "Int64Vector") + .def(py::init( + [](size_t size, uint64_t default_value) { + return sdsl::int_vector<64>(size, default_value, 64); }), + py::arg("size") = 0, py::arg("default_value") = 0) + ); } From 8a0c077877db1da42489b08bfcbfc001ecfaa501 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Fri, 19 Apr 2019 00:04:20 +0300 Subject: [PATCH 20/24] test circleci --- .circleci/NiceLinuxDockerfile | 8 ++++ .circleci/config.yml | 79 +++++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 32 deletions(-) create mode 100644 .circleci/NiceLinuxDockerfile diff --git a/.circleci/NiceLinuxDockerfile b/.circleci/NiceLinuxDockerfile new file mode 100644 index 0000000..8ef5518 --- /dev/null +++ b/.circleci/NiceLinuxDockerfile @@ -0,0 +1,8 @@ +FROM debian:testing +RUN mkdir /work +WORKDIR /work +RUN \ + apt update && \ + apt install -y --no-install-recommends clang ssh git tar zip ca-certificates && \ + apt install -y cmake python-pip && \ + rm -rf /var/lib/apt/lists/* diff --git a/.circleci/config.yml b/.circleci/config.yml index 3b717db..f30bab3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,42 +2,57 @@ version: 2 jobs: build: docker: - - image: ivigns/nice-ubuntu:0.0.1 + - image: ivigns/nice-linux:debian-0.0.3 resource_class: xlarge working_directory: /work steps: - checkout - run: - name: Build pysdsl - command: | - #-- partial build --- - cp .circleci/__init__.cpp pysdsl/__init__.cpp - #-------------------- - git submodule sync - git submodule update --init --recursive - git submodule update --recursive - cd /work/sdsl-lite - bash uninstall.sh /usr - cd /tmp - rm -rf sdsl-lite-build - rm -rf libdivsufsort-build - mkdir sdsl-lite-build - mkdir libdivsufsort-build - export CC=clang - export CXX=clang++ - export CFLAGS="-O3 -pipe -fPIC" - export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" - cd /tmp/libdivsufsort-build - cmake /work/libdivsufsort - make install - export CXXFLAGS="${CXXFLAGS} -DNOCROSSCONSTRUCTORS" - cd /tmp/sdsl-lite-build - cmake /work/sdsl-lite - make install - cd /work/pybind11 - pip install --no-binary :all: --no-cache-dir . --verbose - cd /work - pip install --no-binary :all: --no-cache-dir . --verbose + name: build + command: + - git submodule sync + - git submodule update --init --recursive + - cd /drone/src/libdivsufsort + - git pull origin master + - cd /drone/src/sdsl-lite + - git pull origin master + - cd /drone/src/sdsl-lite/external/libdivsufsort + - git pull origin master + - cd /drone/src/pybind11 + - git pull origin master + - cd /tmp + - mkdir sdsl-lite-build + - mkdir libdivsufsort-build + - export CC=clang + - export CXX=clang++ + - export CFLAGS="-O3 -static -lc -fPIC -static-libgcc -pipe -fcolor-diagnostics -lpthread -Wl,-Bstatic" + - cd /tmp/libdivsufsort-build + - cmake -D BUILD_SHARED_LIBS=OFF /drone/src/libdivsufsort + - make install + - export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -static-libstdc++ -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" + - cd /tmp/sdsl-lite-build + - cmake /drone/src/sdsl-lite + - make install + - export CXXFLAGS="-O3 -pipe -stdlib=libc++ -fcolor-diagnostics -fPIC -DNOCROSSCONSTRUCTORS" + - export CFLAGS="-O3 -pipe -fcolor-diagnostics -fPIC" + - cd /drone/src/pybind11 + - pip install --no-binary ':all:' --no-cache-dir . --verbose + - cd /drone/src + - pip wheel --no-binary ':all:' --no-cache-dir -w dist . --verbose - run: - name: Show + name: show command: cd /work && ls -aR + build: + docker: + - image: debian:testing + resource_class: xlarge + working_directory: /work + steps: + - checkout + - run: + - apt-get update -qq + - apt-get install -qqy python python-pip + - pip install $(ls -d /tmp/cache/dist/*) + - mkdir /tmp/test + - cd /tmp/test + - python -c 'import pysdsl' From 9c0fae917613bc63fd5059bb517dd0eb149c1054 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Fri, 19 Apr 2019 00:06:38 +0300 Subject: [PATCH 21/24] test circleci --- .circleci/config.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f30bab3..89afd0f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,17 +42,12 @@ jobs: - run: name: show command: cd /work && ls -aR - build: - docker: - - image: debian:testing - resource_class: xlarge - working_directory: /work - steps: - - checkout - run: - - apt-get update -qq - - apt-get install -qqy python python-pip - - pip install $(ls -d /tmp/cache/dist/*) - - mkdir /tmp/test - - cd /tmp/test - - python -c 'import pysdsl' + name: test wheel + command: + - apt-get update -qq + - apt-get install -qqy python python-pip + - pip install $(ls -d /tmp/cache/dist/*) + - mkdir /tmp/test + - cd /tmp/test + - python -c 'import pysdsl' From c72e95d1ffe6635d65df2961cd48c7dd6ae94d6b Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Fri, 19 Apr 2019 00:12:59 +0300 Subject: [PATCH 22/24] configure circleci --- .circleci/config.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 89afd0f..d55a148 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,16 +9,16 @@ jobs: - checkout - run: name: build - command: + command: | - git submodule sync - git submodule update --init --recursive - - cd /drone/src/libdivsufsort + - cd /work/libdivsufsort - git pull origin master - - cd /drone/src/sdsl-lite + - cd /work/sdsl-lite - git pull origin master - - cd /drone/src/sdsl-lite/external/libdivsufsort + - cd /work/sdsl-lite/external/libdivsufsort - git pull origin master - - cd /drone/src/pybind11 + - cd /work/pybind11 - git pull origin master - cd /tmp - mkdir sdsl-lite-build @@ -27,17 +27,17 @@ jobs: - export CXX=clang++ - export CFLAGS="-O3 -static -lc -fPIC -static-libgcc -pipe -fcolor-diagnostics -lpthread -Wl,-Bstatic" - cd /tmp/libdivsufsort-build - - cmake -D BUILD_SHARED_LIBS=OFF /drone/src/libdivsufsort + - cmake -D BUILD_SHARED_LIBS=OFF /work/libdivsufsort - make install - export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -static-libstdc++ -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" - cd /tmp/sdsl-lite-build - - cmake /drone/src/sdsl-lite + - cmake /work/sdsl-lite - make install - export CXXFLAGS="-O3 -pipe -stdlib=libc++ -fcolor-diagnostics -fPIC -DNOCROSSCONSTRUCTORS" - export CFLAGS="-O3 -pipe -fcolor-diagnostics -fPIC" - - cd /drone/src/pybind11 + - cd /work/pybind11 - pip install --no-binary ':all:' --no-cache-dir . --verbose - - cd /drone/src + - cd /work - pip wheel --no-binary ':all:' --no-cache-dir -w dist . --verbose - run: name: show @@ -47,7 +47,7 @@ jobs: command: - apt-get update -qq - apt-get install -qqy python python-pip - - pip install $(ls -d /tmp/cache/dist/*) + - pip install $(ls -d /work/dist/*) - mkdir /tmp/test - cd /tmp/test - python -c 'import pysdsl' From 6e3135fcfbe6eb474a2da5260518b5a954cde994 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Fri, 19 Apr 2019 00:13:53 +0300 Subject: [PATCH 23/24] hot fix --- .circleci/config.yml | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d55a148..69dda37 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,44 +10,44 @@ jobs: - run: name: build command: | - - git submodule sync - - git submodule update --init --recursive - - cd /work/libdivsufsort - - git pull origin master - - cd /work/sdsl-lite - - git pull origin master - - cd /work/sdsl-lite/external/libdivsufsort - - git pull origin master - - cd /work/pybind11 - - git pull origin master - - cd /tmp - - mkdir sdsl-lite-build - - mkdir libdivsufsort-build - - export CC=clang - - export CXX=clang++ - - export CFLAGS="-O3 -static -lc -fPIC -static-libgcc -pipe -fcolor-diagnostics -lpthread -Wl,-Bstatic" - - cd /tmp/libdivsufsort-build - - cmake -D BUILD_SHARED_LIBS=OFF /work/libdivsufsort - - make install - - export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -static-libstdc++ -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" - - cd /tmp/sdsl-lite-build - - cmake /work/sdsl-lite - - make install - - export CXXFLAGS="-O3 -pipe -stdlib=libc++ -fcolor-diagnostics -fPIC -DNOCROSSCONSTRUCTORS" - - export CFLAGS="-O3 -pipe -fcolor-diagnostics -fPIC" - - cd /work/pybind11 - - pip install --no-binary ':all:' --no-cache-dir . --verbose - - cd /work - - pip wheel --no-binary ':all:' --no-cache-dir -w dist . --verbose + git submodule sync + git submodule update --init --recursive + cd /work/libdivsufsort + git pull origin master + cd /work/sdsl-lite + git pull origin master + cd /work/sdsl-lite/external/libdivsufsort + git pull origin master + cd /work/pybind11 + git pull origin master + cd /tmp + mkdir sdsl-lite-build + mkdir libdivsufsort-build + export CC=clang + export CXX=clang++ + export CFLAGS="-O3 -static -lc -fPIC -static-libgcc -pipe -fcolor-diagnostics -lpthread -Wl,-Bstatic" + cd /tmp/libdivsufsort-build + cmake -D BUILD_SHARED_LIBS=OFF /work/libdivsufsort + make install + export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -static-libstdc++ -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" + cd /tmp/sdsl-lite-build + cmake /work/sdsl-lite + make install + export CXXFLAGS="-O3 -pipe -stdlib=libc++ -fcolor-diagnostics -fPIC -DNOCROSSCONSTRUCTORS" + export CFLAGS="-O3 -pipe -fcolor-diagnostics -fPIC" + cd /work/pybind11 + pip install --no-binary ':all:' --no-cache-dir . --verbose + cd /work + pip wheel --no-binary ':all:' --no-cache-dir -w dist . --verbose - run: name: show command: cd /work && ls -aR - run: name: test wheel - command: - - apt-get update -qq - - apt-get install -qqy python python-pip - - pip install $(ls -d /work/dist/*) - - mkdir /tmp/test - - cd /tmp/test - - python -c 'import pysdsl' + command: | + apt-get update -qq + apt-get install -qqy python python-pip + pip install $(ls -d /work/dist/*) + mkdir /tmp/test + cd /tmp/test + python -c 'import pysdsl' From 6dc9a4652a00b894b3ae03d8145908fc3a1433e8 Mon Sep 17 00:00:00 2001 From: Ivan Ignatev Date: Fri, 19 Apr 2019 00:15:40 +0300 Subject: [PATCH 24/24] hot fix --- .circleci/config.yml | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 69dda37..ae5319b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,35 +10,35 @@ jobs: - run: name: build command: | - git submodule sync - git submodule update --init --recursive - cd /work/libdivsufsort - git pull origin master - cd /work/sdsl-lite - git pull origin master - cd /work/sdsl-lite/external/libdivsufsort - git pull origin master - cd /work/pybind11 - git pull origin master - cd /tmp - mkdir sdsl-lite-build - mkdir libdivsufsort-build - export CC=clang - export CXX=clang++ - export CFLAGS="-O3 -static -lc -fPIC -static-libgcc -pipe -fcolor-diagnostics -lpthread -Wl,-Bstatic" - cd /tmp/libdivsufsort-build - cmake -D BUILD_SHARED_LIBS=OFF /work/libdivsufsort - make install - export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -static-libstdc++ -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" - cd /tmp/sdsl-lite-build - cmake /work/sdsl-lite - make install - export CXXFLAGS="-O3 -pipe -stdlib=libc++ -fcolor-diagnostics -fPIC -DNOCROSSCONSTRUCTORS" - export CFLAGS="-O3 -pipe -fcolor-diagnostics -fPIC" - cd /work/pybind11 - pip install --no-binary ':all:' --no-cache-dir . --verbose - cd /work - pip wheel --no-binary ':all:' --no-cache-dir -w dist . --verbose + git submodule sync + git submodule update --init --recursive + cd /work/libdivsufsort + git pull origin master + cd /work/sdsl-lite + git pull origin master + cd /work/sdsl-lite/external/libdivsufsort + git pull origin master + cd /work/pybind11 + git pull origin master + cd /tmp + mkdir sdsl-lite-build + mkdir libdivsufsort-build + export CC=clang + export CXX=clang++ + export CFLAGS="-O3 -static -lc -fPIC -static-libgcc -pipe -fcolor-diagnostics -lpthread -Wl,-Bstatic" + cd /tmp/libdivsufsort-build + cmake -D BUILD_SHARED_LIBS=OFF /work/libdivsufsort + make install + export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -static-libstdc++ -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" + cd /tmp/sdsl-lite-build + cmake /work/sdsl-lite + make install + export CXXFLAGS="-O3 -pipe -stdlib=libc++ -fcolor-diagnostics -fPIC -DNOCROSSCONSTRUCTORS" + export CFLAGS="-O3 -pipe -fcolor-diagnostics -fPIC" + cd /work/pybind11 + pip install --no-binary ':all:' --no-cache-dir . --verbose + cd /work + pip wheel --no-binary ':all:' --no-cache-dir -w dist . --verbose - run: name: show command: cd /work && ls -aR