Exemplo n.º 1
0
    def __init__(self, io, early_config, io_config, name):
        try:
            config_lp = None
            library = pressio.instance()
            self._io = pressio.get_io(library, io.encode())
            if not self._io:
                raise PressioException.from_library(library)

            if name is not None:
                pressio.compressor_set_name(self._io, name.encode())

            early_config_lp = _python_to_pressio(early_config)
            pressio.io_set_options(self._io, early_config_lp)
            pressio.options_free(early_config_lp)

            config_lp = pressio.io_get_options(self._io)
            config_lp = _python_to_pressio(io_config, config_lp)

            pressio.io_set_options(self._io, config_lp)
        finally:
            pressio.release(library)
            pressio.options_free(config_lp)
Exemplo n.º 2
0
 def get_config(self):
     """get compile time configuration"""
     lp_options = pressio.io_get_options(self._io)
     options = _pressio_to_python(lp_options)
     pressio.options_free(lp_options)
     return options
Exemplo n.º 3
0
 def _get_config(self):
     lp_options = pressio.io_get_options(self._io)
     options = _pressio_to_python(lp_options)
     pressio.options_free(lp_options)
     return options
Exemplo n.º 4
0
pressio.options_set_string(sz_options, b"sz:error_bound_mode_str", b'abs')
pressio.options_set_double(sz_options, b"sz:abs_err_bound", 0.5)

pressio.compressor_check_options(compressor, sz_options)
pressio.compressor_set_options(compressor, sz_options)
pressio.compressor_set_metrics(compressor, metrics)

data = np.random.rand(300, 300, 300)
with tempfile.NamedTemporaryFile() as tmp:
    data.tofile(tmp)

    posix_io = pressio.get_io(library, b'posix')

    #configure read
    posix_options = pressio.io_get_options(posix_io)
    pressio.options_set_string(posix_options, b'io:path',
                               bytes(tmp.name, 'ascii'))
    pressio.io_set_options(posix_io, posix_options)

    #configure template buffer
    dims = pressio.vector_uint64_t([300, 300, 300])
    input_template = pressio.data_new_empty(pressio.double_dtype, dims)

    #preform read
    input_data = pressio.io_read(posix_io, input_template)

    compressed_data = pressio.data_new_empty(pressio.byte_dtype,
                                             pressio.vector_uint64_t())
    decompressed_data = pressio.data_new_empty(pressio.double_dtype, dims)