Skip to content

Commit f109115

Browse files
author
Mathieu Taillefumier
committed
Fix compilation issues
- Restored hopping.h - Rename hmc with tmlqcd - Fix TM_USE_DDalphaAMG when necessary - Remove header guards in git_hash.c
1 parent e09b7ab commit f109115

File tree

13 files changed

+395
-70
lines changed

13 files changed

+395
-70
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ cmake_dependent_option(
158158
DDalphaAMG_ENABLE_SCHWARZ_RES "Enable paramount output support" OFF
159159
"TM_USE_DDalphaAMG" OFF)
160160

161-
cmake_dependent_option(DDalphaAMG_ENABLE_OMP "Enable OpenMP support" ON
161+
cmake_dependent_option(DDalphaAMG_ENABLE_OMP "Enable OpenMP support" ${TM_USE_OMP}
162162
"TM_USE_DDalphaAMG" OFF)
163163

164164
cmake_dependent_option(

cmake/git_hash.c.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
#ifndef _GIT_HASH_H
2-
#define _GIT_HASH_H
3-
41
const char git_hash[] = "@TM_SHA@";
5-
6-
#endif /* _GIT_HASH_H */

src/bin/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
list(APPEND tmlqcd_prog "benchmark;deriv_mg_tune;hmc_tm;offline_measurement")
1+
list(APPEND tmlqcd_prog "invert;benchmark;deriv_mg_tune;hmc_tm;offline_measurement")
22

33
include_directories(
44
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
@@ -10,7 +10,7 @@ include_directories(
1010
foreach(_prog ${tmlqcd_prog})
1111
add_executable(${_prog} "${_prog}.c")
1212

13-
target_link_libraries(${_prog} PUBLIC hmc)
13+
target_link_libraries(${_prog} PUBLIC tmlqcd)
1414
set_target_properties(
1515
${_prog}
1616
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"

src/lib/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,16 @@ endif()
394394
# space at all
395395

396396
if(BUILD_SHARED_LIBS)
397-
add_library(hmc SHARED "${ALL_SRC};${FLEX_tmlqcd_input_read_OUTPUTS}")
397+
add_library(tmlqcd SHARED "${ALL_SRC};${FLEX_tmlqcd_input_read_OUTPUTS}")
398398
else()
399-
add_library(hmc STATIC "${ALL_SRC};${FLEX_tmlqcd_input_read_OUTPUTS}")
399+
add_library(tmlqcd STATIC "${ALL_SRC};${FLEX_tmlqcd_input_read_OUTPUTS}")
400400
endif()
401401

402-
set_target_properties(hmc PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1)
402+
set_target_properties(tmlqcd PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1)
403403

404404
# define a library and add the dependencies
405405
target_link_libraries(
406-
hmc
406+
tmlqcd
407407
PUBLIC $<$<BOOL:${TM_USE_DDalphaAMG}>:DDalphaAMG>
408408
$<$<BOOL:${TM_USE_QPHIX}>:tmlqcd::qphix>
409409
$<$<BOOL:${TM_USE_FFTW}>:tmlqcd::fftw3>
@@ -427,16 +427,16 @@ target_link_libraries(
427427
m)
428428

429429
target_compile_definitions(
430-
hmc PUBLIC HAVE_CONFIG_H $<$<BOOL:${TM_USE_HIP}>:${TM_GPU_PLATFORM_DFLAGS}>)
430+
tmlqcd PUBLIC HAVE_CONFIG_H $<$<BOOL:${TM_USE_HIP}>:${TM_GPU_PLATFORM_DFLAGS}>)
431431

432432
target_include_directories(
433-
hmc
433+
tmlqcd
434434
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
435435
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
436436
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
437437

438438
install(
439-
TARGETS hmc
439+
TARGETS tmlqcd
440440
EXPORT tmlqcd_targets
441441
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
442442

src/lib/DDalphaAMG_interface.c

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>.
1919
*
20-
* Interface for TM_USE_DDalphaAMG
20+
* Interface for DDalphaAMG
2121
*
2222
*******************************************************************************/
2323

@@ -43,47 +43,47 @@ double mg_dtau_update;
4343
double mg_rho_update;
4444

4545
void MG_init(void) {
46-
printf("ERROR: MG_init called but TM_USE_DDalphaAMG library not included.\n");
46+
printf("ERROR: MG_init called but DDalphaAMG library not included.\n");
4747
exit(1);
4848
}
4949

5050
void MG_update_gauge(double step) {
51-
printf("ERROR: MG_update_gauge called but TM_USE_DDalphaAMG library not included.\n");
51+
printf("ERROR: MG_update_gauge called but DDalphaAMG library not included.\n");
5252
exit(1);
5353
}
5454

5555
void MG_update_mu(double mu_tmLQCD, double odd_tmLQCD) {
56-
printf("ERROR: MG_update_mu called but TM_USE_DDalphaAMG library not included.\n");
56+
printf("ERROR: MG_update_mu called but DDalphaAMG library not included.\n");
5757
exit(1);
5858
}
5959

6060
void MG_reset(void) {
61-
printf("ERROR: MG_reset called but TM_USE_DDalphaAMG library not included.\n");
61+
printf("ERROR: MG_reset called but DDalphaAMG library not included.\n");
6262
exit(1);
6363
}
6464

6565
void MG_finalize(void) {
66-
printf("ERROR: MG_finalize called but TM_USE_DDalphaAMG library not included.\n");
66+
printf("ERROR: MG_finalize called but DDalphaAMG library not included.\n");
6767
exit(1);
6868
}
6969

7070
int MG_solver(spinor *const phi_new, spinor *const phi_old, const double precision,
7171
const int max_iter, const int rel_prec, const int N, su3 **gf, matrix_mult f) {
72-
printf("ERROR: MG_solver called but TM_USE_DDalphaAMG library not included.\n");
72+
printf("ERROR: MG_solver called but DDalphaAMG library not included.\n");
7373
exit(1);
7474
}
7575

7676
int MG_solver_eo(spinor *const Even_new, spinor *const Odd_new, spinor *const Even,
7777
spinor *const Odd, const double precision, const int max_iter, const int rel_prec,
7878
const int N, su3 **gf, matrix_mult_full f_full) {
79-
printf("ERROR: MG_solver_eo called but TM_USE_DDalphaAMG library not included.\n");
79+
printf("ERROR: MG_solver_eo called but DDalphaAMG library not included.\n");
8080
exit(1);
8181
}
8282

8383
int MG_solver_nd(spinor *const up_new, spinor *const dn_new, spinor *const up_old,
8484
spinor *const dn_old, const double precision, const int max_iter,
8585
const int rel_prec, const int N, su3 **gf, matrix_mult_nd f) {
86-
printf("ERROR: MG_solver_nd called but TM_USE_DDalphaAMG library not included.\n");
86+
printf("ERROR: MG_solver_nd called but DDalphaAMG library not included.\n");
8787
exit(1);
8888
}
8989

@@ -207,7 +207,7 @@ static inline int MG_check(spinor *const phi_new, spinor *const phi_old, const i
207207
"ERROR: something bad happened... MG converged giving the wrong solution!! Trying to "
208208
"restart... \n");
209209
printf(
210-
"ERROR contd: || s - f_{tmLQC} * f_{TM_USE_DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = "
210+
"ERROR contd: || s - f_{tmLQC} * f_{DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = "
211211
"%e > %e "
212212
"\n",
213213
differ[0], differ[1], differ[0] / differ[1], precision);
@@ -216,9 +216,8 @@ static inline int MG_check(spinor *const phi_new, spinor *const phi_old, const i
216216
}
217217

218218
if (g_debug_level > 0 && g_proc_id == 0)
219-
printf(
220-
"MGTEST: || s - f_{tmLQC} * f_{TM_USE_DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = %e \n",
221-
differ[0], differ[1], differ[0] / differ[1]);
219+
printf("MGTEST: || s - f_{tmLQC} * f_{DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = %e \n",
220+
differ[0], differ[1], differ[0] / differ[1]);
222221

223222
return 1;
224223
}
@@ -259,7 +258,7 @@ static inline int MG_check_nd(spinor *const up_new, spinor *const dn_new, spinor
259258
"ERROR: something bad happened... MG converged giving the wrong solution!! Trying to "
260259
"restart... \n");
261260
printf(
262-
"ERROR contd: || s - f_{tmLQC} * f_{TM_USE_DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = "
261+
"ERROR contd: || s - f_{tmLQC} * f_{DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = "
263262
"%e > %e "
264263
"\n",
265264
differ[0], differ[1], differ[0] / differ[1], precision);
@@ -268,9 +267,8 @@ static inline int MG_check_nd(spinor *const up_new, spinor *const dn_new, spinor
268267
}
269268

270269
if (g_debug_level > 0 && g_proc_id == 0)
271-
printf(
272-
"MGTEST: || s - f_{tmLQC} * f_{TM_USE_DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = %e \n",
273-
differ[0], differ[1], differ[0] / differ[1]);
270+
printf("MGTEST: || s - f_{tmLQC} * f_{DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = %e \n",
271+
differ[0], differ[1], differ[0] / differ[1]);
274272

275273
return 1;
276274
}
@@ -308,7 +306,7 @@ static inline int MG_mms_check_nd(spinor **const up_new, spinor **const dn_new,
308306
"ERROR: something bad happened... MG converged giving the wrong solution!! Trying to "
309307
"restart... \n");
310308
printf(
311-
"ERROR contd: || s - f_{tmLQC} * f_{TM_USE_DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = "
309+
"ERROR contd: || s - f_{tmLQC} * f_{DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = "
312310
"%e > "
313311
"%e \n",
314312
differ[0], differ[1], differ[0] / differ[1], precision[i]);
@@ -318,9 +316,8 @@ static inline int MG_mms_check_nd(spinor **const up_new, spinor **const dn_new,
318316
}
319317

320318
if (g_debug_level > 0 && g_proc_id == 0)
321-
printf(
322-
"MGTEST: || s - f_{tmLQC} * f_{TM_USE_DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = %e \n",
323-
differ[0], differ[1], differ[0] / differ[1]);
319+
printf("MGTEST: || s - f_{tmLQC} * f_{DDalphaAMG}^{-1} * s || / ||s|| = %e / %e = %e \n",
320+
differ[0], differ[1], differ[0] / differ[1]);
324321
}
325322

326323
finalize_solver(check_vect, 2);
@@ -349,49 +346,49 @@ static int MG_pre_solve(su3 **gf) {
349346
if (mg_initialized == 0) {
350347
MG_init();
351348
mg_initialized = 1;
352-
if (g_proc_id == 0) printf("TM_USE_DDalphaAMG initialized\n");
349+
if (g_proc_id == 0) printf("DDalphaAMG initialized\n");
353350
MPI_Barrier(MPI_COMM_WORLD);
354351
}
355352

356353
if (mg_update_gauge == 1) {
357354
DDalphaAMG_set_configuration((double *)&(gf[0][0]), &mg_status);
358355
mg_update_gauge = 0;
359356
if (mg_status.success && g_proc_id == 0)
360-
printf("TM_USE_DDalphaAMG cnfg set, plaquette %e\n", mg_status.info);
357+
printf("DDalphaAMG cnfg set, plaquette %e\n", mg_status.info);
361358
else if (g_proc_id == 0)
362359
printf("ERROR: configuration updating did not run correctly");
363360
}
364361

365362
if (mg_do_setup == 1) {
366363
if (mg_setup_mu_set) {
367-
if (g_proc_id == 0) printf("TM_USE_DDalphaAMG using mu=%f during setup\n", mg_setup_mu);
364+
if (g_proc_id == 0) printf("DDalphaAMG using mu=%f during setup\n", mg_setup_mu);
368365
MG_update_mu(mg_setup_mu, 0);
369366
} else
370367
MG_update_mu(g_mu, 0);
371-
if (g_proc_id == 0) printf("TM_USE_DDalphaAMG running setup\n");
368+
if (g_proc_id == 0) printf("DDalphaAMG running setup\n");
372369
DDalphaAMG_setup(&mg_status);
373370
mg_do_setup = 0;
374371
mg_tau = gauge_tau;
375372
if (mg_status.success && g_proc_id == 0)
376-
printf("TM_USE_DDalphaAMG setup ran, time %.2f sec (%.2f %% on coarse grid)\n",
377-
mg_status.time, 100. * (mg_status.coarse_time / mg_status.time));
373+
printf("DDalphaAMG setup ran, time %.2f sec (%.2f %% on coarse grid)\n", mg_status.time,
374+
100. * (mg_status.coarse_time / mg_status.time));
378375
else if (g_proc_id == 0)
379376
printf("ERROR: setup procedure did not run correctly");
380377
}
381378

382379
if (mg_update_setup > 0) {
383380
if (mg_setup_mu_set) {
384-
if (g_proc_id == 0) printf("TM_USE_DDalphaAMG using mu=%f during setup\n", mg_setup_mu);
381+
if (g_proc_id == 0) printf("DDalphaAMG using mu=%f during setup\n", mg_setup_mu);
385382
MG_update_mu(mg_setup_mu, 0);
386383
} else
387384
MG_update_mu(g_mu, 0);
388-
if (g_proc_id == 0) printf("TM_USE_DDalphaAMG updating setup\n");
385+
if (g_proc_id == 0) printf("DDalphaAMG updating setup\n");
389386
DDalphaAMG_update_setup(mg_update_setup, &mg_status);
390387
mg_update_setup = 0;
391388
mg_tau = gauge_tau;
392389
if (mg_status.success && g_proc_id == 0)
393-
printf("TM_USE_DDalphaAMG setup ran, time %.2f sec (%.2f %% on coarse grid)\n",
394-
mg_status.time, 100. * (mg_status.coarse_time / mg_status.time));
390+
printf("DDalphaAMG setup ran, time %.2f sec (%.2f %% on coarse grid)\n", mg_status.time,
391+
100. * (mg_status.coarse_time / mg_status.time));
395392
else if (g_proc_id == 0)
396393
printf("ERROR: setup updating did not run correctly");
397394
}
@@ -401,7 +398,7 @@ static int MG_pre_solve(su3 **gf) {
401398

402399
static int MG_solve(spinor *const phi_new, spinor *const phi_old, const double precision,
403400
const int N, matrix_mult f) {
404-
// for rescaling convention in TM_USE_DDalphaAMG: (4+m)*\delta_{x,y} in tmLQCD: 1*\delta_{x,y} ->
401+
// for rescaling convention in DDalphaAMG: (4+m)*\delta_{x,y} in tmLQCD: 1*\delta_{x,y} ->
405402
// rescale by 1/4+m
406403
double mg_scale = 0.5 / g_kappa;
407404
double *old = (double *)phi_old;
@@ -535,7 +532,7 @@ static int MG_solve(spinor *const phi_new, spinor *const phi_old, const double p
535532

536533
static int MG_solve_nd(spinor *up_new, spinor *dn_new, spinor *const up_old, spinor *const dn_old,
537534
const double precision, const int N, matrix_mult_nd f) {
538-
// for rescaling convention in TM_USE_DDalphaAMG: (4+m)*\delta_{x,y} in tmLQCD: 1*\delta_{x,y} ->
535+
// for rescaling convention in DalphaAMG: (4+m)*\delta_{x,y} in tmLQCD: 1*\delta_{x,y} ->
539536
// rescale by 1/4+m moreover in the nd case, the tmLQCD is multiplied by phmc_invmaxev
540537
double mg_scale = 0.5 / g_kappa / phmc_invmaxev;
541538
double sqnorm;
@@ -809,7 +806,7 @@ static int MG_solve_nd(spinor *up_new, spinor *dn_new, spinor *const up_old, spi
809806
// 0 and shift
810807
f == Qsw_pm_ndpsi || // (Gamma5 Dh tau1)^2 - Schur complement squared
811808
f == Qsw_pm_ndpsi_shift) { // (Gamma5 Dh tau1)^2 - Schur complement squared with shift
812-
// TM_USE_DDalphaAMG: tau1 gamma5 Dh tau1 gamma5 Dh
809+
// DDalphaAMG: tau1 gamma5 Dh tau1 gamma5 Dh
813810
// tmLQCD: gamma5 Dh tau1 gamma5 Dh tau1
814811
if (init_guess) {
815812
mul_gamma5(old1, VOLUME);
@@ -906,7 +903,7 @@ static int MG_solve_nd(spinor *up_new, spinor *dn_new, spinor *const up_old, spi
906903
static int MG_mms_solve_nd(spinor **const up_new, spinor **const dn_new, spinor *const up_old,
907904
spinor *const dn_old, const double *shifts, const int no_shifts,
908905
double *precision, const int N, matrix_mult_nd f) {
909-
// for rescaling convention in TM_USE_DDalphaAMG: (4+m)*\delta_{x,y} in tmLQCD: 1*\delta_{x,y} ->
906+
// for rescaling convention in DDalphaAMG: (4+m)*\delta_{x,y} in tmLQCD: 1*\delta_{x,y} ->
910907
// rescale by 1/4+m moreover in the nd case, the tmLQCD is multiplied by phmc_invmaxev
911908
double mg_scale = 0.5 / g_kappa / phmc_invmaxev;
912909
double *old1 = (double *)up_old;
@@ -1007,7 +1004,7 @@ static int MG_mms_solve_nd(spinor **const up_new, spinor **const dn_new, spinor
10071004
// 0 and shift
10081005
f == Qsw_pm_ndpsi_shift) { // (Gamma5 Dh tau1)^2 - Schur complement squared with shift
10091006
mg_scale *= mg_scale;
1010-
// TM_USE_DDalphaAMG: tau1 gamma5 Dh tau1 gamma5 Dh
1007+
// DDalphaAMG: tau1 gamma5 Dh tau1 gamma5 Dh
10111008
// tmLQCD: gamma5 Dh tau1 gamma5 Dh tau1
10121009
DDalphaAMG_solve_ms_doublet_squared_odd(new2, old2, new1, old1, mg_even_shifts, mg_odd_shifts,
10131010
no_shifts, precision, &mg_status);
@@ -1116,7 +1113,7 @@ void MG_init() {
11161113
mg_params.conf_index_fct = conf_index_fct;
11171114
mg_params.vector_index_fct = vector_index_fct;
11181115

1119-
/* in TM_USE_DDalphaAMG
1116+
/* in DDalphaAMG
11201117
* Printing level:
11211118
* -1: silent (errors or warnings)
11221119
* 0: minimal //default

src/lib/operator/Hopping_Matrix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ void Hopping_Matrix(const int ieo, spinor* const l, spinor* const k) {
106106
{
107107
#endif
108108

109+
#include "hopping.h"
109110
#include "operator/hopping_body_dbl.inc"
110111

111112
#ifdef TM_USE_OMP

0 commit comments

Comments
 (0)