Skip to content

fortran version of zfp C code example - simple compressor

License

Notifications You must be signed in to change notification settings

ofmla/zfp_simple_example

Repository files navigation

Fortran ZFP Example

License: MIT Fortran Build Status

This repository demonstrates how to integrate the Fortran bindings for the ZFP library into a simple example that illustrates compression and decompression of a double-precision 3D array.

Overview

ZFP is an open-source library for compressed floating-point and integer arrays that support high throughput read and write random access. This repository focuses on integrating the Fortran bindings for ZFP into a Fortran project, showcasing its usage through a simple example.

The zfp_example.f90 file contains the main program, which demonstrates the compression and decompression of a 3D array of 64-bit floats using the ZFP library. It would be the equivalent of the simple compressor example. The zfp_fct_wrapper.f90 file provides a Fortran module with functions for interacting with the ZFP library.

Features

  • Integration of Fortran bindings for the ZFP library.
  • Simple example demonstrating compression and decompression of a 3D array of 64-bit floats.
  • Easy-to-understand CMakeLists.txt file for building the example.

Prerequisites

Before building and running the example, ensure you have the following prerequisites installed:

  • Fortran compiler which fully supports F2018 (e.g., GNU Fortran, Intel Fortran)
  • CMake (version 3.16 or higher)

Build the app

  1. Clone this repository:

    git clone https://github.com/ofmla/fortran-zfp-example.git
  2. Build the project using CMake:

    cd fortran-zfp-example
    mkdir build
    cd build
    cmake ..
    cmake --build .
  3. Run the executable with the appropriate command-line argument (-c for compress or -d for decompress). Executing

    ./exe -c

    will create an archive named compressed.zfp.

To decompress the compressed data and save it to decompressed.zfp, run the executable with the -d option:

  ./exe -d

Attempting to decompress data without first compressing it will result in an error, as the compressed.zfp file does not exist. This example is built with double precision (real64) real values, but you can use zfp_fct_wrapper.f90 in a project that uses real32 and explicitly specify the real kind with the preprocessor flag -DREAL_KIND=REAL32, i.e., cmake -DREAL_KIND=REAL32 ...

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request.

License

This project is licensed under the MIT License

About

fortran version of zfp C code example - simple compressor

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published