=============================================================

HDF5 configuration

=============================================================

Steps for configuring hdf5 file (HDF5 1.10.10 doesn’t require cmake):

[1] download hdf5 - https://portal.hdfgroup.org/display/support/Downloads

[2] download szip - https://support.hdfgroup.org/doc_resource/SZIP/

[3] download zlib - https://www.zlib.net/

[4] Extract all

>> tar -xzvf <path of downloaded file/filename>

[5] Make directories for configuring all these packages in your desired location

>> cd ~

>> mkdir mypkgs_bin (just an example)

>> cd mypkgs_bin

>> mkdir hdf5 szip zlib

(Below 3 commands are optional)

>> cd hdf5

>> mkdir serial

>> mkdir parallel

[6] Go to the extracted szip and zlib directory location and configure

>> cd <path of extracted file>/szip-2.1.1

>> ./configure --prefix=<path>/mypkgs_bin/szip/

>> make -j16 && make install

Do the similar for zlib i.e.

>> cd <path of extracted file>/zlib-1.2.13

>> ./configure --prefix=<path>/mypkgs_bin/zlib/

>> make -j16 && make install

[7] Now go to extracted hdf5 directory location and configure

>> ./configure --prefix=/Users/manishtamta/mypkgs_bin/hdf5/parallel --enable-shared --with-zlib=/Users/manishtamta/mypkgs_bin/zlib --with-szlib=/Users/manishtamta/mypkgs_bin/szib --enable-parallel --enable-build-mode=production

>> make -j16 && make install

For serial run configuration remove --enable-parallel

>> ./configure --prefix=/Users/manishtamta/mypkgs_bin/hdf5/serial --enable-shared --with-zlib=/Users/manishtamta/mypkgs_bin/zlib --with-szlib=/Users/manishtamta/mypkgs_bin/szib --enable-build-mode=production

>> make -j16 && make install

Remark: After configuration in mypkgs_bin directory there should be include and lib in szip and zlib directories additionally bin along with include and lib in the hdf5 directory.

[8] Now go to zshrc or bashrc, add LD_LIBRARY_PATH, PATH and CPATH

>> vi ~/.zshrc or vi ~/.bashrc (depending upon SHELL)

export LD_LIBRARY_PATH="/Users/manishtama/mypkgs_bin/szip/lib:$LD_LIBRARY_PATH"

export LD_LIBRARY_PATH="/Users/manishtama/mypkgs_bin/zlib/lib:$LD_LIBRARY_PATH"

export LD_LIBRARY_PATH="/Users/manishtama/mypkgs_bin/hdf5/lib:$LD_LIBRARY_PATH"

export PATH="/Users/manishtama/mypkgs_bin/hdf5/bin:$PATH"

export CPATH="/Users/manishtama/mypkgs_bin/hdf5/include:$CPATH"

>> source ~/.zshrc (refreshes the shell and applies the changes)

=============================================================

Application in PLUTO code

=============================================================

[1] For using hdf5 file in pluto.ini enable the dbl.h5 or flt.h5 flag

[2] create a local make file

>> touch local_make

>> vi local_make

1  HDF5_LIB      = /Users/manishtamta/mypkgs_bin/hdf5

2  INCLUDE_DIRS += -I$(HDF5_LIB)/include

3  LDFLAGS      += -L$(HDF5_LIB)/lib -lhdf5 -lz

4  CFLAGS       += -DUSE_HDF5 #-DH5_USE_16_API

5  OBJ          += hdf5_io.o

6  #CFLAGS      += -DUSE_PNG

7  #LDFLAGS     += -L$(PNG_LIB)/lib -lpng

8  #LDFLAGS     += -lgsl -lgslcblas

=============================================================

Commands to see the content of hdf5 files in the terminal

=============================================================

>> h5ls data.0000.dbl.h5

>> h5dump data.0000.dbl.h5

>> h5dump -n data.0000.dbl.h5 (Displays a list of the objects and attributes in a file)

>> h5dump -H <filename> (Displays header information only)

=============================================================

Loading and reading hdf5 data in python

=============================================================

import h5py

wdir = '<path of output data>'

f = h5py.File(wdir+"data.0000.dbl.h5", "r")

f.keys()

rho = array(f['Timestep_10/vars/rho/'])

x = array(f['cell_coords/X/'])


=============================================================

Jupyter notebooks over ssh port forwarding

=============================================================

Steps:

>> ssh -L 8000:localhost:8888 <username>@<IP> (Basically remote address)

>> Enter password

>> jupyter notebook --no-browser --port=8888

>> Go to http://localhost:8000/ in browser

>> Copy and paste the token

To view  Jupyter servers:

>> jupyter server list