Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e900d96
WASM hacks
juntyr Feb 12, 2026
52ce28f
don't ask ...
juntyr Feb 17, 2026
bd9bc90
no verbose Makefile
juntyr Feb 17, 2026
47c32a0
Add messages for enabled optional components
juntyr Feb 17, 2026
46e9829
Fix LIBPRESSIO_BUILT_PLUGINS propagation
juntyr Feb 18, 2026
e562964
disabled some plugins to ensure libpressio_instance runs without erro…
juntyr Feb 18, 2026
fefdcb4
enable all plugins that register successfully
juntyr Feb 18, 2026
4257b2b
slightly fewer hacks
juntyr Feb 23, 2026
2826604
Fix cmake env variable lookup
juntyr Feb 23, 2026
640c5f3
add debug message for pressio_register_generator CMAKE_CXX_FLAGS
juntyr Mar 2, 2026
fef8c01
pressio_data_new_copy takes const src
juntyr Mar 3, 2026
1b8bf84
Fix plugin namespaces for plugin registration
juntyr Mar 9, 2026
9b9984c
fix one more plugin
juntyr Mar 9, 2026
98ea03f
fix diff
juntyr Mar 9, 2026
a616f4c
port pressio_register_generator to CMake
juntyr Mar 10, 2026
f96d474
reduce CMakeLists diff
juntyr Mar 10, 2026
3fae38e
add LIBPRESSIO_WITH_EXTERNAL option
juntyr Mar 10, 2026
2013711
fix some non-writeable outputs
juntyr Mar 15, 2026
cb4be0f
fix bzip2 lossless config
juntyr Mar 16, 2026
e099bce
revert cusz make_writeable
juntyr Mar 21, 2026
14cbc06
clean up static casts
juntyr Mar 21, 2026
77843df
extract external plugins
juntyr Mar 21, 2026
fd7684d
extract manual registration generation into separate cmake file
juntyr Mar 21, 2026
8addf5a
add sol2 include dirs
juntyr Mar 23, 2026
0966822
revert remove_background make_writeable
juntyr Mar 23, 2026
d99c6b2
split roibin optional component into three
juntyr Mar 23, 2026
9434253
Only record first plugin file in CMakeLists
juntyr Mar 23, 2026
2467630
fix list commands
juntyr Mar 26, 2026
df779cd
foreach fix
juntyr Mar 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 34 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,23 @@ endif()
#instead of using target_sources libpressio_plugin_source to gather the list of plugin files
#in order to generate a source file for static linking of libpressio
set(LIBPRESSIO_BUILT_PLUGINS "")
macro(libpressio_plugin_file file_name)
macro(libpressio_plugin_file_aux file_name)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/${file_name}
)
endmacro()
macro(libpressio_plugin_file file_name)
libpressio_plugin_file_aux("${file_name}")
list(APPEND LIBPRESSIO_BUILT_PLUGINS "${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/${file_name}")
set(LIBPRESSIO_BUILT_PLUGINS "${LIBPRESSIO_BUILT_PLUGINS}" PARENT_SCOPE)
endmacro()
#REQUIRED CORE plugins included in every build of libpressio
libpressio_plugin_file(domains_metrics/print.cc)
libpressio_plugin_file(compressors/noop.cc)
libpressio_plugin_file(compressors/pressio.cc)
libpressio_plugin_file(metrics/composite.cc)
libpressio_plugin_file(metrics/external.cc)
libpressio_plugin_file(metrics/error_stat.cc)
libpressio_plugin_file(launch/external_forkexec.cc)
libpressio_plugin_file(launch_metrics/noop.cc)
libpressio_plugin_file(launch_metrics/print.cc)
libpressio_plugin_file(metrics/noop.cc)
Expand All @@ -152,6 +154,15 @@ libpressio_plugin_file(io/posix.cc)
libpressio_plugin_file(domains/malloc.cc)
libpressio_plugin_file(domains/nonowning.cc)

#RECOMMENDED plugins that should be included when building libpressio
option(LIBPRESSIO_WITH_EXTERNAL "Support external plugins" ON)
if(LIBPRESSIO_WITH_EXTERNAL)
libpressio_plugin_file(metrics/external.cc)
libpressio_plugin_file(launch/external_forkexec.cc)
endif()

message("STATUS" "LIBPRESSIO_BUILD_MODE = ${LIBPRESSIO_BUILD_MODE}")

