Skip to content

Commit

Permalink
libpressio version 0.34.0
Browse files Browse the repository at this point in the history
Major Changes:

+ Added support for PETSC format to generic IO
+ Added support for CSV format to generic IO
+ Added support to clone compressors/io/metrics modules

Bug fixes

+ Various bug fixes to POSIX IO that prevented it from working correctly
  in C++11
  • Loading branch information
robertu94 committed Feb 18, 2020
1 parent b72c479 commit 976dd6a
Show file tree
Hide file tree
Showing 32 changed files with 630 additions and 6 deletions.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(libpressio VERSION "0.33.0" LANGUAGES CXX C)
project(libpressio VERSION "0.34.0" LANGUAGES CXX C)

#correct was to set a default build type
# https://blog.kitware.com/cmake-and-the-default-build-type/
Expand Down Expand Up @@ -87,6 +87,7 @@ add_library(libpressio
./src/plugins/metrics/pearsons.cc
./src/plugins/io/posix.cc
./src/plugins/io/noop.cc
./src/plugins/io/csv.cc
./src/plugins/io/io.cc

#public headers
Expand Down Expand Up @@ -237,6 +238,16 @@ if(LIBPRESSIO_HAS_FPZIP)

endif()

option(LIBPRESSIO_HAS_PETSC "build the petsc io plugin" OFF)
if(LIBPRESSIO_HAS_PETSC)
pkg_search_module(PETSc IMPORTED_TARGET PETSc)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/io/petsc.cc
)
target_link_libraries(libpressio PRIVATE PkgConfig::PETSc)
endif()

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/pressio_version.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/pressio_version.h
Expand Down
9 changes: 9 additions & 0 deletions include/libpressio_ext/cpp/compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ class libpressio_compressor_plugin {
* */
int check_options(struct pressio_options const&);

/**
* \returns a copy of each a compressor and its configuration. If the
* compressor is not thread-safe and indicates such via its configuration, it
* may return a new shared pointer to the same object. For this reason, this
* function may not be const.
*/
virtual std::shared_ptr<libpressio_compressor_plugin> clone()=0;


protected:
/**
* Should be used by implementing plug-ins to provide error codes
Expand Down
7 changes: 7 additions & 0 deletions include/libpressio_ext/cpp/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ struct libpressio_io_plugin {
* \returns an implementation specific integer error code for the last error, 0 is reserved for no error
*/
int error_code() const;

/**
* clones an io module
* \returns a new reference to an io plugin.
*/
virtual std::shared_ptr<libpressio_io_plugin> clone()=0;
protected:
/**
* Should be used by implementing plug-ins to provide error codes
Expand Down Expand Up @@ -134,6 +140,7 @@ struct libpressio_io_plugin {
*/
virtual struct pressio_options get_options_impl() const=0;


private:
struct {
int code;
Expand Down
5 changes: 5 additions & 0 deletions include/libpressio_ext/cpp/metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ class libpressio_metrics_plugin {
* \param[in] options a pressio_options structure containing the options for the provided metrics plugin
*/
virtual int set_metrics_options(struct pressio_options const& options);

/**
* \returns a clone of the metric
*/
virtual std::unique_ptr<libpressio_metrics_plugin> clone()=0;
};

/**
Expand Down
8 changes: 8 additions & 0 deletions include/libpressio_ext/io/pressio_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ int pressio_io_minor_version(struct pressio_io const* io);
*/
int pressio_io_patch_version(struct pressio_io const* io);

/**
* Creates a new reference to an io module with the same configuration
*
* \param[in] io the io module to clone
* \returns a new reference to an io module
*/
struct presio_io* pressio_io_clone(struct pressio_io* io);

#endif /* end of include guard: PRESSIO_IO_H */

#ifdef __cplusplus
Expand Down
12 changes: 12 additions & 0 deletions include/pressio_compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@ int pressio_compressor_minor_version(struct pressio_compressor const* compressor
*/
int pressio_compressor_patch_version(struct pressio_compressor const* compressor);

/**
* Clones a compressor and its configuration including metrics information
*
* \param[in] compressor the compressor to clone. It will not be modified
* except to modify a reference count as needed.
* \returns a pointer to a new compressor plugin reference which is equivalent
* to the compressor cloned. It the compressor is not thread safe, it may
* return a new reference to the same object.
*
*/
struct pressio_compressor* pressio_compressor_clone(struct pressio_compressor* compressor);

/**
* reports the level of thread safety supported by the compressor.
*
Expand Down
7 changes: 7 additions & 0 deletions include/pressio_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ struct pressio_options* pressio_metrics_get_options(struct pressio_metrics const
*/
int pressio_metrics_set_options(struct pressio_metrics const* metrics, struct pressio_options const* options);

/**
* Clones a pressio_metrics object and its configuration
* \param[in] metrics the metrics object to clone
* \returns a new reference to a pressio metrics object
*/
struct pressio_metrics* pressio_metrics_clone(struct pressio_metrics* metrics);


#endif

Expand Down
4 changes: 4 additions & 0 deletions src/plugins/compressors/blosc_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class blosc_plugin: public libpressio_compressor_plugin {
return "blosc";
}

std::shared_ptr<libpressio_compressor_plugin> clone() override {
return compat::make_unique<blosc_plugin>(*this);
}


private:
int internal_error(int rc) { std::stringstream ss; ss << "interal error " << rc; return set_error(1, ss.str()); }
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/compressors/fpzip_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ class fpzip_plugin: public libpressio_compressor_plugin {
const char* prefix() const noexcept override {
return "fpzip";
}
std::shared_ptr<libpressio_compressor_plugin> clone() override {
return compat::make_unique<fpzip_plugin>(*this);
}

private:
std::string version_str;
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/compressors/magick++.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ class magick_plugin: public libpressio_compressor_plugin {
return "magick";
}

std::shared_ptr<libpressio_compressor_plugin> clone() override {
return compat::make_unique<magick_plugin>(*this);
}

private:

int invalid_dimensions(size_t n_dims) {
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/compressors/mgard_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ class mgard_plugin: public libpressio_compressor_plugin {
return "mgard";
}

std::shared_ptr<libpressio_compressor_plugin> clone() override {
return std::make_unique<mgard_plugin>(*this);
}


private:

Expand Down
3 changes: 3 additions & 0 deletions src/plugins/compressors/noop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class noop_compressor_plugin: public libpressio_compressor_plugin {
const char* prefix() const override {
return "noop";
}
std::shared_ptr<libpressio_compressor_plugin> clone() override{
return std::make_unique<noop_compressor_plugin>(*this);
}
};

static pressio_register X(compressor_plugins(), "noop", [](){ return compat::make_unique<noop_compressor_plugin>();});
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/compressors/sz_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "pressio_option.h"


class sz_plugin: public libpressio_compressor_plugin {
class sz_plugin: public libpressio_compressor_plugin, std::enable_shared_from_this<sz_plugin> {
public:
sz_plugin() {
std::stringstream ss;
Expand Down Expand Up @@ -178,6 +178,10 @@ class sz_plugin: public libpressio_compressor_plugin {
return "sz";
}

std::shared_ptr<libpressio_compressor_plugin> clone() override {
return this->shared_from_this();
}


private:
static int libpressio_type_to_sz_type(pressio_dtype type) {
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/compressors/zfp_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ class zfp_plugin: public libpressio_compressor_plugin {
return "zfp";
}

std::shared_ptr<libpressio_compressor_plugin> clone() override{
return compat::make_unique<zfp_plugin>(*this);
}


private:
int invalid_type() { return set_error(1, "invalid_type");}
Expand Down
Loading

0 comments on commit 976dd6a

Please sign in to comment.