etmc / tmLQCD

tmLQCD is a freely available software suite providing a set of tools to be used in lattice QCD simulations. This is mainly a HMC implementation (including PHMC and RHMC) for Wilson, Wilson Clover and Wilson twisted mass fermions and inverter for different versions of the Dirac operator. The code is fully parallelised and ships with optimisations for various modern architectures, such as commodity PC clusters and the Blue Gene family.
http://www.itkp.uni-bonn.de/~urbach/software.html
GNU General Public License v3.0
32 stars 47 forks source link

disentangle NDPOLY and POLY monomials #90

Open urbach opened 12 years ago

urbach commented 12 years ago

currently it seems to me that it is really hard to disentangle ndpoly and poly monomials. In particular there are many if statements in ndpoly_monomial where I am not sure how they work. There are many dublicated code sequences, it seems to me in chebyshev_polynomial.c, chebyshev_polynomial_nd.c and Ptilde_nd.c, it seems to me

Moreover, the init_poly_monomial in monomial.c is not at the right place here and has significant overlap with old init_phmc or the new init_ndpoly_monoial functions. What is the status of preconditioning for polynomials?

@annube could you help there please?

annube commented 12 years ago

For the first part I can say the following: In the ancient times (~4-5 years ago) I implemented the degenerate PHMC as an optimisation of 1+1 PHMC in case of a zero mass splitting. So the trigger for this part of the code was the mass-splitting being zero (therefore the if statements). In 2010 I have implemented a degenerate PHMC (+ mass preconditioning) explicitly, which makes the old stuff dispensable. So I would suggest to just remove the degenerate stuff (together with the "if statements") in ndpoly_monomial.c. I will also check and try to clean up the duplicated code in the chebyshev_polynomial.c, chebyshev_polynomial_nd.c and Ptilde_nd.c files. I had a quick look at this and I saw in fact some potential to reorganize these files.

Concerning init_poly_monomial: where else should we initialise the poly monomial?

urbach commented 12 years ago

@annube thanks for your reply!

In my branch NDTwistedClover I am already working on this, so maybe you don't do it in parallel but rather have a look there. I could reomve the if statements in ndpoly_monomial.c easily.

concerning the init function: have a look at my new ndpoly_monomial.c version. There is now an init_ndpoly_monomial function which belong into this file I belive. However, its not clear to me in how far this can be merged with your init_poly_monomial function. In the new ndpoly_monomial.c I also reorganised everything such that the variables of the monomial are used rather than the global variables. However, this is currently only at this top level, all the lower level functions use still the global variables.

the files related to chebyshev need re-organisation, but I also need to include the clover term there. Right now it looks like a nightmare...

annube commented 12 years ago

@urbach Do you know which code sequences you have to remove in ndpoly_monomial.c? If not, I made the corresponding changes already in my phmc_cleanup branch. But I wanted to test this before pull requesting.

concerning the initialisation of the poly monomial: I've seen already how the ndpoly monomial is initialized. And I think I can migrate the poly initialization also to init_phmc.c. Furthermore I can reuse this phmc variable stack that was also introduced init_phmc.c making the handling of the global variables much easier.

I would also help in reorganising the chebyshev stuff. In which way do you need the chebyshev approximation for the clover term?

urbach commented 12 years ago

did you have a look to my NDTwistedClover branch?

Do you know which code sequences you have to remove in ndpoly_monomial.c? If not, I made the corresponding changes already in my phmc_cleanup branch. But I wanted to test this before pull requesting.

what I have to remove: have a look at cloverndpoly_monomial.c. But if you did it already we can also pull this from your branch.

concerning the initialisation of the poly monomial: I've seen already how the ndpoly monomial is initialized. And I think I > can migrate the poly initialization also to init_phmc.c. Furthermore I can reuse this phmc variable stack that was also introduced init_phmc.c making the handling of the global variables much easier.

init_phmc should be obsolete in the future. I really need init_ndpoly_monomial, otherwise I cannot have several ndpoly monomials at the same time. Every monomial keeps its own variables, doesn't it? So we don't need this stack, do we? Currently we just need to set the global variables according to the ones stored in the monomial, see my new ndpoly_monomial.c implementation.

I would also help in reorganising the chebyshev stuff. In which way do you need the chebyshev approximation for the clover term?

For including the clover term I have to replace certain functions with their clover counterparts. This starts already in the determination of the eigenvalues and the approximation interval. Currently its all hard-coded :(