diff --git a/.github/workflows/basic-build.yaml b/.github/workflows/basic-build.yaml index a045787ad..75ee4a43c 100644 --- a/.github/workflows/basic-build.yaml +++ b/.github/workflows/basic-build.yaml @@ -9,21 +9,28 @@ jobs: steps: # handling of environment variable: https://stackoverflow.com/a/57969570 - name: lscpu + if: ${{ always() }} run: | lscpu; \ echo "nb_cores=$(lscpu | grep \^CPU\(s\)\: | awk '{print $2}')" >> $GITHUB_ENV - name: gcc_version + if: ${{ always() }} run: gcc --version - name: echo_nb_cores + if: ${{ always() }} run: echo "Number of cores ${nb_cores}" - name: get_packages - run: sudo apt-get update && sudo apt install openmpi-bin openmpi-common numdiff + run: sudo apt-get update && sudo apt install openmpi-bin openmpi-common libopenmpi3 libopenmpi-dev numdiff + + - name: mpicc_version + if: ${{ always() }} + run: mpicc --version - name: get_lime - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: usqcd-software/c-lime path: lime @@ -41,8 +48,15 @@ jobs: make -j make install + - name: Archive lime config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: lime_config_output + path: ${{github.workspace}}/lime/build/config.log + - name: get_lemon - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: etmc/lemon path: lemon @@ -61,9 +75,16 @@ jobs: ../configure --prefix=$(pwd)/install_dir make -j make install + + - name: Archive lemon config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: lemon_config_output + path: ${{github.workspace}}/lemon/build/config.log - name: get_tmlqcd - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: main @@ -94,11 +115,25 @@ jobs: --with-lapack="-lblas -llapack" || cat config.log make -j + - name: Archive tmLQCD config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: tmlqcd_config_output + path: ${{github.workspace}}/main/build/config.log + - name: nf2_rgmixedcg_hmc_tmcloverdetratio working-directory: ${{github.workspace}}/main/build run: | mpirun -np 2 ./hmc_tm \ -f ../sample-input/sample-hmc-rgmixedcg-tmcloverdetratio.input + + - name: Archive nf2_rgmixedcg_hmc_tmcloverdetratio output + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: tmlqcd_test_output + path: ${{github.workspace}}/main/build/output.data - name: compare_nf2_rgmixedcg_hmc_tmcloverdetratio working-directory: ${{github.workspace}}/main/build diff --git a/.github/workflows/ddalphaamg-build.yaml b/.github/workflows/ddalphaamg-build.yaml index 9167ab541..68aae1c19 100644 --- a/.github/workflows/ddalphaamg-build.yaml +++ b/.github/workflows/ddalphaamg-build.yaml @@ -8,7 +8,7 @@ jobs: steps: - name: get_tmlqcd - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: main @@ -20,16 +20,22 @@ jobs: echo "nb_cores=$(lscpu | grep \^CPU\(s\)\: | awk '{print $2}')" >> $GITHUB_ENV - name: gcc_version + if: ${{ always() }} run: gcc --version - name: echo_nb_cores + if: ${{ always() }} run: echo "Number of cores ${nb_cores}" - name: get_packages - run: sudo apt update && sudo apt install openmpi-bin openmpi-common numdiff + run: sudo apt update && sudo apt install openmpi-bin openmpi-common libopenmpi3 libopenmpi-dev numdiff + + - name: mpicc_version + if: ${{ always() }} + run: mpicc --version - name: get_lime - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: usqcd-software/c-lime path: lime @@ -50,8 +56,15 @@ jobs: make -j make install + - name: Archive lime config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: lime_config_output + path: ${{github.workspace}}/lime/build/config.log + - name: get_lemon - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: etmc/lemon path: lemon @@ -73,10 +86,18 @@ jobs: make -j make install + - name: Archive lemon config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: lemon_config_output + path: ${{github.workspace}}/lemon/build/config.log + - name: get_ddalphaamg - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - repository: sbacchio/ddalphaamg + repository: kostrzewa/ddalphaamg #sbacchio/ddalphaamg + ref: fix_main_build path: ddalphaamg - name: build_ddalphaamg @@ -120,6 +141,13 @@ jobs: mpirun -np 2 ./hmc_tm \ -f ../sample-input/sample-hmc-ddalphaamg-tmcloverdetratio.input + - name: Archive nf2_ddalphaamg_hmc_tmcloverdetratio output + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: tmlqcd_test_output + path: ${{github.workspace}}/main/build/output.data + - name: compare_nf2_ddalphaamg_hmc_tmcloverdetratio working-directory: ${{github.workspace}}/main/build run: | diff --git a/.github/workflows/qphix-build.yaml b/.github/workflows/qphix-build.yaml index 5fa3fe347..7ed5275d5 100644 --- a/.github/workflows/qphix-build.yaml +++ b/.github/workflows/qphix-build.yaml @@ -9,21 +9,28 @@ jobs: steps: # handling of environment variable: https://stackoverflow.com/a/57969570 - name: lscpu + if: ${{ always() }} run: | lscpu; \ echo "nb_cores=$(lscpu | grep \^CPU\(s\)\: | awk '{print $2}')" >> $GITHUB_ENV - name: gcc_version + if: ${{ always() }} run: gcc --version - name: echo_nb_cores + if: ${{ always() }} run: echo "Number of cores ${nb_cores}" - name: get_packages - run: sudo apt update && sudo apt install openmpi-bin openmpi-common numdiff + run: sudo apt update && sudo apt install openmpi-bin openmpi-common libopenmpi3 libopenmpi-dev numdiff + + - name: mpicc_version + if: ${{ always() }} + run: mpicc --version - name: get_lime - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: usqcd-software/c-lime path: lime @@ -41,8 +48,15 @@ jobs: make -j make install + - name: Archive lime config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: lime_config_output + path: ${{github.workspace}}/lime/build/config.log + - name: get_lemon - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: etmc/lemon path: lemon @@ -63,8 +77,16 @@ jobs: make -j make install + - name: Archive lemon config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: lemon_config_output + path: ${{github.workspace}}/lemon/build/config.log + + - name: get_qmp - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: usqcd-software/qmp path: qmp @@ -86,11 +108,18 @@ jobs: make -j make install + - name: Archive qmp config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: qmp_config_output + path: ${{github.workspace}}/qmp/build/config.log + - name: get_qphix - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: JeffersonLab/qphix - ref: fix_tmlqcd + ref: sysctl_deprecated path: qphix - name: create_qphix_builddir @@ -99,7 +128,7 @@ jobs: - name: cache_qphix id: cache-qphix - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: qphix/build key: ${{ runner.os }}-haswell-qphix @@ -116,6 +145,7 @@ jobs: -Dtm_clover=ON \ -Dtwisted_mass=ON \ -Dtesting=OFF \ + -Drecursive_jN=$(( ${nb_cores} + 3 )) \ -DCMAKE_CXX_COMPILER=mpicxx \ -DCMAKE_CXX_FLAGS="-std=c++11 -O2 -mavx2 -mfma -mtune=haswell -march=haswell -fopenmp" \ -DCMAKE_C_COMPILER=mpicc \ @@ -126,7 +156,7 @@ jobs: make install - name: get_tmlqcd - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: main @@ -160,12 +190,27 @@ jobs: --enable-qphix-soalen=4 || cat config.log make -j + - name: Archive tmLQCD config.log + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: tmlqcd_config_output + path: ${{github.workspace}}/main/build/config.log + - name: nf2_qphix_hmc_tmcloverdetratio working-directory: ${{github.workspace}}/main/build run: | mpirun -np 2 ./hmc_tm \ -f ../sample-input/sample-hmc-qphix-tmcloverdetratio.input + - name: Archive nf2_qphix_hmc_tmcloverdetratio output + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: tmlqcd_test_output + path: ${{github.workspace}}/main/build/output.data + + - name: compare_nf2_qphix_hmc_tmcloverdetratio working-directory: ${{github.workspace}}/main/build run: | diff --git a/.gitignore b/.gitignore index 041011885..82a86fead 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ doc/*.txt doc/*.gpl doc/wrapper* history_hmc_tm +.vscode/* \ No newline at end of file diff --git a/default_input_values.h b/default_input_values.h index cf781368b..b6b30f690 100644 --- a/default_input_values.h +++ b/default_input_values.h @@ -85,6 +85,7 @@ #define _default_rlxd_level 1 #define _default_solver_flag 1 // this is CG (see solver/solver_types.h) #define _default_nd_solver_flag 15 // this is CGMMSND (see solver/solver_types.h) +#define _default_HB_solver_flag 26 // this is INVALID_SOLVER (see solver/solver_types.h) #define _default_startoption 0 #define _default_Ntherm 0 #define _default_Nmeas 1 diff --git a/doc/input.tex b/doc/input.tex index 818f4334e..090ef9e59 100644 --- a/doc/input.tex +++ b/doc/input.tex @@ -422,7 +422,8 @@ \subsection{Input parameter for main program} \left[\det(P_{n}(Q^2(\kappa) + \mu^2)) det(Q^2(\kappa_2) + \mu^2_2)\right]^{-1} \] \end{itemize} -Each of them has different options: +Each of them has different options +: \begin{itemize} \item {\ttfamily DET, CLOVERDET}: \begin{itemize} @@ -450,19 +451,24 @@ \subsection{Input parameter for main program} \item {\ttfamily MaxSolverIterations}: default is $5000$ \item {\ttfamily Solver}: the solver to be used, either CG or BiCGstab. Default is CG. + \item {\ttfamily HB\_Solver}: the solver to be used in the heatbath step, see section \ref{sec:hb.solver} for details. \item {\ttfamily Name}: a name to be assigned to the monomial. The default is {\ttfamily DET} \end{itemize} +% \item {\ttfamily DETRATIO}: the same as for {\ttfamily DET}, but in addition: \begin{itemize} \item {\ttfamily 2KappaMu2} \item {\ttfamily Kappa2} - \item {\ttfamily Name}: a name to be assigned to the monomial. The - default is {\ttfamily DETRATIO} + \item {\ttfamily Name}: + a name to be assigned to the monomial. + The default is {\ttfamily DETRATIO} \end{itemize} - - +% +\item {\ttfamily CLOVERDETRATIO}: + see {\ttfamily CLOVERDET} and {\ttfamily DETRATIO}. +% \item {\ttfamily GAUGE}: \begin{itemize} \item {\ttfamily Timescale}: the timescale on which to integrate @@ -641,6 +647,24 @@ \subsection{Input parameter for main program} {\ttfamily } is to be replaced by the ratio {\ttfamily Lmin/Lmax}. \end{itemize} +\subsubsection{The heatbath solver} +\label{sec:hb.solver} + +Inside each monomial the user specifies the solver for the inversion of the Dirac operator. +The solver used in the HB (heatbath) can be different from the MD (Molecular Dynamics) and ACC step (acceptance step). +% +This is determined by the {\ttfamily HB\_solver} parameter inside the {\ttfamily BeginMonomial}-{\ttfamily EndMonomial}. +Supported values: CG, MIXEDCG, RGMIXEDCG, BICGSTAB, MIXEDBICGSTAB, MG. +If specified, the following (optional) parameters of the HB solver are parsed: +\begin{itemize} + \item {\ttfamily HB\_MaxSolverIterations}: analogous to {\ttfamily MaxSolverIterations} + \item {\ttfamily HB\_UseExternalInverter}: analogous to {\ttfamily UseExternalInverter} + \item {\ttfamily HB\_UseSloppyPrecision}: analogous to {\ttfamily UseSloppyPrecision} + \item {\ttfamily HB\_UseCompression}: analogous to {\ttfamily UseCompression} +\end{itemize} +% +Their default values are taken from the corresponding MD solver parameters. + \subsubsection{The Integrator} The Integrator can be specified similar to the monomials: diff --git a/monomial/cloverdetratio_monomial.c b/monomial/cloverdetratio_monomial.c index 53a129173..4dea03408 100644 --- a/monomial/cloverdetratio_monomial.c +++ b/monomial/cloverdetratio_monomial.c @@ -283,15 +283,15 @@ void cloverdetratio_heatbath(const int id, hamiltonian_field_t * const hf) { zero_spinor_field(mnl->pf,VOLUME/2); tm_stopwatch_pop(&g_timers, 0, 1, ""); - if( mnl->solver == MG ){ - mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->solver_params, mnl->maxiter, mnl->accprec, - g_relative_precision_flag, VOLUME/2, mnl->Qp, mnl->solver); + if( mnl->HB_solver == MG ){ + mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->HB_solver_params, mnl->HB_maxiter, mnl->accprec, + g_relative_precision_flag, VOLUME/2, mnl->Qp, mnl->HB_solver); chrono_add_solution(mnl->pf, mnl->csg_field, mnl->csg_index_array, mnl->csg_N, &mnl->csg_n, VOLUME/2); } else { - mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->solver_params, mnl->maxiter, mnl->accprec, - g_relative_precision_flag, VOLUME/2, mnl->Qsq, mnl->solver); + mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->HB_solver_params, mnl->HB_maxiter, mnl->accprec, + g_relative_precision_flag, VOLUME/2, mnl->Qsq, mnl->HB_solver); chrono_add_solution(mnl->pf, mnl->csg_field, mnl->csg_index_array, mnl->csg_N, &mnl->csg_n, VOLUME/2); diff --git a/monomial/detratio_monomial.c b/monomial/detratio_monomial.c index 169f4d046..1b955005e 100644 --- a/monomial/detratio_monomial.c +++ b/monomial/detratio_monomial.c @@ -240,14 +240,14 @@ void detratio_heatbath(const int id, hamiltonian_field_t * const hf) { boundary(g_kappa); zero_spinor_field(mnl->w_fields[0], VOLUME/2); - if( mnl->solver == MG || mnl->solver == BICGSTAB ){ - mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->solver_params, mnl->maxiter, mnl->accprec, - g_relative_precision_flag, VOLUME/2, mnl->Qp, mnl->solver); + if( mnl->HB_solver == MG || mnl->HB_solver == BICGSTAB ){ + mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->HB_solver_params, mnl->HB_maxiter, mnl->accprec, + g_relative_precision_flag, VOLUME/2, mnl->Qp, mnl->HB_solver); chrono_add_solution(mnl->pf, mnl->csg_field, mnl->csg_index_array, mnl->csg_N, &mnl->csg_n, VOLUME/2); } else { - mnl->iter0 = solve_degenerate(mnl->w_fields[0], mnl->w_fields[1], mnl->solver_params, mnl->maxiter, - mnl->accprec, g_relative_precision_flag, VOLUME/2, mnl->Qsq, mnl->solver); + mnl->iter0 = solve_degenerate(mnl->w_fields[0], mnl->w_fields[1], mnl->HB_solver_params, mnl->HB_maxiter, + mnl->accprec, g_relative_precision_flag, VOLUME/2, mnl->Qsq, mnl->HB_solver); tm_stopwatch_push(&g_timers, "Qm", ""); mnl->Qm(mnl->pf, mnl->w_fields[0]); tm_stopwatch_pop(&g_timers, 0, 1, ""); @@ -271,23 +271,23 @@ void detratio_heatbath(const int id, hamiltonian_field_t * const hf) { boundary(g_kappa); zero_spinor_field(mnl->pf,VOLUME); - if((mnl->solver == CG) || (mnl->solver == MIXEDCG) || (mnl->solver == RGMIXEDCG)){ - mnl->iter0 = solve_degenerate(mnl->w_fields[0], mnl->w_fields[1], mnl->solver_params, - mnl->maxiter, mnl->accprec, g_relative_precision_flag, VOLUME, Q_pm_psi, mnl->solver); + if((mnl->HB_solver == CG) || (mnl->HB_solver == MIXEDCG) || (mnl->HB_solver == RGMIXEDCG)){ + mnl->iter0 = solve_degenerate(mnl->w_fields[0], mnl->w_fields[1], mnl->HB_solver_params, + mnl->HB_maxiter, mnl->accprec, g_relative_precision_flag, VOLUME, Q_pm_psi, mnl->HB_solver); tm_stopwatch_push(&g_timers, "Q_minus_psi", ""); Q_minus_psi(mnl->pf, mnl->w_fields[0]); tm_stopwatch_pop(&g_timers, 0, 1, ""); chrono_add_solution(mnl->pf, mnl->csg_field, mnl->csg_index_array, mnl->csg_N, &mnl->csg_n, VOLUME/2); // FIXME why only MG here? - } else if( mnl->solver == MG ){ - mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->solver_params, mnl->maxiter, mnl->accprec, - g_relative_precision_flag, VOLUME, Q_plus_psi, mnl->solver); + } else if( mnl->HB_solver == MG ){ + mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->HB_solver_params, mnl->HB_maxiter, mnl->accprec, + g_relative_precision_flag, VOLUME, Q_plus_psi, mnl->HB_solver); chrono_add_solution(mnl->pf, mnl->csg_field, mnl->csg_index_array, mnl->csg_N, &mnl->csg_n, VOLUME/2); } else { - mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->solver_params, mnl->maxiter, mnl->accprec, - g_relative_precision_flag, VOLUME, Q_plus_psi, mnl->solver); + mnl->iter0 = solve_degenerate(mnl->pf, mnl->w_fields[1], mnl->HB_solver_params, mnl->HB_maxiter, mnl->accprec, + g_relative_precision_flag, VOLUME, Q_plus_psi, mnl->HB_solver); chrono_add_solution(mnl->pf, mnl->csg_field, mnl->csg_index_array, mnl->csg_N, &mnl->csg_n, VOLUME/2); chrono_add_solution(mnl->pf, mnl->csg_field2, mnl->csg_index_array2, diff --git a/monomial/monomial.c b/monomial/monomial.c index 5c1c6f80f..ee1c406a7 100644 --- a/monomial/monomial.c +++ b/monomial/monomial.c @@ -94,6 +94,7 @@ int add_monomial(const int type) { monomial_list[no_monomials].accprec = _default_g_eps_sq_acc; monomial_list[no_monomials].forceprec = _default_g_eps_sq_force; monomial_list[no_monomials].maxiter = _default_max_solver_iterations; + monomial_list[no_monomials].HB_maxiter = _default_max_solver_iterations; if((monomial_list[no_monomials].type == NDRAT) || (monomial_list[no_monomials].type == NDRATCOR) || (monomial_list[no_monomials].type == NDCLOVERRAT) || @@ -103,6 +104,7 @@ int add_monomial(const int type) { } else{ monomial_list[no_monomials].solver = _default_solver_flag; + monomial_list[no_monomials].HB_solver = _default_HB_solver_flag; } monomial_list[no_monomials].solver_params.mcg_delta = _default_mixcg_innereps; monomial_list[no_monomials].solver_params.solution_type = TM_SOLUTION_M_MDAG; @@ -115,6 +117,7 @@ int add_monomial(const int type) { monomial_list[no_monomials].solver_params.sloppy_precision = _default_operator_sloppy_precision_flag; monomial_list[no_monomials].external_library = _default_external_library; monomial_list[no_monomials].solver_params.refinement_precision = _default_operator_sloppy_precision_flag; + monomial_list[no_monomials].HB_solver_params = monomial_list[no_monomials].solver_params; monomial_list[no_monomials].even_odd_flag = _default_even_odd_flag; monomial_list[no_monomials].forcefactor = 1.; monomial_list[no_monomials].use_rectangles = 0; @@ -248,6 +251,12 @@ int init_monomials(const int V, const int even_odd_flag) { } } else if(monomial_list[i].type == CLOVERDETRATIO) { + if (monomial_list[i].HB_solver == _default_HB_solver_flag) { + monomial_list[i].HB_solver = monomial_list[i].solver; + monomial_list[i].HB_solver_params = monomial_list[i].solver_params; + monomial_list[i].HB_maxiter = monomial_list[i].maxiter; + } + monomial_list[i].hbfunction = &cloverdetratio_heatbath; monomial_list[i].accfunction = &cloverdetratio_acc; monomial_list[i].derivativefunction = &cloverdetratio_derivative; @@ -277,6 +286,12 @@ int init_monomials(const int V, const int even_odd_flag) { } } else if(monomial_list[i].type == DETRATIO) { + if (monomial_list[i].HB_solver == _default_HB_solver_flag) { + monomial_list[i].HB_solver = monomial_list[i].solver; + monomial_list[i].HB_solver_params = monomial_list[i].solver_params; + monomial_list[i].HB_maxiter =monomial_list[i].maxiter; + } + monomial_list[i].hbfunction = &detratio_heatbath; monomial_list[i].accfunction = &detratio_acc; monomial_list[i].derivativefunction = &detratio_derivative; diff --git a/monomial/monomial.h b/monomial/monomial.h index 48f8fcb6d..26aa1af48 100644 --- a/monomial/monomial.h +++ b/monomial/monomial.h @@ -62,10 +62,12 @@ typedef struct { int initialised; int timescale; int maxiter; + int HB_maxiter; // as maxiter, but for the HB solver int id; int even_odd_flag; int rngrepro; int solver; + int HB_solver; // solver for the HB only (optional) int iter0, iter1, iter2; int csg_N, csg_N2; @@ -90,6 +92,7 @@ typedef struct { double forceprec; double accprec; solver_params_t solver_params; + solver_params_t HB_solver_params; // parameters of the HB solver /* force normalisation */ double forcefactor; /* some book-keeping */ diff --git a/mpi_init.c b/mpi_init.c index ce9ffe585..f2e153a04 100644 --- a/mpi_init.c +++ b/mpi_init.c @@ -213,7 +213,8 @@ void tmlqcd_mpi_init(int argc,char *argv[]) { int dims[] = {0,0,0,0}; int ndims = 0; int nalldims = 4; - int reorder = 1, namelen; + /* BK 2023/02/03 - for correct functioning on LUMI-G, we disable task reordering */ + int reorder = 0, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; #endif g_proc_coords[0] = 0; diff --git a/read_input.l b/read_input.l index b91b07428..c4e8c0764 100644 --- a/read_input.l +++ b/read_input.l @@ -581,6 +581,7 @@ static inline double fltlist_next_token(int * const list_end){ %x INITMONOMIAL %x DETMONOMIAL %x CLDETMONOMIAL +%x DETRATMONOMIAL %x CLDETRATMONOMIAL %x CLDETRATRWMONOMIAL %x GAUGEMONOMIAL @@ -600,6 +601,7 @@ static inline double fltlist_next_token(int * const list_end){ %x MNAME %x MCSTR %x MSOLVER +%x HB_MSOLVER %x RATMSOLVER %x NDMSOLVER %x GTYPE @@ -2170,13 +2172,13 @@ static inline double fltlist_next_token(int * const list_end){ } else if(mnl->type == CLOVERDET) BEGIN(CLDETMONOMIAL); else if(mnl->type == CLOVERDETRATIO) BEGIN(CLDETRATMONOMIAL); + else if(mnl->type == DETRATIO) BEGIN(DETRATMONOMIAL); else if(mnl->type == CLOVERDETRATIORW) BEGIN(CLDETRATRWMONOMIAL); else BEGIN(DETMONOMIAL); } - -{ +{ {SPC}*Timescale{EQL}{DIGIT}+ { if(mnl->type == NDDETRATIO || mnl->type == NDCLOVERDETRATIO) { mnl->timescale = -5; @@ -2338,7 +2340,67 @@ static inline double fltlist_next_token(int * const list_end){ } } -{ +{ + {SPC}*HB_Solver{EQL} { + solver_caller=YY_START; + BEGIN(HB_MSOLVER); + } + {SPC}*HB_MaxSolverIterations{EQL}{DIGIT}+ { + sscanf(yytext, " %[a-zA-Z_] = %d", name, &a); + mnl->HB_maxiter = a; + if(myverbose) printf(" HB_MaxSolverIterations set to %d line %d monomial %d\n", a, line_of_file, current_monomial); + } + {SPC}*HB_UseExternalInverter{EQL}quda { + if(myverbose) printf(" HB Use Quda inverter line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.external_inverter = QUDA_INVERTER; + } + {SPC}*HB_UseExternalInverter{EQL}qphix { + if(myverbose) printf(" HB Use QPhiX inverter line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.external_inverter = QPHIX_INVERTER; + } + {SPC}*HB_UseExternalInverter{EQL}no { + if(myverbose) printf(" HB Use QPhiX inverter line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.external_inverter = NO_EXT_INV; + } + {SPC}*HB_UseSloppyPrecision{EQL}yes { + if(myverbose) printf(" HB Use sloppy precision (single) in the inverter (if supported) line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.sloppy_precision = SLOPPY_SINGLE; + } + {SPC}*HB_UseSloppyPrecision{EQL}float { + if(myverbose) printf(" HB Use sloppy precision (single) in the inverter (if supported) line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.sloppy_precision = SLOPPY_SINGLE; + } + {SPC}*HB_UseSloppyPrecision{EQL}single { + if(myverbose) printf(" HB Use sloppy precision (single) in the inverter (if supported) line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.sloppy_precision = SLOPPY_SINGLE; + } + {SPC}*HB_UseSloppyPrecision{EQL}no { + if(myverbose) printf(" HB Use sloppy precision (double) in the inverter line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.sloppy_precision = SLOPPY_DOUBLE; + } + {SPC}*HB_UseSloppyPrecision{EQL}double { + if(myverbose) printf(" HB Use sloppy precision (double) in the inverter line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.sloppy_precision = SLOPPY_DOUBLE; + } + {SPC}*HB_UseSloppyPrecision{EQL}half { + if(myverbose) printf(" HB Use sloppy precision (half) in the inverter (if supported) line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.sloppy_precision = SLOPPY_HALF; + } + {SPC}*HB_UseCompression{EQL}12 { + if(myverbose) printf(" HB Use 12 compression in the inverter (if supported) line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.compression_type = COMPRESSION_12; + } + {SPC}*HB_UseCompression{EQL}8 { + if(myverbose) printf(" HB Use 8 compression in the inverter (if supported) line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.compression_type = COMPRESSION_8; + } + {SPC}*HB_UseCompression{EQL}18 { + if(myverbose) printf(" HB Not using compression in the inverter line %d monomial %d\n", line_of_file, current_monomial); + mnl->HB_solver_params.compression_type = NO_COMPRESSION; + } +} + +{ {SPC}*ForcePrecision{EQL}{FLT} { sscanf(yytext, " %[a-zA-Z] = %lf",name , &c); mnl->forceprec = c; @@ -2637,6 +2699,51 @@ static inline double fltlist_next_token(int * const list_end){ } } +{ + CG { + if(myverbose) printf(" HB Solver set to \"%s\" line %d monomial %d\n", yytext, line_of_file, current_monomial); + mnl->HB_solver = CG; + BEGIN(solver_caller); + } + mixedCG { + if(myverbose) printf(" HB Solver set to \"%s\" line %d monomial %d\n", yytext, line_of_file, current_monomial); + mnl->HB_solver = MIXEDCG; + BEGIN(solver_caller); + } + rgmixedCG { + if(myverbose) printf(" HB Solver set to \"%s\" line %d monomial %d\n", yytext, line_of_file, current_monomial); + mnl->HB_solver = RGMIXEDCG; + BEGIN(solver_caller); + } + BICGSTAB { + if(myverbose) printf(" HB Solver set to \"%s\" line %d monomial %d\n", yytext, line_of_file, current_monomial); + mnl->HB_solver = BICGSTAB; + BEGIN(solver_caller); + } + mixedbicgstab { + if(myverbose) printf(" HB Solver set to \"%s\" line %d monomial %d\n", yytext, line_of_file, current_monomial); + mnl->HB_solver=MIXEDBICGSTAB; + BEGIN(solver_caller); + } + MG { + if(myverbose) printf(" HB Solver set to \"%s\" line %d monomial %d\n", yytext, line_of_file, current_monomial); + mnl->HB_solver = MG; + BEGIN(solver_caller); + } + DDalphaAMG { +#ifdef DDalphaAMG + if(myverbose) printf(" HB Solver set to DDalphaAMG line %d operator %d\n", line_of_file, current_operator); + mnl->HB_solver = MG; + BEGIN(solver_caller); +#else + printf("ERROR line %d operator %d: DDalphaAMG library not included\n", line_of_file, current_operator); + exit(1); +#endif + } +} + + + { rgmixedCG { if(myverbose) printf(" Solver set to \"%s\" line %d monomial %d\n", yytext, line_of_file, current_monomial); diff --git a/solver/solver_types.h b/solver/solver_types.h index 0e00a16fb..0538481ab 100644 --- a/solver/solver_types.h +++ b/solver/solver_types.h @@ -47,7 +47,8 @@ typedef enum SOLVER_TYPE { MG, MIXEDBICGSTAB, DUMMYHERMTEST, - CA_GCR + CA_GCR, + INVALID_SOLVER } SOLVER_TYPE; int solver_is_mixed( const int solver_type );