#optional components created with libpressio_optional_component don't require dependencies
#they can be enabled in two (non-exclusive) ways:
# 1 by 1 using -DLIBPRESSIO_HAS_${NAME}=ON
Expand All @@ -162,9 +173,20 @@ function(libpressio_optional_component name description file_names)
string(TOUPPER "${name}" name_upper)
cmake_dependent_option(LIBPRESSIO_HAS_${name_upper} ${description} OFF "LIBPRESSIO_BUILD_MODE STREQUAL CORE" OFF)
if(LIBPRESSIO_HAS_${name_upper} OR LIBPRESSIO_BUILD_MODE STREQUAL FULL)
foreach(file_name IN LISTS file_names)
libpressio_plugin_file(/${file_name})
endforeach()
message("STATUS" "LIBPRESSIO_HAS_${name_upper} = ON")
list(LENGTH file_names LIBPRESSIO_OPTIONAL_COMPONENT_NFILES)
if("${LIBPRESSIO_OPTIONAL_COMPONENT_NFILES}" GREATER 0)
list(GET file_names 0 LIBPRESSIO_OPTIONAL_COMPONENT_FILE)
libpressio_plugin_file(/${LIBPRESSIO_OPTIONAL_COMPONENT_FILE})
if("${LIBPRESSIO_OPTIONAL_COMPONENT_NFILES}" GREATER 1)
list(SUBLIST file_names 1 -1 LIBPRESSIO_OPTIONAL_COMPONENT_FILES_AUX)
foreach(file_name IN LISTS LIBPRESSIO_OPTIONAL_COMPONENT_FILES_AUX)
libpressio_plugin_file_aux(/${file_name})
endforeach()
endif()
endif()
else()
message("STATUS" "LIBPRESSIO_HAS_${name_upper} = OFF")
endif()
endfunction()

