Skip to content

Commit

Permalink
Merge for 1.5.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Mar 23, 2023
2 parents 2ee681f + 6224231 commit cd23320
Show file tree
Hide file tree
Showing 144 changed files with 1,048 additions and 674 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
../tools/coverage/setup.py
PYTHONPATH=`pwd`/coverage cmake .. -DCMAKE_BUILD_TYPE="${{ matrix.build }}" -DCMAKE_CXX_FLAGS="${{ matrix.flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.flags }}" -DCMAKE_MODULE_LINKER_FLAGS="${{ matrix.flags }}" -DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.flags }}"
make -j 2
export LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
ctest -j 2 --output-on-failure -L ${{ matrix.tests }}
- name: Combine coverage
run: |
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ else()
link_directories(${Log4CXX_LIBRARY_DIR})
endif()

if(${PYTHON_NUMPY_FOUND})
set(RMF_HAS_NUMPY "1" CACHE BOOL "Whether to include numpy support" FORCE)
else()
set(RMF_HAS_NUMPY "0" CACHE BOOL "Whether to include numpy support" FORCE)
endif()

include(GNUInstallDirs)

Expand All @@ -134,7 +139,8 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)

# Version information
set (RMF_VERSION_MAJOR 1)
set (RMF_VERSION_MINOR 4)
set (RMF_VERSION_MINOR 5)
set (RMF_VERSION_MICRO 0)

