mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 18:16:28 +01:00
Removed local context var declarations from kernels and pass along context from passed arguments. #25
This commit is contained in:
parent
a5e58c80d7
commit
978e20ac42
@ -255,7 +255,6 @@ end function qmckl_sherman_morrison_f
|
|||||||
#+begin_src c :tangle (eval c) :comments org
|
#+begin_src c :tangle (eval c) :comments org
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "qmckl.h"
|
#include "qmckl.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
qmckl_exit_code qmckl_sherman_morrison_c(const qmckl_context context,
|
qmckl_exit_code qmckl_sherman_morrison_c(const qmckl_context context,
|
||||||
const uint64_t Dim,
|
const uint64_t Dim,
|
||||||
@ -1098,8 +1097,6 @@ qmckl_exit_code qmckl_sherman_morrison_smw2s_c(const qmckl_context context,
|
|||||||
// << " updates" << std::endl;
|
// << " updates" << std::endl;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
qmckl_context local_context;
|
|
||||||
local_context = qmckl_context_create();
|
|
||||||
qmckl_exit_code rc;
|
qmckl_exit_code rc;
|
||||||
|
|
||||||
uint64_t n_of_2blocks = N_updates / 2;
|
uint64_t n_of_2blocks = N_updates / 2;
|
||||||
@ -1115,7 +1112,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw2s_c(const qmckl_context context,
|
|||||||
for (uint64_t i = 0; i < n_of_2blocks; i++) {
|
for (uint64_t i = 0; i < n_of_2blocks; i++) {
|
||||||
const double *Updates_2block = &Updates[i * length_2block];
|
const double *Updates_2block = &Updates[i * length_2block];
|
||||||
const uint64_t *Updates_index_2block = &Updates_index[i * 2];
|
const uint64_t *Updates_index_2block = &Updates_index[i * 2];
|
||||||
rc = qmckl_woodbury_2_c(local_context, Dim, Updates_2block, Updates_index_2block, breakdown, Slater_inv);
|
rc = qmckl_woodbury_2_c(context, Dim, Updates_2block, Updates_index_2block, breakdown, Slater_inv);
|
||||||
if (rc != 0) { // Send the entire block to slagel_splitting
|
if (rc != 0) { // Send the entire block to slagel_splitting
|
||||||
uint64_t l = 0;
|
uint64_t l = 0;
|
||||||
rc = qmckl_slagel_splitting_c(Dim, 2, Updates_2block, Updates_index_2block,
|
rc = qmckl_slagel_splitting_c(Dim, 2, Updates_2block, Updates_index_2block,
|
||||||
@ -1135,7 +1132,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw2s_c(const qmckl_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (later > 0) {
|
if (later > 0) {
|
||||||
rc = qmckl_sherman_morrison_splitting_c(local_context, Dim, later, later_updates, later_index, breakdown, Slater_inv);
|
rc = qmckl_sherman_morrison_splitting_c(context, Dim, later, later_updates, later_index, breakdown, Slater_inv);
|
||||||
}
|
}
|
||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1307,8 +1304,6 @@ qmckl_exit_code qmckl_sherman_morrison_smw3s_c(const qmckl_context context,
|
|||||||
// << " updates" << std::endl;
|
// << " updates" << std::endl;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
qmckl_context local_context;
|
|
||||||
local_context = qmckl_context_create();
|
|
||||||
qmckl_exit_code rc;
|
qmckl_exit_code rc;
|
||||||
|
|
||||||
uint64_t n_of_3blocks = N_updates / 3;
|
uint64_t n_of_3blocks = N_updates / 3;
|
||||||
@ -1324,7 +1319,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw3s_c(const qmckl_context context,
|
|||||||
for (uint64_t i = 0; i < n_of_3blocks; i++) {
|
for (uint64_t i = 0; i < n_of_3blocks; i++) {
|
||||||
const double *Updates_3block = &Updates[i * length_3block];
|
const double *Updates_3block = &Updates[i * length_3block];
|
||||||
const uint64_t *Updates_index_3block = &Updates_index[i * 3];
|
const uint64_t *Updates_index_3block = &Updates_index[i * 3];
|
||||||
rc = qmckl_woodbury_3_c(local_context, Dim, Updates_3block, Updates_index_3block, breakdown, Slater_inv);
|
rc = qmckl_woodbury_3_c(context, Dim, Updates_3block, Updates_index_3block, breakdown, Slater_inv);
|
||||||
if (rc != 0) { // Send the entire block to slagel_splitting
|
if (rc != 0) { // Send the entire block to slagel_splitting
|
||||||
uint64_t l = 0;
|
uint64_t l = 0;
|
||||||
rc = qmckl_slagel_splitting_c(Dim, 3, Updates_3block, Updates_index_3block,
|
rc = qmckl_slagel_splitting_c(Dim, 3, Updates_3block, Updates_index_3block,
|
||||||
@ -1344,7 +1339,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw3s_c(const qmckl_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (later > 0) {
|
if (later > 0) {
|
||||||
rc = qmckl_sherman_morrison_splitting_c(local_context, Dim, later, later_updates, later_index, breakdown, Slater_inv);
|
rc = qmckl_sherman_morrison_splitting_c(context, Dim, later, later_updates, later_index, breakdown, Slater_inv);
|
||||||
}
|
}
|
||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1516,8 +1511,6 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context,
|
|||||||
// << " updates" << std::endl;
|
// << " updates" << std::endl;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
qmckl_context local_context;
|
|
||||||
local_context = qmckl_context_create();
|
|
||||||
qmckl_exit_code rc;
|
qmckl_exit_code rc;
|
||||||
|
|
||||||
uint64_t n_of_3blocks = N_updates / 3;
|
uint64_t n_of_3blocks = N_updates / 3;
|
||||||
@ -1533,7 +1526,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context,
|
|||||||
for (uint64_t i = 0; i < n_of_3blocks; i++) {
|
for (uint64_t i = 0; i < n_of_3blocks; i++) {
|
||||||
const double *Updates_3block = &Updates[i * length_3block];
|
const double *Updates_3block = &Updates[i * length_3block];
|
||||||
const uint64_t *Updates_index_3block = &Updates_index[i * 3];
|
const uint64_t *Updates_index_3block = &Updates_index[i * 3];
|
||||||
rc = qmckl_woodbury_3_c(local_context, Dim, Updates_3block, Updates_index_3block, breakdown, Slater_inv);
|
rc = qmckl_woodbury_3_c(context, Dim, Updates_3block, Updates_index_3block, breakdown, Slater_inv);
|
||||||
if (rc != 0) { // Send the entire block to slagel_splitting
|
if (rc != 0) { // Send the entire block to slagel_splitting
|
||||||
uint64_t l = 0;
|
uint64_t l = 0;
|
||||||
rc = qmckl_slagel_splitting_c(Dim, 3, Updates_3block, Updates_index_3block,
|
rc = qmckl_slagel_splitting_c(Dim, 3, Updates_3block, Updates_index_3block,
|
||||||
@ -1546,7 +1539,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context,
|
|||||||
if (remainder == 2) { // Apply last remaining block of 2 updates with Woodbury 2x2 kernel
|
if (remainder == 2) { // Apply last remaining block of 2 updates with Woodbury 2x2 kernel
|
||||||
const double *Updates_2block = &Updates[n_of_3blocks * length_3block];
|
const double *Updates_2block = &Updates[n_of_3blocks * length_3block];
|
||||||
const uint64_t *Updates_index_2block = &Updates_index[3 * n_of_3blocks];
|
const uint64_t *Updates_index_2block = &Updates_index[3 * n_of_3blocks];
|
||||||
rc = qmckl_woodbury_2_c(local_context, Dim, Updates_2block, Updates_index_2block, breakdown, Slater_inv);
|
rc = qmckl_woodbury_2_c(context, Dim, Updates_2block, Updates_index_2block, breakdown, Slater_inv);
|
||||||
if (rc != 0) { // Send the entire block to slagel_splitting
|
if (rc != 0) { // Send the entire block to slagel_splitting
|
||||||
uint64_t l = 0;
|
uint64_t l = 0;
|
||||||
rc = qmckl_slagel_splitting_c(Dim, 2, Updates_2block, Updates_index_2block,
|
rc = qmckl_slagel_splitting_c(Dim, 2, Updates_2block, Updates_index_2block,
|
||||||
@ -1564,7 +1557,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s_c(const qmckl_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (later > 0) {
|
if (later > 0) {
|
||||||
rc = qmckl_sherman_morrison_splitting_c(local_context, Dim, later, later_updates, later_index, breakdown, Slater_inv);
|
rc = qmckl_sherman_morrison_splitting_c(context, Dim, later, later_updates, later_index, breakdown, Slater_inv);
|
||||||
}
|
}
|
||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user