Skip to content

Commit

Permalink
Merge branch 'master' into patch-v220
Browse files Browse the repository at this point in the history
  • Loading branch information
q-posev authored Sep 27, 2022
2 parents 7b587bf + 5b5730e commit 0d948ac
Show file tree
Hide file tree
Showing 42 changed files with 2,195 additions and 180 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ jobs:
./configure --enable-silent-rules
- name: compile TREXIO
run: make -j 2
run: make -j2

- name: check TREXIO
run: make check
run: make -j2 check

- name: create virtual environment
run: |
Expand All @@ -82,8 +82,22 @@ jobs:
name: pytrexio-source
path: ./trexio-*.tar.gz

- name: clean
run: make clean
- name: maintainer clean
run: make maintainer-clean

- name: reconfigure with clang and AddressSanitizer
run: |
./autogen.sh
./configure CC=clang-11 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules
- name: recompile TREXIO
run: make -j2

- name: recheck TREXIO for memory leaks
run: make -j2 check

- name: maintainer clean
run: make maintainer-clean

trexio_macos:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ jobs:

#- name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
#verbose: true
Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16)

# Initialize the CMake project.
project(Trexio
VERSION 2.2.1
VERSION 2.3.0
DESCRIPTION "TREX I/O library"
LANGUAGES C Fortran
)
Expand Down
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
CHANGES
=======

2.3
---

- Added trexio_to_bitfield_list functionality
- Added `trexio_has_group` functionality
- Added OCaml binding
- Added spin and energy in MOs
- Added CSF group
- Added `trexio_flush` functionality
- Optional compilation `--without-fortran`

2.2
---

Expand Down
67 changes: 52 additions & 15 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@

ACLOCAL_AMFLAGS = -I m4
CLEANFILES = trexio.mod
if HAVE_FORTRAN
BUILT_SOURCES = trexio.mod
else
BUILT_SOURCES =
endif
EXTRA_DIST = .git_hash

PACKAGE_VERSION = @PACKAGE_VERSION@
Expand All @@ -45,18 +49,20 @@ pkgconfig_DATA = pkgconfig/trexio.pc

# =============== BUILD =============== #

trexio_h = $(srcdir)/include/trexio.h
trexio_f = $(srcdir)/include/trexio_f.f90
trexio_h = include/trexio.h
include_HEADERS = $(trexio_h)

include_HEADERS = $(trexio_h) $(trexio_f)
if HAVE_FORTRAN
trexio_f = include/trexio_f.f90
include_HEADERS += $(trexio_f)
endif

AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include

lib_LTLIBRARIES = src/libtrexio.la


SOURCES = \
$(trexio_h) \
src/trexio.c \
src/trexio_private.h \
src/trexio_s.h \
Expand All @@ -75,7 +81,7 @@ ORG_FILES = \
trex.org


src_libtrexio_la_SOURCES = $(SOURCES)
src_libtrexio_la_SOURCES = $(trexio_h) $(SOURCES)

# Include CMake-related files in the distribution.
EXTRA_DIST += CMakeLists.txt \
Expand Down Expand Up @@ -117,28 +123,37 @@ TESTS_C += \
tests/overwrite_all_hdf5
endif

TESTS_F = \
tests/test_f
TESTS = $(TESTS_C)

if HAVE_FORTRAN
TESTS_F = tests/test_f
TESTS += $(TESTS_F)
endif

TESTS = $(TESTS_C) $(TESTS_F)
check_PROGRAMS = $(TESTS)

# specify common LDADD options for all tests
LDADD = src/libtrexio.la

test_trexio_f = $(srcdir)/tests/trexio_f.f90
CLEANFILES += $(test_trexio_f)
if HAVE_FORTRAN
test_trexio_f = tests/trexio_f.f90

$(test_trexio_f): $(trexio_f)
cp $(trexio_f) $(test_trexio_f)

trexio.mod: tests/trexio_f.o

tests_test_f_SOURCES = $(test_trexio_f) tests/test_f.f90
endif

clean-local:
-rm -rf -- *.dir/ *.h5 __pycache__/