Expand All @@ -189,7 +211,7 @@ libpressio_optional_component(entropy "build the entropy metrics plugin" /metric
libpressio_optional_component(historian "build the historian metrics plugin" /metrics/historian.cc)
libpressio_optional_component(input_stats "build the input_stats metrics plugin" /metrics/input_stats.cc)
libpressio_optional_component(iota "build the iota io plugin" /io/iota.cc)
libpressio_optional_component(kl_divergance "build the kl_divergance plugin" /metrics/kl_divergance.cc)
libpressio_optional_component(kl_divergence "build the kl_divergence plugin" /metrics/kl_divergence.cc)
libpressio_optional_component(ks_test "build the KS test metrics plugin" /metrics/ks_test.cc)
libpressio_optional_component(kth_error "build the kth error metrics plugin" /metrics/kth_error.cc)
libpressio_optional_component(linear_quantizer "build the linear quantizer compressor plugin" /compressors/linear_quantizer.cc)
Expand All @@ -211,8 +233,9 @@ libpressio_optional_component(sobolev "computes the sobolev norm" /metrics/sobol
libpressio_optional_component(gradient "computes the gradient length" /metrics/gradlength.cc)
libpressio_optional_component(out_of_bounds "computes the gradient length" /metrics/out_of_bounds.cc)
libpressio_optional_component(write_debug_inputs "metric that writes output buffers for testing" /metrics/write_debug_inputs.cc)
set(roibin_sources /compressors/roibin.cc /compressors/binning.cc /compressors/masked_binning.cc)
libpressio_optional_component(roibin "build the roibin metacompressor" "${roibin_sources}")
libpressio_optional_component(roibin "build the roibin metacompressor" /compressors/roibin.cc)
libpressio_optional_component(binning "build the binning metacompressor" /compressors/binning.cc)
libpressio_optional_component(masked_binning "build the masked binning metacompressor" /compressors/masked_binning.cc)
libpressio_optional_component(pipeline "build the pipeline metacompressor" /compressors/pipeline.cc)

option(LIBPRESSIO_INTERPROCEDURAL_OPTIMIZATION "Use interprocedural optimization (LTO)" OFF)
Expand Down Expand Up @@ -607,6 +630,7 @@ option(LIBPRESSIO_HAS_LUA "build multi-objective code" OFF)
if(LIBPRESSIO_HAS_LUA)
set(LIBPRESSIO_FEATURES "${LIBPRESSIO_FEATURES} lua")
find_package(sol2 REQUIRED)
target_include_directories(libpressio PRIVATE ${SOL2_INCLUDE_DIRS})
if(LIBPRESSIO_LUA_PKGCONFIG)
find_package(PkgConfig REQUIRED)
pkg_search_module(Lua IMPORTED_TARGET lua luajit)
Expand Down Expand Up @@ -696,15 +720,7 @@ endif()

# static libraries and some system linkers will strip the registration classes
# causing nothing to be registered
add_executable(pressio_register_generator src/pressio_register_generator.cc)
target_compile_features(pressio_register_generator PRIVATE cxx_std_11)
add_custom_command(
OUTPUT pressio_manual_register.cc
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/pressio_register_generator" -c "${LIBPRESSIO_BUILT_PLUGINS}" -o "${CMAKE_CURRENT_BINARY_DIR}/pressio_manual_register.cc"
COMMENT "generating registration source file"
DEPENDS pressio_register_generator ${LIBPRESSIO_BUILT_PLUGINS} src/pressio_register_generator.cc
VERBATIM
)
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/pressio_manual_register.cmake)
target_sources(libpressio PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/pressio_manual_register.cc)

configure_file(
Expand Down
2 changes: 1 addition & 1 deletion docs/WritingACompressorPlugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ We finally register the library with libpressio:


```cpp
static pressio_register X(compressor_plugins(), "log", [](){ return std::make_unique<log_transform>();});
static pressio_register registration(compressor_plugins(), "log", [](){ return std::make_unique<log_transform>();});
```

High quality compressor modules may be accepted into libpressio. Contributed modules should be placed in to
Expand Down
2 changes: 1 addition & 1 deletion docs/WritingAMetricsPlugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class counting_metric: public libpressio_metrics_plugin {
Finally, we will register the plugin in the under the names "counts" in the metrics plugging registry

```cpp
static pressio_register X(metrics_plugins(), "counts", [](){ return std::make_unique<counting_metric>(); });
static pressio_register registration(metrics_plugins(), "counts", [](){ return std::make_unique<counting_metric>(); });
```

Then a user of the library can then ask libpressio to construct their new plugin as normal.
Expand Down
2 changes: 1 addition & 1 deletion include/pressio_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct pressio_data* pressio_data_new_clone(const struct pressio_data* src);
* \param[in] num_dimensions the number of dimensions; must match the length of dimensions
* \param[in] dimensions an array corresponding to the dimensions of the data, a copy is made of this on construction
*/
struct pressio_data* pressio_data_new_copy(const enum pressio_dtype dtype, void* src, size_t const num_dimensions, size_t const dimensions[]);
struct pressio_data* pressio_data_new_copy(const enum pressio_dtype dtype, const void* src, size_t const num_dimensions, size_t const dimensions[]);
/**
* allocates a new pressio_data structure and corresponding data. The corresponding data is uninitialized
*
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/MGARDx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class mgardx_compressor_plugin : public libpressio_compressor_plugin {
double eb = 1e-5;
};

pressio_register plugin(compressor_plugins(), "mgardx", []() {
pressio_register registration(compressor_plugins(), "mgardx", []() {
return compat::make_unique<mgardx_compressor_plugin>();
});

Expand Down
6 changes: 3 additions & 3 deletions src/plugins/compressors/bzip2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class bzip2_compressor_plugin : public libpressio_compressor_plugin {
struct pressio_options options;
set(options, "pressio:thread_safe", pressio_thread_safety_multiple);
set(options, "pressio:stability", "experimental");
set(options, "pressio:lossless:min", 0);
set(options, "pressio:lossless:max", 250);
set(options, "pressio:lossless:min", 1);
set(options, "pressio:lossless:max", 9);
set(options, "bzip2:block_size_100k:min", 1);
set(options, "bzip2:block_size_100k:max", 9);
set(options, "bzip2:work_factor:min", 0);
Expand Down Expand Up @@ -67,7 +67,7 @@ class bzip2_compressor_plugin : public libpressio_compressor_plugin {
get(options, "bzip2:small", &small);
int temp = 0;
if(get(options, "pressio:lossless", &temp) == pressio_options_key_set) {
if(temp >= 0 && temp <= 250) {
if(temp >= 1 && temp <= 9) {
Comment thread
juntyr marked this conversation as resolved.
blockSize100k = temp;
} else {
set_error(1, "lossless out of range");
Expand Down
16 changes: 12 additions & 4 deletions src/plugins/compressors/chunking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "std_compat/numeric.h"
#include "std_compat/functional.h"

namespace libpressio { namespace compressors { namespace chunking {
namespace libpressio { namespace compressors { namespace chunking_ns {

class chunking_plugin: public libpressio_compressor_plugin {
public:
Expand Down Expand Up @@ -133,7 +133,7 @@ class chunking_plugin: public libpressio_compressor_plugin {
} else {
//non-contigious, need to copy
pressio_data input = domain_manager().make_readable(domain_plugins().build("malloc"), *real_input);
tmp = libpressio::compressors::chunking::chunk_data(input, chunk_size, {{"nthreads", nthreads}});
tmp = libpressio::compressors::chunking_ns::chunk_data(input, chunk_size, {{"nthreads", nthreads}});
auto ptr = static_cast<uint8_t*>(tmp.data());
for (size_t i = 0; i < num_chunks; ++i) {
inputs.emplace_back(pressio_data::nonowning(real_input->dtype(), ptr+(i*stride), chunk_size, "malloc"));
Expand Down Expand Up @@ -211,7 +211,15 @@ class chunking_plugin: public libpressio_compressor_plugin {
uint64_t* inptr64 = reinterpret_cast<uint64_t*>(input->data());
size_t n_buffers = *inptr64;
const size_t header_size = sizeof(uint64_t) *(n_buffers+1);
std::vector<uint64_t> sizes(inptr64+1, inptr64+(1+n_buffers));
std::vector<uint64_t> sizes64(inptr64+1, inptr64+(1+n_buffers));
std::vector<size_t> sizes(sizes64.size());
std::transform(
std::begin(sizes64),
std::end(sizes64),
std::begin(sizes),
[](const uint64_t x) {
return static_cast<size_t>(x);
});

//create the buffers to decompress
std::vector<pressio_data> inputs;
Expand Down Expand Up @@ -265,7 +273,7 @@ class chunking_plugin: public libpressio_compressor_plugin {
memcpy(outptr+accum_size_out, outputs[i].data(), stride_in_bytes);
accum_size_out += stride_in_bytes;
}
libpressio::compressors::chunking::restore_data(*output, combined, chunk_size, {{"nthreads", nthreads}});
libpressio::compressors::chunking_ns::restore_data(*output, combined, chunk_size, {{"nthreads", nthreads}});
}
auto dechunk_end = std::chrono::steady_clock::now();
dechunk_time = std::chrono::duration_cast<std::chrono::milliseconds>(dechunk_end-dechunk_begin).count();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/chunking_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace libpressio {
namespace compressors {
namespace chunking {
namespace chunking_ns {
namespace detail {

struct copy_from_blocks {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/chunking_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct pressio_options;

namespace libpressio {
namespace compressors {
namespace chunking {
namespace chunking_ns {

/**
* preform the chunking as optimal-ally we know how to
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/delta_encoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <std_compat/memory.h>
#include <sstream>

namespace libpressio { namespace compressors { namespace delta_encoder {
namespace libpressio { namespace compressors { namespace delta_encoding_ns {

struct delta_encoder {
template <class T>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/digit_rounding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "pressio_compressor.h"
#include "std_compat/memory.h"

namespace libpressio { namespace compressors { namespace digit_rounding {
namespace libpressio { namespace compressors { namespace digit_rounding_ns {

#define INVALID_TYPE -1

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/compressors/linear_quantizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <std_compat/memory.h>
#include <sstream>

namespace libpressio { namespace compressors { namespace linear_quantizer {
namespace libpressio { namespace compressors { namespace linear_quantizer_ns {

struct linear_quantizer_step_finder {
template <class T>
Expand Down Expand Up @@ -121,7 +121,7 @@ applies linear_quantizer encoding to prior to compression and reverses it post d
} else if(ret < 0) {
set_error(meta->error_code(), meta->error_msg());
}
*output = domain_manager().make_readable(domain_plugins().build("malloc"), std::move(*output));
*output = domain_manager().make_writeable(domain_plugins().build("malloc"), std::move(*output));
Comment thread
juntyr marked this conversation as resolved.
pressio_data_for_each<int>(quantized_output, *output, linear_quantizer_decoder{step});
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/log_transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <sstream>
#include <cmath>

namespace libpressio { namespace compressors { namespace log_transform {
namespace libpressio { namespace compressors { namespace log_transform_ns {

struct log_encoder {
template <class T>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/masked_binning.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "libpressio_ext/cpp/domain_manager.h"
#include "roibin_impl.h"

namespace libpressio { namespace compressors { namespace mask_binning_ns {
namespace libpressio { namespace compressors { namespace masked_binning_ns {

using namespace utilities;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class pipeline_compressor_plugin : public libpressio_compressor_plugin {
//output needs to be on the host to add the header
*output = pressio_data::owning(
pressio_byte_dtype,
{tmp_in.size_in_bytes() + header_size}
{tmp_in.size_in_bytes() + static_cast<size_t>(header_size)}
);
uint64_t* metadata_ptr = static_cast<uint64_t*>(output->data());
metadata_ptr[0] = 1; /*version*/
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/compressors/resize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "pressio_compressor.h"
#include "std_compat/memory.h"

namespace libpressio { namespace compressors { namespace resize {
namespace libpressio { namespace compressors { namespace resize_ns {

class resize_meta_compressor_plugin : public libpressio_compressor_plugin
{
Expand Down
Loading