NDIM instead of NSPIN in calculation of flops (Defect #475)

Added by Alessandro Sciarra over 6 years ago. Updated over 6 years ago.

Status:New Start date:14 May 2013
Priority:Low Due date:
Assignee:Christopher Pinke % Done:


Target version:-


In Spinors class we have the function

uint64_t hardware::code::Spinors::get_flop_size(const std::string& in) const

that calculates the number of flops for each kernel. In my opinion there should be NSPIN instead of NDIM in several places (maybe everywhere). For instance we have
if (in == "sax") {
  //this kernel performs on each site spinor_times_complex
  return S * (NDIM * NC * ( meta::get_flop_complex_mult() ) );

and here, per site, we have 12 multiplications between complex numbers. Now, that 12, is NC times NSPIN and not NC times NDIM. Of course, this remark is of very general nature and then this bug is not a bug as long as one simulates Wilson fermions of spin 1/2 in 4 dimensions. Nevertheless, probably, it should be fixed.


Updated by Alessandro Sciarra over 6 years ago

Of course, there are also some functions in util.cpp in the meta directory that should be adjusted. For example:

size_t meta::get_flop_spinor_spinor() noexcept {
  //  NDIM * NC * complex_mult + ( NDIM * NC -1 ) complex adds
  return NDIM * NC * get_flop_complex_mult() + (NDIM * NC - 1) * 2;

Updated by Alessandro Sciarra over 6 years ago

Another remark: probably, using NSPIN instead of NDIM and adjusting some method in util.cpp, a unique get_flop_size function both for Wilson and staggered fermions could be developed. The only difference between these two functions is that NSPIN is 1 for staggered fermions and it is 4 for Wilson fermions. Nevertheless, so far, in the Spinors_staggered class meta::get_flop_su3vec_sqnorm() and meta::get_flop_su3vec_su3vec() are used, while in Spinors class meta::get_flop_spinor_sqnorm() and meta::get_flop_spinor_spinor() are called.

Updated by Alessandro Sciarra over 6 years ago

It is worth remarking that also the functions

size_t hardware::code::Spinors_staggered::get_read_write_size(const std::string& in) const
size_t hardware::code::Spinors::get_read_write_size(const std::string& in) const

could, maybe, be unified on condition that in the Spinors::get_read_write_size function all the 12 are replaced by NSPIN*NC. In Spinors_staggered::get_read_write_size NSPIN is 1 and all is already written in terms of NC.

  • Assignee set to Christopher Pinke

Also available in: Atom PDF