# =============== GUIX MANIFEST =============== #

trexio_scm = $(srcdir)/tools/trexio.scm
EXTRA_DIST += $(trexio_scm)

# =============== DOCUMENTATION =============== #

HTML_TANGLED = docs/index.html \
Expand Down Expand Up @@ -176,9 +191,15 @@ HDF5_CPPFLAGS = @HDF5_CPPFLAGS@

if TREXIO_DEVEL

CLEANFILES += $(SOURCES) $(trexio_f) $(trexio_h) $(HTML_TANGLED) $(htmlizer) .git_hash
CLEANFILES += $(SOURCES) $(trexio_h) $(HTML_TANGLED) $(htmlizer) .git_hash

BUILT_SOURCES += $(SOURCES) $(trexio_f) $(test_trexio_f)
BUILT_SOURCES += $(SOURCES) $(trexio_h)

if HAVE_FORTRAN
CLEANFILES += $(trexio_f)
BUILT_SOURCES += $(trexio_f) $(test_trexio_f)
$(trexio_f): $(trexio_h)
endif

.git_hash: FORCE
git log | head -1 | cut -d ' ' -f 2 > .git_hash
Expand All @@ -188,10 +209,10 @@ all: .git_hash
GENERATOR_FILES = $(srcdir)/tools/generator.py \
$(srcdir)/tools/generator_tools.py

$(SOURCES): $(trexio_f)
$(SOURCES): $(trexio_h)
src/trexio.c: $(trexio_h)

$(trexio_f): $(ORG_FILES) $(GENERATOR_FILES)
$(trexio_h): $(ORG_FILES) $(GENERATOR_FILES)
cd $(srcdir)/tools && ./build_trexio.sh

$(htmlizer): $(ORG_FILES) $(srcdir)/src/README.org
Expand All @@ -208,6 +229,22 @@ cppcheck.out: $(trexio_h)
--language=c --std=c99 -rp --platform=unix64 \
-I../include *.c *.h 2>../$@

#################
# OCaml binding #
#################

ocaml/trexio/_build/default/lib/trexio.cma:
$(MAKE) -C ocaml/trexio

ocaml: ocaml/trexio/_build/default/lib/trexio.cma

ocaml-install: ocaml/trexio/_build/default/lib/trexio.cma
opam install ocaml/trexio

##################
# Python binding #
##################

