mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-12-26 06:15:08 +01:00
Add squared Frobenius norm to vfc_test_h5
Besides the new variable addition, vfc_test_h5 has also be made simpler by executing directly all the possible lagorithms (instead of requiring argument). This results in a much more concise vfc_tests_config.json, since only one executable invocation is required.
This commit is contained in:
parent
348fe14dd0
commit
99b297435c
@ -44,6 +44,16 @@ double residual2(double * A, unsigned int Dim) {
|
||||
return res;
|
||||
}
|
||||
|
||||
double frobenius2(double * A, unsigned int Dim) {
|
||||
double res = 0.0;
|
||||
for (unsigned int i = 0; i < Dim; i++) {
|
||||
for (unsigned int j = 0; j < Dim; j++) {
|
||||
res += A[i * Dim + j] * A[i * Dim + j];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void read_int(H5File file, std::string key, unsigned int * data) {
|
||||
DataSet ds = file.openDataSet(key);
|
||||
ds.read(data, PredType::STD_U32LE);
|
||||
@ -158,6 +168,7 @@ int test_cycle(H5File file, int cycle, std::string version, vfc_probes * probes)
|
||||
|
||||
double res_max = residual_max(res, dim);
|
||||
double res2 = residual2(res, dim);
|
||||
double frob2 = frobenius2(res, dim);
|
||||
|
||||
#ifdef DEBUG
|
||||
showMatrix(res, dim, "Result");
|
||||
@ -165,6 +176,7 @@ int test_cycle(H5File file, int cycle, std::string version, vfc_probes * probes)
|
||||
|
||||
vfc_put_probe(probes, &(zero_padded_group)[0], &("res_max_" + version)[0], res_max);
|
||||
vfc_put_probe(probes, &(zero_padded_group)[0], &("res2_" + version)[0], res2);
|
||||
vfc_put_probe(probes, &(zero_padded_group)[0], &("frob2_" + version)[0], frob2);
|
||||
|
||||
delete [] res, updates, u, col_update_index,
|
||||
slater_matrix, slater_inverse;
|
||||
@ -173,30 +185,36 @@ int test_cycle(H5File file, int cycle, std::string version, vfc_probes * probes)
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 3) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Execute from within '/'" << std::endl;
|
||||
std::cerr << "usage: test_h5 <version> <path to cycles file>" << std::endl;
|
||||
std::cerr << "usage: test_h5 <path to cycles file>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::string version(argv[1]);
|
||||
std::vector<int> cycles_list = get_cycles_list(argv[2]);
|
||||
std::vector<int> cycles_list = get_cycles_list(argv[1]);
|
||||
H5File file(FILE_NAME, H5F_ACC_RDONLY);
|
||||
|
||||
vfc_probes probes = vfc_init_probes();
|
||||
probes = vfc_init_probes();
|
||||
|
||||
std::vector<std::string> algorithms = {
|
||||
"maponia3", "sm1", "sm2", "sm3", "sm4"
|
||||
};
|
||||
bool ok;
|
||||
for (int i = 0; i < cycles_list.size(); i++) {
|
||||
ok = test_cycle(file, cycles_list[i], version, &probes);
|
||||
|
||||
for(int i = 0; i < algorithms.size(); i++) {
|
||||
std::cout << "Using algorithm : " << algorithms[i] << std::endl;
|
||||
for (int j = 0; j < cycles_list.size(); j++) {
|
||||
ok = test_cycle(file, cycles_list[j], algorithms[i], &probes);
|
||||
if (ok) {
|
||||
std::cout << "ok -- cycle " << std::to_string(i)
|
||||
std::cout << "ok -- cycle " << std::to_string(j)
|
||||
<< std::endl;
|
||||
}
|
||||
else {
|
||||
std::cerr << "failed -- cycle " << std::to_string(i)
|
||||
std::cerr << "failed -- cycle " << std::to_string(j)
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vfc_dump_probes(&probes);
|
||||
|
||||
|
@ -3,67 +3,7 @@
|
||||
"executables": [
|
||||
{
|
||||
"executable": "bin/vfc_test_h5",
|
||||
"parameters" : "maponia3 vfc_ci_cycles.txt",
|
||||
"vfc_backends": [
|
||||
{
|
||||
"name": "libinterflop_mca.so",
|
||||
"repetitions": 50
|
||||
},
|
||||
{
|
||||
"name": "libinterflop_mca.so --mode=rr",
|
||||
"repetitions": 50
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"executable": "bin/vfc_test_h5",
|
||||
"parameters" : "sm1 vfc_ci_cycles.txt",
|
||||
"vfc_backends": [
|
||||
{
|
||||
"name": "libinterflop_mca.so",
|
||||
"repetitions": 50
|
||||
},
|
||||
{
|
||||
"name": "libinterflop_mca.so --mode=rr",
|
||||
"repetitions": 50
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"executable": "bin/vfc_test_h5",
|
||||
"parameters" : "sm2 vfc_ci_cycles.txt",
|
||||
"vfc_backends": [
|
||||
{
|
||||
"name": "libinterflop_mca.so",
|
||||
"repetitions": 50
|
||||
},
|
||||
{
|
||||
"name": "libinterflop_mca.so --mode=rr",
|
||||
"repetitions": 50
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"executable": "bin/vfc_test_h5",
|
||||
"parameters" : "sm3 vfc_ci_cycles.txt",
|
||||
"vfc_backends": [
|
||||
{
|
||||
"name": "libinterflop_mca.so",
|
||||
"repetitions": 50
|
||||
},
|
||||
{
|
||||
"name": "libinterflop_mca.so --mode=rr",
|
||||
"repetitions": 50
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"executable": "bin/vfc_test_h5",
|
||||
"parameters" : "sm4 vfc_ci_cycles.txt",
|
||||
"parameters" : "vfc_ci_cycles.txt",
|
||||
"vfc_backends": [
|
||||
{
|
||||
"name": "libinterflop_mca.so",
|
||||
|
Loading…
Reference in New Issue
Block a user