From d9cfebba5070cc37a609033389a6231b51a6af0f Mon Sep 17 00:00:00 2001 From: v1j4y Date: Mon, 6 Dec 2021 15:32:24 +0100 Subject: [PATCH 1/7] Added chameleon support. --- configure.ac | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/configure.ac b/configure.ac index fa3277d..8d432c7 100644 --- a/configure.ac +++ b/configure.ac @@ -105,6 +105,52 @@ AC_CHECK_LIB([pthread], [pthread_create]) # CFLAGS="${CFLAGS} ${OPENMP_CFLAGS}" #fi +# CHAMELEON +AC_ARG_WITH(chameleon, + AS_HELP_STRING([--without-chameleon], + [Do not use Chameleon. Default: auto-detect]), [ +case "$with_chameleon" in + no) + : ;; + yes) + PKG_CHECK_MODULES([LIBCHAMELEON],[chameleon >= 1.0.0], + [PKG_CFLAGS="$PKG_CFLAGS $LIBCHAMELEON_CFLAGS" + PKG_LIBS="$PKG_LIBS $LIBCHAMELEON_LIBS"] + ,[ + + ## something went wrong. + ## try to find the package without pkg-config + + ## check that the library is actually new enough. + ## by testing for a 1.0.0+ function which we use + AC_CHECK_LIB(chameleon,CHAMELEON_finalize,[LIBCHAMELEON_LIBS="-lchameleon"]) + ]) + AH_TEMPLATE(HAVE_CHAMELEON,[Chameleon support is available]) + ;; + *) + if test ! -d "$withval" ; then + AC_MSG_ERROR([--with-chameleon path does not point to a directory]) + fi + LIBCHAMELEON_LIBS="-L$with_chameleon/lib -lchameleon -lchameleon_starpu -lhqr -lcoreblas" + LIBCHAMELEON_CFLAGS="-I$with_chameleon/include $CFLAGS" + LIBCHAMELEON_CPPFLAGS="-I$with_chameleon/include $CPPFLAGS" + esac +]) + +if test "x$LIBCHAMELEON_LIBS" != "x" ; then + LIBS="$LIBS $LIBCHAMELEON_LIBS" + CFLAGS="$CFLAGS $LIBCHAMELEON_CFLAGS" + CPPFLAGS="$CPPFLAGS $LIBCHAMELEON_CPPFLAGS" + AC_CHECK_HEADERS([chameleon.h], [], [AC_MSG_ERROR("chamelon.h not found")]) + AC_DEFINE_UNQUOTED([HAVE_CHAMELEON],1,[CHAMELEON support is available]) +fi + +#AS_IF([test "x$with_chameleon" != "xno"], [ +#]) + +AC_MSG_NOTICE([CHAMELEON library support: ${with_CHAMELEON:=auto} ${LIBCHAMELEON_PATH} ${LIBCHAMELEON_LIBS}]) + + # TREXIO AC_ARG_WITH(trexio, [AS_HELP_STRING([--without-trexio],[disable support for TREXIO])], @@ -280,6 +326,7 @@ FC..............: ${FC} FCLAGS..........: ${FCFLAGS} LDFLAGS:........: ${LDFLAGS} LIBS............: ${LIBS} +USE CHAMELEON...: ${with_chameleon} Package features: ${ARGS} From e8a7b1a3f6dc6bcc68315043506b4c027cb390c9 Mon Sep 17 00:00:00 2001 From: v1j4y Date: Thu, 27 Jan 2022 16:35:39 +0100 Subject: [PATCH 2/7] compute_asymp_jasb started. --- org/qmckl_jastrow.org | 44 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/org/qmckl_jastrow.org b/org/qmckl_jastrow.org index ad6826f..17fa2b8 100644 --- a/org/qmckl_jastrow.org +++ b/org/qmckl_jastrow.org @@ -13,7 +13,6 @@ these factors along with their derivatives. (org-babel-lob-ingest "../tools/lib.org") #+end_src - #+begin_src c :tangle (eval h_private_func) #ifndef QMCKL_JASTROW_HPF #define QMCKL_JASTROW_HPF @@ -1328,48 +1327,37 @@ integer function qmckl_compute_asymp_jasb_f(context, bord_num, bord_vector, resc x = x * kappa_inv asymp_jasb(i) = asymp_jasb(i) + bord_vector(p + 1) * x end do - end do + end function qmckl_compute_asymp_jasb_f #+end_src +#+begin_src c :tangle (eval c) +qmckl_exit_code qmckl_compute_asymp_jasb ( + const qmckl_context context, + const int64_t bord_num, + const double* bord_vector, + const double rescale_factor_kappa_ee, + double* const asymp_jasb ) { + // Put some code here + + return QMCKL_SUCCESS; +} // end function qmckl_exit_code +#+end_src + #+CALL: generate_c_header(table=qmckl_asymp_jasb_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+RESULTS: - #+BEGIN_src c :tangle (eval h_func) :comments org + #+begin_src c :tangle (eval h_func) :comments org qmckl_exit_code qmckl_compute_asymp_jasb ( const qmckl_context context, const int64_t bord_num, const double* bord_vector, const double rescale_factor_kappa_ee, double* const asymp_jasb ); - #+END_src + #+end_src - #+CALL: generate_c_interface(table=qmckl_asymp_jasb_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - - #+RESULTS: - #+BEGIN_src f90 :tangle (eval f) :comments org :exports none - integer(c_int32_t) function qmckl_compute_asymp_jasb & - (context, bord_num, bord_vector, rescale_factor_kappa_ee, asymp_jasb) & - bind(C) result(info) - - use, intrinsic :: iso_c_binding - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: bord_num - real (c_double ) , intent(in) :: bord_vector(bord_num + 1) - real (c_double ) , intent(in) , value :: rescale_factor_kappa_ee - real (c_double ) , intent(out) :: asymp_jasb(2) - - integer(c_int32_t), external :: qmckl_compute_asymp_jasb_f - info = qmckl_compute_asymp_jasb_f & - (context, bord_num, bord_vector, rescale_factor_kappa_ee, asymp_jasb) - - end function qmckl_compute_asymp_jasb - #+END_src - *** Test #+name: asymp_jasb #+begin_src python :results output :exports none :noweb yes From 158c2afb411646699ce27309a1c862f32afa5703 Mon Sep 17 00:00:00 2001 From: v1j4y Date: Thu, 27 Jan 2022 16:38:28 +0100 Subject: [PATCH 3/7] Fixed edits. --- org/qmckl_jastrow.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org/qmckl_jastrow.org b/org/qmckl_jastrow.org index 17fa2b8..0beaaa1 100644 --- a/org/qmckl_jastrow.org +++ b/org/qmckl_jastrow.org @@ -1327,7 +1327,7 @@ integer function qmckl_compute_asymp_jasb_f(context, bord_num, bord_vector, resc x = x * kappa_inv asymp_jasb(i) = asymp_jasb(i) + bord_vector(p + 1) * x end do - + end do end function qmckl_compute_asymp_jasb_f #+end_src From eb34535d22f1eeb0d7eefa8b0d9f9ef82a9f90d1 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:21:29 +0100 Subject: [PATCH 4/7] Test QMCkl with the latest TREXIO + MacOS CI (#58) * FIX: update the metadata group of the TREXIO file This change is required to make `test_qmckl_trexio` pass with the recent additions to the TREXIO (see `unsafe` attribute of the metadata group). * Install the latest TREXIO in GH actions * Enable CI test on MacOS * Fix TREXIO installation on MacOS * Update TREXIO pkg-config path * Change PKG_CONFIG_PATH * Fix F77 issue of autoconf * Disable useless F77 check --- .github/workflows/test-build.yml | 108 +++++++++++++-------- configure.ac | 1 - share/qmckl/test_data/chbrclf/metadata.txt | 3 +- 3 files changed, 68 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index e49d444..a4dd421 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -18,70 +18,94 @@ jobs: - name: Install dependencies run: sudo apt-get install emacs autoconf libhdf5-dev - - name: Install trexio + #- name: Install trexio from the distribution tarball + # run: | + # export TAG=v2.1.0 + # export VERSION=2.1.0 + # wget https://github.com/TREX-CoE/trexio/releases/download/${TAG}/trexio-${VERSION}.tar.gz + # tar -zxf trexio-${VERSION}.tar.gz + # cd trexio-${VERSION} + # ./configure --prefix=/usr + # make -j 4 + # sudo make install + - name: Install the latest TREXIO from the GitHub clone run: | - export TAG=v2.1.0 - export VERSION=2.1.0 - wget https://github.com/TREX-CoE/trexio/releases/download/${TAG}/trexio-${VERSION}.tar.gz - tar -zxf trexio-${VERSION}.tar.gz - cd trexio-${VERSION} + git clone https://github.com/TREX-CoE/trexio.git + cd trexio + ./autogen.sh ./configure --prefix=/usr - make -j 8 + make -j 4 sudo make install - - name: Build + - name: Build QMCkl run: | ./autogen.sh ./configure --enable-silent-rules --enable-debug - make -j 8 + make -j 4 - name: Run test - run: | - make -j check + run: make -j 4 check - name: Archive test log file if: failure() uses: actions/upload-artifact@v2 with: - name: test-report + name: test-report-ubuntu path: test-suite.log - name: Dist test - run: | - make distcheck + run: make distcheck - name: Archive test log file if: failure() uses: actions/upload-artifact@v2 with: - name: dist-report + name: dist-report-ubuntu path: test-suite.log + x86_macos: -# x86_macos: -# -# runs-on: macos-latest -# name: x86 MacOS latest -# -# steps: -# - uses: actions/checkout@v2 -# - name: install dependencies -# run: | -# brew install gfortran-10 -# brew install emacs -# brew install autoconf automake libtool -# - name: install trexio -# run: | -# wget https://github.com/TREX-CoE/trexio/releases/download/v1.0/trexio-1.0.0.tar.gz -# tar -zxf trexio-1.0.0.tar.gz -# cd trexio-1.0.0 -# ./configure -# make -j 8 -# sudo make install -# - name: Run test -# run: | -# ./autogen.sh -# ./configure --enable-silent-rules --enable-debug -# make -j 8 -# make -j check -# make distcheck + runs-on: macos-latest + name: x86 MacOS latest + + steps: + - uses: actions/checkout@v2 + - name: install dependencies + run: brew install emacs hdf5 automake pkg-config + + - name: Symlink gfortran (macOS) + if: runner.os == 'macOS' + run: | + # make sure gfortran is available + # https://github.com/actions/virtual-environments/issues/2524 + # https://github.com/cbg-ethz/dce/blob/master/.github/workflows/pkgdown.yaml + sudo ln -s /usr/local/bin/gfortran-10 /usr/local/bin/gfortran + sudo mkdir /usr/local/gfortran + sudo ln -s /usr/local/Cellar/gcc@10/*/lib/gcc/10 /usr/local/gfortran/lib + gfortran --version + + - name: Install the latest TREXIO from the GitHub clone + run: | + git clone https://github.com/TREX-CoE/trexio.git + cd trexio + ./autogen.sh + ./configure --prefix=${PWD}/_install --enable-silent-rules + make -j 4 + make install + + - name: Build QMCkl + run: | + export PKG_CONFIG_PATH=${PWD}/trexio/_install/lib/pkgconfig:$PKG_CONFIG_PATH + ./autogen.sh + ./configure --enable-silent-rules --enable-debug + make -j 4 + + - name: Run test + run: make -j 4 check + + - name: Archive test log file + if: failure() + uses: actions/upload-artifact@v2 + with: + name: test-report-macos + path: test-suite.log diff --git a/configure.ac b/configure.ac index 3e0b83e..1f58783 100644 --- a/configure.ac +++ b/configure.ac @@ -75,7 +75,6 @@ AC_PROG_CC m4_version_prereq([2.70],[], [AC_PROG_CC_C99]) AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])]) AC_PROG_CC_C_O -AC_PROG_F77 AC_PROG_FC AC_PROG_FC_C_O AC_FC_SRCEXT([f90]) diff --git a/share/qmckl/test_data/chbrclf/metadata.txt b/share/qmckl/test_data/chbrclf/metadata.txt index 834b9f7..b2f0327 100644 --- a/share/qmckl/test_data/chbrclf/metadata.txt +++ b/share/qmckl/test_data/chbrclf/metadata.txt @@ -2,9 +2,10 @@ rank_metadata_code 0 rank_metadata_author 0 metadata_code_num_isSet 0 metadata_author_num_isSet 0 +metadata_unsafe_isSet 0 len_metadata_package_version 6 metadata_package_version -2.0.0 +2.2.0 len_metadata_description 0 metadata_description metadata_code From f6f346d5117b040647e95cba8284a2f3fc1fcd6c Mon Sep 17 00:00:00 2001 From: Gianfranco Abrusci Date: Wed, 2 Feb 2022 16:37:26 +0100 Subject: [PATCH 5/7] seg fault at qmckl_compute_asymp_jasb --- org/qmckl_jastrow.org | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/org/qmckl_jastrow.org b/org/qmckl_jastrow.org index 0beaaa1..15223ea 100644 --- a/org/qmckl_jastrow.org +++ b/org/qmckl_jastrow.org @@ -1340,8 +1340,36 @@ qmckl_exit_code qmckl_compute_asymp_jasb ( const double rescale_factor_kappa_ee, double* const asymp_jasb ) { // Put some code here + int64_t i, p, info; + double kappa_inv, x, asym_one; - return QMCKL_SUCCESS; + kappa_inv = 1.0/ rescale_factor_kappa_ee; + + info = QMCKL_SUCCESS; + + if (context == QMCKL_NULL_CONTEXT){ + info = QMCKL_INVALID_CONTEXT; + return info; + } + + if (bord_num <= 0) { + info = QMCKL_INVALID_ARG_2; + return info; + } + asym_one = bord_vector[0] * kappa_inv / (1.0 + bord_vector[1] * kappa_inv); + asymp_jasb[0] = asym_one; + asymp_jasb[1] = 0.5 * asym_one; + + for (int i=0; i<=1; ++i) { + x = kappa_inv; + + for (int p = 1; p < bord_num-1; ++i){ + x = x * kappa_inv; + asymp_jasb[i] = asymp_jasb[i] + bord_vector[p + 1] * x; + } + } + + return info; } // end function qmckl_exit_code #+end_src From 67f80532f99f371967c8934d98fee2f3df676ea6 Mon Sep 17 00:00:00 2001 From: Gianfranco Abrusci Date: Wed, 2 Feb 2022 18:21:40 +0100 Subject: [PATCH 6/7] still failing --- org/qmckl_jastrow.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org/qmckl_jastrow.org b/org/qmckl_jastrow.org index 15223ea..7c37818 100644 --- a/org/qmckl_jastrow.org +++ b/org/qmckl_jastrow.org @@ -1340,7 +1340,7 @@ qmckl_exit_code qmckl_compute_asymp_jasb ( const double rescale_factor_kappa_ee, double* const asymp_jasb ) { // Put some code here - int64_t i, p, info; + int64_t info; double kappa_inv, x, asym_one; kappa_inv = 1.0/ rescale_factor_kappa_ee; @@ -1363,7 +1363,7 @@ qmckl_exit_code qmckl_compute_asymp_jasb ( for (int i=0; i<=1; ++i) { x = kappa_inv; - for (int p = 1; p < bord_num-1; ++i){ + for (int p = 1; p < bord_num; ++i){ x = x * kappa_inv; asymp_jasb[i] = asymp_jasb[i] + bord_vector[p + 1] * x; } From 6a0c54f48c4df59ec8481a6239c027a0f6b64e7c Mon Sep 17 00:00:00 2001 From: Gianfranco Abrusci Date: Thu, 3 Feb 2022 11:40:54 +0100 Subject: [PATCH 7/7] fixed seg fault: incremented wrong counter --- org/qmckl_jastrow.org | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/org/qmckl_jastrow.org b/org/qmckl_jastrow.org index 7c37818..c70ef9f 100644 --- a/org/qmckl_jastrow.org +++ b/org/qmckl_jastrow.org @@ -1332,45 +1332,40 @@ integer function qmckl_compute_asymp_jasb_f(context, bord_num, bord_vector, resc end function qmckl_compute_asymp_jasb_f #+end_src -#+begin_src c :tangle (eval c) +#+begin_src c :comments org :tangle (eval c) :noweb yes qmckl_exit_code qmckl_compute_asymp_jasb ( const qmckl_context context, const int64_t bord_num, const double* bord_vector, const double rescale_factor_kappa_ee, double* const asymp_jasb ) { - // Put some code here - int64_t info; + // What is wrong here? double kappa_inv, x, asym_one; - kappa_inv = 1.0/ rescale_factor_kappa_ee; - - info = QMCKL_SUCCESS; + kappa_inv = 1.0 / rescale_factor_kappa_ee; if (context == QMCKL_NULL_CONTEXT){ - info = QMCKL_INVALID_CONTEXT; - return info; + return QMCKL_INVALID_CONTEXT; } if (bord_num <= 0) { - info = QMCKL_INVALID_ARG_2; - return info; + return QMCKL_INVALID_ARG_2; } + asym_one = bord_vector[0] * kappa_inv / (1.0 + bord_vector[1] * kappa_inv); asymp_jasb[0] = asym_one; asymp_jasb[1] = 0.5 * asym_one; - for (int i=0; i<=1; ++i) { + for (int i = 0 ; i <= 1; ++i) { x = kappa_inv; - - for (int p = 1; p < bord_num; ++i){ + for (int p = 1; p < bord_num; ++p){ x = x * kappa_inv; asymp_jasb[i] = asymp_jasb[i] + bord_vector[p + 1] * x; } } - return info; -} // end function qmckl_exit_code + return QMCKL_SUCCESS; +} #+end_src #+CALL: generate_c_header(table=qmckl_asymp_jasb_args,rettyp=get_value("CRetType"),fname=get_value("Name"))