setup_py = $(srcdir)/python/setup.py
setup_cfg = $(srcdir)/python/setup.cfg
pytrexio_py = $(srcdir)/python/pytrexio/pytrexio.py
Expand Down Expand Up @@ -277,6 +314,6 @@ CLEANFILES += $(pytrexio_c) \
python/src/*.c \
python/src/*.h

.PHONY: cppcheck python-test python-install python-sdist check-numpy FORCE
.PHONY: cppcheck python-test python-install python-sdist check-numpy FORCE ocaml

endif
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

# TREXIO
<img src="https://trex-coe.eu/sites/default/files/styles/responsive_no_crop/public/2022-01/TREXIO%20Code.png" width=200>

[![build](https://github.com/TREX-CoE/trexio/actions/workflows/actions.yml/badge.svg)](https://github.com/TREX-CoE/trexio/actions/workflows/actions.yml)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/TREX-CoE/trexio)
Expand All @@ -9,10 +10,10 @@ TREX library for efficient I/O.

## Minimal requirements (for users):

- Autotools (autoconf >= 2.69, automake >= 1.11, libtool >= 2.2) or CMake (>= 3.16)
- Autotools (autoconf >= 2.69, automake >= 1.11, libtool >= 2.2) or CMake (>= 3.16)
- C compiler (gcc/icc/clang)
- Fortran compiler (gfortran/ifort)
- HDF5 library (>= 1.8) [optional, recommended for high performance]
- HDF5 library (>= 1.8) [optional, recommended for high performance]


## Installation procedure from the tarball (for users):
Expand Down Expand Up @@ -63,6 +64,9 @@ The aforementioned instructions rely on [Autotools](https://www.gnu.org/software

## Installation procedure for conda users

[![Anaconda-Server Badge](https://anaconda.org/conda-forge/trexio/badges/version.svg)](https://anaconda.org/conda-forge/trexio)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/trexio/badges/platforms.svg)](https://anaconda.org/conda-forge/trexio)

The official releases of TREXIO `>2.0.0` are also available via the `conda-forge` channel.
The pre-compiled stable binaries of `trexio` can be installed as follows:

Expand All @@ -73,6 +77,33 @@ conda install trexio -c conda-forge
More details can be found in the corresponding [trexio-feedstock](https://github.com/conda-forge/trexio-feedstock).
Note that both parallel (see `mpi_openmpi` prefix) and serial (`nompi`) variants are provided.

## Installation procedure for Guix users

The official releases of TREXIO `>=2.0.0` can be installed using the
[GNU Guix](https://guix.gnu.org) functional package manager.
The [trexio.scm](https://github.com/TREX-CoE/trexio/blob/master/tools/trexio.scm)
Schema file contains the manifest specification for the `trexio` package.
It can be installed within the selected `$GUIX_PROFILE` as follows:

```
guix package \
--profile=$GUIX_PROFILE \
--cores=<n_cores> \
--install-from-file=trexio.scm
```

## Installation procedure for Spack users

The official releases `>=2.0.0` and the development version of TREXIO can be installed using the
[Spack](https://spack.io/) package manager.
The [trexio/package.py](https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/trexio/package.py)
file contains the Spack specifications required to build different variants of `trexio` library.
It can be installed as follows

```
spack install --jobs <n_cores> trexio
```

## Compilation without the HDF5 library

By default, the configuration step proceeds to search for the [HDF5 library](https://portal.hdfgroup.org/display/HDF5/HDF5).
Expand Down
47 changes: 39 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([trexio],[2.2.1],[https://github.com/TREX-CoE/trexio/issues])
AC_INIT([trexio],[2.3.0],[https://github.com/TREX-CoE/trexio/issues])

AC_CONFIG_SRCDIR([Makefile.in])
AC_CONFIG_HEADERS([include/config.h])
Expand Down Expand Up @@ -50,12 +50,18 @@ AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
[AC_MSG_ERROR([The compiler does not support C99])])
AC_PROG_CC_C_O

# Fortran
AC_PROG_FC
AC_FC_FREEFORM
AC_FC_SRCEXT([f90])
AC_PROG_FC_C_O
AC_FC_LIBRARY_LDFLAGS

# Fortran API [default: --with-fortran], do not disable in the dev mode
AC_ARG_WITH(fortran, [AS_HELP_STRING([--without-fortran],[do not test and install the Fortran API])], ok=$withval, ok=yes)
if test "$ok" = "yes"; then
AC_PROG_FC
AC_FC_FREEFORM
AC_FC_SRCEXT([f90])
AC_PROG_FC_C_O
AC_FC_LIBRARY_LDFLAGS
fi

AM_CONDITIONAL([HAVE_FORTRAN],[test "$ok" = "yes"])

# pkg-config
PKG_PROG_PKG_CONFIG()
Expand All @@ -66,6 +72,31 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_GREP

# Specific options required with some compilers
case $FC in
*gfortran*)
FCFLAGS="$FCFLAGS -fPIC"
;;
*flang*)
FCFLAGS="$FCFLAGS -fPIC"
;;
*ifort*)
FCFLAGS="$FCFLAGS -fPIC"
;;
esac

case $CC in
*gcc*)
CFLAGS="$CFLAGS -fPIC"
;;
*clang*)
CFLAGS="$CFLAGS -fPIC"
;;
*icc*)
CFLAGS="$CFLAGS -fPIC"
;;
esac


## ---------
## Libraries
Expand Down Expand Up @@ -138,7 +169,7 @@ AC_TYPE_UINT32_T
AC_TYPE_UINT64_T

# Checks for library functions.
AC_FUNC_MALLOC
# AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset mkdir strerror])

if test "x$enable_maintainer_mode" == "xyes"; then
Expand Down
Loading

0 comments on commit 0d948ac

Please sign in to comment.