mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
add benchmark to see whether matrix multiplication is slower than read from object
This commit is contained in:
@ -1,11 +1,35 @@
|
||||
/*
|
||||
* Test_fatLinks.cc
|
||||
*
|
||||
* D. Clarke
|
||||
*
|
||||
* Test the various constructs used to make fat links.
|
||||
*
|
||||
*/
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/smearing/Test_fatLinks.cc
|
||||
|
||||
Copyright (C) 2023
|
||||
|
||||
Author: D. A. Clarke <clarke.davida@gmail.com>
|
||||
|
||||
This program 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
See the full license in the file "LICENSE" in the top level distribution
|
||||
directory
|
||||
*************************************************************************************/
|
||||
/*
|
||||
@file Test_fatLinks.cc
|
||||
@brief test of the HISQ smearing
|
||||
*/
|
||||
|
||||
|
||||
#include <Grid/Grid.h>
|
||||
#include <Grid/lattice/PaddedCell.h>
|
||||
@ -14,7 +38,7 @@
|
||||
using namespace Grid;
|
||||
|
||||
|
||||
// Make the logger work like Python print()
|
||||
/*! @brief make the logger work like python print */
|
||||
template<typename... Args>
|
||||
inline std::string sjoin(Args&&... args) noexcept {
|
||||
std::ostringstream msg;
|
||||
@ -27,32 +51,26 @@ inline void Grid_log(Args&&... args) {
|
||||
std::cout << GridLogMessage << msg << std::endl;
|
||||
}
|
||||
|
||||
struct fatParams: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(
|
||||
fatParams,
|
||||
std::string, conf_in,
|
||||
std::string, conf_out);
|
||||
|
||||
template <class ReaderClass>
|
||||
fatParams(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "parameters", *this);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// one method: input --> fat
|
||||
// another : input --> long (naik)
|
||||
// another : input --> unitarize
|
||||
//
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int main (int argc, char** argv) {
|
||||
|
||||
// Params for the test.
|
||||
int Ns = 8;
|
||||
int Nt = 4;
|
||||
Coordinate latt_size(Nd,0); latt_size[0]=Ns; latt_size[1]=Ns; latt_size[2]=Ns; latt_size[3]=Nt;
|
||||
std::string conf_in = "nersc.l8t4b3360";
|
||||
std::string conf_out = "nersc.l8t4b3360.3link";
|
||||
|
||||
// Initialize the Grid
|
||||
Grid_init(&argc,&argv);
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplexD::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
Grid_log("mpi = ",mpi_layout);
|
||||
Grid_log(" mpi = ",mpi_layout);
|
||||
Grid_log("simd = ",simd_layout);
|
||||
Grid_log("latt = ",latt_size);
|
||||
GridCartesian GRID(latt_size,simd_layout,mpi_layout);
|
||||
@ -61,19 +79,15 @@ int main (int argc, char **argv)
|
||||
LatticeGaugeField Umu(&GRID);
|
||||
LatticeGaugeField U_smr(&GRID);
|
||||
|
||||
// Read in the parameter file
|
||||
XmlReader Reader("fatParams.xml",false, "grid");
|
||||
fatParams param(Reader);
|
||||
FieldMetaData header;
|
||||
|
||||
// Read the configuration into Umu
|
||||
NerscIO::readConfiguration(Umu, header, param.conf_in);
|
||||
FieldMetaData header;
|
||||
NerscIO::readConfiguration(Umu, header, conf_in);
|
||||
|
||||
// Smear Umu and store result in U_smr
|
||||
Smear_HISQ_fat<LatticeGaugeField> hisq_fat(&GRID,1/8.,0.,1/16.,1/64.,1/384.,0.);
|
||||
hisq_fat.smear(U_smr,Umu);
|
||||
|
||||
NerscIO::writeConfiguration(U_smr,param.conf_out,"HISQ");
|
||||
NerscIO::writeConfiguration(U_smr,conf_out,"HISQ");
|
||||
|
||||
// Test a C-style instantiation
|
||||
double path_coeff[6] = {1, 2, 3, 4, 5, 6};
|
||||
|
Reference in New Issue
Block a user