Skip to content

Commit

Permalink
some conflicts later...
Browse files Browse the repository at this point in the history
  • Loading branch information
EmielSlootman committed Dec 23, 2024
2 parents 467411c + ac5d553 commit 538a929
Show file tree
Hide file tree
Showing 9 changed files with 4,993 additions and 3,616 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
./autogen.sh
mkdir _build
cd _build
../configure --enable-silent-rules --enable-python
../configure --enable-python
make -j 4
sudo make install
Expand All @@ -45,8 +45,8 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-report-ubuntu
path: test-suite.log
name: qmckl-standard
path: _build/test-suite.log

- name: Dist test
run: make distcheck
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
./autogen.sh
mkdir _build_debug
cd _build_debug
../configure --enable-debug --enable-silent-rules
../configure --enable-debug --disable-doc
make -j2
- name: Run test
Expand All @@ -105,7 +105,7 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-report-ubuntu-debug
name: qmckl-debug
path: _build_debug/test-suite.log

hpc:
Expand All @@ -124,7 +124,7 @@ jobs:
git clone https://github.com/TREX-CoE/trexio.git
cd trexio
./autogen.sh
./configure --prefix=/usr
./configure --prefix=/usr
make -j 4
sudo make install
Expand All @@ -133,7 +133,7 @@ jobs:
./autogen.sh
mkdir _build_hpc
cd _build_hpc
../configure --enable-hpc
../configure --enable-hpc --disable-doc
make -j2
- name: Run test
Expand All @@ -144,7 +144,7 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-report-ubuntu-debug
name: qmckl-hpc
path: _build_hpc/test-suite.log

macos:
Expand Down Expand Up @@ -189,6 +189,6 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-report-macos-x86
name: qmckl-macos-x86
path: _build_hpc/test-suite.log

3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ qmckl_h = include/qmckl.h
qmckl_f = include/qmckl_f.F90
qmckl_fo = include/qmckl_f.o
include_HEADERS = $(qmckl_h) $(qmckl_f)
test_headers = include/chbrclf.h include/n2.h

QMCKL_TEST_DIR = $(abs_srcdir)/share/qmckl/test_data/

Expand Down Expand Up @@ -76,7 +77,7 @@ ln_s_verbose_0 = @echo " LN_S $<";

# Include Guix manifest in the source code distribution tarball
tools_qmckl_scm = tools/qmckl.scm
EXTRA_DIST += $(tools_qmckl_scm)
EXTRA_DIST += $(tools_qmckl_scm) $(test_headers)

# Documentation rules
if HAVE_DOC
Expand Down
13 changes: 10 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ AC_ARG_WITH([ifort],

AS_IF([test "x$with_ifort" = "xyes"], [
FC=ifort
FCFLAGS="-march=native -ip -Ofast -ftz -finline -g -mkl=sequential" ])
FCFLAGS="-march=native -ip -O3 -finline -g -mkl=sequential" ])

# Intel C compiler
AC_ARG_WITH([icx],
Expand All @@ -66,7 +66,7 @@ AC_ARG_WITH([icx],

AS_IF([test "x$with_icx" = "xyes"], [
CC=icx
CFLAGS="-march=native -Ofast -finline -g -qmkl=sequential" ])
CFLAGS="-march=native -O3 -finline -g -qmkl=sequential" ])

