Fix compilation errors without HDF5 library (#2947)

This commit is contained in:
Stefano Battaglia 2023-08-25 13:16:27 +02:00 committed by GitHub
parent 0f474a84fe
commit 967ffb23fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 24 deletions

View file

@ -13,26 +13,31 @@
! **************************************************************************************************
MODULE hdf5_wrapper
USE hdf5, ONLY: &
h5aclose_f, h5acreate_f, h5aopen_f, h5aread_f, h5awrite_f, h5close_f, h5dclose_f, &
h5dcreate_f, h5dget_space_f, h5dopen_f, h5dread_f, h5dwrite_f, h5f_acc_rdonly_f, &
h5f_acc_trunc_f, h5fclose_f, h5fcreate_f, h5fopen_f, h5gclose_f, h5gcreate_f, h5gopen_f, &
h5open_f, h5s_scalar_f, h5sclose_f, h5screate_f, h5screate_simple_f, &
h5sget_simple_extent_npoints_f, h5t_c_s1, h5t_cset_utf8_f, h5t_enum_f, h5t_native_double, &
h5t_native_integer, h5t_str_nullpad_f, h5t_string, h5tclose_f, h5tcopy_f, h5tcreate_f, &
h5tenum_insert_f, h5tset_cset_f, h5tset_size_f, h5tset_strpad_f, hid_t, hsize_t, size_t
USE iso_c_binding, ONLY: C_LOC,&
c_ptr
USE kinds, ONLY: dp
#ifdef __HDF5
USE hdf5, ONLY: &
h5aclose_f, h5acreate_f, h5aopen_f, h5aread_f, h5awrite_f, h5close_f, h5dclose_f, &
h5dcreate_f, h5dget_space_f, h5dopen_f, h5dread_f, h5dwrite_f, h5f_acc_rdonly_f, &
h5f_acc_trunc_f, h5fclose_f, h5fcreate_f, h5fopen_f, h5gclose_f, h5gcreate_f, h5gopen_f, &
h5open_f, h5s_scalar_f, h5sclose_f, h5screate_f, h5screate_simple_f, &
h5sget_simple_extent_npoints_f, h5t_c_s1, h5t_cset_utf8_f, h5t_enum_f, h5t_native_double, &
h5t_native_integer, h5t_str_nullpad_f, h5t_string, h5tclose_f, h5tcopy_f, h5tcreate_f, &
h5tenum_insert_f, h5tset_cset_f, h5tset_size_f, h5tset_strpad_f, hid_t, hsize_t, size_t
#endif
USE iso_c_binding, ONLY: C_LOC, &
c_ptr
USE kinds, ONLY: dp
#include "./base/base_uses.f90"
IMPLICIT NONE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'hdf5_wrapper'
#ifdef __HDF5
INTEGER, PARAMETER, PUBLIC :: hdf5_id = hid_t
#endif
CONTAINS
#ifdef __HDF5
! **************************************************************************************************
!> \brief Initialize the HDF5 fortran API
! **************************************************************************************************
@ -759,4 +764,6 @@ CONTAINS
END SUBROUTINE h5aread_double_scalar
#endif
END MODULE hdf5_wrapper

View file

@ -9183,10 +9183,10 @@ CONTAINS
n_keywords=3, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="UNIX", &
description="Use a UNIX socket rather than an INET socket.", &
usage="unix LOGICAL", &
default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
CALL keyword_create(keyword, __LOCATION__, name="INET", &
description="Use an INET socket rather than a UNIX socket.", &
usage="INET <LOGICAL>", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

View file

@ -2482,9 +2482,9 @@ CONTAINS
TYPE(section_vals_type), POINTER :: as_input
CHARACTER(len=*), PARAMETER :: routineN = 'rsdft_embedding'
INTEGER :: handle
#ifdef __NO_SOCKETS
INTEGER :: handle
CALL timeset(routineN, handle)
CPABORT("CP2K was compiled with the __NO_SOCKETS option!")
MARK_USED(qs_env)
@ -2492,8 +2492,7 @@ CONTAINS
MARK_USED(as_input)
#else
INTEGER :: client_fd, handle, iter, iw, max_iter, &
socket_fd
INTEGER :: iw, client_fd, socket_fd, iter, max_iter
LOGICAL :: converged, do_scf_embedding, ionode
REAL(KIND=dp) :: alpha, delta_E, energy_corr, energy_new, &
energy_old, energy_scf, eps_iter, t1, &
@ -2645,7 +2644,7 @@ CONTAINS
CHARACTER(len=default_path_length) :: hostname
INTEGER :: handle, iw, port, protocol
LOGICAL :: unix
LOGICAL :: inet
TYPE(cp_logger_type), POINTER :: logger
CALL timeset(routineN, handle)
@ -2653,12 +2652,13 @@ CONTAINS
logger => cp_get_default_logger()
iw = cp_logger_get_default_io_unit(logger)
socket_fd = 0
protocol = 0
! protocol == 0 for UNIX, protocol > 0 for INET
CALL section_vals_val_get(as_input, "SOCKET%UNIX", l_val=unix)
IF (.NOT. unix) protocol = 1
CALL section_vals_val_get(as_input, "SOCKET%INET", l_val=inet)
IF (inet) THEN
protocol = 1
ELSE
protocol = 0
END IF
CALL section_vals_val_get(as_input, "SOCKET%HOST", c_val=hostname)
CALL section_vals_val_get(as_input, "SOCKET%PORT", i_val=port)