1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-09-16 17:55:29 +02:00

Added qmckl_context_touch for benchmarking

This commit is contained in:
Anthony Scemama 2022-02-17 22:29:53 +01:00
parent 45e7eab963
commit c93e7828c5
3 changed files with 46 additions and 19 deletions

View File

@ -5384,13 +5384,11 @@ qmckl_compute_ao_vgl_hpc (
switch (nucleus_max_ang_mom[inucl]) {
case 0:
for (int64_t il=0 ; il<n ; ++il) {
ao_vgl_1[il] = s1 * f[il];
ao_vgl_2[il] = s2 * f[il];
ao_vgl_3[il] = s3 * f[il];
ao_vgl_4[il] = s4 * f[il];
ao_vgl_5[il] = s5;
}
ao_vgl_1[0] = s1 * f[0];
ao_vgl_2[0] = s2 * f[0];
ao_vgl_3[0] = s3 * f[0];
ao_vgl_4[0] = s4 * f[0];
ao_vgl_5[0] = s5;
break;
case 1:
poly_vgl_1 = &(poly_vgl_l1[0][idx]);

View File

@ -141,15 +141,6 @@ typedef struct qmckl_context_struct {
} qmckl_context_struct;
#+end_src
The context keeps a ``date'' that allows to check which data needs
to be recomputed. The date is incremented when the electron
coordinates are updated.
When a new element is added to the context, the functions
[[Creation][qmckl_context_create]], [[Destroy][qmckl_context_destroy]] and [[Copy][qmckl_context_copy]]
should be updated inorder to make deep copies.
A tag is used internally to check if the memory domain pointed
by a pointer is a valid context. This allows to check that even if
the pointer associated with a context is non-null, we can still
@ -185,6 +176,35 @@ qmckl_context qmckl_context_check(const qmckl_context context) {
}
#+end_src
The context keeps a ``date'' that allows to check which data needs
to be recomputed. The date is incremented when the context is touched.
When a new element is added to the context, the functions
[[Creation][qmckl_context_create]], [[Destroy][qmckl_context_destroy]] and [[Copy][qmckl_context_copy]]
should be updated in order to make deep copies.
#+begin_src c :comments org :tangle (eval h_func) :noexport
qmckl_exit_code qmckl_context_touch(const qmckl_context context) ;
#+end_src
#+begin_src c :tangle (eval c)
qmckl_exit_code qmckl_context_touch(const qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return qmckl_failwith( context,
QMCKL_INVALID_CONTEXT,
"qmckl_context_touch",
NULL);
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
ctx->date += 1UL;
ctx->point.date += 1UL;
return QMCKL_SUCCESS;
}
#+end_src
** Creation
To create a new context, ~qmckl_context_create()~ should be used.

View File

@ -318,8 +318,17 @@ qmckl_set_point (qmckl_context context,
ctx->point.num = num;
if (transp == 'T') {
memcpy(ctx->point.coord.data, coord, 3*num*sizeof(double));
double *a = ctx->point.coord.data;
#ifdef HAVE_OPENMP
#pragma omp for
#endif
for (int64_t i=0 ; i<3*num ; ++i) {
a[i] = coord[i];
}
} else {
#ifdef HAVE_OPENMP
#pragma omp for
#endif
for (int64_t i=0 ; i<num ; ++i) {
qmckl_mat(ctx->point.coord, i, 0) = coord[3*i ];
qmckl_mat(ctx->point.coord, i, 1) = coord[3*i+1];
@ -328,8 +337,8 @@ qmckl_set_point (qmckl_context context,
}
/* Increment the date of the context */
ctx->date += 1UL;
ctx->point.date = ctx->date;
rc = qmckl_context_touch(context);
assert (rc == QMCKL_SUCCESS);
return QMCKL_SUCCESS;