From 96463a8376c859c865bbc9f5ede0d0e8f3f110f9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 22 May 2023 12:10:20 +0200 Subject: [PATCH 1/5] Fixing too modern fortran test --- tests/test_f.f90 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_f.f90 b/tests/test_f.f90 index c4fff33..089e612 100644 --- a/tests/test_f.f90 +++ b/tests/test_f.f90 @@ -129,7 +129,19 @@ subroutine test_write(file_name, back_end) basis_shell_num = 24 basis_nucleus_index = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 /) - label = [character(len=8) :: 'C', 'Na','C', 'C 66', 'C','C', 'H 99', 'Ru', 'H', 'H', 'H', 'H' ] + allocate(character(len=8) :: label(12)) + label(1) = 'C' + label(2) = 'Na' + label(3) = 'C' + label(4) = 'C 66' + label(5) = 'C' + label(6) = 'C' + label(7) = 'H 99' + label(8) = 'Ru' + label(9) = 'H' + label(10)= 'H' + label(11)= 'H' + label(12)= 'H' sym_str = 'B3U with some comments' From 7206d5176089f1109078ad38cb9a4295a1b0a66e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 22 May 2023 12:19:58 +0200 Subject: [PATCH 2/5] Fixed tests with gfortran 4 --- tests/test_f.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_f.f90 b/tests/test_f.f90 index 089e612..fa7d2d1 100644 --- a/tests/test_f.f90 +++ b/tests/test_f.f90 @@ -69,8 +69,8 @@ subroutine test_write(file_name, back_end) double precision :: charge(12) double precision :: coord(3,12) - character(len=:), allocatable :: sym_str - character(len=:), allocatable :: label(:) + character(len=32), allocatable :: sym_str + character(len=8), allocatable :: label(:) double precision, allocatable :: energy(:) integer , allocatable :: spin(:) @@ -129,7 +129,7 @@ subroutine test_write(file_name, back_end) basis_shell_num = 24 basis_nucleus_index = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 /) - allocate(character(len=8) :: label(12)) + allocate(label(12)) label(1) = 'C' label(2) = 'Na' label(3) = 'C' From 7b6de725b586ad9378fdb29a200531d4d3cb8971 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 2 Jun 2023 14:25:56 +0200 Subject: [PATCH 3/5] Fixed formats in tests --- tests/io_dset_sparse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/io_dset_sparse.c b/tests/io_dset_sparse.c index 298158e..575210f 100644 --- a/tests/io_dset_sparse.c +++ b/tests/io_dset_sparse.c @@ -46,7 +46,7 @@ static int test_write_dset_sparse (const char* file_name, const back_end_t backe uint64_t chunk_size = (uint64_t) size/N_CHUNKS; chunk_size = chunk_size > 0 ? chunk_size : (uint64_t) size; int n_chunks = size/chunk_size; - printf("chunk_size = %ld\n", chunk_size); + printf("chunk_size = %lld\n", chunk_size); printf("n_chunks = %d\n", n_chunks); uint64_t offset_f = 0UL + offset; @@ -55,7 +55,7 @@ static int test_write_dset_sparse (const char* file_name, const back_end_t backe // write n_chunks times using write_sparse while(offset_d < size) { if (offset_d+chunk_size > size) chunk_size = size-offset_d; - printf("chunk_size = %ld\n", chunk_size); + printf("chunk_size = %lld\n", chunk_size); if (chunk_size == 0L) break; rc = trexio_write_mo_2e_int_eri(file, offset_f, chunk_size, &index[4*offset_d], &value[offset_d]); printf("%5d: %s\n", __LINE__, trexio_string_of_error(rc)); @@ -163,7 +163,7 @@ static int test_read_dset_sparse (const char* file_name, const back_end_t backen printf("%5d: %s\n", __LINE__, trexio_string_of_error(rc)); /* for (int i=0 ; i Date: Fri, 2 Jun 2023 14:53:54 +0200 Subject: [PATCH 4/5] Better search for hdf5 in python-install --- python/install_pytrexio.sh | 38 ++++++++++++++++++++++++++- src/templates_text/templator_text.org | 6 ++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/python/install_pytrexio.sh b/python/install_pytrexio.sh index 8542874..f90f650 100755 --- a/python/install_pytrexio.sh +++ b/python/install_pytrexio.sh @@ -16,7 +16,43 @@ done # check that both variables are set if [[ -z ${H5_LDFLAGS_LOCAL} ]] || [[ -z ${H5_CFLAGS_LOCAL} ]]; then if [[ -z ${H5_LDFLAGS} ]] || [[ -z ${H5_CFLAGS} ]]; then - echo "Paths to the HDF5 installation are not provided. pkgconfig will try to detect them." + which h5cc &> /dev/null + if [[ $? -eq 0 ]] ; then + HDF5_tmp_flags=$(h5cc -showconfig \ + | grep 'FLAGS\|Extra libraries:' \ + | awk -F: '{printf("%s "), $2}' ) + echo $HDF5_tmp_flags + + # Find the installation directory and append include/ + HDF5_tmp_inst=$(h5cc -showconfig \ + | grep 'Installation point:' \ + | awk '{print $NF}' ) + echo $HDF5_tmp_inst + + # Add this to the CPPFLAGS + HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include" + + HDF5_SHOW=$(h5cc -show) + + # Now sort the flags out based upon their prefixes + for arg in $HDF5_SHOW $HDF5_tmp_flags ; do + case "$arg" in + -I*) echo $HDF5_CPPFLAGS | grep -e "$arg" 2>&1 >/dev/null \ + || HDF5_CPPFLAGS="$HDF5_CPPFLAGS $arg" + ;; + -L*) echo $HDF5_LDFLAGS | grep -e "$arg" 2>&1 >/dev/null \ + || HDF5_LDFLAGS="$HDF5_LDFLAGS $arg" + ;; + -l*) echo $HDF5_LIBS | grep -e "$arg" 2>&1 >/dev/null \ + || HDF5_LIBS="$HDF5_LIBS $arg" + ;; + esac + done + export H5_LDFLAGS="$HDF5_LDFLAGS" + export H5_CFLAGS="$HDF5_CPPFLAGS" + else + echo "Paths to the HDF5 installation are not provided. pkgconfig will try to detect them." + fi else echo "Using exported H5_LDFLAGS and H5_CFLAGS environment variables." fi diff --git a/src/templates_text/templator_text.org b/src/templates_text/templator_text.org index 3005aa7..39874fe 100644 --- a/src/templates_text/templator_text.org +++ b/src/templates_text/templator_text.org @@ -166,7 +166,11 @@ On non-POSIX file systems, the function ~mkdtemp~ might is not defined. In that case, we define an alternate one, which is not as safe as the original one. #+begin_src c :tangle basic_text.c -#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L +#if /* Since glibc 2.19: */ _DEFAULT_SOURCE \ + || /* Glibc 2.19 and earlier: */ _BSD_SOURCE \ + || /* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200809L + +/* mkdtemp is defined */ #else char* mkdtemp(char* template) { From d8a37b26bf7d464615ac00cd29c737f21f773077 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 2 Jun 2023 14:57:20 +0200 Subject: [PATCH 5/5] Silence dead code warnings with clang --- tools/generator_tools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/generator_tools.py b/tools/generator_tools.py index f8e25db..c42b124 100644 --- a/tools/generator_tools.py +++ b/tools/generator_tools.py @@ -611,13 +611,13 @@ def get_detailed_num_dict (configuration: dict) -> dict: tmp_dict.update(get_dtype_dict(v2[0], 'num')) if v2[0] in ['int', 'dim', 'dim readonly']: tmp_dict['trex_json_int_type'] = v2[0] - tmp_dict['is_index'] = 'false' + tmp_dict['is_index'] = '(false)' elif v2[0] in ['index']: tmp_dict['trex_json_int_type'] = v2[0] tmp_dict['is_index'] = 'file->one_based' else: tmp_dict['trex_json_int_type'] = '' - tmp_dict['is_index'] = 'false' + tmp_dict['is_index'] = '(false)' num_dict[tmp_num] = tmp_dict @@ -721,7 +721,7 @@ def split_dset_dict_detailed (datasets: dict) -> tuple: if 'index' in datatype: tmp_dict['is_index'] = 'file->one_based' else: - tmp_dict['is_index'] = 'false' + tmp_dict['is_index'] = '(false)' # add the list of dimensions tmp_dict['dims'] = [dim.replace('.','_') for dim in v[1]]