set(RMF_SOVERSION "${RMF_VERSION_MAJOR}.${RMF_VERSION_MINOR}" CACHE INTERNAL "" FORCE)
set(RMF_HAS_DEBUG_VECTOR 0 CACHE BOOL "Whether to use a bounds checked vector")
Expand Down
12 changes: 12 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Change Log {#changelog}
==========

# 1.5.0 - 2023-03-22 # {#changelog_1_5_0}
- Windows builds now require MS Visual Studio 2015 or later (for full C++11
support). The following macros for pre-C++11 environments are no longer
needed and are deprecated: `RMF_NOEXCEPT`, `RMF_CANEXCEPT`.
- All RMF binaries now report the full version (including micro version)
when the --version flag is used (e.g. "1.4.1", not "1.4").
- If built with NumPy, some Python-specific functions are now provided to
allow direct access to RMF data via NumPy arrays.
- File handles can now be explicitly closed (via a `close` method). Most IO
operations on a closed handle will now raise an error. In Python file handles
now support the context manager protocol so can be used in 'with' blocks.

# 1.4.1 - 2022-11-21 # {#changelog_1_4_1}
- Build fixes to work with SWIG 4.1.
- Various internal build scripts now use 'python3' rather than
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and score data.
The main documentation is found on the
[web site](http://integrativemodeling.org/rmf/nightly/doc/).

Copyright 2007-2022 IMP Inventors.
Copyright 2007-2023 IMP Inventors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
45 changes: 38 additions & 7 deletions benchmark/benchmark_rmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#include <boost/iterator/iterator_facade.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/timer.hpp>
#include <exception>
#include <iostream>
#include <chrono>
#include <string>
#include <vector>

Expand Down Expand Up @@ -45,6 +45,21 @@ std::string show_size(unsigned int sz) {
return oss.str();
}

class Timer {
std::chrono::steady_clock::time_point start_time_;
public:
Timer() {
start_time_ = std::chrono::steady_clock::now();
}

double elapsed() const {
auto end_time = std::chrono::steady_clock::now();
auto time_span = std::chrono::duration_cast<
std::chrono::duration<double> >(end_time - start_time_);
return time_span.count();
}
};

void benchmark_size(std::string path, std::string type) {
unsigned int size = 0;
if (boost::filesystem::is_directory(path)) {
Expand Down Expand Up @@ -181,11 +196,11 @@ double load(RMF::FileConstHandle file, const RMF::NodeIDs& nodes) {
std::pair<std::size_t, std::size_t> benchmark_create(RMF::FileHandle file,
std::string type) {
RMF::NodeIDs atoms;
boost::timer timer;
Timer timer;
boost::tuple<std::size_t> cur = create(file, atoms);
std::cout << type << ", create, " << timer.elapsed() << ", " << cur.get<0>()
<< std::endl;
boost::timer frame_timer;
Timer frame_timer;
boost::tuple<double, std::size_t> frames = create_frames(file, atoms);
std::cout << type << ", create frame, " << frame_timer.elapsed() / 20.0
<< ", " << frames.get<0>() << std::endl;
Expand All @@ -194,7 +209,7 @@ std::pair<std::size_t, std::size_t> benchmark_create(RMF::FileHandle file,

void benchmark_traverse(RMF::FileConstHandle file, std::string type) {
file.set_current_frame(RMF::FrameID(0));
boost::timer timer;
Timer timer;
double count = 0;
double t;
while (timer.elapsed() < 1) {
Expand All @@ -211,17 +226,18 @@ void benchmark_load(RMF::FileConstHandle file, std::string type) {
for(RMF::NodeID n : file.get_node_ids()) {
if (ipcf.get_is(file.get_node(n))) nodes.push_back(n);
}
boost::timer timer;
Timer timer;
double dist = load(file, nodes);
std::cout << type << ", load, " << timer.elapsed() / 20.0 << ", " << dist
<< std::endl;
}

RMF::FileConstHandle benchmark_open(std::string path, std::string type) {
boost::timer timer;
Timer timer;
RMF::FileConstHandle ret;
double count = 0;
while (timer.elapsed() < 1) {
ret.close();
ret = RMF::open_rmf_file_read_only(path);
++count;
}
Expand Down Expand Up @@ -268,14 +284,29 @@ int main(int, char**) {
}
benchmark_size(name, "rmfz");
}
#if RMF_HAS_DEPRECATED_BACKENDS
{
const std::string name = name_base + ".rmf-hdf5";
{
RMF::FileHandle fh = RMF::create_rmf_file(name);
benchmark_create(fh, "hdf5");
}
{
RMF::FileConstHandle fh = benchmark_open(name, "hdf5");
benchmark_traverse(fh, "hdf5");
benchmark_load(fh, "hdf5");
}
benchmark_size(name, "hdf5");
}
#endif
{
RMF::BufferHandle buffer;
{
RMF::FileHandle fh = RMF::create_rmf_buffer(buffer);
benchmark_create(fh, "buffer");
}
{
boost::timer timer;
Timer timer;
RMF::FileConstHandle fh = RMF::open_rmf_buffer_read_only(buffer);
std::cout << "buffer"
<< ", open, " << timer.elapsed() << ", 0" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion bin/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void print_help_and_exit(char* argv[]) {

void print_version_and_exit() {
std::cout << "RMF version " << RMF_VERSION_MAJOR << "." << RMF_VERSION_MINOR
<< std::endl;
<< "." << RMF_VERSION_MICRO << std::endl;
exit(0);
}

Expand Down
4 changes: 2 additions & 2 deletions bin/rmf3_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2007-2022 IMP Inventors. All rights reserved.
*/

#include <boost/shared_ptr.hpp>
#include <memory>
#include <stddef.h>
#include <exception>
#include <iostream>
Expand Down Expand Up @@ -38,7 +38,7 @@ int main(int argc, char** argv) {
if (variables_map.count("verbose")) {
internal_avro::EncoderPtr encoder =
internal_avro::jsonEncoder(schema);
boost::shared_ptr<internal_avro::OutputStream> os =
std::shared_ptr<internal_avro::OutputStream> os =
internal_avro::ostreamOutputStream(std::cout);
encoder->init(*os);
internal_avro::encode(*encoder, frame);
Expand Down
2 changes: 2 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
// Version number
#define RMF_VERSION_MAJOR @RMF_VERSION_MAJOR@
#define RMF_VERSION_MINOR @RMF_VERSION_MINOR@
#define RMF_VERSION_MICRO @RMF_VERSION_MICRO@

#define RMF_HAS_LOG4CXX @RMF_HAS_LOG4CXX@
#define RMF_HAS_NUMPY @RMF_HAS_NUMPY@

#define RMF_HAS_DEPRECATED_BACKENDS @RMF_DEPRECATED_BACKENDS@

Expand Down
4 changes: 4 additions & 0 deletions doc/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Standalone: if you are using [Anaconda Python](https://www.anaconda.com/), insta

conda install -c conda-forge rmf

or on a Mac with [Homebrew](https://brew.sh/), install with

brew tap salilab/salilab; brew install rmf

IMP: Download an IMP binary (which includes RMF) from the
[IMP download page](https://integrativemodeling.org/download.html).

Expand Down
2 changes: 1 addition & 1 deletion doc/Main.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ See
Also see the [rmf examples](https://github.com/salilab/rmf_examples) repository
for examples of interesting or problematic RMF files.

Copyright 2007-2022 IMP Inventors.
Copyright 2007-2023 IMP Inventors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
15 changes: 7 additions & 8 deletions include/RMF/BufferConstHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include "RMF/config.h"
#include "infrastructure_macros.h"
#include "exceptions.h"
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <memory>
#include <limits>
#include <stdint.h>

Expand All @@ -29,7 +28,7 @@ namespace RMF {
*/
class BufferConstHandle {
protected:
boost::shared_ptr<std::vector<char> > data_;
std::shared_ptr<std::vector<char> > data_;
int compare(BufferConstHandle o) const {
if (&*data_ < &*o.data_)
return -1;
Expand All @@ -42,13 +41,13 @@ class BufferConstHandle {
public:
#ifndef SWIG
explicit BufferConstHandle(std::string r)
: data_(boost::make_shared<std::vector<char> >(r.begin(), r.end())) {}
: data_(std::make_shared<std::vector<char> >(r.begin(), r.end())) {}
#endif
explicit BufferConstHandle(const std::vector<char> &r)
: data_(boost::make_shared<std::vector<char> >(r.begin(), r.end())) {}
: data_(std::make_shared<std::vector<char> >(r.begin(), r.end())) {}
explicit BufferConstHandle(const std::vector<uint8_t> &r)
: data_(boost::make_shared<std::vector<char> >(r.begin(), r.end())) {}
explicit BufferConstHandle(boost::shared_ptr<std::vector<char> > r)
: data_(std::make_shared<std::vector<char> >(r.begin(), r.end())) {}
explicit BufferConstHandle(std::shared_ptr<std::vector<char> > r)
: data_(r) {}
const std::vector<char> &get_buffer() const { return *data_; }
#ifndef SWIG
Expand All @@ -65,7 +64,7 @@ class BufferConstHandle {
return std::make_pair(reinterpret_cast<const uint8_t *>(&(*data_)[0]),
data_->size());
}
boost::shared_ptr<std::vector<char> > get() const { return data_; }
std::shared_ptr<std::vector<char> > get() const { return data_; }
#endif
};

Expand Down
4 changes: 2 additions & 2 deletions include/RMF/Decorator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "internal/SharedData.h"
#include "NodeConstHandle.h"
#include "NodeHandle.h"
#include <boost/shared_ptr.hpp>
#include <memory>

RMF_ENABLE_WARNINGS
namespace RMF {
Expand All @@ -29,7 +29,7 @@ namespace RMF {
class Decorator {
private:
NodeID id_;
boost::shared_ptr<internal::SharedData> data_;
std::shared_ptr<internal::SharedData> data_;

protected:
Decorator(NodeConstHandle handle)
Expand Down
Loading

0 comments on commit cd23320

Please sign in to comment.