mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-08-24 22:21:46 +02:00
Add the qmckl_probes interface (#2)
* comment * Update distance test code The distance test has been updated to the latest version, with a first attempt at using vfc_probes inside it * Functional implementation of vfc_probes in the distance tests This commit has the first functional vfc_ci tests. Verificarlo tests should be written over the existing tests, and they can be enabled with the following configure command: QMCKL_DEVEL=1 ./configure --prefix=$PWD/_install --enable-maintainer-mode --enable-vfc_ci CC="verificarlo-f -Mpreprocess -D VFC_CI" FC="verificarlo-f -Mpreprocess -D VFC_CI" --host=x86_64 The --enable-vfc_ci flag will trigger the linking of the vfc_ci library. Moreover, as of now, the "-Mpreprocess" and "-D VFC_CI" flags have to be specified directly here. There is probably an appropriate macro to place those flags into but I couldn't find it yet, and could only manage to build the tests this way. When the VFC_CI preprocessor is defined, somme additional code to register and export the test probes can be executed (see qmckl_distance.org). As of now, the tests are built as normal, even though they are expected to fail : make all make check From there, the test_qmckl_distance (and potentially the others) executable can be called at will. This will typically be done automatically by vfc_ci, but one could manually execute the executable by defining the following env variables : VFC_PROBES_OUTPUT="test.csv" VFC_BACKENDS="libinterflop_ieee.so" depending on the export file and the Verificarlo backend to be used. The next steps will be to define more tests such as this one, and to integrate them into a Verificarlo CI workflow (by writing a vfc_tests_config.json file and using the automatic CI setup command). * Error in FOrtran interface fixed * Added missing Fortran interfaces * Modify distance test and install process integration All probes are now ignored using only the preprocessor (instead of checking for a facultative argument) in the distance test. Moreover,preprocessing can now be enabled correctly using FCFLAGS (the issue seemed to come from the order of the arguments passed to gfortran/verificarlo-f with the preprocessor arg having to come first). * Add vfc_probes to AO tests vfc_probes have been added to qmckl_ao.org in the same way as qmckl_distance.org, which means that it can be enabled or disabled at compile time using the --enable-vfc_ci option. qmckl_distance.org has been slightly modified with a better indentation, and configure.ac now adds the "-D VFC_CI" flag to CFLAGS when vfc_ci is enabled. * Start work on the vfc tests config file and on a probes wrapper The goal in the next few commits is to make the integration of vfc_probes even easier by using a wrapper to vfc_probe dedicated to qmckl. This will make it easier to create a call to vfc_probe that can be ignored if VFC_CI is not defined in the preprocessor. Once this is done, the integration will be completed by trying to create an actual workflow to automatically build the library and execute CI tests. * Moved qmckl_probes out of src As of now, qmckl_probes have been moved to tools, and can be built via a bash script. This approach seems to make more sense, as this should not be a part of the library itself, but an additional tool to test it. * Functional Makefile setup to enable qmckl_probes The current setup builds qmck_probes by adding it to the main QMckl libray (by adding it to the libtool sources). The Fortran interface's module still need to be compiled separately. TODO : Clean the build setup, improve integration in qmckl_tests and update tests in qmckl_ao with the new syntax. * New probes syntax in AO tests * Clean the probes/Makefile setup The Fortran module is now built a the same time than the main library. The commit also adds a few fixes in the tests and probes wrapper. Co-authored-by: Anthony Scemama <scemama@irsamc.ups-tlse.fr>
This commit is contained in:
parent
d0eb207404
commit
145f4fba40
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,6 +22,7 @@ m4/ltversion.m4
|
|||||||
m4/lt~obsolete.m4
|
m4/lt~obsolete.m4
|
||||||
qmckl-*.tar.gz
|
qmckl-*.tar.gz
|
||||||
qmckl.mod
|
qmckl.mod
|
||||||
|
qmckl_probes_f.mod
|
||||||
qmckl.pc
|
qmckl.pc
|
||||||
stamp-h1
|
stamp-h1
|
||||||
tools/compile
|
tools/compile
|
||||||
|
20
Makefile.am
20
Makefile.am
@ -31,7 +31,6 @@
|
|||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if VFC_CI
|
if VFC_CI
|
||||||
AM_LDFLAGS=-lvfc_probes -lvfc_probes_f
|
AM_LDFLAGS=-lvfc_probes -lvfc_probes_f
|
||||||
endif
|
endif
|
||||||
@ -97,6 +96,7 @@ $(src_qmckl_fo): $(src_qmckl_f)
|
|||||||
$(src_qmckl_f): $(srcdir)/$(qmckl_f)
|
$(src_qmckl_f): $(srcdir)/$(qmckl_f)
|
||||||
cp $(srcdir)/$(qmckl_f) $(src_qmckl_f)
|
cp $(srcdir)/$(qmckl_f) $(src_qmckl_f)
|
||||||
|
|
||||||
|
|
||||||
share/doc/qmckl/html/index.html: share/doc/qmckl/html/README.html
|
share/doc/qmckl/html/index.html: share/doc/qmckl/html/README.html
|
||||||
$(ln_s_verbose)cd share/doc/qmckl/html/ && \
|
$(ln_s_verbose)cd share/doc/qmckl/html/ && \
|
||||||
rm -rf index.html && \
|
rm -rf index.html && \
|
||||||
@ -115,13 +115,14 @@ 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)
|
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) $(qmckl_probes_src) $(qmckl_probes_o) qmckl_probes_f.mod
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
tools/build_doc.sh \
|
tools/build_doc.sh \
|
||||||
tools/build_makefile.py \
|
tools/build_makefile.py \
|
||||||
tools/build_qmckl_f.sh \
|
tools/build_qmckl_f.sh \
|
||||||
tools/build_qmckl_h.sh \
|
tools/build_qmckl_h.sh \
|
||||||
|
tools/build_qmckl_probes.sh\
|
||||||
tools/config_doc.el \
|
tools/config_doc.el \
|
||||||
tools/config_tangle.el \
|
tools/config_tangle.el \
|
||||||
tools/init.el \
|
tools/init.el \
|
||||||
@ -150,14 +151,27 @@ cat_h_verbose_0 = @echo " HEADER $@";
|
|||||||
## Rules
|
## Rules
|
||||||
## =====
|
## =====
|
||||||
|
|
||||||
|
qmckl_probes_src = src/qmckl_probes.h qmckl_probes.c qmckl_probes_f.f90
|
||||||
|
qmckl_probes_o = src/qmckl_probes.o qmckl_probes_f.o
|
||||||
|
|
||||||
SUFFIXES = .f90 .h .org .c _f.f90 _func.h _type.h _private_func.h _private_type.h
|
SUFFIXES = .f90 .h .org .c _f.f90 _func.h _type.h _private_func.h _private_type.h
|
||||||
|
src_libqmckl_la_SOURCES += src/qmckl_probes.h src/qmckl_probes.c src/qmckl_probes_f.f90
|
||||||
|
|
||||||
$(qmckl_h): $(H_FUNC_FILES) $(H_TYPE_FILES)
|
$(qmckl_h): $(H_FUNC_FILES) $(H_TYPE_FILES)
|
||||||
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_h.sh
|
|
||||||
|
|
||||||
$(qmckl_f): $(FH_FUNC_FILES) $(FH_TYPE_FILES)
|
$(qmckl_f): $(FH_FUNC_FILES) $(FH_TYPE_FILES)
|
||||||
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_f.sh
|
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_f.sh
|
||||||
|
|
||||||
|
|
||||||
|
src/qmckl_probes.c: $(srcdir)/tools/qmckl_probes.c
|
||||||
|
cp $(srcdir)/tools/qmckl_probes.c $(srcdir)/src/qmckl_probes.c
|
||||||
|
|
||||||
|
src/qmckl_probes.h: $(srcdir)/tools/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
|
||||||
|
|
||||||
$(htmlize_el):
|
$(htmlize_el):
|
||||||
$(srcdir)/tools/install_htmlize.sh $(htmlize_el)
|
$(srcdir)/tools/install_htmlize.sh $(htmlize_el)
|
||||||
|
|
||||||
|
18
ci_install.sh
Executable file
18
ci_install.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This scripts is meant to be used by Verificarlo CI to automatically install
|
||||||
|
# the library dependencies and build it with Verificarlo with vfc_probes support
|
||||||
|
# enabled.
|
||||||
|
|
||||||
|
./autogen.sh
|
||||||
|
QMCKL_DEVEL=1 ./configure --prefix=$PWD/_install \
|
||||||
|
--enable-silent-rules --enable-maintainer-mode --enable-vfc_ci --host=x86_64 \
|
||||||
|
CC="verificarlo-f" FC="verificarlo-f"
|
||||||
|
|
||||||
|
make all
|
||||||
|
# Here we build the test suite, but expect it to fail because it is run without
|
||||||
|
# specifying VFC_BACKENDS. However, the generated executables will be reused
|
||||||
|
# individually by the CI.
|
||||||
|
make check
|
||||||
|
|
||||||
|
exit 0
|
@ -1,4 +1,4 @@
|
|||||||
#+TITLE: Atomic Orbitals
|
qmckl_probe(#+TITLE: Atomic Orbitals
|
||||||
#+SETUPFILE: ../tools/theme.setup
|
#+SETUPFILE: ../tools/theme.setup
|
||||||
#+INCLUDE: ../tools/lib.org
|
#+INCLUDE: ../tools/lib.org
|
||||||
|
|
||||||
@ -60,9 +60,6 @@ gradients and Laplacian of the atomic basis functions.
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "chbrclf.h"
|
#include "chbrclf.h"
|
||||||
|
|
||||||
#ifdef VFC_CI
|
|
||||||
#include <vfc_probes.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
qmckl_context context;
|
qmckl_context context;
|
||||||
@ -1399,15 +1396,12 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context, probes) bind(C)
|
|||||||
integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||||
#endif
|
#endif
|
||||||
use qmckl
|
use qmckl
|
||||||
|
use qmckl_probes_f
|
||||||
#ifdef VFC_CI
|
|
||||||
use iso_c_binding
|
|
||||||
use vfc_probes_f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer(c_int64_t), intent(in), value :: context
|
integer(c_int64_t), intent(in), value :: context
|
||||||
|
logical(C_BOOL) :: vfc_err
|
||||||
|
|
||||||
#ifdef VFC_CI
|
#ifdef VFC_CI
|
||||||
type(vfc_probes) :: probes
|
type(vfc_probes) :: probes
|
||||||
@ -1438,10 +1432,9 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
|||||||
test_qmckl_ao_gaussian_vgl = &
|
test_qmckl_ao_gaussian_vgl = &
|
||||||
qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv)
|
qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv)
|
||||||
|
|
||||||
#ifdef VFC_CI
|
vfc_err = qmckl_probe("ao"//C_NULL_CHAR, "gaussian_vgl"//C_NULL_CHAR, &
|
||||||
vfc_err = vfc_probe(probes, "ao"//C_NULL_CHAR, "gaussian_vgl"//C_NULL_CHAR, &
|
|
||||||
DBLE(test_qmckl_ao_gaussian_vgl))
|
DBLE(test_qmckl_ao_gaussian_vgl))
|
||||||
#else
|
|
||||||
if (test_qmckl_ao_gaussian_vgl /= 0) return
|
if (test_qmckl_ao_gaussian_vgl /= 0) return
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2449,21 +2442,14 @@ end function qmckl_ao_power_f
|
|||||||
integer(c_int32_t) function test_qmckl_ao_power(context, probes) bind(C)
|
integer(c_int32_t) function test_qmckl_ao_power(context, probes) bind(C)
|
||||||
#else
|
#else
|
||||||
integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
||||||
#endif
|
|
||||||
|
|
||||||
use qmckl
|
use qmckl
|
||||||
|
use qmckl_probes_f
|
||||||
#ifdef VFC_CI
|
|
||||||
use iso_c_binding
|
|
||||||
use vfc_probes_f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
#ifdef VFC_CI
|
logical(C_BOOL) :: vfc_err
|
||||||
type(vfc_probes) :: probes
|
|
||||||
integer(C_INT) :: vfc_err
|
|
||||||
#endif
|
|
||||||
|
|
||||||
integer(qmckl_context), intent(in), value :: context
|
integer(qmckl_context), intent(in), value :: context
|
||||||
|
|
||||||
@ -2487,10 +2473,9 @@ integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_ao_power = qmckl_ao_power(context, n, X, LMAX, P, LDP)
|
test_qmckl_ao_power = qmckl_ao_power(context, n, X, LMAX, P, LDP)
|
||||||
|
|
||||||
#ifdef VFC_CI
|
vfc_err = qmckl_probe("ao"//C_NULL_CHAR, "power"//C_NULL_CHAR, &
|
||||||
vfc_err = vfc_probe(probes, "ao"//C_NULL_CHAR, "power"//C_NULL_CHAR, &
|
|
||||||
DBLE(test_qmckl_ao_power))
|
DBLE(test_qmckl_ao_power))
|
||||||
#else
|
|
||||||
if (test_qmckl_ao_power /= QMCKL_SUCCESS) return
|
if (test_qmckl_ao_power /= QMCKL_SUCCESS) return
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2807,15 +2792,12 @@ integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context, probes) bind(C
|
|||||||
integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
|
integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
|
||||||
#endif
|
#endif
|
||||||
use qmckl
|
use qmckl
|
||||||
|
use qmckl_probes_f
|
||||||
#ifdef VFC_CI
|
|
||||||
use iso_c_binding
|
|
||||||
use vfc_probes_f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer(c_int64_t), intent(in), value :: context
|
integer(c_int64_t), intent(in), value :: context
|
||||||
|
logical(C_BOOL) :: vfc_err
|
||||||
|
|
||||||
#ifdef VFC_CI
|
#ifdef VFC_CI
|
||||||
type(vfc_probes) :: probes
|
type(vfc_probes) :: probes
|
||||||
@ -2847,10 +2829,9 @@ integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
|
|||||||
test_qmckl_ao_polynomial_vgl = &
|
test_qmckl_ao_polynomial_vgl = &
|
||||||
qmckl_ao_polynomial_vgl(context, X, R, lmax, n, L, ldl, VGL, ldv)
|
qmckl_ao_polynomial_vgl(context, X, R, lmax, n, L, ldl, VGL, ldv)
|
||||||
|
|
||||||
#ifdef VFC_CI
|
vfc_err = qmckl_probe("ao"//C_NULL_CHAR, "polynomial_vgl"//C_NULL_CHAR, &
|
||||||
vfc_err = vfc_probe(probes, "ao"//C_NULL_CHAR, "polynomial_vgl"//C_NULL_CHAR, &
|
|
||||||
DBLE(test_qmckl_ao_polynomial_vgl))
|
DBLE(test_qmckl_ao_polynomial_vgl))
|
||||||
#else
|
|
||||||
if (test_qmckl_ao_polynomial_vgl /= QMCKL_SUCCESS) return
|
if (test_qmckl_ao_polynomial_vgl /= QMCKL_SUCCESS) return
|
||||||
if (n /= d) return
|
if (n /= d) return
|
||||||
#endif
|
#endif
|
||||||
|
@ -290,22 +290,18 @@ end function qmckl_distance_sq_f
|
|||||||
|
|
||||||
*** Test :noexport:
|
*** Test :noexport:
|
||||||
#+begin_src f90 :tangle (eval f_test)
|
#+begin_src f90 :tangle (eval f_test)
|
||||||
#ifdef VFC_CI
|
|
||||||
integer(qmckl_exit_code) function test_qmckl_distance_sq(context, probes) bind(C)
|
|
||||||
#else
|
|
||||||
integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||||
#endif
|
|
||||||
|
|
||||||
use qmckl
|
use qmckl
|
||||||
|
use qmckl_probes_f
|
||||||
#ifdef VFC_CI
|
|
||||||
use iso_c_binding
|
use iso_c_binding
|
||||||
use vfc_probes_f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer(qmckl_context), intent(in), value :: context
|
integer(qmckl_context), intent(in), value :: context
|
||||||
|
logical(C_BOOL) :: vfc_err
|
||||||
|
|
||||||
|
|
||||||
#ifdef VFC_CI
|
#ifdef VFC_CI
|
||||||
type(vfc_probes) :: probes
|
type(vfc_probes) :: probes
|
||||||
@ -341,32 +337,28 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
|||||||
test_qmckl_distance_sq = &
|
test_qmckl_distance_sq = &
|
||||||
qmckl_distance_sq(context, 'X', 't', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance_sq(context, 'X', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
|
|
||||||
#ifdef VFC_CI
|
vfc_err = qmckl_probe("distance", "distance_sq_Xt", DBLE(test_qmckl_distance_sq))
|
||||||
print *, "About to create probe"
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
|
||||||
"distance_sq_Xt"//C_NULL_CHAR, DBLE(test_qmckl_distance_sq))
|
|
||||||
print *, "Created probe"
|
|
||||||
#else
|
|
||||||
if (test_qmckl_distance_sq == 0) return
|
if (test_qmckl_distance_sq == 0) return
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
test_qmckl_distance_sq = &
|
test_qmckl_distance_sq = &
|
||||||
qmckl_distance_sq(context, 't', 'X', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance_sq(context, 't', 'X', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
|
||||||
"distance_sq_tX"//C_NULL_CHAR, DBLE(test_qmckl_distance_sq))
|
vfc_err = qmckl_probe("distance", "distance_sq_tX", DBLE(test_qmckl_distance_sq))
|
||||||
#else
|
|
||||||
if (test_qmckl_distance_sq == 0) return
|
if (test_qmckl_distance_sq == 0) return
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
test_qmckl_distance_sq = &
|
test_qmckl_distance_sq = &
|
||||||
qmckl_distance_sq(context, 'T', 't', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance_sq(context, 'T', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_sq_Tt", DBLE(test_qmckl_distance_sq))
|
||||||
"distance_sq_Tt"//C_NULL_CHAR, DBLE(test_qmckl_distance_sq))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_distance_sq == 0) return
|
if (test_qmckl_distance_sq == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_distance_sq = QMCKL_FAILURE
|
test_qmckl_distance_sq = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -383,12 +375,11 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_distance_sq = &
|
test_qmckl_distance_sq = &
|
||||||
qmckl_distance_sq(context, 'n', 'T', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance_sq(context, 'n', 'T', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_sq_nT", DBLE(test_qmckl_distance_sq))
|
||||||
"distance_sq_nT"//C_NULL_CHAR, DBLE(test_qmckl_distance_sq))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_distance_sq == 0) return
|
if (test_qmckl_distance_sq == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_distance_sq = QMCKL_FAILURE
|
test_qmckl_distance_sq = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -405,12 +396,11 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_distance_sq = &
|
test_qmckl_distance_sq = &
|
||||||
qmckl_distance_sq(context, 'T', 'n', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance_sq(context, 'T', 'n', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_sq_Tn", DBLE(test_qmckl_distance_sq))
|
||||||
"distance_sq_Tn"//C_NULL_CHAR, DBLE(test_qmckl_distance_sq))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_distance_sq == 0) return
|
if (test_qmckl_distance_sq == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_distance_sq = QMCKL_FAILURE
|
test_qmckl_distance_sq = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -427,12 +417,10 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_distance_sq = &
|
test_qmckl_distance_sq = &
|
||||||
qmckl_distance_sq(context, 'n', 'N', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance_sq(context, 'n', 'N', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_sq_nN", DBLE(test_qmckl_distance_sq))
|
||||||
"distance_sq_nN"//C_NULL_CHAR, DBLE(test_qmckl_distance_sq))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_distance_sq == 0) return
|
if (test_qmckl_distance_sq == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_distance_sq = QMCKL_FAILURE
|
test_qmckl_distance_sq = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -452,13 +440,8 @@ end function test_qmckl_distance_sq
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src c :comments link :tangle (eval c_test)
|
#+begin_src c :comments link :tangle (eval c_test)
|
||||||
#ifdef VFC_CI
|
|
||||||
qmckl_exit_code test_qmckl_distance_sq(qmckl_context context, vfc_probes * probes);
|
|
||||||
assert(test_qmckl_distance_sq(context, &probes) == QMCKL_SUCCESS);
|
|
||||||
#else
|
|
||||||
qmckl_exit_code test_qmckl_distance_sq(qmckl_context context);
|
qmckl_exit_code test_qmckl_distance_sq(qmckl_context context);
|
||||||
assert(test_qmckl_distance_sq(context) == QMCKL_SUCCESS);
|
assert(test_qmckl_distance_sq(context) == QMCKL_SUCCESS);
|
||||||
#endif
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* Distance
|
* Distance
|
||||||
|
|
||||||
@ -755,23 +738,17 @@ end function qmckl_distance_f
|
|||||||
|
|
||||||
*** Test :noexport:
|
*** Test :noexport:
|
||||||
#+begin_src f90 :tangle (eval f_test)
|
#+begin_src f90 :tangle (eval f_test)
|
||||||
#ifdef VFC_CI
|
|
||||||
integer(qmckl_exit_code) function test_qmckl_dist(context, probes) bind(C)
|
|
||||||
#else
|
|
||||||
integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
||||||
#endif
|
|
||||||
use qmckl
|
use qmckl
|
||||||
#ifdef VFC_CI
|
use qmckl_probes_f
|
||||||
use iso_c_binding
|
use iso_c_binding
|
||||||
use vfc_probes_f
|
|
||||||
#endif
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer(qmckl_context), intent(in), value :: context
|
integer(qmckl_context), intent(in), value :: context
|
||||||
#ifdef VFC_CI
|
logical(C_BOOL) :: vfc_err
|
||||||
type(vfc_probes) :: probes
|
|
||||||
integer(C_INT) :: vfc_err
|
|
||||||
#endif
|
|
||||||
|
|
||||||
double precision, allocatable :: A(:,:), B(:,:), C(:,:)
|
double precision, allocatable :: A(:,:), B(:,:), C(:,:)
|
||||||
integer*8 :: m, n, LDA, LDB, LDC
|
integer*8 :: m, n, LDA, LDB, LDC
|
||||||
@ -799,30 +776,27 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_dist = &
|
test_qmckl_dist = &
|
||||||
qmckl_distance(context, 'X', 't', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance(context, 'X', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_Xt", DBLE(test_qmckl_dist))
|
||||||
"distance_Xt"//C_NULL_CHAR, DBLE(test_qmckl_dist))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_dist == 0) return
|
if (test_qmckl_dist == 0) return
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
test_qmckl_dist = &
|
test_qmckl_dist = &
|
||||||
qmckl_distance(context, 't', 'X', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance(context, 't', 'X', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_tX", DBLE(test_qmckl_dist))
|
||||||
"distance_tX"//C_NULL_CHAR, DBLE(test_qmckl_dist))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_dist == 0) return
|
if (test_qmckl_dist == 0) return
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
test_qmckl_dist = &
|
test_qmckl_dist = &
|
||||||
qmckl_distance(context, 'T', 't', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance(context, 'T', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_Tt", DBLE(test_qmckl_dist))
|
||||||
"distance_Tt"//C_NULL_CHAR, DBLE(test_qmckl_dist))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_dist == 0) return
|
if (test_qmckl_dist == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_dist = QMCKL_FAILURE
|
test_qmckl_dist = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -839,12 +813,11 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_dist = &
|
test_qmckl_dist = &
|
||||||
qmckl_distance(context, 'n', 'T', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance(context, 'n', 'T', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_nT", DBLE(test_qmckl_dist))
|
||||||
"distance_nT"//C_NULL_CHAR, DBLE(test_qmckl_dist))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_dist == 0) return
|
if (test_qmckl_dist == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_dist = QMCKL_FAILURE
|
test_qmckl_dist = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -861,12 +834,11 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_dist = &
|
test_qmckl_dist = &
|
||||||
qmckl_distance(context, 'T', 'n', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance(context, 'T', 'n', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_Tn", DBLE(test_qmckl_dist))
|
||||||
"distance_Tn"//C_NULL_CHAR, DBLE(test_qmckl_dist))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_dist == 0) return
|
if (test_qmckl_dist == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_dist = QMCKL_FAILURE
|
test_qmckl_dist = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -883,12 +855,11 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
|||||||
|
|
||||||
test_qmckl_dist = &
|
test_qmckl_dist = &
|
||||||
qmckl_distance(context, 'n', 'N', m, n, A, LDA, B, LDB, C, LDC)
|
qmckl_distance(context, 'n', 'N', m, n, A, LDA, B, LDB, C, LDC)
|
||||||
#ifdef VFC_CI
|
|
||||||
vfc_err = vfc_probe(probes, "distance"//C_NULL_CHAR, &
|
vfc_err = qmckl_probe("distance", "distance_nN", DBLE(test_qmckl_dist))
|
||||||
"distance_nN"//C_NULL_CHAR, DBLE(test_qmckl_dist))
|
|
||||||
#else
|
|
||||||
if (test_qmckl_dist == 0) return
|
if (test_qmckl_dist == 0) return
|
||||||
#endif
|
|
||||||
|
|
||||||
test_qmckl_dist = QMCKL_FAILURE
|
test_qmckl_dist = QMCKL_FAILURE
|
||||||
|
|
||||||
@ -910,13 +881,8 @@ end function test_qmckl_dist
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src c :comments link :tangle (eval c_test)
|
#+begin_src c :comments link :tangle (eval c_test)
|
||||||
#ifdef VFC_CI
|
|
||||||
qmckl_exit_code test_qmckl_dist(qmckl_context context, vfc_probes * probes);
|
|
||||||
assert(test_qmckl_dist(context, &probes) == QMCKL_SUCCESS);
|
|
||||||
#else
|
|
||||||
qmckl_exit_code test_qmckl_dist(qmckl_context context);
|
qmckl_exit_code test_qmckl_dist(qmckl_context context);
|
||||||
assert(test_qmckl_dist(context) == QMCKL_SUCCESS);
|
assert(test_qmckl_dist(context) == QMCKL_SUCCESS);
|
||||||
#endif
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Rescaled Distance
|
* Rescaled Distance
|
||||||
@ -1577,11 +1543,8 @@ end function qmckl_distance_rescaled_deriv_e_f
|
|||||||
* End of files :noexport:
|
* End of files :noexport:
|
||||||
|
|
||||||
#+begin_src c :comments link :tangle (eval c_test)
|
#+begin_src c :comments link :tangle (eval c_test)
|
||||||
assert (qmckl_context_destroy(context) == QMCKL_SUCCESS);
|
|
||||||
|
|
||||||
#ifdef VFC_CI
|
assert (qmckl_context_destroy(context) == QMCKL_SUCCESS);
|
||||||
vfc_dump_probes(&probes);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
105
tools/qmckl_probes.c
Normal file
105
tools/qmckl_probes.c
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef VFC_CI
|
||||||
|
#include <vfc_probes.h>
|
||||||
|
vfc_probes probes;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Wrappers to Verificarlo functions
|
||||||
|
|
||||||
|
#ifdef VFC_CI
|
||||||
|
void __attribute__((constructor)) qmckl_init_probes(){
|
||||||
|
probes = vfc_init_probes();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
bool qmckl_probe(
|
||||||
|
char * testName,
|
||||||
|
char * varName,
|
||||||
|
double value
|
||||||
|
) {
|
||||||
|
#ifdef VFC_CI
|
||||||
|
return vfc_probe(&probes, testName, varName, value);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 !(value == expectedValue);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 !(value <= expectedValue + accuracyTarget || value >= expectedValue - accuracyTarget);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void __attribute__((destructor)) qmckl_dump_probes(){
|
||||||
|
#ifdef VFC_CI
|
||||||
|
vfc_dump_probes(&probes);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Fortran wrappers
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
65
tools/qmckl_probes.h
Normal file
65
tools/qmckl_probes.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VFC_CI
|
||||||
|
#include <vfc_probes.h>
|
||||||
|
extern vfc_probes * probes;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Wrappers to Verificarlo functions
|
||||||
|
|
||||||
|
#ifdef VFC_CI
|
||||||
|
void qmckl_init_probes() __attribute__((constructor));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool qmckl_probe(
|
||||||
|
char * testName,
|
||||||
|
char * varName,
|
||||||
|
double value
|
||||||
|
);
|
||||||
|
|
||||||
|
bool qmckl_probe_check(
|
||||||
|
char * testName,
|
||||||
|
char * varName,
|
||||||
|
double value,
|
||||||
|
double expectedValue,
|
||||||
|
double accuracyTarget
|
||||||
|
);
|
||||||
|
|
||||||
|
bool qmckl_probe_check_relative(
|
||||||
|
char * testName,
|
||||||
|
char * varName,
|
||||||
|
double value,
|
||||||
|
double expectedValue,
|
||||||
|
double accuracyTarget
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef VFC_CI
|
||||||
|
void qmckl_dump_probes() __attribute__((destructor));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Fortran wrappers
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
49
tools/qmckl_probes_f.f90
Normal file
49
tools/qmckl_probes_f.f90
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
module qmckl_probes_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_probes_f
|
19
vfc_tests_config.json
Normal file
19
vfc_tests_config.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"make_command": "./ci_install.sh",
|
||||||
|
"executables": [
|
||||||
|
{
|
||||||
|
"executable": "tests/test_qmckl_distance",
|
||||||
|
"vfc_backends": [{
|
||||||
|
"name": "libinterflop_mca.so",
|
||||||
|
"repetitions": 25
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"executable": "tests/test_qmckl_ao",
|
||||||
|
"vfc_backends": [{
|
||||||
|
"name": "libinterflop_mca.so",
|
||||||
|
"repetitions": 25
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user