AS_IF([test "x$with_icx.$with_ifort" = "xyes.yes"], [
ax_blas_ok="yes"
Expand All @@ -82,7 +82,7 @@ AC_ARG_WITH([icc],

AS_IF([test "x$with_icc" = "xyes"], [
CC=icc
CFLAGS="-march=native -ip -Ofast -ftz -finline -g -mkl=sequential" ])
CFLAGS="-march=native -ip -O3 -finline -g -mkl=sequential" ])

AS_IF([test "x$with_icc.$with_ifort" = "xyes.yes"], [
ax_blas_ok="yes"
Expand Down Expand Up @@ -359,6 +359,13 @@ AS_IF([test "x$ok" = "xyes"], [
])


AC_ARG_ENABLE(sanitizer, [AS_HELP_STRING([--enable-sanitizer],[enable sanitizer debug flags])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
CFLAGS="${CFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=bounds -fsanitize=bounds-strict"
FCFLAGS="${FCFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=bounds -fsanitize=bounds-strict"
fi



##

Expand Down
12 changes: 11 additions & 1 deletion include/n2.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ double n2_nucl_coord[3][n2_nucl_num] =
#define n2_elec_up_num ((int64_t) 5)
#define n2_elec_dn_num ((int64_t) 5)
#define n2_elec_num ((int64_t) 10)
#define n2_walk_num ((int64_t) 1)
#define n2_walk_num ((int64_t) 2)

double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
{-0.250655104764153 , 0.503070975550133 , -0.166554344502303},
Expand All @@ -22,6 +22,16 @@ double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
{-0.232271834949124 , -1.059321673434182E-002 , -0.504862241464867},
{ 1.09360863531826 , -2.036103063808752E-003 , -2.702796910818986E-002},
{-0.108090166832043 , 0.189161729653261 , 2.15398313919894},
{ 0.397978144318712 , -0.254277292595981 , 2.54553335476344}},{
{-0.108090166832043 , 0.189161729653261 , 2.15398313919894},
{ 1.09360863531826 , -2.036103063808752E-003 , -2.702796910818986E-002},
{-0.232271834949124 , -1.059321673434182E-002 , -0.504862241464867},
{-0.127732483187947 , -0.138975497694196 , -8.669850480215846E-002},
{ 0.766647499681200 , -0.293515395797937 , 3.66454589201239 },
{-4.901239896295210E-003 , -1.120440036458986E-002 , 1.99761909330422 },
{ 1.61335569047166 , -0.615556732874863 , -1.43165470979934 },
{-0.587812193472177 , -0.128751981129274 , 0.187773606533075},
{-0.250655104764153 , 0.503070975550133 , -0.166554344502303},
{ 0.397978144318712 , -0.254277292595981 , 2.54553335476344}}};

/* Jastrow related */
Expand Down
58 changes: 49 additions & 9 deletions org/qmckl_electron.org
Original file line number Diff line number Diff line change
Expand Up @@ -678,25 +678,32 @@ for (int64_t i=0 ; i<3*elec_num*walk_num ; ++i) {
*** Get

#+begin_src c :comments org :tangle (eval h_func) :noweb yes
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance);
qmckl_exit_code
qmckl_get_electron_ee_distance(qmckl_context context,
double* const distance,
const int64_t size_max);
#+end_src

#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_electron_ee_distance(context, distance) &
integer(c_int32_t) function qmckl_get_electron_ee_distance(context, distance, size_max) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
real (c_double ) , intent(out) :: distance(*)
integer (c_int64_t) , intent(in) :: size_max
end function
end interface
#+end_src


#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance)
qmckl_exit_code
qmckl_get_electron_ee_distance(qmckl_context context,
double* const distance,
const int64_t size_max)
{
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return QMCKL_NULL_CONTEXT;
Expand All @@ -707,10 +714,23 @@ qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* co
rc = qmckl_provide_ee_distance(context);
if (rc != QMCKL_SUCCESS) return rc;

if (distance == NULL) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_get_electron_ee_distance",
"distance is a null pointer");
}

qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
assert (ctx != NULL);

size_t sze = ctx->electron.num * ctx->electron.num * ctx->electron.walker.num;
const int64_t sze = ctx->electron.num * ctx->electron.num * ctx->electron.walker.num;
if (size_max < sze) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_3,
"qmckl_get_electron_ee_distance",
"size_max < num*num*walk_num");
}
memcpy(distance, ctx->electron.ee_distance, sze * sizeof(double));

return QMCKL_SUCCESS;
Expand Down Expand Up @@ -901,7 +921,7 @@ assert(qmckl_electron_provided(context));


double ee_distance[walk_num * elec_num * elec_num];
rc = qmckl_get_electron_ee_distance(context, ee_distance);
rc = qmckl_get_electron_ee_distance(context, ee_distance, walk_num * elec_num * elec_num);

// (e1,e2,w)
// (0,0,0) == 0.
Expand Down Expand Up @@ -1133,24 +1153,31 @@ qmckl_check(context, rc);
*** Get

#+begin_src c :comments org :tangle (eval h_func) :noweb yes
qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance);
qmckl_exit_code
qmckl_get_electron_en_distance(qmckl_context context,
double* const distance,
const int64_t size_max);
#+end_src

#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_electron_en_distance(context, distance) &
integer(c_int32_t) function qmckl_get_electron_en_distance(context, distance, size_max) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
real (c_double ) , intent(out) :: distance(*)
integer (c_int64_t) , intent(in) :: size_max
end function
end interface
#+end_src

#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance)
qmckl_exit_code
qmckl_get_electron_en_distance(qmckl_context context,
double* const distance,
const int64_t size_max)
{

if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
Expand All @@ -1165,7 +1192,20 @@ qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* di
qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
assert (ctx != NULL);

if (distance == NULL) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_get_electron_en_distance",
"distance is a null pointer");
}

size_t sze = ctx->point.num * ctx->nucleus.num;
if (size_max < sze) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_3,
"qmckl_get_electron_en_distance",
"size_max < num*nucl_num");
}
memcpy(distance, ctx->electron.en_distance, sze * sizeof(double));

return QMCKL_SUCCESS;
Expand Down Expand Up @@ -1385,7 +1425,7 @@ assert(qmckl_nucleus_provided(context));

double en_distance[walk_num][elec_num][nucl_num];

rc = qmckl_get_electron_en_distance(context, &(en_distance[0][0][0]));
rc = qmckl_get_electron_en_distance(context, &(en_distance[0][0][0]), walk_num * elec_num * nucl_num);
qmckl_check(context, rc);

// (e,n,w) in Fortran notation
Expand Down
Loading

0 comments on commit 538a929

Please sign in to comment.