Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDF5 Updates #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ bin/CitcomSRegional
bin/citcoms
bin/mpipycitcoms
bin/pycitcoms
visual/h5tocap
visual/h5tovelo
visual/project_geoid
Py2C/Py2C

Expand Down
7 changes: 1 addition & 6 deletions bin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
# $Id$


INCLUDES = -I$(top_srcdir)/lib

AM_CPPFLAGS =
if COND_HDF5
AM_CPPFLAGS += -DUSE_HDF5
endif
AM_CPPFLAGS = -I$(top_srcdir)/lib

bin_PROGRAMS = CitcomSFull CitcomSRegional

Expand Down
14 changes: 4 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])

# 'configure' options
CIT_ARG_HDF5([auto])
AC_ARG_VAR(HC_HOME, [home path to HC program, used by --with-ggrd])
AC_ARG_WITH([ggrd],
[AC_HELP_STRING([--with-ggrd],
Expand Down Expand Up @@ -63,21 +62,16 @@ AC_PROG_LIBTOOL
AC_SEARCH_LIBS([MPI_Init], [mpi mpich], [], [AC_MSG_ERROR([MPI library not found])])


CIT_CHECK_LIB_HDF5
CIT_CHECK_LIB_HDF5_PARALLEL

# Checks for header files.
AC_CHECK_HEADER([mpi.h], [], [AC_MSG_ERROR([header 'mpi.h' not found])])
CIT_CHECK_HEADER_HDF5

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

if test "$want_hdf5" != no; then
want_hdf5=yes
fi
AM_CONDITIONAL([COND_HDF5], [test "$want_hdf5" = yes])
AX_LIB_HDF5([parallel])
AM_CONDITIONAL([COND_HDF5], [test "$with_hdf5" = yes])

AC_SEARCH_LIBS([gzopen], [z], [
CPPFLAGS="-DUSE_GZDIR $CPPFLAGS"
], [
Expand Down Expand Up @@ -153,7 +147,7 @@ echo -e "\t CFLAGS: " $CFLAGS
echo -e "\t CPPFLAGS: " $CPPFLAGS
echo -e "\t LDFLAGS: " $LDFLAGS
echo -e "\t LIBS: " $LIBS
echo -e "\t with-hdf5: " $want_hdf5
echo -e "\t with-hdf5: " $with_hdf5
echo -e "\t with-ggrd: " $want_ggrd
echo

Expand Down
8 changes: 3 additions & 5 deletions doc/citcoms-manual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1172,12 +1172,10 @@ \section{\label{sec:HDF5-Configuration}HDF5 Configuration (Optional)}
\end{quote}
By default, CitcomS will attempt to auto-detect your PHDF5 installation,
and will disable HDF5 support if it is not found. You may specify
the location of your PHDF5 installation by setting the PHDF5\_HOME
environment variable to the appropriate installation prefix.
the location of your PHDF5 installation by passing the \texttt{-{}-with-hdf5}
argument with the appropriate installation prefix.
\begin{lyxcode}
\$~export~PHDF5\_HOME=/opt/phdf5/1.6.5

\$~./configure~-{}-with-hdf5
\$~./configure~-{}-with-hdf5=/opt/phdf5/1.6.5
\end{lyxcode}

\subsection{Additional Tools}
Expand Down
3 changes: 0 additions & 3 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ lib_LTLIBRARIES =
noinst_LIBRARIES += libCitcomS.a

AM_CPPFLAGS =
if COND_HDF5
AM_CPPFLAGS += -DUSE_HDF5
endif

CUDA_SOURCES =

Expand Down
14 changes: 7 additions & 7 deletions lib/Output_h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "output_h5.h"


#ifdef USE_HDF5
#ifdef HAVE_HDF5

/****************************************************************************
* Structs for HDF5 output *
Expand Down Expand Up @@ -146,7 +146,7 @@ extern void compute_geoid(struct All_variables *);

void h5output_allocate_memory(struct All_variables *E)
{
#ifdef USE_HDF5
#ifdef HAVE_HDF5
/*
* Field variables
*/
Expand Down Expand Up @@ -220,7 +220,7 @@ void h5output_allocate_memory(struct All_variables *E)

void h5output(struct All_variables *E, int cycles)
{
#ifndef USE_HDF5
#ifndef HAVE_HDF5
if(E->parallel.me == 0)
fprintf(stderr, "h5output(): CitcomS was compiled without HDF5!\n");
MPI_Finalize();
Expand All @@ -244,7 +244,7 @@ void h5output(struct All_variables *E, int cycles)

void h5input_params(struct All_variables *E)
{
#ifdef USE_HDF5
#ifdef HAVE_HDF5

int m = E->parallel.me;

Expand All @@ -266,7 +266,7 @@ void h5input_params(struct All_variables *E)
}


#ifdef USE_HDF5
#ifdef HAVE_HDF5

static void h5output_const(struct All_variables *E)
{
Expand Down Expand Up @@ -461,7 +461,7 @@ void h5output_coord(struct All_variables *E)
h5create_field(E->hdf5.file_id, field, "coord", "coordinates of nodes");

/* write to dataset */
dataset = H5Dopen(E->hdf5.file_id, "/coord");
dataset = H5Dopen(E->hdf5.file_id, "/coord", H5P_DEFAULT);
status = h5write_field(dataset, field, 1, 1);

/* release resources */
Expand Down Expand Up @@ -2416,4 +2416,4 @@ herr_t set_attribute_double_vector(hid_t obj_id,
return set_attribute_array(obj_id, attr_name, 1, &dim, H5T_NATIVE_DOUBLE, data);
}

#endif /* #ifdef USE_HDF5 */
#endif /* #ifdef HAVE_HDF5 */
6 changes: 3 additions & 3 deletions lib/global_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ to functions across the whole filespace of CITCOM.



#ifdef USE_HDF5
#ifdef HAVE_HDF5
#include "hdf5.h"
#endif

Expand Down Expand Up @@ -699,7 +699,7 @@ struct CITCOM_GNOMONIC {
};


#ifdef USE_HDF5
#ifdef HAVE_HDF5
#include "hdf5_related.h"
#endif
#include "tracer_defs.h"
Expand All @@ -715,7 +715,7 @@ struct All_variables {
FILE *fptime;
FILE *fp_out;

#ifdef USE_HDF5
#ifdef HAVE_HDF5
struct HDF5_INFO hdf5;
#endif
struct HAVE Have;
Expand Down
2 changes: 1 addition & 1 deletion m4
11 changes: 10 additions & 1 deletion visual/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,18 @@ project_geoid_SOURCES = project_geoid.c

if COND_HDF5
bin_PROGRAMS += h5tocap h5tovelo

h5tocap_SOURCES = h5tocap.c h5util.c h5util.h
h5tocap_CFLAGS = $(HDF5_CFLAGS)
h5tocap_CPPFLAGS = $(HDF5_CPPFLAGS)
h5tocap_LDFLAGS = $(HDF5_LDFLAGS)
h5tocap_LDADD = $(HDF5_LIBS)

h5tovelo_SOURCES = h5tovelo.c h5util.c h5util.h
h5tovelo_LDADD = $(LIBHDF5)
h5tovelo_CFLAGS = $(HDF5_CFLAGS)
h5tovelo_CPPFLAGS = $(HDF5_CPPFLAGS)
h5tovelo_LDFLAGS = $(HDF5_LDFLAGS)
h5tovelo_LDADD = $(HDF5_LIBS)
endif

CLEANFILES = $(nodist_visual_DATA)
Expand Down
2 changes: 1 addition & 1 deletion visual/h5tocap.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int main(int argc, char *argv[])
* Read model parameters from file
*/

input = H5Gopen(h5file, "input");
input = H5Gopen(h5file, "input", H5P_DEFAULT);
if (input < 0)
{
fprintf(stderr, "Could not open /input group in \"%s\"\n", filename);
Expand Down
4 changes: 2 additions & 2 deletions visual/h5tovelo.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int main(int argc, char *argv[])
* Read model parameters from file1
*/

input = H5Gopen(h5file1, "input");
input = H5Gopen(h5file1, "input", H5P_DEFAULT);
if (input < 0)
{
fprintf(stderr, "Could not open /input group in \"%s\"\n", filename1);
Expand Down Expand Up @@ -134,7 +134,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}

input = H5Gopen(h5file2, "/");
input = H5Gopen(h5file2, "/", H5P_DEFAULT);
status = get_attribute_float(input, "time", &time);
status = H5Gclose(input);

Expand Down
4 changes: 2 additions & 2 deletions visual/h5util.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ field_t *open_field(hid_t group, const char *name)
field->maxdims = NULL;
field->n = 0;

dataset = H5Dopen(group, name);
dataset = H5Dopen(group, name, H5P_DEFAULT);
if(dataset < 0)
{
free(field);
Expand Down Expand Up @@ -122,7 +122,7 @@ herr_t read_field(hid_t group, field_t *field, int cap)
if (group < 0 || field == NULL)
return -1;

dataset = H5Dopen(group, field->name);
dataset = H5Dopen(group, field->name, H5P_DEFAULT);

if (dataset < 0)
return -1;
Expand Down