Giter VIP home page Giter VIP logo

fzlib's Introduction

Fortran Module to interface with zlib

Introduction

Write a F90 interface to zlib [ref]. To be able to read (eventually write) compressed gzip files calling zlib functions.

Library home: https://zlib.net

Manual Compilation

Compilers library notes:

Leon (RHEL 7.8)

GCC - gfortran

$> module load gnu (I use zlib I installed in there)

$> ldconfig -p | grep libjpeg

Using system’s gfortran (4.8.5) compiles but ‘Cannot open file for reading’ $> gfortran -O2 -o a.x `pkg-config –libs zlib` a.f90

Using gfortran (9.2.0, and 10.2.0) it works!! $> gfortran -O2 -o a.x `pkg-config –libs zlib` a.f90

The system’s libz.so.1 also works with 9 and 10 GCC. Even if for the same execuatble, I change the link paths (ldd a.x) by module load/unload

Or I compile with $> gfortran -O2 -o a.x a.f90 -lz (no pkg-config)

So, the problem seems to be the system’s gfortran 4.8.5

Intel - ifort $> module purge; module load intel $> ifort -O2 -o a.x a.f90 -lz BTA: intel does not seem to have the intrinsic STAT, like GCC

Mac OS (Augusta)

Has the library See man zlib

BTA: I see augusta t has the (latest) 1.2.11 version (same number I compiled in Leon)

See $> otools -L a.x /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)

BTA: however, although the code compiles, (I used gfortran from GCC 10.2.0) it fails at run time at the gzopen() function too.

The gzip tools also uses it: $> otool -L `which gzip`

CMake

$> module load cmake $> mkdir BUILD && cd BUILD

It compiles fine but, it does not run correctly. See note on ‘-O2’ flag.

$> cmake -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_Fortran_FLAGS=”-O2 -Wall” ..

Alternatively, from the root directory $> module load cmake

BTA: Create makefile(s): instruct CMake to use the CMakeLists in the directory ‘.’, i.e., the current, root, WD and place all the auxiliary files in the new directory BUILD

$> cmake . -BBUILD

BTA: now build: $> cmake –build BUILD

BTA: run: $> ./BUILD/prog/scanfs.x

run

UPDATE: in reality, I observed that neither combination of gfortra/libz works unless ‘-O2’ is turned on. Same compiling with cmake

binary image is in BUILD, directory ./prog/scanfs.x

$> ./BUILD/prog/scanfs.x

References

How to structure the projects

CMake wiki

fzlib's People

Contributors

baudilio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.