-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #549 from etmc/quda_work_clover_force
WIP Quda work clover force
- Loading branch information
Showing
16 changed files
with
439 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/*********************************************************************** | ||
* | ||
* Copyright (C) 2024 Bartosz Kostrzewa | ||
* | ||
* This file is part of tmLQCD. | ||
* | ||
* tmLQCD is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* tmLQCD is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>. | ||
***********************************************************************/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
# include<tmlqcd_config.h> | ||
#endif | ||
#ifdef TM_USE_OMP | ||
# include <omp.h> | ||
#endif | ||
#include <stdio.h> | ||
#include "global.h" | ||
#include "monomial/monomial.h" | ||
|
||
/* this function compares two derivatives calculated by an external library and tmLQCD */ | ||
void compare_derivative(monomial *mnl, su3adj **ext_lib, su3adj **native, | ||
const double threshold, const char * name){ | ||
int n_diff = 0; | ||
|
||
for(int ix = 0; ix < VOLUME; ix++){ | ||
for(int mu=0; mu<4; mu++){ | ||
double *ext=&(ext_lib[ix][mu].d1); | ||
double *nat=&(native[ix][mu].d1); | ||
for(int j=0; j<8; ++j){ | ||
double diff=ext[j]-nat[j]; | ||
if (sqrt(diff*diff) > threshold || isnan( ext[j] ) || isinf(ext[j]) ){ | ||
n_diff++; | ||
printf("derivative at (t,x,y,z,mu,j) %d,%d,%d,%d,%d,%d," | ||
" ext: %-14e, native: %-14e ratio: %-14g diff %-14g on proc_id %d\n", | ||
g_coord[ix][0], g_coord[ix][1], g_coord[ix][2], g_coord[ix][3], mu, j, | ||
ext[j], nat[j], ext[j]/nat[j], ext[j]-nat[j], g_proc_id); | ||
} | ||
} | ||
} | ||
} | ||
if(n_diff > 0){ | ||
printf("%s: the deviation between tmLQCD and the external library " | ||
"exceeds the threshold %.1e in %d case(s) for parameters: c0=%e c1=%e g_beta=%e on proc_id: %d\n", | ||
name, | ||
threshold, | ||
n_diff, | ||
mnl->c0, | ||
mnl->c1, | ||
mnl->beta, | ||
g_proc_id); | ||
|
||
if(g_strict_residual_check) fatal_error("Difference between external library and tmLQCD-native function!", | ||
name); | ||
} | ||
|
||
int red_n_diff = 0; | ||
#ifdef TM_USE_MPI | ||
MPI_Barrier(MPI_COMM_WORLD); | ||
MPI_Reduce(&n_diff, &red_n_diff, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD); | ||
#else | ||
red_n_diff = n_diff; | ||
#endif | ||
if(g_proc_id == 0){ | ||
printf("The maximum number of deviations in %s exceeding the threshold %.1e was %d\n", | ||
name, threshold, red_n_diff); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*********************************************************************** | ||
* | ||
* Copyright (C) 2024 Bartosz Kostrzewa | ||
* | ||
* This file is part of tmLQCD. | ||
* | ||
* tmLQCD is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* tmLQCD is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>. | ||
***********************************************************************/ | ||
|
||
#ifndef COMPARE_DERIVATIVE_H | ||
#define COMPARE_DERIVATIVE_H | ||
|
||
#include "monomial/monomial.h" | ||
#include "su3adj.h" | ||
|
||
void compare_derivative(monomial *mnl, su3adj **ext_lib, su3adj **native, const double threshold, const char * name); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.