mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Merge branch 'master' into wf_det_grad_cof
This commit is contained in:
commit
5a44ce39c2
2
.github/workflows/gh-pages.yml
vendored
2
.github/workflows/gh-pages.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
run: ./autogen.sh
|
||||
|
||||
- name: ./configure
|
||||
run: QMCKL_DEVEL=1 ./configure --enable-silent-rules --enable-maintainer-mode
|
||||
run: QMCKL_DEVEL=1 ./configure --enable-silent-rules --enable-maintainer-mode --without-trexio
|
||||
|
||||
- name: make
|
||||
run: make -j 8 html
|
||||
|
13
.github/workflows/test-build.yml
vendored
13
.github/workflows/test-build.yml
vendored
@ -14,11 +14,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install emacs autoconf libhdf5-dev
|
||||
|
||||
- name: Install trexio
|
||||
run: |
|
||||
# TODO: Update the following link when v1.1 will be released
|
||||
export VERSION=1.1.0
|
||||
wget https://github.com/TREX-CoE/trexio/releases/download/v${VERSION}/trexio-${VERSION}.tar.gz
|
||||
tar -zxf trexio-${VERSION}.tar.gz
|
||||
@ -26,32 +27,36 @@ jobs:
|
||||
./configure --prefix=/usr
|
||||
make -j 8
|
||||
sudo make install
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./autogen.sh
|
||||
QMCKL_DEVEL=1 ./configure --enable-silent-rules --enable-maintainer-mode --enable-debug
|
||||
make -j 8
|
||||
|
||||
- name: Run test
|
||||
run: |
|
||||
make -j check
|
||||
ldd tests/test_qmckl_ao
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: test-report
|
||||
path: test-suite.log
|
||||
|
||||
- name: Dist test
|
||||
run: |
|
||||
make distcheck
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dist-report
|
||||
path: test-suite.log
|
||||
|
||||
|
||||
|
||||
|
||||
# x86_macos:
|
||||
#
|
||||
# runs-on: macos-latest
|
||||
|
12
.github/workflows/vfc_test_workflow.yml
vendored
12
.github/workflows/vfc_test_workflow.yml
vendored
@ -25,7 +25,17 @@ jobs:
|
||||
run: |
|
||||
ln -s /usr/bin/python3 /usr/bin/python
|
||||
apt update
|
||||
apt -y install emacs pkg-config
|
||||
apt -y install emacs pkg-config wget libhdf5-dev
|
||||
|
||||
- name: Install trexio
|
||||
run: |
|
||||
export VERSION=1.1.0
|
||||
wget https://github.com/TREX-CoE/trexio/releases/download/v${VERSION}/trexio-${VERSION}.tar.gz
|
||||
tar -zxf trexio-${VERSION}.tar.gz
|
||||
cd trexio-${VERSION}
|
||||
./configure --prefix=/usr
|
||||
make -j 8
|
||||
sudo make install
|
||||
|
||||
- name: Run tests
|
||||
run: vfc_ci test -g -r
|
||||
|
28
Makefile.am
28
Makefile.am
@ -30,10 +30,6 @@
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if VFC_CI
|
||||
AM_LDFLAGS=-lvfc_probes -lvfc_probes_f
|
||||
endif
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
VERSION_MAJOR = @VERSION_MAJOR@
|
||||
@ -41,7 +37,7 @@ VERSION_MINOR = @VERSION_MINOR@
|
||||
VERSION_PATCH = @VERSION_PATCH@
|
||||
|
||||
SUBDIRS =
|
||||
CLEANFILES = qmckl.mod qmckl_probes_f.mod
|
||||
CLEANFILES = qmckl.mod qmckl_verificarlo_f.mod
|
||||
EXTRA_DIST =
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
@ -56,7 +52,6 @@ test_qmckl_fo = tests/qmckl_f.o
|
||||
src_qmckl_f = src/qmckl_f.f90
|
||||
src_qmckl_fo = src/qmckl_f.o
|
||||
header_tests = tests/chbrclf.h tests/n2.h
|
||||
qmckl_probes_src = src/qmckl_probes.h src/qmckl_probes.c src/qmckl_probes_f.f90
|
||||
|
||||
|
||||
fortrandir = $(datadir)/qmckl/fortran/
|
||||
@ -68,7 +63,7 @@ AM_CPPFLAGS += -DQMCKL_TEST_DIR="\"$(abs_srcdir)/share/qmckl/test_data/\""
|
||||
|
||||
|
||||
lib_LTLIBRARIES = src/libqmckl.la
|
||||
src_libqmckl_la_SOURCES = $(qmckl_h) $(src_qmckl_f) $(C_FILES) $(F_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES) $(header_tests) $(qmckl_probes_src)
|
||||
src_libqmckl_la_SOURCES = $(qmckl_h) $(src_qmckl_f) $(C_FILES) $(F_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES) $(header_tests)
|
||||
|
||||
export qmckl_f qmckl_h srcdir
|
||||
|
||||
@ -99,15 +94,6 @@ $(src_qmckl_fo): $(src_qmckl_f)
|
||||
$(src_qmckl_f): $(srcdir)/$(qmckl_f)
|
||||
cp $(srcdir)/$(qmckl_f) $(src_qmckl_f)
|
||||
|
||||
src/qmckl_probes.c:
|
||||
cp $(srcdir)/tools/qmckl_probes.c $(srcdir)/src/qmckl_probes.c
|
||||
|
||||
src/qmckl_probes.h:
|
||||
cp $(srcdir)/tools/qmckl_probes.h $(srcdir)/src/qmckl_probes.h
|
||||
|
||||
src/qmckl_probes_f.f90:
|
||||
cp $(srcdir)/tools/qmckl_probes_f.f90 $(srcdir)/src/qmckl_probes_f.f90
|
||||
|
||||
share/doc/qmckl/html/index.html: share/doc/qmckl/html/README.html
|
||||
$(ln_s_verbose)cd share/doc/qmckl/html/ && \
|
||||
rm -rf index.html && \
|
||||
@ -122,11 +108,16 @@ doc: html text
|
||||
|
||||
if QMCKL_DEVEL
|
||||
|
||||
|
||||
if VFC_CI
|
||||
AM_LDFLAGS=-lvfc_probes -lvfc_probes_f
|
||||
endif
|
||||
|
||||
dist_src_DATA = $(ORG_FILES) $(TANGLED_FILES) $(EXPORTED_FILES)
|
||||
|
||||
BUILT_SOURCES = $(C_FILES) $(F_FILES) $(FH_FUNC_FILES) $(FH_TYPE_FILES) $(H_FUNC_FILES) $(H_TYPE_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES) $(qmckl_f) $(qmckl_h) $(header_tests)
|
||||
|
||||
CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) $(C_TEST_FILES) $(F_TEST_FILES) $(qmckl_f) $(qmckl_h) $(HTML_FILES) $(TEXT_FILES) share/doc/qmckl/html/index.html $(EXPORTED_FILES) $(header_tests)
|
||||
CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) $(C_TEST_FILES) $(F_TEST_FILES) $(qmckl_f) $(qmckl_h) $(HTML_FILES) $(TEXT_FILES) share/doc/qmckl/html/index.html $(EXPORTED_FILES) $(header_tests)
|
||||
|
||||
EXTRA_DIST += \
|
||||
$(srcdir)/tools/build_doc.sh \
|
||||
@ -151,7 +142,7 @@ export_verbose_0 = @echo " DOC $@";
|
||||
|
||||
tangle_verbose = $(tangle_verbose_@AM_V@)
|
||||
tangle_verbose_ = $(tangle_verbose_@AM_DEFAULT_V@)
|
||||
tangle_verbose_0 = @echo " TANGLE $<";
|
||||
tangle_verbose_0 = @echo " ORG $<";
|
||||
|
||||
cat_h_verbose = $(cat_h_verbose_@AM_V@)
|
||||
cat_h_verbose_ = $(cat_h_verbose_@AM_DEFAULT_V@)
|
||||
@ -190,7 +181,6 @@ cppcheck.out: $(qmckl_h)
|
||||
--language=c --std=c99 -rp --platform=unix64 \
|
||||
-I../include *.c *.h 2>../$@
|
||||
|
||||
|
||||
.PHONY: cppcheck
|
||||
|
||||
endif
|
||||
|
@ -16,14 +16,23 @@ grep TITLE $(cat table_of_contents) | tr ':' ' '
|
||||
#+end_src
|
||||
|
||||
#+RESULTS: toc
|
||||
| qmckl.org | #+TITLE | Introduction | |
|
||||
| qmckl_error.org | #+TITLE | Error | handling |
|
||||
| qmckl_context.org | #+TITLE | Context | |
|
||||
| qmckl_memory.org | #+TITLE | Memory | management |
|
||||
| qmckl_numprec.org | #+TITLE | Numerical | precision |
|
||||
| qmckl_electron.org | #+TITLE | Electrons | |
|
||||
| qmckl_ao.org | #+TITLE | Atomic | Orbitals |
|
||||
| qmckl_distance.org | #+TITLE | Inter-particle | distances |
|
||||
| qmckl.org | #+TITLE | Introduction | | |
|
||||
| qmckl_error.org | #+TITLE | Error | handling | |
|
||||
| qmckl_context.org | #+TITLE | Context | | |
|
||||
| qmckl_memory.org | #+TITLE | Memory | management | |
|
||||
| qmckl_numprec.org | #+TITLE | Numerical | precision | |
|
||||
| qmckl_distance.org | #+TITLE | Inter-particle | distances | |
|
||||
| qmckl_nucleus.org | #+TITLE | Nucleus | | |
|
||||
| qmckl_electron.org | #+TITLE | Electrons | | |
|
||||
| qmckl_ao.org | #+TITLE | Atomic | Orbitals | |
|
||||
| qmckl_mo.org | #+TITLE | Molecular | Orbitals | |
|
||||
| qmckl_jastrow.org | #+TITLE | Jastrow | Factor | |
|
||||
| qmckl_sherman_morrison_woodbury.org | #+TITLE | Sherman-Morrison-Woodbury | | |
|
||||
| qmckl_utils.org | #+TITLE | Utility | functions | |
|
||||
| qmckl_blas.org | #+TITLE | BLAS | functions | |
|
||||
| qmckl_trexio.org | #+TITLE | TREXIO | I/O | library |
|
||||
| qmckl_verificarlo.org | #+TITLE | Verificarlo | CI | |
|
||||
| qmckl_tests.org | #+TITLE | Data | for | Tests |
|
||||
|
||||
#+begin_src python :var data=toc :exports results :results raw
|
||||
result = []
|
||||
@ -40,20 +49,30 @@ return '\n'.join(result)
|
||||
- [[./qmckl_context.html][Context]]
|
||||
- [[./qmckl_memory.html][Memory management]]
|
||||
- [[./qmckl_numprec.html][Numerical precision]]
|
||||
- [[./qmckl_distance.html][Inter-particle distances]]
|
||||
- [[./qmckl_nucleus.html][Nucleus]]
|
||||
- [[./qmckl_electron.html][Electrons]]
|
||||
- [[./qmckl_ao.html][Atomic Orbitals]]
|
||||
- [[./qmckl_distance.html][Inter-particle distances]]
|
||||
- [[./qmckl_mo.html][Molecular Orbitals]]
|
||||
- [[./qmckl_jastrow.html][Jastrow Factor]]
|
||||
- [[./qmckl_sherman_morrison_woodbury.html][Sherman-Morrison-Woodbury]]
|
||||
- [[./qmckl_utils.html][Utility functions]]
|
||||
- [[./qmckl_blas.html][BLAS functions]]
|
||||
- [[./qmckl_trexio.html][TREXIO I/O library]]
|
||||
- [[./qmckl_verificarlo.html][Verificarlo CI]]
|
||||
- [[./qmckl_tests.html][Data for Tests]]
|
||||
|
||||
|
||||
--------------------------------
|
||||
|
||||
|
||||
The ultimate goal of the QMCkl library is to provide a high-performance
|
||||
implementation of the main kernels of QMC. In this particular
|
||||
implementation of the library, we focus on the definition of the API
|
||||
and the tests, and on a /pedagogical/ presentation of the
|
||||
algorithms. We expect the HPC experts to use this repository as a
|
||||
reference for re-writing optimized libraries.
|
||||
implementation of the main kernels of Quantum Monte Carlo
|
||||
methods.
|
||||
In this particular implementation of the library, we focus on the
|
||||
definition of the API and the tests, and on a /pedagogical/
|
||||
presentation of the algorithms. We expect the HPC experts to use
|
||||
this repository as a reference for re-writing optimized libraries.
|
||||
|
||||
The source code of the library is available at
|
||||
https://github.com/trex-coe/qmckl
|
||||
|
@ -46,6 +46,12 @@ gradients and Laplacian of the atomic basis functions.
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifndef QMCKL_AO_HPF
|
||||
#define QMCKL_AO_HPF
|
||||
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_type)
|
||||
#ifndef QMCKL_AO_HPT
|
||||
#define QMCKL_AO_HPT
|
||||
@ -4168,6 +4174,10 @@ assert( fabs(ao_vgl[1][26][224] - (-3.843864637762753e-09)) < 1.e-14 );
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
rc = qmckl_context_destroy(context);
|
||||
@ -4177,7 +4187,7 @@ assert( fabs(ao_vgl[1][26][224] - (-3.843864637762753e-09)) < 1.e-14 );
|
||||
}
|
||||
#+end_src
|
||||
|
||||
**✸ Compute file names
|
||||
*** Compute file names
|
||||
#+begin_src emacs-lisp
|
||||
; The following is required to compute the file names
|
||||
|
||||
|
@ -23,7 +23,8 @@ int main() {
|
||||
|
||||
** ~qmckl_dgemm~
|
||||
|
||||
Matrix multiply l$C_{ij} = \beta C_{ij} + \alpha \sum_{k} A_{ik} \cdot B_{kj}$ using Fortran ~matmul~ function.
|
||||
Matrix multiply: $C_{ij} = \beta C_{ij} + \alpha \sum_{k} A_{ik} \cdot B_{kj}$ using Fortran ~matmul~ function.
|
||||
|
||||
TODO: Add description about the external library dependence.
|
||||
|
||||
#+NAME: qmckl_dgemm_args
|
||||
@ -41,7 +42,7 @@ int main() {
|
||||
| double | beta | in | Array containing the $n \times m$ matrix $B$ |
|
||||
| double | C[][ldc] | out | Array containing the $n \times m$ matrix $B$ |
|
||||
| int64_t | ldc | in | Leading dimension of array ~B~ |
|
||||
|
||||
|
||||
*** Requirements
|
||||
|
||||
- ~context~ is not ~QMCKL_NULL_CONTEXT~
|
||||
@ -75,7 +76,7 @@ int main() {
|
||||
const int64_t ldb,
|
||||
const double beta,
|
||||
double* const C,
|
||||
const int64_t ldc );
|
||||
const int64_t ldc );
|
||||
#+END_src
|
||||
|
||||
*** Source
|
||||
@ -160,11 +161,23 @@ integer function qmckl_dgemm_f(context, TransA, TransB, m, n, k, alpha, A, LDA,
|
||||
endif
|
||||
|
||||
if (TransA) then
|
||||
C = matmul(AT,B)
|
||||
if (alpha == 1.d0 && beta == 0.d0) then
|
||||
C = matmul(AT,B)
|
||||
else
|
||||
C = beta*C + alpha*matmul(AT,B)
|
||||
endif
|
||||
else if (TransB) then
|
||||
C = matmul(A,BT)
|
||||
if (alpha == 1.d0 && beta == 0.d0) then
|
||||
C = matmul(A,BT)
|
||||
else
|
||||
C = beta*C + alpha*matmul(A,BT)
|
||||
endif
|
||||
else
|
||||
C = matmul(A,B)
|
||||
if (alpha == 1.d0 && beta == 0.d0) then
|
||||
C = matmul(A,B)
|
||||
else
|
||||
C = beta*C + alpha*matmul(A,B)
|
||||
endif
|
||||
endif
|
||||
end function qmckl_dgemm_f
|
||||
#+end_src
|
||||
@ -250,7 +263,7 @@ integer(qmckl_exit_code) function test_qmckl_dgemm(context) bind(C)
|
||||
double precision :: x, alpha, beta
|
||||
|
||||
TransA = .False.
|
||||
TransB = .False.
|
||||
TransB = .False.
|
||||
m = 1_8
|
||||
k = 4_8
|
||||
n = 6_8
|
||||
@ -301,7 +314,7 @@ integer(qmckl_exit_code) function test_qmckl_dgemm(context) bind(C)
|
||||
deallocate(A,B,C,D)
|
||||
end function test_qmckl_dgemm
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :comments link :tangle (eval c_test)
|
||||
qmckl_exit_code test_qmckl_dgemm(qmckl_context context);
|
||||
assert(QMCKL_SUCCESS == test_qmckl_dgemm(context));
|
||||
|
@ -288,7 +288,7 @@ end function qmckl_distance_sq_f
|
||||
integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||
|
||||
use qmckl
|
||||
use qmckl_probes_f
|
||||
use qmckl_verificarlo_f
|
||||
use iso_c_binding
|
||||
|
||||
implicit none
|
||||
@ -720,7 +720,7 @@ end function qmckl_distance_f
|
||||
integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
||||
|
||||
use qmckl
|
||||
use qmckl_probes_f
|
||||
use qmckl_verificarlo_f
|
||||
use iso_c_binding
|
||||
|
||||
implicit none
|
||||
|
@ -18,6 +18,11 @@ up-spin and down-spin electrons, and the electron coordinates.
|
||||
#include <stdbool.h>
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifndef QMCKL_ELECTRON_HPF
|
||||
#define QMCKL_ELECTRON_HPF
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c_test) :noweb yes
|
||||
#include "qmckl.h"
|
||||
#include <assert.h>
|
||||
@ -2605,6 +2610,10 @@ assert (rc == QMCKL_SUCCESS);
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
if (qmckl_context_destroy(context) != QMCKL_SUCCESS)
|
||||
|
@ -456,8 +456,19 @@ qmckl_get_error(qmckl_context context,
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
assert (ctx != NULL); /* Impossible because the context is valid. */
|
||||
|
||||
/* Turn off annoying GCC warning */
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
||||
#endif
|
||||
|
||||
strncpy(function_name, ctx->error.function, QMCKL_MAX_FUN_LEN-1);
|
||||
strncpy(message , ctx->error.message , QMCKL_MAX_MSG_LEN-1);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
(*exit_code) = ctx->error.exit_code;
|
||||
}
|
||||
qmckl_unlock(context);
|
||||
|
@ -13,6 +13,11 @@ these factors along with their derivatives.
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifndef QMCKL_JASTROW_HPF
|
||||
#define QMCKL_JASTROW_HPF
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_type)
|
||||
#ifndef QMCKL_JASTROW_HPT
|
||||
#define QMCKL_JASTROW_HPT
|
||||
@ -5469,6 +5474,10 @@ assert(fabs(factor_een_deriv_e[0][0] + 0.0005481671107226865) < 1e-12);
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
rc = qmckl_context_destroy(context);
|
||||
|
@ -41,6 +41,11 @@ int main() {
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func) :noweb yes
|
||||
#ifndef QMCKL_MEMORY_HPF
|
||||
#define QMCKL_MEMORY_HPF
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_type) :noweb yes
|
||||
#ifndef QMCKL_MEMORY_HPT
|
||||
#define QMCKL_MEMORY_HPT
|
||||
@ -273,6 +278,11 @@ assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
* End of files :noexport:
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_private_func)
|
||||
#endif
|
||||
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_private_type)
|
||||
#endif
|
||||
|
||||
|
@ -21,6 +21,11 @@ function to calculate the MOs.
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifndef QMCKL_MO_HPF
|
||||
#define QMCKL_MO_HPF
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_type)
|
||||
#ifndef QMCKL_MO_HPT
|
||||
#define QMCKL_MO_HPT
|
||||
@ -818,6 +823,10 @@ printf("\n");
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
rc = qmckl_context_destroy(context);
|
||||
|
@ -10,6 +10,11 @@ All the data relative to the molecular geometry is described here.
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifndef QMCKL_NUCLEUS_HPF
|
||||
#define QMCKL_NUCLEUS_HPF
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_type)
|
||||
#ifndef QMCKL_NUCLEUS_HPT
|
||||
#define QMCKL_NUCLEUS_HPT
|
||||
@ -1345,6 +1350,10 @@ end function qmckl_compute_en_potential_f
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
if (qmckl_context_destroy(context) != QMCKL_SUCCESS)
|
||||
|
File diff suppressed because one or more lines are too long
328
org/qmckl_verificarlo.org
Normal file
328
org/qmckl_verificarlo.org
Normal file
@ -0,0 +1,328 @@
|
||||
#+TITLE: Verificarlo CI
|
||||
#+SETUPFILE: ../tools/theme.setup
|
||||
#+INCLUDE: ../tools/lib.org
|
||||
|
||||
* Headers :noexport:
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifndef QMCKL_VERIFICARLO_HPT
|
||||
#define QMCKL_VERIFICARLO_HPT
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#ifdef VFC_CI
|
||||
#include <vfc_probes.h>
|
||||
extern vfc_probes * probes;
|
||||
#endif
|
||||
|
||||
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef VFC_CI
|
||||
#include <vfc_probes.h>
|
||||
vfc_probes probes;
|
||||
#else
|
||||
|
||||
/* Disable GCC warnings with unused variables */
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#+end_src
|
||||
|
||||
* Verificarlo probes
|
||||
|
||||
This file contains utility functions to enable the Verificarlo
|
||||
Continuous Integration system (~VFC_CI~).
|
||||
|
||||
It is a wrapper to Verificarlo's ~vfc_probes~ system. The goal of QMCkl
|
||||
probes is to simplify the use of ~vfc_probes~, and to provide functions that
|
||||
can be called either with or without ~VFC_CI~ support by using ~#ifndef~
|
||||
statements :
|
||||
|
||||
- when ~VFC_CI~ is disabled, the functions will either return ~false~
|
||||
(no error) or perform a check based on a reference value
|
||||
|
||||
- when ~VFC_CI~ is enabled, the functions will simply encapsulate
|
||||
calls to ~vfc_probe~.
|
||||
|
||||
Moreover, one does not have to worry about the life cycle of the probes
|
||||
structure, as it is automatically created, dumped and freed by this wrapper.
|
||||
|
||||
~VFC_CI~ support can be enabled by using the following configure command :
|
||||
|
||||
#+begin_src bash
|
||||
QMCKL_DEVEL=1 ./configure --prefix=$PWD/_install --enable-silent-rules \
|
||||
--enable-maintainer-mode CC=verificarlo-f FC=verificarlo-f --host=x86_64
|
||||
#+end_src
|
||||
|
||||
Finally, this wrapper also comes with a Fortran interface (in its dedicated
|
||||
file).
|
||||
|
||||
To learn more about Verificarlo CI :
|
||||
https://github.com/verificarlo/verificarlo/blob/master/doc/06-Postprocessing.md#verificarlo-ci
|
||||
|
||||
|
||||
** Automatically initialize the vfc_probe object if ~VFC_CI~ is defined
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifdef VFC_CI
|
||||
void qmckl_init_probes() __attribute__((constructor));
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
#ifdef VFC_CI
|
||||
void __attribute__((constructor)) qmckl_init_probes(){
|
||||
probes = vfc_init_probes();
|
||||
}
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
** Standard probe, without check
|
||||
|
||||
- if ~VFC_CI~ is defined, place a standard probe
|
||||
- if ~VFC_CI~ is undefined, return ~false~ (no error)
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
bool qmckl_probe(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double value
|
||||
);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
bool qmckl_probe(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double value)
|
||||
{
|
||||
#ifdef VFC_CI
|
||||
return vfc_probe(&probes, testName, varName, value);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Probe with absolute check
|
||||
|
||||
- if VFC_CI is defined, place a probe with an absolute check
|
||||
- if VFC_CI is undefined, perform an absolute check based on target value
|
||||
and accuracy
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
bool qmckl_probe_check(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double value,
|
||||
double expectedValue,
|
||||
double accuracyTarget
|
||||
);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
bool qmckl_probe_check(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double value,
|
||||
double expectedValue,
|
||||
double accuracyTarget)
|
||||
{
|
||||
#ifdef VFC_CI
|
||||
return vfc_probe_check(&probes, testName, varName, value, accuracyTarget);
|
||||
#else
|
||||
return !(fabs(value - expectedValue) < accuracyTarget);
|
||||
#endif
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Probe with relative check
|
||||
|
||||
- if VFC_CI is defined, place a probe with a relative check
|
||||
- if VFC_CI is undefined, perform a relative check based on target value
|
||||
and accuracy
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
bool qmckl_probe_check_relative(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double value,
|
||||
double expectedValue,
|
||||
double accuracyTarget
|
||||
);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
bool qmckl_probe_check_relative (
|
||||
char * testName,
|
||||
char * varName,
|
||||
double value,
|
||||
double expectedValue,
|
||||
double accuracyTarget)
|
||||
{
|
||||
#ifdef VFC_CI
|
||||
return vfc_probe_check_relative(&probes, testName, varName, value, accuracyTarget);
|
||||
#else
|
||||
return !(fabs(value - expectedValue) / fabs(expectedValue) < accuracyTarget);
|
||||
#endif
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Automatically delete and dump the vfc_probe object if ~VFC_CI~ is defined
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
#ifdef VFC_CI
|
||||
void qmckl_dump_probes() __attribute__((destructor));
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
#ifdef VFC_CI
|
||||
void __attribute__((destructor)) qmckl_dump_probes(){
|
||||
vfc_dump_probes(&probes);
|
||||
}
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
* Fortran wrappers
|
||||
|
||||
#+begin_src c :tangle (eval h_private_func)
|
||||
bool qmckl_probe_f(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double * value
|
||||
);
|
||||
|
||||
bool qmckl_probe_check_f(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double * value,
|
||||
double * expectedValue,
|
||||
double * accuracyTarget
|
||||
);
|
||||
|
||||
|
||||
bool qmckl_probe_check_relative_f(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double * value,
|
||||
double * expectedValue,
|
||||
double * accuracyTarget
|
||||
);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
bool qmckl_probe_f(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double * value)
|
||||
{
|
||||
return qmckl_probe(testName, varName, *value);
|
||||
}
|
||||
|
||||
|
||||
bool qmckl_probe_check_f(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double * value,
|
||||
double * expectedValue,
|
||||
double * accuracyTarget)
|
||||
{
|
||||
return qmckl_probe_check(
|
||||
testName, varName,
|
||||
,*value, *expectedValue, *accuracyTarget
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool qmckl_probe_check_relative_f(
|
||||
char * testName,
|
||||
char * varName,
|
||||
double * value,
|
||||
double * expectedValue,
|
||||
double * accuracyTarget)
|
||||
{
|
||||
return qmckl_probe_check_relative(
|
||||
testName, varName,
|
||||
,*value, *expectedValue, *accuracyTarget
|
||||
);
|
||||
}
|
||||
#+end_src
|
||||
|
||||
#+begin_src f90 :tangle (eval f)
|
||||
module qmckl_verificarlo_f
|
||||
interface
|
||||
logical(c_bool) function qmckl_probe &
|
||||
(testName, varName, val) &
|
||||
bind(C, name="qmckl_probe_f")
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
import
|
||||
implicit none
|
||||
|
||||
character(C_CHAR), dimension(*) :: testName
|
||||
character(C_CHAR), dimension(*) :: varName
|
||||
|
||||
real(C_DOUBLE) :: val
|
||||
end function qmckl_probe
|
||||
|
||||
logical(c_bool) function qmckl_probe_check &
|
||||
(testName, varName, val, expectedValue, accuracyTarget) &
|
||||
bind(C, name="qmckl_probe_check_f")
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
import
|
||||
implicit none
|
||||
|
||||
character(C_CHAR), dimension(*) :: testName
|
||||
character(C_CHAR), dimension(*) :: varName
|
||||
|
||||
real(C_DOUBLE) :: val
|
||||
real(C_DOUBLE) :: expectedValue
|
||||
real(C_DOUBLE) :: accuracyTarget
|
||||
end function qmckl_probe_check
|
||||
|
||||
logical(c_bool) function qmckl_probe_check_relative &
|
||||
(testName, varName, val, expectedValue, accuracyTarget) &
|
||||
bind(C, name="qmckl_probe_check_relative_f")
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
import
|
||||
implicit none
|
||||
|
||||
character(C_CHAR), dimension(*) :: testName
|
||||
character(C_CHAR), dimension(*) :: varName
|
||||
|
||||
real(C_DOUBLE) :: val
|
||||
real(C_DOUBLE) :: expectedValue
|
||||
real(C_DOUBLE) :: accuracyTarget
|
||||
end function qmckl_probe_check_relative
|
||||
end interface
|
||||
end module qmckl_verificarlo_f
|
||||
#+end_src
|
||||
|
||||
* End of files :noexport:
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
#ifndef VFC_CI
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments link :tangle (eval h_private_func)
|
||||
#endif
|
||||
#+end_src
|
@ -11,8 +11,10 @@ qmckl_local_energy.org
|
||||
qmckl_memory.org
|
||||
qmckl_mo.org
|
||||
qmckl_numprec.org
|
||||
qmckl_distance.org
|
||||
qmckl_nucleus.org
|
||||
qmckl_sherman_morrison_woodbury.org
|
||||
qmckl_tests.org
|
||||
qmckl_utils.org
|
||||
qmckl_trexio.org
|
||||
qmckl_verificarlo.org
|
||||
qmckl_tests.org
|
||||
|
@ -36,10 +36,17 @@ do
|
||||
exported=${i%.org}.exported
|
||||
exported=$(dirname $exported)/.$(basename $exported)
|
||||
NOW=$(date +"%m%d%H%M.%S")
|
||||
extract_doc ${i} > $exported
|
||||
extract_doc ${i} &> $exported
|
||||
rc=$?
|
||||
|
||||
# Make log file older than the exported files
|
||||
touch -t ${NOW} $exported
|
||||
|
||||
# Fail if tangling failed
|
||||
if [[ $rc -ne 0 ]] ; then
|
||||
cat $exported
|
||||
exit rc
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
@ -35,8 +35,13 @@ do
|
||||
tangled=${i%.org}.tangled
|
||||
tangled=$(dirname $tangled)/.$(basename $tangled)
|
||||
NOW=$(date +"%m%d%H%M.%S")
|
||||
tangle ${i} > $tangled
|
||||
|
||||
tangle ${i} &> $tangled
|
||||
rc=$?
|
||||
# Make log file older than the tangled files
|
||||
touch -t ${NOW} $tangled
|
||||
# Fail if tangling failed
|
||||
if [[ $rc -ne 0 ]] ; then
|
||||
cat $tangled
|
||||
exit rc
|
||||
fi
|
||||
done
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"make_command": "./ci_install.sh",
|
||||
"make_command": "tools/ci_install.sh",
|
||||
"executables": [
|
||||
{
|
||||
"executable": "tests/test_qmckl_distance",
|
||||
|
Loading…
Reference in New Issue
Block a user