mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Renamed function prefixes.
This commit is contained in:
parent
5e5c15a09d
commit
8ba882675e
@ -34,9 +34,9 @@ range(2, 3)
|
||||
|
||||
|
||||
* Naïve Sherman-Morrison
|
||||
** ~qmckl_sherman_morrison_naive~
|
||||
** ~qmckl_sm_naive~
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_sherman_morrison_naive
|
||||
:Name: qmckl_sm_naive
|
||||
:CRetType: qmckl_exit_code
|
||||
:FRetType: qmckl_exit_code
|
||||
:END:
|
||||
@ -75,7 +75,7 @@ If the determinant of the Slater-matrix is passed, it will be updated to the det
|
||||
from applying the updates to the original matrix.
|
||||
|
||||
*** API
|
||||
#+NAME: qmckl_sherman_morrison_naive_args
|
||||
#+NAME: qmckl_sm_naive_args
|
||||
| Variable | Type | In/Out | Description |
|
||||
|-----------------+-------------------------+--------+------------------------------------------------------|
|
||||
| ~context~ | ~qmckl_context~ | in | Global state |
|
||||
@ -150,7 +150,7 @@ end subroutine copy_back
|
||||
#+end_src
|
||||
|
||||
#+begin_src f90 :tangle (eval f)
|
||||
integer function qmckl_sherman_morrison_naive_doc_f(context, &
|
||||
integer function qmckl_sm_naive_doc_f(context, &
|
||||
lds, dim, &
|
||||
nupdates, &
|
||||
upds, &
|
||||
@ -230,20 +230,20 @@ integer function qmckl_sherman_morrison_naive_doc_f(context, &
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
end function qmckl_sherman_morrison_naive_doc_f
|
||||
end function qmckl_sm_naive_doc_f
|
||||
#+end_src
|
||||
|
||||
**** C interface to the pedagogical kernel (not directly exposed)
|
||||
The following Fortran function ~qmckl_sherman_morrison_naive_doc~ makes sure
|
||||
that the pedagogical kernel ~qmckl_sherman_morrison_naive_doc_f~, written in
|
||||
Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function ~qmckl_sherman_morrison_naive_doc~ will be exposed in the header file 'qmckl.h'
|
||||
The following Fortran function ~qmckl_sm_naive_doc~ makes sure
|
||||
that the pedagogical kernel ~qmckl_sm_naive_doc_f~, written in
|
||||
Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function ~qmckl_sm_naive_doc~ will be exposed in the header file 'qmckl.h'
|
||||
for C users and in the module file 'qmckl_f.F90' for Fortran users.
|
||||
|
||||
#+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc")
|
||||
#+CALL: generate_c_interface(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_naive_doc &
|
||||
integer(c_int32_t) function qmckl_sm_naive_doc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C) result(info)
|
||||
|
||||
@ -260,20 +260,20 @@ integer(c_int32_t) function qmckl_sherman_morrison_naive_doc &
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
integer(c_int32_t), external :: qmckl_sherman_morrison_naive_doc_f
|
||||
info = qmckl_sherman_morrison_naive_doc_f &
|
||||
integer(c_int32_t), external :: qmckl_sm_naive_doc_f
|
||||
info = qmckl_sm_naive_doc_f &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant)
|
||||
|
||||
end function qmckl_sherman_morrison_naive_doc
|
||||
end function qmckl_sm_naive_doc
|
||||
#+end_src
|
||||
|
||||
*** C headers (exposed in qmckl.h)
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
#+CALL: generate_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) : comments org
|
||||
qmckl_exit_code qmckl_sherman_morrison_naive (
|
||||
qmckl_exit_code qmckl_sm_naive (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -285,11 +285,11 @@ qmckl_exit_code qmckl_sherman_morrison_naive (
|
||||
double* determinant );
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_hpc")
|
||||
#+CALL: generate_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_hpc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_private_func) :comments org
|
||||
qmckl_exit_code qmckl_sherman_morrison_naive_hpc (
|
||||
qmckl_exit_code qmckl_sm_naive_hpc (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -301,11 +301,11 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc (
|
||||
double* determinant );
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc")
|
||||
#+CALL: generate_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code qmckl_sherman_morrison_naive_doc (
|
||||
qmckl_exit_code qmckl_sm_naive_doc (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -344,8 +344,8 @@ Common includes and macros used by all the Sherman-Morrison-Woodbury kernels.
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
~qmckl_sherman_morrison_naive_hpc~ is a high performance variation of
|
||||
~qmckl_sherman_morrison_naive~ written in C. It is used in cases when ~Dim~ is
|
||||
~qmckl_sm_naive_hpc~ is a high performance variation of
|
||||
~qmckl_sm_naive~ written in C. It is used in cases when ~Dim~ is
|
||||
smaller than the leading dimension ~LDS~, irrespective of whetether ~LDS~
|
||||
includes zero padding to benefit from SIMD instructions or not. Cases like this
|
||||
include situations where one wants to apply updates to a square submatrix of the
|
||||
@ -354,7 +354,7 @@ It takes advantage of memory aligned data and assumes no data dependencies
|
||||
inside the loops. The loops are fully vectorised whenever ~Dim~ is an integer
|
||||
multiple of ~SIMD_LEGTH~.
|
||||
#+begin_src c :tangle (eval c) :comments org
|
||||
qmckl_exit_code qmckl_sherman_morrison_naive_hpc(
|
||||
qmckl_exit_code qmckl_sm_naive_hpc(
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -368,7 +368,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc(
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_NULL_CONTEXT,
|
||||
"qmckl_sherman_morrison_naive_hpc",
|
||||
"qmckl_sm_naive_hpc",
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -423,10 +423,10 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc(
|
||||
}
|
||||
#+end_src
|
||||
|
||||
~qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}~ is a C function-template that is used to genereate instances of C fucntions based on the range given above. The advantage of this method is that for each of these instances all the dimensions and loop-bounds are known at compile time, allowing the compiler to optimize more aggressively.
|
||||
~qmckl_exit_code qmckl_sm_naive_{Dim}~ is a C function-template that is used to genereate instances of C fucntions based on the range given above. The advantage of this method is that for each of these instances all the dimensions and loop-bounds are known at compile time, allowing the compiler to optimize more aggressively.
|
||||
#+NAME:naive_template_code
|
||||
#+begin_src c
|
||||
static inline qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}(
|
||||
static inline qmckl_exit_code qmckl_sm_naive_{Dim}(
|
||||
const qmckl_context context,
|
||||
const uint64_t N_updates,
|
||||
const double* __restrict Updates,
|
||||
@ -438,7 +438,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc(
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return qmckl_failwith(context,
|
||||
QMCKL_NULL_CONTEXT,
|
||||
"qmckl_sherman_morrison_naive_{Dim}",
|
||||
"qmckl_sm_naive_{Dim}",
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ Python script that generated C switch cases that call individual kernel instance
|
||||
#+begin_src python :noweb yes
|
||||
text="""
|
||||
case {Dim}:
|
||||
return qmckl_sherman_morrison_naive_{Dim}(context,
|
||||
return qmckl_sm_naive_{Dim}(context,
|
||||
N_updates,
|
||||
Updates,
|
||||
Updates_index,
|
||||
@ -536,9 +536,9 @@ return '\n'.join(result)
|
||||
<<naive_kernel_generator()>>
|
||||
#+end_src
|
||||
|
||||
~qmckl_sherman_morrison_naive~ is a generic function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~.
|
||||
~qmckl_sm_naive~ is a generic function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~.
|
||||
#+begin_src c :tangle (eval c) :comments org :noweb yes
|
||||
qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context,
|
||||
qmckl_exit_code qmckl_sm_naive(const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
const uint64_t N_updates,
|
||||
@ -551,7 +551,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context,
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return qmckl_failwith(context,
|
||||
QMCKL_NULL_CONTEXT,
|
||||
"qmckl_sherman_morrison_naive",
|
||||
"qmckl_sm_naive",
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -562,7 +562,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context,
|
||||
}
|
||||
}
|
||||
else { // Updating smaller sub-matrix
|
||||
return qmckl_sherman_morrison_naive_hpc(context,
|
||||
return qmckl_sm_naive_hpc(context,
|
||||
LDS,
|
||||
Dim,
|
||||
N_updates,
|
||||
@ -573,7 +573,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context,
|
||||
determinant);
|
||||
}
|
||||
#else
|
||||
return qmckl_sherman_morrison_naive_doc(context,
|
||||
return qmckl_sm_naive_doc(context,
|
||||
LDS,
|
||||
Dim,
|
||||
N_updates,
|
||||
@ -590,17 +590,17 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context,
|
||||
|
||||
*** Fortran interfaces (exposed in qmckl_f.F90)
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_sherman_morrison_naive
|
||||
:Name: qmckl_sm_naive
|
||||
:CRetType: qmckl_exit_code
|
||||
:FRetType: qmckl_exit_code
|
||||
:END:
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive_hpc")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_hpc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_naive_hpc &
|
||||
integer(c_int32_t) function qmckl_sm_naive_hpc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -617,16 +617,16 @@ interface
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_sherman_morrison_naive_hpc
|
||||
end function qmckl_sm_naive_hpc
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive_doc")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_naive_doc &
|
||||
integer(c_int32_t) function qmckl_sm_naive_doc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -643,16 +643,16 @@ interface
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_sherman_morrison_naive_doc
|
||||
end function qmckl_sm_naive_doc
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_naive &
|
||||
integer(c_int32_t) function qmckl_sm_naive &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -669,7 +669,7 @@ interface
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_sherman_morrison_naive
|
||||
end function qmckl_sm_naive
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
@ -701,7 +701,7 @@ assert(Slater_inv1 != NULL);
|
||||
|
||||
// original determinant of Slater1 (before applying updates)
|
||||
double det = 3.407025646103221e-10;
|
||||
rc = qmckl_sherman_morrison_naive(context,
|
||||
rc = qmckl_sm_naive(context,
|
||||
LDS,
|
||||
Dim,
|
||||
N_updates1,
|
||||
@ -738,15 +738,15 @@ assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
* Sherman-Morrison with Slagel Splitting (core)
|
||||
** ~qmckl_slagel_splitting~
|
||||
** ~qmckl_sm_splitting_core~
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_slagel_splitting
|
||||
:Name: qmckl_sm_splitting_core
|
||||
:CRetType: qmckl_exit_code
|
||||
:FRetType: qmckl_exit_code
|
||||
:END:
|
||||
|
||||
*** Introduction
|
||||
~qmckl_slagel_splitting~ is the inner core part of 'Sherman-Morrison with update splitting' in the next section.
|
||||
~qmckl_sm_splitting_core~ is the inner core part of 'Sherman-Morrison with update splitting' in the next section.
|
||||
It is not normally used by itself but it is possible to use it nonetheless.
|
||||
|
||||
It has three extra parameters in its API:
|
||||
@ -754,14 +754,14 @@ It has three extra parameters in its API:
|
||||
- ~later_index~ initially empty array that will contain the row/column numbers of the updates that were split during execution
|
||||
- ~later~ initially zero integer that records the number of updates that were split during exection.
|
||||
|
||||
It is up to the user to decide what to do with these updates once the kernel returns. Normally ~qmckl_slagel_splitting~ is
|
||||
used as the core part of a recursive function, as is done in ~qmckl_sherman_morrison_splitting~ or as part of a more complex
|
||||
It is up to the user to decide what to do with these updates once the kernel returns. Normally ~qmckl_sm_splitting_core~ is
|
||||
used as the core part of a recursive function, as is done in ~qmckl_sm_splitting~ or as part of a more complex
|
||||
kernel like ~qmckl_sherman_morrison_smw32s~.
|
||||
|
||||
If the determinant is passed it will only be partially updated if there were any update splits.
|
||||
|
||||
*** API
|
||||
#+NAME: qmckl_slagel_splitting_args
|
||||
#+NAME: qmckl_sm_splitting_core_args
|
||||
| Variable | Type | In/Out | Description |
|
||||
|-----------------+-------------------------+--------+---------------------------------------------------------------|
|
||||
| ~context~ | ~qmckl_context~ | in | Global state |
|
||||
@ -795,7 +795,7 @@ able to do numerically correct computations, it does not do it in the most effic
|
||||
not be used in real workloads.
|
||||
|
||||
#+begin_src f90 :tangle (eval f)
|
||||
integer function qmckl_slagel_splitting_doc_f( &
|
||||
integer function qmckl_sm_splitting_core_doc_f( &
|
||||
context, &
|
||||
lds, dim, &
|
||||
nupdates, &
|
||||
@ -843,21 +843,21 @@ integer function qmckl_slagel_splitting_doc_f( &
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
end function qmckl_slagel_splitting_doc_f
|
||||
end function qmckl_sm_splitting_core_doc_f
|
||||
#+end_src
|
||||
|
||||
**** C interface to the pedagogical kernel (not directly exposed)
|
||||
The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure
|
||||
that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in
|
||||
The following Fortran function ~qmckl_sm_splitting_core_doc~ makes sure
|
||||
that the pedagogical kernel ~qmckl_sm_splitting_core_doc_f~, written in
|
||||
Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function
|
||||
~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h'
|
||||
~qmckl_sm_splitting_core_doc~ will be exposed in the header file 'qmckl.h'
|
||||
for C users and in the module file 'qmckl_f.F90' for Fortran users.
|
||||
|
||||
#+CALL: generate_c_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc")
|
||||
#+CALL: generate_c_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_slagel_splitting_doc &
|
||||
integer(c_int32_t) function qmckl_sm_splitting_core_doc &
|
||||
(context, &
|
||||
LDS, &
|
||||
Dim, &
|
||||
@ -888,8 +888,8 @@ integer(c_int32_t) function qmckl_slagel_splitting_doc &
|
||||
integer (c_int64_t) , intent(inout) :: later
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
integer(c_int32_t), external :: qmckl_slagel_splitting_doc_f
|
||||
info = qmckl_slagel_splitting_doc_f &
|
||||
integer(c_int32_t), external :: qmckl_sm_splitting_core_doc_f
|
||||
info = qmckl_sm_splitting_core_doc_f &
|
||||
(context, &
|
||||
LDS, &
|
||||
Dim, &
|
||||
@ -903,15 +903,15 @@ integer(c_int32_t) function qmckl_slagel_splitting_doc &
|
||||
later, &
|
||||
determinant)
|
||||
|
||||
end function qmckl_slagel_splitting_doc
|
||||
end function qmckl_sm_splitting_core_doc
|
||||
#+end_src
|
||||
|
||||
*** C headers (exposed in qmckl.h)
|
||||
#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
#+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code qmckl_slagel_splitting (
|
||||
qmckl_exit_code qmckl_sm_splitting_core (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -926,11 +926,11 @@ qmckl_exit_code qmckl_slagel_splitting (
|
||||
double* determinant );
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc")
|
||||
#+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code qmckl_slagel_splitting_doc (
|
||||
qmckl_exit_code qmckl_sm_splitting_core_doc (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -947,7 +947,7 @@ qmckl_exit_code qmckl_slagel_splitting_doc (
|
||||
|
||||
*** C sources
|
||||
#+begin_src c :tangle (eval c) :comments org
|
||||
qmckl_exit_code qmckl_slagel_splitting_hpc(
|
||||
qmckl_exit_code qmckl_sm_splitting_core_hpc(
|
||||
const qmckl_context context,
|
||||
uint64_t LDS,
|
||||
uint64_t Dim,
|
||||
@ -965,7 +965,7 @@ qmckl_exit_code qmckl_slagel_splitting_hpc(
|
||||
return qmckl_failwith(
|
||||
context,
|
||||
QMCKL_NULL_CONTEXT,
|
||||
"qmckl_slagel_splitting_hpc",
|
||||
"qmckl_sm_splitting_core_hpc",
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -1033,7 +1033,7 @@ qmckl_exit_code qmckl_slagel_splitting_hpc(
|
||||
|
||||
#+NAME:slagel_splitting_template_code
|
||||
#+begin_src c
|
||||
static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}(
|
||||
static inline qmckl_exit_code qmckl_sm_splitting_core_{Dim}(
|
||||
const qmckl_context context,
|
||||
uint64_t N_updates,
|
||||
const double* __restrict Updates,
|
||||
@ -1049,7 +1049,7 @@ static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}(
|
||||
return qmckl_failwith(
|
||||
context,
|
||||
QMCKL_NULL_CONTEXT,
|
||||
"qmckl_slagel_splitting_{Dim}",
|
||||
"qmckl_sm_splitting_core_{Dim}",
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,7 @@ return '\n'.join(result)
|
||||
#+begin_src python :noweb yes
|
||||
text="""
|
||||
case {Dim}: {
|
||||
return qmckl_slagel_splitting_{Dim}(
|
||||
return qmckl_sm_splitting_core_{Dim}(
|
||||
context,
|
||||
N_updates,
|
||||
Updates,
|
||||
@ -1159,7 +1159,7 @@ return '\n'.join(result)
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c) :comments org :noweb yes
|
||||
qmckl_exit_code qmckl_slagel_splitting(
|
||||
qmckl_exit_code qmckl_sm_splitting_core(
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -1184,7 +1184,7 @@ qmckl_exit_code qmckl_slagel_splitting(
|
||||
}
|
||||
}
|
||||
else { // Updating smaller sub-matrix
|
||||
return qmckl_slagel_splitting_hpc(
|
||||
return qmckl_sm_splitting_core_hpc(
|
||||
context,
|
||||
LDS,
|
||||
Dim,
|
||||
@ -1199,7 +1199,7 @@ qmckl_exit_code qmckl_slagel_splitting(
|
||||
determinant);
|
||||
}
|
||||
#else
|
||||
// return qmckl_slagel_splitting_doc(
|
||||
// return qmckl_sm_splitting_core_doc(
|
||||
// context,
|
||||
// LDS,
|
||||
// Dim,
|
||||
@ -1212,7 +1212,7 @@ qmckl_exit_code qmckl_slagel_splitting(
|
||||
// later_index,
|
||||
// later,
|
||||
// determinant);
|
||||
return qmckl_slagel_splitting_hpc(
|
||||
return qmckl_sm_splitting_core_hpc(
|
||||
context,
|
||||
LDS,
|
||||
Dim,
|
||||
@ -1233,17 +1233,17 @@ qmckl_exit_code qmckl_slagel_splitting(
|
||||
|
||||
*** Fortran interfaces (exposed in qmckl_f.F90)
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_slagel_splitting
|
||||
:Name: qmckl_sm_splitting_core
|
||||
:CRetType: qmckl_exit_code
|
||||
:FRetType: qmckl_exit_code
|
||||
:END:
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_hpc")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_core_hpc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_slagel_splitting_hpc &
|
||||
integer(c_int32_t) function qmckl_sm_splitting_core_hpc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, &
|
||||
Slater_inv, later_updates, later_index, later, determinant) &
|
||||
bind(C)
|
||||
@ -1264,16 +1264,16 @@ interface
|
||||
integer (c_int64_t) , intent(inout) :: later
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_slagel_splitting_hpc
|
||||
end function qmckl_sm_splitting_core_hpc
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_doc")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_core_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_slagel_splitting_doc &
|
||||
integer(c_int32_t) function qmckl_sm_splitting_core_doc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, &
|
||||
Slater_inv, later_updates, later_index, later, determinant) &
|
||||
bind(C)
|
||||
@ -1294,16 +1294,16 @@ interface
|
||||
integer (c_int64_t) , intent(inout) :: later
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_slagel_splitting_doc
|
||||
end function qmckl_sm_splitting_core_doc
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_core")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_slagel_splitting &
|
||||
integer(c_int32_t) function qmckl_sm_splitting_core &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, &
|
||||
Slater_inv, later_updates, later_index, later, determinant) &
|
||||
bind(C)
|
||||
@ -1324,7 +1324,7 @@ interface
|
||||
integer (c_int64_t) , intent(inout) :: later
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_slagel_splitting
|
||||
end function qmckl_sm_splitting_core
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
@ -1334,9 +1334,9 @@ with Sherman-Morrison and update splitting. Please look at the performance recco
|
||||
|
||||
|
||||
* Sherman-Morrison with Slagel Splitting
|
||||
** ~qmckl_sherman_morrison_splitting~
|
||||
** ~qmckl_sm_splitting~
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_sherman_morrison_splitting
|
||||
:Name: qmckl_sm_splitting
|
||||
:CRetType: qmckl_exit_code
|
||||
:FRetType: qmckl_exit_code
|
||||
:END:
|
||||
@ -1357,7 +1357,7 @@ If the determinant of the Slater-matrix is passed, it will be updated to the det
|
||||
from applying the updates to the original matrix.
|
||||
|
||||
*** API
|
||||
#+NAME: qmckl_sherman_morrison_splitting_args
|
||||
#+NAME: qmckl_sm_splitting_args
|
||||
| Variable | Type | In/Out | Description |
|
||||
|---------------+-----------------------+--------+------------------------------------------------------|
|
||||
| context | qmckl_context | in | Global state |
|
||||
@ -1386,7 +1386,7 @@ able to do numerically correct computations, it does not do it in the most effic
|
||||
not be used in real workloads.
|
||||
|
||||
#+begin_src f90 :tangle (eval f)
|
||||
integer function qmckl_sherman_morrison_splitting_doc_f(context, &
|
||||
integer function qmckl_sm_splitting_doc_f(context, &
|
||||
lds, dim, &
|
||||
nupdates, &
|
||||
upds, &
|
||||
@ -1422,21 +1422,21 @@ integer function qmckl_sherman_morrison_splitting_doc_f(context, &
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
end function qmckl_sherman_morrison_splitting_doc_f
|
||||
end function qmckl_sm_splitting_doc_f
|
||||
#+end_src
|
||||
|
||||
**** C interface to the pedagogical kernel (not directly exposed)
|
||||
The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure
|
||||
that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in
|
||||
The following Fortran function ~qmckl_sm_splitting_core_doc~ makes sure
|
||||
that the pedagogical kernel ~qmckl_sm_splitting_core_doc_f~, written in
|
||||
Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function
|
||||
~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h'
|
||||
~qmckl_sm_splitting_core_doc~ will be exposed in the header file 'qmckl.h'
|
||||
for C users and in the module file 'qmckl_f.F90' for Fortran users.
|
||||
|
||||
#+CALL: generate_c_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_doc")
|
||||
#+CALL: generate_c_interface(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc &
|
||||
integer(c_int32_t) function qmckl_sm_splitting_doc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C) result(info)
|
||||
|
||||
@ -1453,20 +1453,20 @@ integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc &
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
integer(c_int32_t), external :: qmckl_sherman_morrison_splitting_doc_f
|
||||
info = qmckl_sherman_morrison_splitting_doc_f &
|
||||
integer(c_int32_t), external :: qmckl_sm_splitting_doc_f
|
||||
info = qmckl_sm_splitting_doc_f &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant)
|
||||
|
||||
end function qmckl_sherman_morrison_splitting_doc
|
||||
end function qmckl_sm_splitting_doc
|
||||
#+end_src
|
||||
|
||||
*** C headers (exposed in qmckl.h)
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
#+CALL: generate_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code qmckl_sherman_morrison_splitting (
|
||||
qmckl_exit_code qmckl_sm_splitting (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -1478,11 +1478,11 @@ qmckl_exit_code qmckl_sherman_morrison_splitting (
|
||||
double* determinant );
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_hpc")
|
||||
#+CALL: generate_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_hpc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code qmckl_sherman_morrison_splitting_hpc (
|
||||
qmckl_exit_code qmckl_sm_splitting_hpc (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -1494,11 +1494,11 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc (
|
||||
double* determinant );
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_doc")
|
||||
#+CALL: generate_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code qmckl_sherman_morrison_splitting_doc (
|
||||
qmckl_exit_code qmckl_sm_splitting_doc (
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -1515,7 +1515,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_doc (
|
||||
#+begin_src python :noweb yes
|
||||
text="""
|
||||
case {Dim}: {
|
||||
rc = qmckl_slagel_splitting_{Dim}(
|
||||
rc = qmckl_sm_splitting_core_{Dim}(
|
||||
context,
|
||||
N_updates,
|
||||
Updates,
|
||||
@ -1536,7 +1536,7 @@ return '\n'.join(result)
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c) :comments org :noweb yes
|
||||
qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(
|
||||
qmckl_exit_code qmckl_sm_splitting_hpc(
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -1551,7 +1551,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(
|
||||
return qmckl_failwith(
|
||||
context,
|
||||
QMCKL_NULL_CONTEXT,
|
||||
"qmckl_sherman_morrison_splitting_hpc",
|
||||
"qmckl_sm_splitting_hpc",
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -1569,7 +1569,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rc = qmckl_slagel_splitting_hpc(
|
||||
rc = qmckl_sm_splitting_core_hpc(
|
||||
context, LDS, Dim, N_updates, Updates, Updates_index,
|
||||
breakdown, Slater_inv, later_updates,
|
||||
later_index, &later, determinant);
|
||||
@ -1577,7 +1577,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(
|
||||
if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE;
|
||||
|
||||
if (later > 0) {
|
||||
qmckl_exit_code rc = qmckl_sherman_morrison_splitting_hpc(
|
||||
qmckl_exit_code rc = qmckl_sm_splitting_hpc(
|
||||
context, LDS, Dim, later,
|
||||
later_updates, later_index,
|
||||
breakdown, Slater_inv, determinant);
|
||||
@ -1589,7 +1589,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c) :comment org
|
||||
qmckl_exit_code qmckl_sherman_morrison_splitting(
|
||||
qmckl_exit_code qmckl_sm_splitting(
|
||||
const qmckl_context context,
|
||||
const uint64_t LDS,
|
||||
const uint64_t Dim,
|
||||
@ -1604,11 +1604,11 @@ qmckl_exit_code qmckl_sherman_morrison_splitting(
|
||||
return qmckl_failwith(
|
||||
context,
|
||||
QMCKL_NULL_CONTEXT,
|
||||
"qmckl_sherman_morrison_splitting",
|
||||
"qmckl_sm_splitting",
|
||||
NULL);
|
||||
}
|
||||
#ifdef HAS_HPC
|
||||
return qmckl_sherman_morrison_splitting_hpc(
|
||||
return qmckl_sm_splitting_hpc(
|
||||
context,
|
||||
LDS,
|
||||
Dim,
|
||||
@ -1619,7 +1619,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting(
|
||||
Slater_inv,
|
||||
determinant);
|
||||
#else
|
||||
// return qmckl_sherman_morrison_splitting_doc(
|
||||
// return qmckl_sm_splitting_doc(
|
||||
// context,
|
||||
// LDS,
|
||||
// Dim,
|
||||
@ -1629,7 +1629,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting(
|
||||
// breakdown,
|
||||
// Slater_inv,
|
||||
// determinant);
|
||||
return qmckl_sherman_morrison_splitting_hpc(
|
||||
return qmckl_sm_splitting_hpc(
|
||||
context,
|
||||
LDS,
|
||||
Dim,
|
||||
@ -1647,17 +1647,17 @@ qmckl_exit_code qmckl_sherman_morrison_splitting(
|
||||
|
||||
*** Fortran interfaces (exposed in qmckl_f.F90)
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_sherman_morrison_naive
|
||||
:Name: qmckl_sm_naive
|
||||
:CRetType: qmckl_exit_code
|
||||
:FRetType: qmckl_exit_code
|
||||
:END:
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting_hpc")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_hpc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_splitting_hpc &
|
||||
integer(c_int32_t) function qmckl_sm_splitting_hpc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -1674,16 +1674,16 @@ interface
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_sherman_morrison_splitting_hpc
|
||||
end function qmckl_sm_splitting_hpc
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting_doc")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_doc")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc &
|
||||
integer(c_int32_t) function qmckl_sm_splitting_doc &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -1700,16 +1700,16 @@ interface
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_sherman_morrison_splitting_doc
|
||||
end function qmckl_sm_splitting_doc
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting")
|
||||
#+CALL: generate_f_interface(table=qmckl_sm_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting")
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_sherman_morrison_splitting &
|
||||
integer(c_int32_t) function qmckl_sm_splitting &
|
||||
(context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -1726,7 +1726,7 @@ interface
|
||||
real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS)
|
||||
real (c_double ) , intent(inout) :: determinant
|
||||
|
||||
end function qmckl_sherman_morrison_splitting
|
||||
end function qmckl_sm_splitting
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
@ -1739,7 +1739,7 @@ assert(Updates3 != NULL);
|
||||
assert(Updates_index3 != NULL);
|
||||
assert(Slater_inv3_2 != NULL);
|
||||
det = -1.23743195512859e-09;
|
||||
rc = qmckl_sherman_morrison_splitting(context, LDS, Dim, N_updates3, Updates3, Updates_index3, breakdown, Slater_inv3_2, &det);
|
||||
rc = qmckl_sm_splitting(context, LDS, Dim, N_updates3, Updates3, Updates_index3, breakdown, Slater_inv3_2, &det);
|
||||
assert(fabs(det - 1.602708950725074e-10) < 1e-15);
|
||||
for (unsigned int i = 0; i < Dim; i++) {
|
||||
for (unsigned int j = 0; j < Dim; j++) {
|
||||
|
Loading…
Reference in New Issue
Block a user