From 03ab80cbe8a578a68f9baee4cbdd676720d71662 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Wed, 31 Jan 2024 12:07:21 -0800 Subject: [PATCH 01/11] Force cereal for serializing boost::unordered_map As of Boost 1.84, Boost provides its own serialize method for unordered_map (to work with Boost.Serialize). This conflicts with cereal's own functions which we previously relied upon. Force use of the cereal functions to remove this ambiguity. --- modules/kernel/include/set_map_macros.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/kernel/include/set_map_macros.h b/modules/kernel/include/set_map_macros.h index df95dc5d4b..66d6265075 100644 --- a/modules/kernel/include/set_map_macros.h +++ b/modules/kernel/include/set_map_macros.h @@ -54,6 +54,14 @@ #define IMP_KERNEL_LARGE_UNORDERED_SET boost::unordered_set #define IMP_KERNEL_LARGE_UNORDERED_MAP boost::unordered_map +// Use cereal's own functions to serialize unordered_map, not those +// provided (for Boost.Serialize) in newer Boost versions +namespace cereal { + template + struct specialize, + cereal::specialization::non_member_load_save> {}; +} + #if defined(_MSC_VER) && _MSC_VER <= 1500 #include // IWYU pragma: export #include // IWYU pragma: export From ab9b4671b29f35a243784d2e431772d482df9d16 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Wed, 31 Jan 2024 14:45:49 -0800 Subject: [PATCH 02/11] Fix name of score methods macro --- .../kernel/ClassnameScore.h | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tools/build/container_templates/kernel/ClassnameScore.h b/tools/build/container_templates/kernel/ClassnameScore.h index fcf6afc822..9a7edb519f 100644 --- a/tools/build/container_templates/kernel/ClassnameScore.h +++ b/tools/build/container_templates/kernel/ClassnameScore.h @@ -33,7 +33,7 @@ IMPKERNEL_BEGIN_NAMESPACE (e.g. ScoreStates) are preserved. Use a Restraint or ScoringFunction to score the model instead. - Implementers should check out IMP_CLASSNAME_SCORE(). + Implementers should check out IMP_CLASSNAME_SCORE_METHODS(). \see PredicateClassnameRestraint */ @@ -66,8 +66,8 @@ class IMPKERNELEXPORT ClassnameScore : public ParticleInputs, @param lower_bound index of first item in o to evaluate @param upper_bound index one past last item in o to evaluate - @note Implementations for these are provided by - the IMP_CLASSNAME_SCORE() macro. + @note An implementation for this is provided by + the IMP_CLASSNAME_SCORE_METHODS() macro. */ virtual double evaluate_indexes(Model *m, const PLURALINDEXTYPE &o, DerivativeAccumulator *da, @@ -76,7 +76,11 @@ class IMPKERNELEXPORT ClassnameScore : public ParticleInputs, //! Compute the score and the derivative if needed over a set. /** Like regular evaluate_indexes(), but the score for each o[x] is also - returned as score[x]. */ + returned as score[x]. + + @note An implementation for this is provided by + the IMP_CLASSNAME_SCORE_METHODS() macro. + */ virtual double evaluate_indexes_scores( Model *m, const PLURALINDEXTYPE &o, DerivativeAccumulator *da, @@ -87,7 +91,11 @@ class IMPKERNELEXPORT ClassnameScore : public ParticleInputs, //! Compute the change in score and the derivative if needed over a set. /** The score for each o[indexes[x]] is updated in score[indexes[x]] and the total difference between the old and new score values (over the - set) is returned. */ + set) is returned. + + @note An implementation for this is provided by + the IMP_CLASSNAME_SCORE_METHODS() macro. + */ virtual double evaluate_indexes_delta( Model *m, const PLURALINDEXTYPE &o, DerivativeAccumulator *da, @@ -110,8 +118,8 @@ class IMPKERNELEXPORT ClassnameScore : public ParticleInputs, @return the score if score<= max or some arbitrary value > max otherwise. - @note Implementations for these are provided by the IMP_CLASSNAME_SCORE() - macro. + @note An implementation for this is provided by + the IMP_CLASSNAME_SCORE_METHODS() macro. */ virtual double evaluate_if_good_indexes(Model *m, const PLURALINDEXTYPE &o, From 38e651ae3ec20d79976ec8869c0ad5d946d6cf91 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Thu, 1 Feb 2024 11:17:26 -0800 Subject: [PATCH 03/11] Correct serialization docs We now use cereal instead of Boost for serialization, and can serialize both Objects and Values. --- doc/manual/conventions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/conventions.md b/doc/manual/conventions.md index 1627185b4e..457f9a269f 100644 --- a/doc/manual/conventions.md +++ b/doc/manual/conventions.md @@ -42,7 +42,7 @@ The Boost.Graph interface cannot be easily exported to Python so we instead prov As is conventional in C++, IMP classes are divided into broad, exclusive types - *Object classes*: They inherit from IMP::Object and are always passed by pointer. They are reference counted and so should only be stored using IMP::Pointer in C++ (in Python everything is reference counted). Never allocate these on the stack as very bad things can happen. Objects cannot be duplicated. Equality on objects is defined as identity (e.g. two different objects are different even if the data they contain is identical). -- *Value classes* which are normal data types. They are passed by value (or `const&`), never by pointer. Equality is defined based on the data stored in the value. Most value types in IMP are always valid, but a few, mostly geometric types (IMP::algebra::Vector3D) are designed for fast, low-level use and are left in an uninitialized state by their default constructor. Most Values can also be serialized using the [Boost.Serialization](https://www.boost.org/doc/libs/1_78_0/libs/serialization/doc/) library in C++, or [pickled](https://docs.python.org/3/library/pickle.html) in Python. +- *Value classes* which are normal data types. They are passed by value (or `const&`), never by pointer. Equality is defined based on the data stored in the value. Most value types in IMP are always valid, but a few, mostly geometric types (IMP::algebra::Vector3D) are designed for fast, low-level use and are left in an uninitialized state by their default constructor. - *RAII classes* control some particular resource using the [RAII idiom](https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization). They grab control of a resource when created and then free it when they are destroyed. As a result, they cannot be copied. Non-IMP examples include things like files in Python, which are automatically closed when the file object is deleted. From a2c3135f7aaea8f0530e34032ea3ab3531f445fa Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 23 Feb 2024 16:00:49 -0800 Subject: [PATCH 04/11] Support building .deb with arm64 libTAU --- tools/debian/rules | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/debian/rules b/tools/debian/rules index 72e0d7009c..bc785d5294 100755 --- a/tools/debian/rules +++ b/tools/debian/rules @@ -15,11 +15,11 @@ LDFLAGS := override_dh_auto_configure: mkdir build # Get libTAU (for cnmultifit) and put in search path - cd build && wget https://integrativemodeling.org/libTAU/libTAU-1.0.1.zip - cd build && echo "d2530291628081ee404b30da5c47ec6dc4302479 libTAU-1.0.1.zip" | sha1sum -c --quiet - cd build && unzip libTAU-1.0.1.zip && mv libTAU-1.0.1/include libTAU - cd build/libTAU-1.0.1/lib && ln -sf Fedora23.x86_64 debian - cd build/libTAU-1.0.1/lib/debian && ln -sf libTAU.so.1 libTAU.so + cd build && wget https://integrativemodeling.org/libTAU/libTAU-1.0.4.zip + cd build && echo "2c92a29613a422ee3f3db0cbbf1fe53c0500b5b6 libTAU-1.0.4.zip" | sha1sum -c --quiet + cd build && unzip libTAU-1.0.4.zip && mv libTAU-1.0.4/include libTAU + [ "`uname -m`" = "aarch64" ] && SUBDIR=Ubuntu18.04.arm64 || SUBDIR=Fedora23.x86_64; cd build/libTAU-1.0.4/lib && ln -sf $${SUDBIR} debian + cd build/libTAU-1.0.4/lib/debian && ln -sf libTAU.so.1 libTAU.so # Allow mpiexec to work inside a docker/podman container (as root) perl -pi -e 's#\{MPIEXEC_PREFLAGS\}#\{MPIEXEC_PREFLAGS\};--allow-run-as-root#' modules/mpi/dependency/MPI.cmake cd build && py3_ver=`python3 -c "import sys; print('%d.%d' % sys.version_info[:2])"` \ @@ -27,7 +27,7 @@ override_dh_auto_configure: -DCGAL_DIR=/usr/lib/x86_64-linux-gnu/cmake/CGAL/ \ -DCMAKE_INSTALL_PYTHONDIR=/usr/lib/python$${py3_ver}/dist-packages \ -DCMAKE_INCLUDE_PATH=`pwd` \ - -DCMAKE_LIBRARY_PATH=`pwd`/libTAU-1.0.1/lib/debian \ + -DCMAKE_LIBRARY_PATH=`pwd`/libTAU-1.0.4/lib/debian \ -DCMAKE_INSTALL_PREFIX=/usr \ -DIMP_TIMEOUT_FACTOR=4 \ -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/imp \ @@ -53,7 +53,7 @@ override_dh_install: -DUSE_PYTHON2=on \ && $(MAKE) -j4 DESTDIR=$(CURDIR)/debian/tmp install # Bundle libTAU so users don't have to get it separately - cp build/libTAU-1.0.1/lib/debian/libTAU.so.1 debian/tmp/usr/lib/*linux*/ + cp build/libTAU-1.0.4/lib/debian/libTAU.so.1 debian/tmp/usr/lib/*linux*/ (cd debian/tmp/usr/lib/*linux*/ && ln -sf libTAU.so.1 libTAU.so) # Don't package MPI for Python2 or -dev rm -rf debian/tmp/usr/lib/python2*/dist-packages/IMP/mpi From 115660b4613ef26b810607e64b3d9ce87c44344c Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 23 Feb 2024 22:00:40 -0800 Subject: [PATCH 05/11] Fix typo --- tools/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/debian/rules b/tools/debian/rules index bc785d5294..c17063b552 100755 --- a/tools/debian/rules +++ b/tools/debian/rules @@ -18,7 +18,7 @@ override_dh_auto_configure: cd build && wget https://integrativemodeling.org/libTAU/libTAU-1.0.4.zip cd build && echo "2c92a29613a422ee3f3db0cbbf1fe53c0500b5b6 libTAU-1.0.4.zip" | sha1sum -c --quiet cd build && unzip libTAU-1.0.4.zip && mv libTAU-1.0.4/include libTAU - [ "`uname -m`" = "aarch64" ] && SUBDIR=Ubuntu18.04.arm64 || SUBDIR=Fedora23.x86_64; cd build/libTAU-1.0.4/lib && ln -sf $${SUDBIR} debian + [ "`uname -m`" = "aarch64" ] && SUBDIR=Ubuntu18.04.arm64 || SUBDIR=Fedora23.x86_64; cd build/libTAU-1.0.4/lib && ln -sf $${SUBDIR} debian cd build/libTAU-1.0.4/lib/debian && ln -sf libTAU.so.1 libTAU.so # Allow mpiexec to work inside a docker/podman container (as root) perl -pi -e 's#\{MPIEXEC_PREFLAGS\}#\{MPIEXEC_PREFLAGS\};--allow-run-as-root#' modules/mpi/dependency/MPI.cmake From 074af1ac8c64197cd9fd46b7ff42ce92ae212119 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 23 Feb 2024 22:07:39 -0800 Subject: [PATCH 06/11] Find CGAL on arm64 Ubuntu --- tools/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/debian/rules b/tools/debian/rules index c17063b552..a33f5d3756 100755 --- a/tools/debian/rules +++ b/tools/debian/rules @@ -24,7 +24,7 @@ override_dh_auto_configure: perl -pi -e 's#\{MPIEXEC_PREFLAGS\}#\{MPIEXEC_PREFLAGS\};--allow-run-as-root#' modules/mpi/dependency/MPI.cmake cd build && py3_ver=`python3 -c "import sys; print('%d.%d' % sys.version_info[:2])"` \ && cmake .. -DCMAKE_BUILD_TYPE=Release \ - -DCGAL_DIR=/usr/lib/x86_64-linux-gnu/cmake/CGAL/ \ + -DCGAL_DIR=/usr/lib/`uname -m`-linux-gnu/cmake/CGAL/ \ -DCMAKE_INSTALL_PYTHONDIR=/usr/lib/python$${py3_ver}/dist-packages \ -DCMAKE_INCLUDE_PATH=`pwd` \ -DCMAKE_LIBRARY_PATH=`pwd`/libTAU-1.0.4/lib/debian \ From d186804eef3facb5c7eff0a07dbf4681311ab6b4 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Thu, 29 Feb 2024 16:57:36 -0800 Subject: [PATCH 07/11] Fix link to create_compatible_rigid_body() --- modules/atom/include/Hierarchy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/atom/include/Hierarchy.h b/modules/atom/include/Hierarchy.h index 062159b7b4..e1ecba6b9a 100644 --- a/modules/atom/include/Hierarchy.h +++ b/modules/atom/include/Hierarchy.h @@ -413,7 +413,7 @@ inline void show(Hierarchy h, std::ostream &out = std::cout) { A name can be passed as it is not easy to automatically pick a decent name. - \see create_aligned_rigid_body() + \see create_compatible_rigid_body() \see Hierarchy \see IMP::core::RigidBody */ From 075907b34387a9919e98817000048d4940775c94 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 1 Mar 2024 14:53:47 -0800 Subject: [PATCH 08/11] Hide use of nested classes from SWIG Some versions of SWIG try and fail to wrap our functions that use nested C++ classes. Help SWIG out by hiding these functions. --- modules/kinematics/include/RRT.h | 2 ++ modules/saxs/include/FormFactorTable.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/kinematics/include/RRT.h b/modules/kinematics/include/RRT.h index 8dec5d14db..2608189510 100644 --- a/modules/kinematics/include/RRT.h +++ b/modules/kinematics/include/RRT.h @@ -107,7 +107,9 @@ class IMPKINEMATICSEXPORT RRT : public IMP::Sampler { unsigned int number_of_collisions_; }; +#ifndef SWIG friend std::ostream& operator<<(std::ostream& s, const Parameters& p); +#endif public: //! Constructor diff --git a/modules/saxs/include/FormFactorTable.h b/modules/saxs/include/FormFactorTable.h index 76bf6e6662..abbcd9b9bf 100644 --- a/modules/saxs/include/FormFactorTable.h +++ b/modules/saxs/include/FormFactorTable.h @@ -212,6 +212,7 @@ class IMPSAXSEXPORT FormFactorTable { double excl_vol_; }; +#ifndef SWIG // read entry friend std::istream& operator>>( std::istream& s, AtomFactorCoefficients& atom_factor_coefficients); @@ -219,6 +220,7 @@ class IMPSAXSEXPORT FormFactorTable { // write entry friend std::ostream& operator<<( std::ostream& s, const AtomFactorCoefficients& atom_factor_coefficients); +#endif private: int read_form_factor_table(const std::string& table_name); From 7603b7a91dd427c5ac069e7dd424b35c12e8d831 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Mon, 1 Apr 2024 15:15:23 -0700 Subject: [PATCH 09/11] Prepare for 2.20.2 release --- ChangeLog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 6e5de0923c..082785ffe5 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,12 @@ ChangeLog {#changelog} ========= +# 2.20.2 - 2024-04-04 # {#changelog_2_20_2} +- Add support for building ARM64 .deb packages. +- Bugfix: fix use of nested classes with latest SWIG. +- Bugfix: allow building with Boost 1.84. +- Bugfix: minor documentation corrections. + # 2.20.1 - 2024-01-16 # {#changelog_2_20_1} - Bugfix: fix `soap_score` crash when scoring multiple models with an orientation-dependent SOAP score. From de2e7f6ab72ed2991fea734db8c0765f9fe17516 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Mon, 1 Apr 2024 15:24:30 -0700 Subject: [PATCH 10/11] Prepare for 2.20.2 release --- tools/rpm/IMP-copr.spec.in | 3 +++ tools/rpm/IMP.spec.in | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tools/rpm/IMP-copr.spec.in b/tools/rpm/IMP-copr.spec.in index a141795f09..3ba2153564 100644 --- a/tools/rpm/IMP-copr.spec.in +++ b/tools/rpm/IMP-copr.spec.in @@ -514,6 +514,9 @@ export PYTHONPATH=%{buildroot}%{_libdir}/python${py2_ver}/site-packages %endif %changelog +* Thu Apr 04 2024 Ben Webb 2.20.2-1 +- 2.20.2 release. + * Tue Jan 16 2024 Ben Webb 2.20.1-1 - 2.20.1 release. diff --git a/tools/rpm/IMP.spec.in b/tools/rpm/IMP.spec.in index a9ba5d4d28..5e408e8ae1 100644 --- a/tools/rpm/IMP.spec.in +++ b/tools/rpm/IMP.spec.in @@ -539,6 +539,9 @@ find ${RPM_BUILD_ROOT}%{_prefix}/share/IMP/tools -name '*.py' -exec perl -pi -e %endif %changelog +* Thu Apr 04 2024 Ben Webb 2.20.2-1 +- 2.20.2 release. + * Tue Jan 16 2024 Ben Webb 2.20.1-1 - 2.20.1 release. From 7fa8d0f30f5a109a04966454f66f5a0b4e2311c6 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Mon, 1 Apr 2024 15:26:02 -0700 Subject: [PATCH 11/11] Add 2.20.2 version info --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4e2200b98e..83ecbf1d7a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.20.1 +2.20.2