From 98413ce2685886f372e85683371351144a6d78b6 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 8 Nov 2022 20:44:16 +0100 Subject: [PATCH 001/168] replacing cudaMalloc with device_malloc --- lib/PLEGMA_Correlator.cu | 18 +++++++------- lib/PLEGMA_FT.cu | 4 +++- lib/PLEGMA_Field.cu | 9 +++---- lib/kernels/PLEGMA_TMDWF.cuh | 4 +++- lib/kernels/PLEGMA_heavy_light_tetraquarks.cu | 16 +++++++++---- .../PLEGMA_heavy_light_tetraquarks_arrays.cu | 2 +- lib/kernels/PLEGMA_mesonsAll.cuh | 5 +++- lib/kernels/PLEGMA_scattreductions.cuh | 24 +++++++++++-------- lib/kernels/PLEGMA_su3field.cuh | 3 ++- lib/kernels/PLEGMA_threep_staple.cu | 6 +++-- lib/kernels/PLEGMA_threep_threeD_part1.cu | 11 +++++---- lib/kernels/PLEGMA_threep_threeD_part2.cu | 15 +++++++----- lib/kernels/PLEGMA_threep_threeD_part3.cu | 13 ++++++---- lib/kernels/PLEGMA_threep_threeD_part4.cu | 13 ++++++---- lib/kernels/PLEGMA_threep_twoD.cu | 8 ++++--- lib/kernels/PLEGMA_vector_utils.cuh | 9 +++++-- 16 files changed, 100 insertions(+), 60 deletions(-) diff --git a/lib/PLEGMA_Correlator.cu b/lib/PLEGMA_Correlator.cu index 3fb03d2e..8fec9ea6 100644 --- a/lib/PLEGMA_Correlator.cu +++ b/lib/PLEGMA_Correlator.cu @@ -1066,17 +1066,17 @@ template class PLEGMA_Correlator; -template -void PLEGMA_Correlator::contractMesonsNew(PLEGMA_Propagator &prop1, - PLEGMA_Propagator &prop2 ); +//template +//void PLEGMA_Correlator::contractMesonsNew(PLEGMA_Propagator &prop1, +// PLEGMA_Propagator &prop2 ); -template -void PLEGMA_Correlator::contractMesonsNew(PLEGMA_Propagator &prop1, - PLEGMA_Propagator &prop2 ); +//template +//void PLEGMA_Correlator::contractMesonsNew(PLEGMA_Propagator &prop1, +// PLEGMA_Propagator &prop2 ); -template -void PLEGMA_Correlator::contractMesonsNew(PLEGMA_Propagator &prop1, - PLEGMA_Propagator &prop2 ); +//template +//void PLEGMA_Correlator::contractMesonsNew(PLEGMA_Propagator &prop1, +// PLEGMA_Propagator &prop2 ); template diff --git a/lib/PLEGMA_FT.cu b/lib/PLEGMA_FT.cu index 3d3c1bec..31d64a57 100644 --- a/lib/PLEGMA_FT.cu +++ b/lib/PLEGMA_FT.cu @@ -7,6 +7,7 @@ #include #include #include +#include using namespace plegma; @@ -97,7 +98,8 @@ std::shared_ptr PLEGMA_FT::getTexMomList() { void * devPtr; int hostPtr[Nmoms()*N_DIMS]; memset(hostPtr, 0, sizeof(hostPtr)); - cudaMalloc(&devPtr, sizeof(hostPtr)); + devPtr=device_malloc(sizeof(hostPtr)); +// cudaMalloc(&devPtr, sizeof(hostPtr)); Float intp; for(int i=0; i #include #include +#include using namespace plegma; #define DEVICE_MEMORY_REPORT @@ -227,8 +228,8 @@ void PLEGMA_Field::create_host(){ template void PLEGMA_Field::create_device(){ -// d_elem=(Float *)device_malloc(Bytes_total_plus_ghost()); - cudaMalloc((void**)&d_elem,Bytes_total_plus_ghost()); + d_elem=(Float *)device_malloc(Bytes_total_plus_ghost()); + //cudaMalloc((void**)&d_elem,Bytes_total_plus_ghost()); if(checkErr) checkQudaError(); #ifdef DEVICE_MEMORY_REPORT // device memory in MB @@ -743,8 +744,8 @@ void PLEGMA_Field::mulMomentumPhases(std::vector mom, int sign) int D3D4 = mom.size(); int V = D3D4 == 3 ? HGC_localVolume3D : HGC_localVolume; Float2 *x; - //x=((Float2) *)device_malloc(V*2*sizeof(Float)); - cudaMalloc((void**)&x, V*2*sizeof(Float)); + x=((Float2) *)device_malloc(V*2*sizeof(Float)); + //cudaMalloc((void**)&x, V*2*sizeof(Float)); cudaMemset((void*) x,0,V*2*sizeof(Float)); if(checkErr) checkQudaError(); std::vector momF(mom.begin(), mom.end()); diff --git a/lib/kernels/PLEGMA_TMDWF.cuh b/lib/kernels/PLEGMA_TMDWF.cuh index f21db1bb..03fa6284 100644 --- a/lib/kernels/PLEGMA_TMDWF.cuh +++ b/lib/kernels/PLEGMA_TMDWF.cuh @@ -1,4 +1,5 @@ #include +#include using namespace plegma; const int N_TMDWF_MESONS=1; // TODO: This is hard to extend. These variables should replaced by compile-time functions. @@ -94,7 +95,8 @@ void contract_TMDWF_mesons_host( ProfileStruct &ps, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + //cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) { diff --git a/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu b/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu index 8bf5ee7c..de6c1c2f 100644 --- a/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu +++ b/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu @@ -1,6 +1,6 @@ #include #include - +#include template __global__ void contract_props(propTex texProp1, propTex texProp2, propTex texProp3, @@ -89,16 +89,22 @@ void contract_tetraquarks_host(ProfileStruct &ps, Float2 *d_partial_block = NULL; size_t alloc_size = (runFT==true) ? (volume * (ps.tp.grid.x/time_step)):volume; hostMalloc(h_partial_block, alloc_size * sizeof(Float2)); - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + //cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + short *idxs, *col_contr; Float2 *vals; int size = 0; for(int j=0; j)); +//cudaMalloc((void**)&idxs, 8*size*sizeof(short)); + idxs=(short*)device_malloc(8*size*sizeof(short)); +// cudaMalloc((void**)&col_contr, 8*size*sizeof(short)); + col_contr=(short*)device_malloc(8*size*sizeof(short)); +// cudaMalloc((void**)&vals, size*sizeof(Float2)); + val=(Float2*)device_malloc(8*size*sizeof(Float2)); + int shift = 0; for(int j=0; j -#include float2 bbud_g5_gj_g5_gj_ll_vals[768] = { {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, -0.0}, {-1.0, -0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, }; short bbud_g5_gj_g5_gj_ll_idxs[768*8] = { 2, 0, 3, 1, 2, 0, 2, 0, 2, 0, 3, 3, 2, 0, 0, 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 3, 3, 0, 0, 0, 2, 2, 3, 1, 0, 0, 2, 0, 2, 2, 3, 3, 0, 0, 0, 0, 2, 3, 3, 1, 1, 0, 2, 0, 2, 3, 3, 3, 1, 0, 0, 0, 2, 0, 2, 0, 2, 0, 3, 1, 2, 0, 2, 2, 2, 0, 1, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 2, 2, 3, 0, 1, 1, 2, 2, 2, 0, 0, 0, 3, 1, 2, 2, 2, 2, 0, 0, 1, 1, 2, 3, 2, 0, 1, 0, 3, 1, 2, 3, 2, 2, 1, 0, 1, 1, 2, 0, 1, 1, 2, 0, 2, 2, 2, 0, 1, 3, 2, 0, 0, 2, 2, 1, 1, 1, 3, 0, 2, 2, 2, 1, 1, 3, 3, 0, 0, 2, 2, 2, 1, 1, 0, 0, 2, 2, 2, 2, 1, 3, 0, 0, 0, 2, 2, 3, 1, 1, 1, 0, 2, 2, 2, 3, 1, 3, 1, 0, 0, 2, 2, 0, 0, 0, 2, 0, 3, 3, 2, 0, 0, 2, 2, 0, 1, 3, 2, 1, 0, 0, 3, 0, 3, 3, 2, 1, 0, 2, 3, 0, 1, 3, 2, 2, 0, 0, 0, 0, 3, 3, 2, 2, 0, 2, 0, 0, 1, 3, 2, 3, 0, 0, 1, 0, 3, 3, 2, 3, 0, 2, 1, 0, 1, 3, 3, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 3, 2, 1, 0, 0, 3, 1, 3, 1, 3, 1, 2, 0, 3, 1, 3, 3, 3, 1, 0, 0, 3, 2, 3, 1, 0, 1, 2, 0, 3, 2, 3, 3, 0, 1, 0, 0, 3, 3, 3, 1, 1, 1, 2, 0, 3, 3, 3, 3, 1, 1, 0, 0, 3, 0, 2, 0, 2, 1, 3, 1, 3, 0, 2, 2, 2, 1, 1, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 1, 1, 3, 2, 2, 0, 0, 1, 3, 1, 3, 2, 2, 2, 0, 1, 1, 1, 3, 3, 2, 0, 1, 1, 3, 1, 3, 3, 2, 2, 1, 1, 1, 1, 3, 0, 1, 1, 2, 1, 2, 2, 3, 0, 1, 3, 2, 1, 0, 2, 3, 1, 1, 1, 3, 1, 2, 2, 3, 1, 1, 3, 3, 1, 0, 2, 3, 2, 1, 1, 0, 1, 2, 2, 3, 2, 1, 3, 0, 1, 0, 2, 3, 3, 1, 1, 1, 1, 2, 2, 3, 3, 1, 3, 1, 1, 0, 2, 3, 0, 0, 0, 2, 1, 3, 3, 3, 0, 0, 2, 2, 1, 1, 3, 3, 1, 0, 0, 3, 1, 3, 3, 3, 1, 0, 2, 3, 1, 1, 3, 3, 2, 0, 0, 0, 1, 3, 3, 3, 2, 0, 2, 0, 1, 1, 3, 3, 3, 0, 0, 1, 1, 3, 3, 3, 3, 0, 2, 1, 1, 1, 3, 0, 0, 3, 1, 2, 2, 2, 0, 0, 0, 3, 3, 2, 2, 0, 0, 0, 1, 3, 1, 3, 2, 2, 0, 0, 1, 3, 3, 3, 2, 0, 0, 0, 2, 3, 1, 0, 2, 2, 0, 0, 2, 3, 3, 0, 2, 0, 0, 0, 3, 3, 1, 1, 2, 2, 0, 0, 3, 3, 3, 1, 2, 0, 0, 0, 0, 2, 0, 2, 2, 3, 1, 0, 0, 2, 2, 2, 2, 1, 1, 0, 1, 2, 0, 3, 2, 3, 1, 0, 1, 2, 2, 3, 2, 1, 1, 0, 2, 2, 0, 0, 2, 3, 1, 0, 2, 2, 2, 0, 2, 1, 1, 0, 3, 2, 0, 1, 2, 3, 1, 0, 3, 2, 2, 1, 2, 1, 1, 0, 0, 1, 1, 2, 2, 2, 2, 0, 0, 1, 3, 2, 2, 0, 2, 0, 1, 1, 1, 3, 2, 2, 2, 0, 1, 1, 3, 3, 2, 0, 2, 0, 2, 1, 1, 0, 2, 2, 2, 0, 2, 1, 3, 0, 2, 0, 2, 0, 3, 1, 1, 1, 2, 2, 2, 0, 3, 1, 3, 1, 2, 0, 2, 0, 0, 0, 0, 2, 2, 3, 3, 0, 0, 0, 2, 2, 2, 1, 3, 0, 1, 0, 0, 3, 2, 3, 3, 0, 1, 0, 2, 3, 2, 1, 3, 0, 2, 0, 0, 0, 2, 3, 3, 0, 2, 0, 2, 0, 2, 1, 3, 0, 3, 0, 0, 1, 2, 3, 3, 0, 3, 0, 2, 1, 2, 1, 3, 1, 0, 3, 1, 2, 3, 2, 0, 1, 0, 3, 3, 2, 3, 0, 0, 1, 1, 3, 1, 3, 3, 2, 0, 1, 1, 3, 3, 3, 3, 0, 0, 1, 2, 3, 1, 0, 3, 2, 0, 1, 2, 3, 3, 0, 3, 0, 0, 1, 3, 3, 1, 1, 3, 2, 0, 1, 3, 3, 3, 1, 3, 0, 0, 1, 0, 2, 0, 2, 3, 3, 1, 1, 0, 2, 2, 2, 3, 1, 1, 1, 1, 2, 0, 3, 3, 3, 1, 1, 1, 2, 2, 3, 3, 1, 1, 1, 2, 2, 0, 0, 3, 3, 1, 1, 2, 2, 2, 0, 3, 1, 1, 1, 3, 2, 0, 1, 3, 3, 1, 1, 3, 2, 2, 1, 3, 1, 1, 1, 0, 1, 1, 2, 3, 2, 2, 1, 0, 1, 3, 2, 3, 0, 2, 1, 1, 1, 1, 3, 3, 2, 2, 1, 1, 1, 3, 3, 3, 0, 2, 1, 2, 1, 1, 0, 3, 2, 2, 1, 2, 1, 3, 0, 3, 0, 2, 1, 3, 1, 1, 1, 3, 2, 2, 1, 3, 1, 3, 1, 3, 0, 2, 1, 0, 0, 0, 2, 3, 3, 3, 1, 0, 0, 2, 2, 3, 1, 3, 1, 1, 0, 0, 3, 3, 3, 3, 1, 1, 0, 2, 3, 3, 1, 3, 1, 2, 0, 0, 0, 3, 3, 3, 1, 2, 0, 2, 0, 3, 1, 3, 1, 3, 0, 0, 1, 3, 3, 3, 1, 3, 0, 2, 1, 3, 1, 3, 2, 0, 3, 1, 2, 0, 2, 0, 2, 0, 3, 3, 0, 0, 2, 0, 2, 1, 3, 1, 2, 0, 3, 0, 2, 1, 3, 3, 0, 0, 3, 0, 2, 2, 3, 1, 2, 0, 0, 0, 2, 2, 3, 3, 0, 0, 0, 0, 2, 3, 3, 1, 2, 0, 1, 0, 2, 3, 3, 3, 0, 0, 1, 0, 2, 0, 2, 0, 3, 0, 2, 1, 2, 0, 2, 2, 1, 0, 2, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 2, 2, 1, 0, 3, 1, 2, 2, 2, 0, 3, 0, 0, 1, 2, 2, 2, 2, 1, 0, 0, 1, 2, 3, 2, 0, 3, 0, 1, 1, 2, 3, 2, 2, 1, 0, 1, 1, 2, 0, 1, 1, 2, 0, 2, 2, 2, 0, 1, 3, 0, 0, 2, 2, 2, 1, 1, 1, 2, 0, 3, 2, 2, 1, 1, 3, 0, 0, 3, 2, 2, 2, 1, 1, 2, 0, 0, 2, 2, 2, 1, 3, 0, 0, 0, 2, 2, 3, 1, 1, 2, 0, 1, 2, 2, 3, 1, 3, 0, 0, 1, 2, 2, 0, 0, 0, 3, 0, 2, 3, 2, 0, 0, 2, 1, 0, 2, 3, 2, 1, 0, 0, 3, 0, 3, 3, 2, 1, 0, 2, 1, 0, 3, 3, 2, 2, 0, 0, 3, 0, 0, 3, 2, 2, 0, 2, 1, 0, 0, 3, 2, 3, 0, 0, 3, 0, 1, 3, 2, 3, 0, 2, 1, 0, 1, 3, 3, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 3, 0, 1, 2, 0, 3, 1, 3, 1, 2, 1, 3, 0, 3, 1, 3, 3, 0, 1, 3, 0, 3, 2, 3, 1, 2, 1, 0, 0, 3, 2, 3, 3, 0, 1, 0, 0, 3, 3, 3, 1, 2, 1, 1, 0, 3, 3, 3, 3, 0, 1, 1, 0, 3, 0, 2, 0, 3, 1, 2, 1, 3, 0, 2, 2, 1, 1, 2, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 1, 2, 2, 1, 1, 3, 1, 3, 2, 2, 0, 3, 1, 0, 1, 3, 2, 2, 2, 1, 1, 0, 1, 3, 3, 2, 0, 3, 1, 1, 1, 3, 3, 2, 2, 1, 1, 1, 1, 3, 0, 1, 1, 2, 1, 2, 2, 3, 0, 1, 3, 0, 1, 2, 2, 3, 1, 1, 1, 2, 1, 3, 2, 3, 1, 1, 3, 0, 1, 3, 2, 3, 2, 1, 1, 2, 1, 0, 2, 3, 2, 1, 3, 0, 1, 0, 2, 3, 3, 1, 1, 2, 1, 1, 2, 3, 3, 1, 3, 0, 1, 1, 2, 3, 0, 0, 0, 3, 1, 2, 3, 3, 0, 0, 2, 1, 1, 2, 3, 3, 1, 0, 0, 3, 1, 3, 3, 3, 1, 0, 2, 1, 1, 3, 3, 3, 2, 0, 0, 3, 1, 0, 3, 3, 2, 0, 2, 1, 1, 0, 3, 3, 3, 0, 0, 3, 1, 1, 3, 3, 3, 0, 2, 1, 1, 1, 3, 0, 0, 3, 1, 2, 2, 2, 0, 0, 0, 3, 3, 0, 2, 2, 0, 0, 1, 3, 1, 2, 2, 3, 0, 0, 1, 3, 3, 0, 2, 3, 0, 0, 2, 3, 1, 2, 2, 0, 0, 0, 2, 3, 3, 0, 2, 0, 0, 0, 3, 3, 1, 2, 2, 1, 0, 0, 3, 3, 3, 0, 2, 1, 0, 0, 0, 2, 0, 3, 2, 2, 1, 0, 0, 2, 2, 1, 2, 2, 1, 0, 1, 2, 0, 3, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3, 1, 0, 2, 2, 0, 3, 2, 0, 1, 0, 2, 2, 2, 1, 2, 0, 1, 0, 3, 2, 0, 3, 2, 1, 1, 0, 3, 2, 2, 1, 2, 1, 1, 0, 0, 1, 1, 2, 2, 2, 2, 0, 0, 1, 3, 0, 2, 2, 2, 0, 1, 1, 1, 2, 2, 3, 2, 0, 1, 1, 3, 0, 2, 3, 2, 0, 2, 1, 1, 2, 2, 0, 2, 0, 2, 1, 3, 0, 2, 0, 2, 0, 3, 1, 1, 2, 2, 1, 2, 0, 3, 1, 3, 0, 2, 1, 2, 0, 0, 0, 0, 3, 2, 2, 3, 0, 0, 0, 2, 1, 2, 2, 3, 0, 1, 0, 0, 3, 2, 3, 3, 0, 1, 0, 2, 1, 2, 3, 3, 0, 2, 0, 0, 3, 2, 0, 3, 0, 2, 0, 2, 1, 2, 0, 3, 0, 3, 0, 0, 3, 2, 1, 3, 0, 3, 0, 2, 1, 2, 1, 3, 1, 0, 3, 1, 2, 3, 2, 0, 1, 0, 3, 3, 0, 3, 2, 0, 1, 1, 3, 1, 2, 3, 3, 0, 1, 1, 3, 3, 0, 3, 3, 0, 1, 2, 3, 1, 2, 3, 0, 0, 1, 2, 3, 3, 0, 3, 0, 0, 1, 3, 3, 1, 2, 3, 1, 0, 1, 3, 3, 3, 0, 3, 1, 0, 1, 0, 2, 0, 3, 3, 2, 1, 1, 0, 2, 2, 1, 3, 2, 1, 1, 1, 2, 0, 3, 3, 3, 1, 1, 1, 2, 2, 1, 3, 3, 1, 1, 2, 2, 0, 3, 3, 0, 1, 1, 2, 2, 2, 1, 3, 0, 1, 1, 3, 2, 0, 3, 3, 1, 1, 1, 3, 2, 2, 1, 3, 1, 1, 1, 0, 1, 1, 2, 3, 2, 2, 1, 0, 1, 3, 0, 3, 2, 2, 1, 1, 1, 1, 2, 3, 3, 2, 1, 1, 1, 3, 0, 3, 3, 2, 1, 2, 1, 1, 2, 3, 0, 2, 1, 2, 1, 3, 0, 3, 0, 2, 1, 3, 1, 1, 2, 3, 1, 2, 1, 3, 1, 3, 0, 3, 1, 2, 1, 0, 0, 0, 3, 3, 2, 3, 1, 0, 0, 2, 1, 3, 2, 3, 1, 1, 0, 0, 3, 3, 3, 3, 1, 1, 0, 2, 1, 3, 3, 3, 1, 2, 0, 0, 3, 3, 0, 3, 1, 2, 0, 2, 1, 3, 0, 3, 1, 3, 0, 0, 3, 3, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 0, 2, 0, 2, 2, 2, 0, 0, 0, 2, 0, 2, 3, 2, 0, 1, 0, 2, 1, 2, 0, 3, 0, 2, 0, 2, 1, 2, 1, 3, 0, 3, 0, 2, 1, 2, 2, 3, 0, 0, 0, 2, 1, 2, 3, 3, 0, 1, 0, 2, 2, 2, 0, 0, 0, 2, 0, 2, 2, 2, 1, 0, 0, 3, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 3, 0, 0, 1, 0, 2, 3, 2, 0, 1, 0, 2, 0, 2, 3, 2, 1, 1, 0, 3, 0, 2, 3, 2, 2, 1, 0, 0, 0, 2, 3, 2, 3, 1, 0, 1, 0, 2, 0, 3, 0, 2, 0, 2, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 2, 2, 0, 0, 1, 2, 0, 3, 3, 2, 0, 1, 1, 2, 1, 3, 0, 3, 0, 2, 1, 2, 1, 3, 1, 3, 0, 3, 1, 2, 1, 3, 2, 3, 0, 0, 1, 2, 1, 3, 3, 3, 0, 1, 1, 2, 2, 3, 0, 0, 0, 2, 1, 2, 2, 3, 1, 0, 0, 3, 1, 2, 2, 3, 2, 0, 0, 0, 1, 2, 2, 3, 3, 0, 0, 1, 1, 2, 3, 3, 0, 1, 0, 2, 1, 2, 3, 3, 1, 1, 0, 3, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 3, 1, 0, 1, 1, 2, 0, 0, 0, 2, 0, 2, 2, 2, 0, 0, 1, 2, 0, 3, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 3, 2, 0, 1, 2, 2, 1, 0, 0, 3, 0, 2, 2, 2, 1, 0, 1, 3, 0, 3, 2, 2, 1, 0, 2, 3, 0, 0, 2, 2, 1, 0, 3, 3, 0, 1, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 0, 1, 0, 0, 3, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 0, 3, 0, 0, 1, 2, 2, 3, 0, 0, 1, 0, 2, 2, 2, 3, 0, 1, 1, 0, 3, 2, 2, 3, 0, 2, 1, 0, 0, 2, 2, 3, 0, 3, 1, 0, 1, 2, 2, 0, 1, 0, 2, 0, 2, 3, 2, 0, 1, 1, 2, 0, 3, 3, 2, 0, 1, 2, 2, 0, 0, 3, 2, 0, 1, 3, 2, 0, 1, 3, 2, 1, 1, 0, 3, 0, 2, 3, 2, 1, 1, 1, 3, 0, 3, 3, 2, 1, 1, 2, 3, 0, 0, 3, 2, 1, 1, 3, 3, 0, 1, 3, 2, 2, 1, 0, 0, 0, 2, 3, 2, 2, 1, 1, 0, 0, 3, 3, 2, 2, 1, 2, 0, 0, 0, 3, 2, 2, 1, 3, 0, 0, 1, 3, 2, 3, 1, 0, 1, 0, 2, 3, 2, 3, 1, 1, 1, 0, 3, 3, 2, 3, 1, 2, 1, 0, 0, 3, 2, 3, 1, 3, 1, 0, 1, 3, 3, 0, 2, 0, 2, 1, 2, 0, 3, 0, 2, 1, 2, 1, 3, 0, 3, 0, 2, 2, 2, 1, 0, 0, 3, 0, 2, 3, 2, 1, 1, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 1, 3, 1, 3, 0, 3, 1, 2, 2, 3, 1, 0, 0, 3, 1, 2, 3, 3, 1, 1, 0, 3, 2, 2, 0, 0, 1, 2, 0, 3, 2, 2, 1, 0, 1, 3, 0, 3, 2, 2, 2, 0, 1, 0, 0, 3, 2, 2, 3, 0, 1, 1, 0, 3, 3, 2, 0, 1, 1, 2, 0, 3, 3, 2, 1, 1, 1, 3, 0, 3, 3, 2, 2, 1, 1, 0, 0, 3, 3, 2, 3, 1, 1, 1, 0, 3, 0, 3, 0, 2, 1, 2, 1, 3, 0, 3, 1, 2, 1, 3, 1, 3, 0, 3, 2, 2, 1, 0, 1, 3, 0, 3, 3, 2, 1, 1, 1, 3, 1, 3, 0, 3, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 2, 3, 1, 0, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 2, 3, 0, 0, 1, 2, 1, 3, 2, 3, 1, 0, 1, 3, 1, 3, 2, 3, 2, 0, 1, 0, 1, 3, 2, 3, 3, 0, 1, 1, 1, 3, 3, 3, 0, 1, 1, 2, 1, 3, 3, 3, 1, 1, 1, 3, 1, 3, 3, 3, 2, 1, 1, 0, 1, 3, 3, 3, 3, 1, 1, 1, 1, 3, 0, 0, 0, 2, 1, 2, 2, 3, 0, 0, 1, 2, 1, 3, 2, 3, 0, 0, 2, 2, 1, 0, 2, 3, 0, 0, 3, 2, 1, 1, 2, 3, 1, 0, 0, 3, 1, 2, 2, 3, 1, 0, 1, 3, 1, 3, 2, 3, 1, 0, 2, 3, 1, 0, 2, 3, 1, 0, 3, 3, 1, 1, 2, 3, 2, 0, 0, 0, 1, 2, 2, 3, 2, 0, 1, 0, 1, 3, 2, 3, 2, 0, 2, 0, 1, 0, 2, 3, 2, 0, 3, 0, 1, 1, 2, 3, 3, 0, 0, 1, 1, 2, 2, 3, 3, 0, 1, 1, 1, 3, 2, 3, 3, 0, 2, 1, 1, 0, 2, 3, 3, 0, 3, 1, 1, 1, 2, 3, 0, 1, 0, 2, 1, 2, 3, 3, 0, 1, 1, 2, 1, 3, 3, 3, 0, 1, 2, 2, 1, 0, 3, 3, 0, 1, 3, 2, 1, 1, 3, 3, 1, 1, 0, 3, 1, 2, 3, 3, 1, 1, 1, 3, 1, 3, 3, 3, 1, 1, 2, 3, 1, 0, 3, 3, 1, 1, 3, 3, 1, 1, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 1, 0, 1, 3, 3, 3, 2, 1, 2, 0, 1, 0, 3, 3, 2, 1, 3, 0, 1, 1, 3, 3, 3, 1, 0, 1, 1, 2, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 2, 1, 1, 0, 3, 3, 3, 1, 3, 1, 1, 1, 3, 0, 0, 2, 0, 2, 2, 2, 0, 0, 0, 2, 1, 2, 2, 3, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 3, 2, 2, 1, 0, 0, 1, 2, 0, 3, 2, 2, 0, 0, 1, 2, 1, 3, 2, 3, 0, 0, 1, 2, 2, 3, 2, 0, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 1, 0, 2, 3, 0, 0, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 3, 0, 2, 1, 0, 0, 3, 2, 0, 1, 2, 2, 0, 0, 3, 2, 1, 1, 2, 3, 0, 0, 3, 2, 2, 1, 2, 0, 0, 0, 3, 2, 3, 1, 2, 1, 0, 0, 0, 3, 0, 2, 2, 2, 1, 0, 0, 3, 1, 2, 2, 3, 1, 0, 0, 3, 2, 2, 2, 0, 1, 0, 0, 3, 3, 2, 2, 1, 1, 0, 1, 3, 0, 3, 2, 2, 1, 0, 1, 3, 1, 3, 2, 3, 1, 0, 1, 3, 2, 3, 2, 0, 1, 0, 1, 3, 3, 3, 2, 1, 1, 0, 2, 3, 0, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 3, 1, 0, 2, 3, 2, 0, 2, 0, 1, 0, 2, 3, 3, 0, 2, 1, 1, 0, 3, 3, 0, 1, 2, 2, 1, 0, 3, 3, 1, 1, 2, 3, 1, 0, 3, 3, 2, 1, 2, 0, 1, 0, 3, 3, 3, 1, 2, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 1, 2, 2, 3, 2, 0, 0, 0, 2, 2, 2, 0, 2, 0, 0, 0, 3, 2, 2, 1, 2, 0, 1, 0, 0, 3, 2, 2, 2, 0, 1, 0, 1, 3, 2, 3, 2, 0, 1, 0, 2, 3, 2, 0, 2, 0, 1, 0, 3, 3, 2, 1, 2, 0, 2, 0, 0, 0, 2, 2, 2, 0, 2, 0, 1, 0, 2, 3, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 3, 0, 2, 1, 2, 0, 3, 0, 0, 1, 2, 2, 2, 0, 3, 0, 1, 1, 2, 3, 2, 0, 3, 0, 2, 1, 2, 0, 2, 0, 3, 0, 3, 1, 2, 1, 2, 0, 0, 1, 0, 2, 2, 2, 3, 0, 0, 1, 1, 2, 2, 3, 3, 0, 0, 1, 2, 2, 2, 0, 3, 0, 0, 1, 3, 2, 2, 1, 3, 0, 1, 1, 0, 3, 2, 2, 3, 0, 1, 1, 1, 3, 2, 3, 3, 0, 1, 1, 2, 3, 2, 0, 3, 0, 1, 1, 3, 3, 2, 1, 3, 0, 2, 1, 0, 0, 2, 2, 3, 0, 2, 1, 1, 0, 2, 3, 3, 0, 2, 1, 2, 0, 2, 0, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 3, 1, 0, 1, 2, 2, 3, 0, 3, 1, 1, 1, 2, 3, 3, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 1, 3, 1, 2, 1, 3, 1, 0, 2, 0, 2, 3, 2, 0, 1, 0, 2, 1, 2, 3, 3, 0, 1, 0, 2, 2, 2, 3, 0, 0, 1, 0, 2, 3, 2, 3, 1, 0, 1, 1, 2, 0, 3, 3, 2, 0, 1, 1, 2, 1, 3, 3, 3, 0, 1, 1, 2, 2, 3, 3, 0, 0, 1, 1, 2, 3, 3, 3, 1, 0, 1, 2, 2, 0, 0, 3, 2, 0, 1, 2, 2, 1, 0, 3, 3, 0, 1, 2, 2, 2, 0, 3, 0, 0, 1, 2, 2, 3, 0, 3, 1, 0, 1, 3, 2, 0, 1, 3, 2, 0, 1, 3, 2, 1, 1, 3, 3, 0, 1, 3, 2, 2, 1, 3, 0, 0, 1, 3, 2, 3, 1, 3, 1, 0, 1, 0, 3, 0, 2, 3, 2, 1, 1, 0, 3, 1, 2, 3, 3, 1, 1, 0, 3, 2, 2, 3, 0, 1, 1, 0, 3, 3, 2, 3, 1, 1, 1, 1, 3, 0, 3, 3, 2, 1, 1, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 2, 3, 3, 0, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 2, 3, 0, 0, 3, 2, 1, 1, 2, 3, 1, 0, 3, 3, 1, 1, 2, 3, 2, 0, 3, 0, 1, 1, 2, 3, 3, 0, 3, 1, 1, 1, 3, 3, 0, 1, 3, 2, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 3, 3, 2, 1, 3, 0, 1, 1, 3, 3, 3, 1, 3, 1, 1, 1, 0, 0, 0, 2, 3, 2, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 2, 2, 3, 0, 2, 1, 0, 0, 3, 2, 3, 1, 2, 1, 1, 0, 0, 3, 3, 2, 2, 1, 1, 0, 1, 3, 3, 3, 2, 1, 1, 0, 2, 3, 3, 0, 2, 1, 1, 0, 3, 3, 3, 1, 2, 1, 2, 0, 0, 0, 3, 2, 2, 1, 2, 0, 1, 0, 3, 3, 2, 1, 2, 0, 2, 0, 3, 0, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 3, 0, 0, 1, 3, 2, 2, 1, 3, 0, 1, 1, 3, 3, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 3, 1, 3, 1, 2, 1, 0, 1, 0, 2, 3, 2, 3, 1, 0, 1, 1, 2, 3, 3, 3, 1, 0, 1, 2, 2, 3, 0, 3, 1, 0, 1, 3, 2, 3, 1, 3, 1, 1, 1, 0, 3, 3, 2, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 2, 3, 3, 0, 3, 1, 1, 1, 3, 3, 3, 1, 3, 1, 2, 1, 0, 0, 3, 2, 3, 1, 2, 1, 1, 0, 3, 3, 3, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 3, 0, 3, 1, 3, 1, 3, 1, 0, 1, 3, 2, 3, 1, 3, 1, 1, 1, 3, 3, 3, 1, 3, 1, 2, 1, 3, 0, 3, 1, 3, 1, 3, 1, 3, 1, 3, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 3, 0, 2, 0, 2, 0, 2, 2, 0, 0, 2, 0, 2, 0, 2, 3, 1, 0, 2, 0, 2, 1, 2, 0, 2, 0, 3, 0, 2, 1, 2, 1, 3, 0, 3, 0, 2, 1, 2, 2, 0, 0, 3, 0, 2, 1, 2, 3, 1, 0, 3, 0, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 1, 3, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 3, 1, 0, 0, 0, 2, 3, 2, 0, 2, 0, 1, 0, 2, 3, 2, 1, 3, 0, 1, 0, 2, 3, 2, 2, 0, 0, 1, 0, 2, 3, 2, 3, 1, 0, 1, 0, 2, 0, 3, 0, 2, 0, 2, 1, 2, 0, 3, 1, 3, 0, 2, 1, 2, 0, 3, 2, 0, 0, 2, 1, 2, 0, 3, 3, 1, 0, 2, 1, 2, 1, 3, 0, 2, 0, 3, 1, 2, 1, 3, 1, 3, 0, 3, 1, 2, 1, 3, 2, 0, 0, 3, 1, 2, 1, 3, 3, 1, 0, 3, 1, 2, 2, 3, 0, 2, 0, 0, 1, 2, 2, 3, 1, 3, 0, 0, 1, 2, 2, 3, 2, 0, 0, 0, 1, 2, 2, 3, 3, 1, 0, 0, 1, 2, 3, 3, 0, 2, 0, 1, 1, 2, 3, 3, 1, 3, 0, 1, 1, 2, 3, 3, 2, 0, 0, 1, 1, 2, 3, 3, 3, 1, 0, 1, 1, 2, 0, 0, 0, 2, 0, 2, 2, 2, 0, 0, 1, 3, 0, 2, 2, 2, 0, 0, 2, 0, 0, 2, 2, 2, 0, 0, 3, 1, 0, 2, 2, 2, 1, 0, 0, 2, 0, 3, 2, 2, 1, 0, 1, 3, 0, 3, 2, 2, 1, 0, 2, 0, 0, 3, 2, 2, 1, 0, 3, 1, 0, 3, 2, 2, 2, 0, 0, 2, 0, 0, 2, 2, 2, 0, 1, 3, 0, 0, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 0, 3, 1, 0, 0, 2, 2, 3, 0, 0, 2, 0, 1, 2, 2, 3, 0, 1, 3, 0, 1, 2, 2, 3, 0, 2, 0, 0, 1, 2, 2, 3, 0, 3, 1, 0, 1, 2, 2, 0, 1, 0, 2, 0, 2, 3, 2, 0, 1, 1, 3, 0, 2, 3, 2, 0, 1, 2, 0, 0, 2, 3, 2, 0, 1, 3, 1, 0, 2, 3, 2, 1, 1, 0, 2, 0, 3, 3, 2, 1, 1, 1, 3, 0, 3, 3, 2, 1, 1, 2, 0, 0, 3, 3, 2, 1, 1, 3, 1, 0, 3, 3, 2, 2, 1, 0, 2, 0, 0, 3, 2, 2, 1, 1, 3, 0, 0, 3, 2, 2, 1, 2, 0, 0, 0, 3, 2, 2, 1, 3, 1, 0, 0, 3, 2, 3, 1, 0, 2, 0, 1, 3, 2, 3, 1, 1, 3, 0, 1, 3, 2, 3, 1, 2, 0, 0, 1, 3, 2, 3, 1, 3, 1, 0, 1, 3, 3, 0, 2, 0, 2, 1, 2, 0, 3, 0, 2, 1, 3, 1, 2, 0, 3, 0, 2, 2, 0, 1, 2, 0, 3, 0, 2, 3, 1, 1, 2, 0, 3, 1, 2, 0, 2, 1, 3, 0, 3, 1, 2, 1, 3, 1, 3, 0, 3, 1, 2, 2, 0, 1, 3, 0, 3, 1, 2, 3, 1, 1, 3, 0, 3, 2, 2, 0, 2, 1, 0, 0, 3, 2, 2, 1, 3, 1, 0, 0, 3, 2, 2, 2, 0, 1, 0, 0, 3, 2, 2, 3, 1, 1, 0, 0, 3, 3, 2, 0, 2, 1, 1, 0, 3, 3, 2, 1, 3, 1, 1, 0, 3, 3, 2, 2, 0, 1, 1, 0, 3, 3, 2, 3, 1, 1, 1, 0, 3, 0, 3, 0, 2, 1, 2, 1, 3, 0, 3, 1, 3, 1, 2, 1, 3, 0, 3, 2, 0, 1, 2, 1, 3, 0, 3, 3, 1, 1, 2, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 2, 0, 1, 3, 1, 3, 1, 3, 3, 1, 1, 3, 1, 3, 2, 3, 0, 2, 1, 0, 1, 3, 2, 3, 1, 3, 1, 0, 1, 3, 2, 3, 2, 0, 1, 0, 1, 3, 2, 3, 3, 1, 1, 0, 1, 3, 3, 3, 0, 2, 1, 1, 1, 3, 3, 3, 1, 3, 1, 1, 1, 3, 3, 3, 2, 0, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 3, 0, 0, 0, 2, 1, 2, 2, 3, 0, 0, 1, 3, 1, 2, 2, 3, 0, 0, 2, 0, 1, 2, 2, 3, 0, 0, 3, 1, 1, 2, 2, 3, 1, 0, 0, 2, 1, 3, 2, 3, 1, 0, 1, 3, 1, 3, 2, 3, 1, 0, 2, 0, 1, 3, 2, 3, 1, 0, 3, 1, 1, 3, 2, 3, 2, 0, 0, 2, 1, 0, 2, 3, 2, 0, 1, 3, 1, 0, 2, 3, 2, 0, 2, 0, 1, 0, 2, 3, 2, 0, 3, 1, 1, 0, 2, 3, 3, 0, 0, 2, 1, 1, 2, 3, 3, 0, 1, 3, 1, 1, 2, 3, 3, 0, 2, 0, 1, 1, 2, 3, 3, 0, 3, 1, 1, 1, 2, 3, 0, 1, 0, 2, 1, 2, 3, 3, 0, 1, 1, 3, 1, 2, 3, 3, 0, 1, 2, 0, 1, 2, 3, 3, 0, 1, 3, 1, 1, 2, 3, 3, 1, 1, 0, 2, 1, 3, 3, 3, 1, 1, 1, 3, 1, 3, 3, 3, 1, 1, 2, 0, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 3, 3, 2, 1, 0, 2, 1, 0, 3, 3, 2, 1, 1, 3, 1, 0, 3, 3, 2, 1, 2, 0, 1, 0, 3, 3, 2, 1, 3, 1, 1, 0, 3, 3, 3, 1, 0, 2, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 2, 0, 1, 1, 3, 3, 3, 1, 3, 1, 1, 1, 3, 0, 0, 2, 0, 2, 2, 2, 0, 0, 0, 2, 1, 3, 2, 2, 0, 0, 0, 2, 2, 0, 2, 2, 0, 0, 0, 2, 3, 1, 2, 2, 0, 0, 1, 2, 0, 2, 2, 3, 0, 0, 1, 2, 1, 3, 2, 3, 0, 0, 1, 2, 2, 0, 2, 3, 0, 0, 1, 2, 3, 1, 2, 3, 0, 0, 2, 2, 0, 2, 2, 0, 0, 0, 2, 2, 1, 3, 2, 0, 0, 0, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 3, 1, 2, 0, 0, 0, 3, 2, 0, 2, 2, 1, 0, 0, 3, 2, 1, 3, 2, 1, 0, 0, 3, 2, 2, 0, 2, 1, 0, 0, 3, 2, 3, 1, 2, 1, 0, 0, 0, 3, 0, 2, 2, 2, 1, 0, 0, 3, 1, 3, 2, 2, 1, 0, 0, 3, 2, 0, 2, 2, 1, 0, 0, 3, 3, 1, 2, 2, 1, 0, 1, 3, 0, 2, 2, 3, 1, 0, 1, 3, 1, 3, 2, 3, 1, 0, 1, 3, 2, 0, 2, 3, 1, 0, 1, 3, 3, 1, 2, 3, 1, 0, 2, 3, 0, 2, 2, 0, 1, 0, 2, 3, 1, 3, 2, 0, 1, 0, 2, 3, 2, 0, 2, 0, 1, 0, 2, 3, 3, 1, 2, 0, 1, 0, 3, 3, 0, 2, 2, 1, 1, 0, 3, 3, 1, 3, 2, 1, 1, 0, 3, 3, 2, 0, 2, 1, 1, 0, 3, 3, 3, 1, 2, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 1, 3, 2, 2, 2, 0, 0, 0, 2, 0, 2, 2, 2, 0, 0, 0, 3, 1, 2, 2, 2, 0, 1, 0, 0, 2, 2, 3, 2, 0, 1, 0, 1, 3, 2, 3, 2, 0, 1, 0, 2, 0, 2, 3, 2, 0, 1, 0, 3, 1, 2, 3, 2, 0, 2, 0, 0, 2, 2, 0, 2, 0, 2, 0, 1, 3, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 3, 1, 2, 0, 2, 0, 3, 0, 0, 2, 2, 1, 2, 0, 3, 0, 1, 3, 2, 1, 2, 0, 3, 0, 2, 0, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 2, 0, 0, 1, 0, 2, 2, 2, 3, 0, 0, 1, 1, 3, 2, 2, 3, 0, 0, 1, 2, 0, 2, 2, 3, 0, 0, 1, 3, 1, 2, 2, 3, 0, 1, 1, 0, 2, 2, 3, 3, 0, 1, 1, 1, 3, 2, 3, 3, 0, 1, 1, 2, 0, 2, 3, 3, 0, 1, 1, 3, 1, 2, 3, 3, 0, 2, 1, 0, 2, 2, 0, 3, 0, 2, 1, 1, 3, 2, 0, 3, 0, 2, 1, 2, 0, 2, 0, 3, 0, 2, 1, 3, 1, 2, 0, 3, 0, 3, 1, 0, 2, 2, 1, 3, 0, 3, 1, 1, 3, 2, 1, 3, 0, 3, 1, 2, 0, 2, 1, 3, 0, 3, 1, 3, 1, 2, 1, 3, 1, 0, 2, 0, 2, 3, 2, 0, 1, 0, 2, 1, 3, 3, 2, 0, 1, 0, 2, 2, 0, 3, 2, 0, 1, 0, 2, 3, 1, 3, 2, 0, 1, 1, 2, 0, 2, 3, 3, 0, 1, 1, 2, 1, 3, 3, 3, 0, 1, 1, 2, 2, 0, 3, 3, 0, 1, 1, 2, 3, 1, 3, 3, 0, 1, 2, 2, 0, 2, 3, 0, 0, 1, 2, 2, 1, 3, 3, 0, 0, 1, 2, 2, 2, 0, 3, 0, 0, 1, 2, 2, 3, 1, 3, 0, 0, 1, 3, 2, 0, 2, 3, 1, 0, 1, 3, 2, 1, 3, 3, 1, 0, 1, 3, 2, 2, 0, 3, 1, 0, 1, 3, 2, 3, 1, 3, 1, 0, 1, 0, 3, 0, 2, 3, 2, 1, 1, 0, 3, 1, 3, 3, 2, 1, 1, 0, 3, 2, 0, 3, 2, 1, 1, 0, 3, 3, 1, 3, 2, 1, 1, 1, 3, 0, 2, 3, 3, 1, 1, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 2, 0, 3, 3, 1, 1, 1, 3, 3, 1, 3, 3, 1, 1, 2, 3, 0, 2, 3, 0, 1, 1, 2, 3, 1, 3, 3, 0, 1, 1, 2, 3, 2, 0, 3, 0, 1, 1, 2, 3, 3, 1, 3, 0, 1, 1, 3, 3, 0, 2, 3, 1, 1, 1, 3, 3, 1, 3, 3, 1, 1, 1, 3, 3, 2, 0, 3, 1, 1, 1, 3, 3, 3, 1, 3, 1, 1, 1, 0, 0, 0, 2, 3, 2, 2, 1, 0, 0, 1, 3, 3, 2, 2, 1, 0, 0, 2, 0, 3, 2, 2, 1, 0, 0, 3, 1, 3, 2, 2, 1, 1, 0, 0, 2, 3, 3, 2, 1, 1, 0, 1, 3, 3, 3, 2, 1, 1, 0, 2, 0, 3, 3, 2, 1, 1, 0, 3, 1, 3, 3, 2, 1, 2, 0, 0, 2, 3, 0, 2, 1, 2, 0, 1, 3, 3, 0, 2, 1, 2, 0, 2, 0, 3, 0, 2, 1, 2, 0, 3, 1, 3, 0, 2, 1, 3, 0, 0, 2, 3, 1, 2, 1, 3, 0, 1, 3, 3, 1, 2, 1, 3, 0, 2, 0, 3, 1, 2, 1, 3, 0, 3, 1, 3, 1, 2, 1, 0, 1, 0, 2, 3, 2, 3, 1, 0, 1, 1, 3, 3, 2, 3, 1, 0, 1, 2, 0, 3, 2, 3, 1, 0, 1, 3, 1, 3, 2, 3, 1, 1, 1, 0, 2, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 2, 0, 3, 3, 3, 1, 1, 1, 3, 1, 3, 3, 3, 1, 2, 1, 0, 2, 3, 0, 3, 1, 2, 1, 1, 3, 3, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 3, 1, 3, 0, 3, 1, 3, 1, 0, 2, 3, 1, 3, 1, 3, 1, 1, 3, 3, 1, 3, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, }; short bbud_g5_gj_g5_gj_ll_col_contr[768*8] = { 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, }; @@ -122,3 +121,4 @@ short bbus_gkC_Cg5_gi_gj_ll_col_contr[768*8] = { 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1 float2 bbus_gjC_Cg5_gjC_Cg5_ll_vals[768] = { {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, -0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {2.0, 0.0}, {-2.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, -0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, {1.0, 0.0}, {-1.0, 0.0}, }; short bbus_gjC_Cg5_gjC_Cg5_ll_idxs[768*8] = { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 3, 1, 2, 0, 0, 0, 0, 0, 2, 1, 3, 0, 0, 0, 0, 0, 1, 1, 0, 2, 0, 2, 0, 0, 0, 1, 1, 2, 0, 2, 0, 0, 3, 1, 2, 2, 0, 2, 0, 0, 2, 1, 3, 2, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 3, 0, 2, 0, 0, 0, 0, 1, 2, 0, 3, 0, 0, 0, 0, 1, 1, 0, 0, 2, 0, 2, 0, 1, 0, 0, 1, 2, 0, 2, 0, 1, 3, 0, 2, 2, 0, 2, 0, 1, 2, 0, 3, 2, 0, 2, 0, 2, 1, 3, 0, 0, 0, 0, 0, 2, 0, 3, 1, 0, 0, 0, 0, 2, 3, 3, 2, 0, 0, 0, 0, 2, 2, 3, 3, 0, 0, 0, 0, 2, 1, 3, 0, 2, 0, 2, 0, 2, 0, 3, 1, 2, 0, 2, 0, 2, 3, 3, 2, 2, 0, 2, 0, 2, 2, 3, 3, 2, 0, 2, 0, 3, 1, 2, 0, 0, 0, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, 3, 3, 2, 2, 0, 0, 0, 0, 3, 2, 2, 3, 0, 0, 0, 0, 3, 1, 2, 0, 2, 0, 2, 0, 3, 0, 2, 1, 2, 0, 2, 0, 3, 3, 2, 2, 2, 0, 2, 0, 3, 2, 2, 3, 2, 0, 2, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 3, 1, 2, 1, 1, 1, 1, 0, 2, 1, 3, 1, 1, 1, 1, 0, 1, 1, 0, 3, 1, 3, 1, 0, 0, 1, 1, 3, 1, 3, 1, 0, 3, 1, 2, 3, 1, 3, 1, 0, 2, 1, 3, 3, 1, 3, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 3, 0, 2, 1, 1, 1, 1, 1, 2, 0, 3, 1, 1, 1, 1, 1, 1, 0, 0, 3, 1, 3, 1, 1, 0, 0, 1, 3, 1, 3, 1, 1, 3, 0, 2, 3, 1, 3, 1, 1, 2, 0, 3, 3, 1, 3, 1, 2, 1, 3, 0, 1, 1, 1, 1, 2, 0, 3, 1, 1, 1, 1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 2, 2, 3, 3, 1, 1, 1, 1, 2, 1, 3, 0, 3, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 1, 2, 3, 3, 2, 3, 1, 3, 1, 2, 2, 3, 3, 3, 1, 3, 1, 3, 1, 2, 0, 1, 1, 1, 1, 3, 0, 2, 1, 1, 1, 1, 1, 3, 3, 2, 2, 1, 1, 1, 1, 3, 2, 2, 3, 1, 1, 1, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 1, 3, 3, 2, 2, 3, 1, 3, 1, 3, 2, 2, 3, 3, 1, 3, 1, 0, 1, 1, 0, 0, 2, 0, 2, 0, 0, 1, 1, 0, 2, 0, 2, 0, 3, 1, 2, 0, 2, 0, 2, 0, 2, 1, 3, 0, 2, 0, 2, 0, 1, 1, 0, 2, 2, 2, 2, 0, 0, 1, 1, 2, 2, 2, 2, 0, 3, 1, 2, 2, 2, 2, 2, 0, 2, 1, 3, 2, 2, 2, 2, 1, 1, 0, 0, 0, 2, 0, 2, 1, 0, 0, 1, 0, 2, 0, 2, 1, 3, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 0, 2, 0, 2, 1, 1, 0, 0, 2, 2, 2, 2, 1, 0, 0, 1, 2, 2, 2, 2, 1, 3, 0, 2, 2, 2, 2, 2, 1, 2, 0, 3, 2, 2, 2, 2, 2, 1, 3, 0, 0, 2, 0, 2, 2, 0, 3, 1, 0, 2, 0, 2, 2, 3, 3, 2, 0, 2, 0, 2, 2, 2, 3, 3, 0, 2, 0, 2, 2, 1, 3, 0, 2, 2, 2, 2, 2, 0, 3, 1, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 3, 1, 2, 0, 0, 2, 0, 2, 3, 0, 2, 1, 0, 2, 0, 2, 3, 3, 2, 2, 0, 2, 0, 2, 3, 2, 2, 3, 0, 2, 0, 2, 3, 1, 2, 0, 2, 2, 2, 2, 3, 0, 2, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 0, 1, 1, 0, 1, 3, 1, 3, 0, 0, 1, 1, 1, 3, 1, 3, 0, 3, 1, 2, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 1, 3, 0, 1, 1, 0, 3, 3, 3, 3, 0, 0, 1, 1, 3, 3, 3, 3, 0, 3, 1, 2, 3, 3, 3, 3, 0, 2, 1, 3, 3, 3, 3, 3, 1, 1, 0, 0, 1, 3, 1, 3, 1, 0, 0, 1, 1, 3, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 1, 1, 0, 0, 3, 3, 3, 3, 1, 0, 0, 1, 3, 3, 3, 3, 1, 3, 0, 2, 3, 3, 3, 3, 1, 2, 0, 3, 3, 3, 3, 3, 2, 1, 3, 0, 1, 3, 1, 3, 2, 0, 3, 1, 1, 3, 1, 3, 2, 3, 3, 2, 1, 3, 1, 3, 2, 2, 3, 3, 1, 3, 1, 3, 2, 1, 3, 0, 3, 3, 3, 3, 2, 0, 3, 1, 3, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 1, 2, 0, 1, 3, 1, 3, 3, 0, 2, 1, 1, 3, 1, 3, 3, 3, 2, 2, 1, 3, 1, 3, 3, 2, 2, 3, 1, 3, 1, 3, 3, 1, 2, 0, 3, 3, 3, 3, 3, 0, 2, 1, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 3, 1, 2, 0, 0, 0, 0, 0, 2, 1, 3, 0, 0, 0, 0, 0, 1, 1, 0, 2, 0, 2, 0, 0, 0, 1, 1, 2, 0, 2, 0, 0, 3, 1, 2, 2, 0, 2, 0, 0, 2, 1, 3, 2, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 3, 0, 2, 0, 0, 0, 0, 1, 2, 0, 3, 0, 0, 0, 0, 1, 1, 0, 0, 2, 0, 2, 0, 1, 0, 0, 1, 2, 0, 2, 0, 1, 3, 0, 2, 2, 0, 2, 0, 1, 2, 0, 3, 2, 0, 2, 0, 2, 1, 3, 0, 0, 0, 0, 0, 2, 0, 3, 1, 0, 0, 0, 0, 2, 3, 3, 2, 0, 0, 0, 0, 2, 2, 3, 3, 0, 0, 0, 0, 2, 1, 3, 0, 2, 0, 2, 0, 2, 0, 3, 1, 2, 0, 2, 0, 2, 3, 3, 2, 2, 0, 2, 0, 2, 2, 3, 3, 2, 0, 2, 0, 3, 1, 2, 0, 0, 0, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, 3, 3, 2, 2, 0, 0, 0, 0, 3, 2, 2, 3, 0, 0, 0, 0, 3, 1, 2, 0, 2, 0, 2, 0, 3, 0, 2, 1, 2, 0, 2, 0, 3, 3, 2, 2, 2, 0, 2, 0, 3, 2, 2, 3, 2, 0, 2, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 3, 1, 2, 1, 1, 1, 1, 0, 2, 1, 3, 1, 1, 1, 1, 0, 1, 1, 0, 3, 1, 3, 1, 0, 0, 1, 1, 3, 1, 3, 1, 0, 3, 1, 2, 3, 1, 3, 1, 0, 2, 1, 3, 3, 1, 3, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 3, 0, 2, 1, 1, 1, 1, 1, 2, 0, 3, 1, 1, 1, 1, 1, 1, 0, 0, 3, 1, 3, 1, 1, 0, 0, 1, 3, 1, 3, 1, 1, 3, 0, 2, 3, 1, 3, 1, 1, 2, 0, 3, 3, 1, 3, 1, 2, 1, 3, 0, 1, 1, 1, 1, 2, 0, 3, 1, 1, 1, 1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 2, 2, 3, 3, 1, 1, 1, 1, 2, 1, 3, 0, 3, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 1, 2, 3, 3, 2, 3, 1, 3, 1, 2, 2, 3, 3, 3, 1, 3, 1, 3, 1, 2, 0, 1, 1, 1, 1, 3, 0, 2, 1, 1, 1, 1, 1, 3, 3, 2, 2, 1, 1, 1, 1, 3, 2, 2, 3, 1, 1, 1, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 1, 3, 3, 2, 2, 3, 1, 3, 1, 3, 2, 2, 3, 3, 1, 3, 1, 0, 1, 1, 0, 0, 2, 0, 2, 0, 0, 1, 1, 0, 2, 0, 2, 0, 3, 1, 2, 0, 2, 0, 2, 0, 2, 1, 3, 0, 2, 0, 2, 0, 1, 1, 0, 2, 2, 2, 2, 0, 0, 1, 1, 2, 2, 2, 2, 0, 3, 1, 2, 2, 2, 2, 2, 0, 2, 1, 3, 2, 2, 2, 2, 1, 1, 0, 0, 0, 2, 0, 2, 1, 0, 0, 1, 0, 2, 0, 2, 1, 3, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 0, 2, 0, 2, 1, 1, 0, 0, 2, 2, 2, 2, 1, 0, 0, 1, 2, 2, 2, 2, 1, 3, 0, 2, 2, 2, 2, 2, 1, 2, 0, 3, 2, 2, 2, 2, 2, 1, 3, 0, 0, 2, 0, 2, 2, 0, 3, 1, 0, 2, 0, 2, 2, 3, 3, 2, 0, 2, 0, 2, 2, 2, 3, 3, 0, 2, 0, 2, 2, 1, 3, 0, 2, 2, 2, 2, 2, 0, 3, 1, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 3, 1, 2, 0, 0, 2, 0, 2, 3, 0, 2, 1, 0, 2, 0, 2, 3, 3, 2, 2, 0, 2, 0, 2, 3, 2, 2, 3, 0, 2, 0, 2, 3, 1, 2, 0, 2, 2, 2, 2, 3, 0, 2, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 0, 1, 1, 0, 1, 3, 1, 3, 0, 0, 1, 1, 1, 3, 1, 3, 0, 3, 1, 2, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 1, 3, 0, 1, 1, 0, 3, 3, 3, 3, 0, 0, 1, 1, 3, 3, 3, 3, 0, 3, 1, 2, 3, 3, 3, 3, 0, 2, 1, 3, 3, 3, 3, 3, 1, 1, 0, 0, 1, 3, 1, 3, 1, 0, 0, 1, 1, 3, 1, 3, 1, 3, 0, 2, 1, 3, 1, 3, 1, 2, 0, 3, 1, 3, 1, 3, 1, 1, 0, 0, 3, 3, 3, 3, 1, 0, 0, 1, 3, 3, 3, 3, 1, 3, 0, 2, 3, 3, 3, 3, 1, 2, 0, 3, 3, 3, 3, 3, 2, 1, 3, 0, 1, 3, 1, 3, 2, 0, 3, 1, 1, 3, 1, 3, 2, 3, 3, 2, 1, 3, 1, 3, 2, 2, 3, 3, 1, 3, 1, 3, 2, 1, 3, 0, 3, 3, 3, 3, 2, 0, 3, 1, 3, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 1, 2, 0, 1, 3, 1, 3, 3, 0, 2, 1, 1, 3, 1, 3, 3, 3, 2, 2, 1, 3, 1, 3, 3, 2, 2, 3, 1, 3, 1, 3, 3, 1, 2, 0, 3, 3, 3, 3, 3, 0, 2, 1, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 3, 1, 2, 0, 0, 1, 1, 0, 2, 1, 3, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 3, 1, 2, 1, 0, 0, 1, 0, 2, 1, 3, 1, 0, 0, 1, 0, 1, 1, 0, 2, 0, 3, 1, 0, 0, 1, 1, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 0, 1, 1, 0, 3, 0, 2, 1, 0, 0, 1, 1, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 3, 0, 2, 0, 0, 1, 1, 1, 2, 0, 3, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 3, 0, 2, 1, 0, 0, 1, 1, 2, 0, 3, 1, 0, 0, 1, 1, 1, 0, 0, 2, 0, 3, 1, 1, 0, 0, 1, 2, 0, 3, 1, 1, 3, 0, 2, 2, 0, 3, 1, 1, 2, 0, 3, 2, 0, 3, 1, 1, 1, 0, 0, 3, 0, 2, 1, 1, 0, 0, 1, 3, 0, 2, 1, 1, 3, 0, 2, 3, 0, 2, 1, 1, 2, 0, 3, 3, 0, 2, 1, 2, 1, 3, 0, 0, 0, 1, 1, 2, 0, 3, 1, 0, 0, 1, 1, 2, 3, 3, 2, 0, 0, 1, 1, 2, 2, 3, 3, 0, 0, 1, 1, 2, 1, 3, 0, 1, 0, 0, 1, 2, 0, 3, 1, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 2, 3, 3, 1, 0, 0, 1, 2, 1, 3, 0, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 3, 3, 2, 2, 0, 3, 1, 2, 2, 3, 3, 2, 0, 3, 1, 2, 1, 3, 0, 3, 0, 2, 1, 2, 0, 3, 1, 3, 0, 2, 1, 2, 3, 3, 2, 3, 0, 2, 1, 2, 2, 3, 3, 3, 0, 2, 1, 3, 1, 2, 0, 0, 0, 1, 1, 3, 0, 2, 1, 0, 0, 1, 1, 3, 3, 2, 2, 0, 0, 1, 1, 3, 2, 2, 3, 0, 0, 1, 1, 3, 1, 2, 0, 1, 0, 0, 1, 3, 0, 2, 1, 1, 0, 0, 1, 3, 3, 2, 2, 1, 0, 0, 1, 3, 2, 2, 3, 1, 0, 0, 1, 3, 1, 2, 0, 2, 0, 3, 1, 3, 0, 2, 1, 2, 0, 3, 1, 3, 3, 2, 2, 2, 0, 3, 1, 3, 2, 2, 3, 2, 0, 3, 1, 3, 1, 2, 0, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 3, 2, 2, 3, 0, 2, 1, 3, 2, 2, 3, 3, 0, 2, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 3, 1, 2, 0, 1, 1, 0, 0, 2, 1, 3, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 3, 1, 2, 1, 1, 0, 0, 0, 2, 1, 3, 1, 1, 0, 0, 0, 1, 1, 0, 2, 1, 3, 0, 0, 0, 1, 1, 2, 1, 3, 0, 0, 3, 1, 2, 2, 1, 3, 0, 0, 2, 1, 3, 2, 1, 3, 0, 0, 1, 1, 0, 3, 1, 2, 0, 0, 0, 1, 1, 3, 1, 2, 0, 0, 3, 1, 2, 3, 1, 2, 0, 0, 2, 1, 3, 3, 1, 2, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 3, 0, 2, 0, 1, 1, 0, 1, 2, 0, 3, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 3, 0, 2, 1, 1, 0, 0, 1, 2, 0, 3, 1, 1, 0, 0, 1, 1, 0, 0, 2, 1, 3, 0, 1, 0, 0, 1, 2, 1, 3, 0, 1, 3, 0, 2, 2, 1, 3, 0, 1, 2, 0, 3, 2, 1, 3, 0, 1, 1, 0, 0, 3, 1, 2, 0, 1, 0, 0, 1, 3, 1, 2, 0, 1, 3, 0, 2, 3, 1, 2, 0, 1, 2, 0, 3, 3, 1, 2, 0, 2, 1, 3, 0, 0, 1, 1, 0, 2, 0, 3, 1, 0, 1, 1, 0, 2, 3, 3, 2, 0, 1, 1, 0, 2, 2, 3, 3, 0, 1, 1, 0, 2, 1, 3, 0, 1, 1, 0, 0, 2, 0, 3, 1, 1, 1, 0, 0, 2, 3, 3, 2, 1, 1, 0, 0, 2, 2, 3, 3, 1, 1, 0, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 0, 3, 1, 2, 1, 3, 0, 2, 3, 3, 2, 2, 1, 3, 0, 2, 2, 3, 3, 2, 1, 3, 0, 2, 1, 3, 0, 3, 1, 2, 0, 2, 0, 3, 1, 3, 1, 2, 0, 2, 3, 3, 2, 3, 1, 2, 0, 2, 2, 3, 3, 3, 1, 2, 0, 3, 1, 2, 0, 0, 1, 1, 0, 3, 0, 2, 1, 0, 1, 1, 0, 3, 3, 2, 2, 0, 1, 1, 0, 3, 2, 2, 3, 0, 1, 1, 0, 3, 1, 2, 0, 1, 1, 0, 0, 3, 0, 2, 1, 1, 1, 0, 0, 3, 3, 2, 2, 1, 1, 0, 0, 3, 2, 2, 3, 1, 1, 0, 0, 3, 1, 2, 0, 2, 1, 3, 0, 3, 0, 2, 1, 2, 1, 3, 0, 3, 3, 2, 2, 2, 1, 3, 0, 3, 2, 2, 3, 2, 1, 3, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 0, 2, 1, 3, 1, 2, 0, 3, 3, 2, 2, 3, 1, 2, 0, 3, 2, 2, 3, 3, 1, 2, 0, 0, 1, 1, 0, 0, 2, 1, 3, 0, 0, 1, 1, 0, 2, 1, 3, 0, 3, 1, 2, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 1, 1, 0, 1, 2, 0, 3, 0, 0, 1, 1, 1, 2, 0, 3, 0, 3, 1, 2, 1, 2, 0, 3, 0, 2, 1, 3, 1, 2, 0, 3, 0, 1, 1, 0, 2, 2, 3, 3, 0, 0, 1, 1, 2, 2, 3, 3, 0, 3, 1, 2, 2, 2, 3, 3, 0, 2, 1, 3, 2, 2, 3, 3, 0, 1, 1, 0, 3, 2, 2, 3, 0, 0, 1, 1, 3, 2, 2, 3, 0, 3, 1, 2, 3, 2, 2, 3, 0, 2, 1, 3, 3, 2, 2, 3, 1, 1, 0, 0, 0, 2, 1, 3, 1, 0, 0, 1, 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 1, 2, 0, 3, 0, 2, 1, 3, 1, 1, 0, 0, 1, 2, 0, 3, 1, 0, 0, 1, 1, 2, 0, 3, 1, 3, 0, 2, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 1, 0, 0, 2, 2, 3, 3, 1, 0, 0, 1, 2, 2, 3, 3, 1, 3, 0, 2, 2, 2, 3, 3, 1, 2, 0, 3, 2, 2, 3, 3, 1, 1, 0, 0, 3, 2, 2, 3, 1, 0, 0, 1, 3, 2, 2, 3, 1, 3, 0, 2, 3, 2, 2, 3, 1, 2, 0, 3, 3, 2, 2, 3, 2, 1, 3, 0, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 3, 3, 2, 0, 2, 1, 3, 2, 2, 3, 3, 0, 2, 1, 3, 2, 1, 3, 0, 1, 2, 0, 3, 2, 0, 3, 1, 1, 2, 0, 3, 2, 3, 3, 2, 1, 2, 0, 3, 2, 2, 3, 3, 1, 2, 0, 3, 2, 1, 3, 0, 2, 2, 3, 3, 2, 0, 3, 1, 2, 2, 3, 3, 2, 3, 3, 2, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 1, 3, 0, 3, 2, 2, 3, 2, 0, 3, 1, 3, 2, 2, 3, 2, 3, 3, 2, 3, 2, 2, 3, 2, 2, 3, 3, 3, 2, 2, 3, 3, 1, 2, 0, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 3, 2, 2, 0, 2, 1, 3, 3, 2, 2, 3, 0, 2, 1, 3, 3, 1, 2, 0, 1, 2, 0, 3, 3, 0, 2, 1, 1, 2, 0, 3, 3, 3, 2, 2, 1, 2, 0, 3, 3, 2, 2, 3, 1, 2, 0, 3, 3, 1, 2, 0, 2, 2, 3, 3, 3, 0, 2, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 2, 2, 3, 2, 2, 3, 3, 3, 1, 2, 0, 3, 2, 2, 3, 3, 0, 2, 1, 3, 2, 2, 3, 3, 3, 2, 2, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 0, 1, 1, 0, 0, 3, 1, 2, 0, 0, 1, 1, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 2, 1, 3, 0, 3, 1, 2, 0, 1, 1, 0, 1, 3, 0, 2, 0, 0, 1, 1, 1, 3, 0, 2, 0, 3, 1, 2, 1, 3, 0, 2, 0, 2, 1, 3, 1, 3, 0, 2, 0, 1, 1, 0, 2, 3, 3, 2, 0, 0, 1, 1, 2, 3, 3, 2, 0, 3, 1, 2, 2, 3, 3, 2, 0, 2, 1, 3, 2, 3, 3, 2, 0, 1, 1, 0, 3, 3, 2, 2, 0, 0, 1, 1, 3, 3, 2, 2, 0, 3, 1, 2, 3, 3, 2, 2, 0, 2, 1, 3, 3, 3, 2, 2, 1, 1, 0, 0, 0, 3, 1, 2, 1, 0, 0, 1, 0, 3, 1, 2, 1, 3, 0, 2, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 1, 0, 0, 1, 3, 0, 2, 1, 0, 0, 1, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 2, 0, 3, 1, 3, 0, 2, 1, 1, 0, 0, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 3, 0, 2, 2, 3, 3, 2, 1, 2, 0, 3, 2, 3, 3, 2, 1, 1, 0, 0, 3, 3, 2, 2, 1, 0, 0, 1, 3, 3, 2, 2, 1, 3, 0, 2, 3, 3, 2, 2, 1, 2, 0, 3, 3, 3, 2, 2, 2, 1, 3, 0, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 3, 3, 2, 0, 3, 1, 2, 2, 2, 3, 3, 0, 3, 1, 2, 2, 1, 3, 0, 1, 3, 0, 2, 2, 0, 3, 1, 1, 3, 0, 2, 2, 3, 3, 2, 1, 3, 0, 2, 2, 2, 3, 3, 1, 3, 0, 2, 2, 1, 3, 0, 2, 3, 3, 2, 2, 0, 3, 1, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 2, 3, 3, 2, 3, 3, 2, 2, 1, 3, 0, 3, 3, 2, 2, 2, 0, 3, 1, 3, 3, 2, 2, 2, 3, 3, 2, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 3, 1, 2, 0, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 3, 2, 2, 0, 3, 1, 2, 3, 2, 2, 3, 0, 3, 1, 2, 3, 1, 2, 0, 1, 3, 0, 2, 3, 0, 2, 1, 1, 3, 0, 2, 3, 3, 2, 2, 1, 3, 0, 2, 3, 2, 2, 3, 1, 3, 0, 2, 3, 1, 2, 0, 2, 3, 3, 2, 3, 0, 2, 1, 2, 3, 3, 2, 3, 3, 2, 2, 2, 3, 3, 2, 3, 2, 2, 3, 2, 3, 3, 2, 3, 1, 2, 0, 3, 3, 2, 2, 3, 0, 2, 1, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 2, 2, 3, 3, 3, 2, 2, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 3, 1, 2, 1, 0, 0, 1, 0, 2, 1, 3, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 3, 1, 2, 0, 0, 1, 1, 0, 2, 1, 3, 0, 0, 1, 1, 0, 1, 1, 0, 3, 0, 2, 1, 0, 0, 1, 1, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 2, 1, 3, 3, 0, 2, 1, 0, 1, 1, 0, 2, 0, 3, 1, 0, 0, 1, 1, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 2, 1, 3, 2, 0, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 3, 0, 2, 1, 0, 0, 1, 1, 2, 0, 3, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 3, 0, 2, 0, 0, 1, 1, 1, 2, 0, 3, 0, 0, 1, 1, 1, 1, 0, 0, 3, 0, 2, 1, 1, 0, 0, 1, 3, 0, 2, 1, 1, 3, 0, 2, 3, 0, 2, 1, 1, 2, 0, 3, 3, 0, 2, 1, 1, 1, 0, 0, 2, 0, 3, 1, 1, 0, 0, 1, 2, 0, 3, 1, 1, 3, 0, 2, 2, 0, 3, 1, 1, 2, 0, 3, 2, 0, 3, 1, 2, 1, 3, 0, 1, 0, 0, 1, 2, 0, 3, 1, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 2, 3, 3, 1, 0, 0, 1, 2, 1, 3, 0, 0, 0, 1, 1, 2, 0, 3, 1, 0, 0, 1, 1, 2, 3, 3, 2, 0, 0, 1, 1, 2, 2, 3, 3, 0, 0, 1, 1, 2, 1, 3, 0, 3, 0, 2, 1, 2, 0, 3, 1, 3, 0, 2, 1, 2, 3, 3, 2, 3, 0, 2, 1, 2, 2, 3, 3, 3, 0, 2, 1, 2, 1, 3, 0, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 3, 3, 2, 2, 0, 3, 1, 2, 2, 3, 3, 2, 0, 3, 1, 3, 1, 2, 0, 1, 0, 0, 1, 3, 0, 2, 1, 1, 0, 0, 1, 3, 3, 2, 2, 1, 0, 0, 1, 3, 2, 2, 3, 1, 0, 0, 1, 3, 1, 2, 0, 0, 0, 1, 1, 3, 0, 2, 1, 0, 0, 1, 1, 3, 3, 2, 2, 0, 0, 1, 1, 3, 2, 2, 3, 0, 0, 1, 1, 3, 1, 2, 0, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 3, 2, 2, 3, 0, 2, 1, 3, 2, 2, 3, 3, 0, 2, 1, 3, 1, 2, 0, 2, 0, 3, 1, 3, 0, 2, 1, 2, 0, 3, 1, 3, 3, 2, 2, 2, 0, 3, 1, 3, 2, 2, 3, 2, 0, 3, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 3, 1, 2, 1, 1, 0, 0, 0, 2, 1, 3, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 3, 1, 2, 0, 1, 1, 0, 0, 2, 1, 3, 0, 1, 1, 0, 0, 1, 1, 0, 3, 1, 2, 0, 0, 0, 1, 1, 3, 1, 2, 0, 0, 3, 1, 2, 3, 1, 2, 0, 0, 2, 1, 3, 3, 1, 2, 0, 0, 1, 1, 0, 2, 1, 3, 0, 0, 0, 1, 1, 2, 1, 3, 0, 0, 3, 1, 2, 2, 1, 3, 0, 0, 2, 1, 3, 2, 1, 3, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 3, 0, 2, 1, 1, 0, 0, 1, 2, 0, 3, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 3, 0, 2, 0, 1, 1, 0, 1, 2, 0, 3, 0, 1, 1, 0, 1, 1, 0, 0, 3, 1, 2, 0, 1, 0, 0, 1, 3, 1, 2, 0, 1, 3, 0, 2, 3, 1, 2, 0, 1, 2, 0, 3, 3, 1, 2, 0, 1, 1, 0, 0, 2, 1, 3, 0, 1, 0, 0, 1, 2, 1, 3, 0, 1, 3, 0, 2, 2, 1, 3, 0, 1, 2, 0, 3, 2, 1, 3, 0, 2, 1, 3, 0, 1, 1, 0, 0, 2, 0, 3, 1, 1, 1, 0, 0, 2, 3, 3, 2, 1, 1, 0, 0, 2, 2, 3, 3, 1, 1, 0, 0, 2, 1, 3, 0, 0, 1, 1, 0, 2, 0, 3, 1, 0, 1, 1, 0, 2, 3, 3, 2, 0, 1, 1, 0, 2, 2, 3, 3, 0, 1, 1, 0, 2, 1, 3, 0, 3, 1, 2, 0, 2, 0, 3, 1, 3, 1, 2, 0, 2, 3, 3, 2, 3, 1, 2, 0, 2, 2, 3, 3, 3, 1, 2, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 0, 3, 1, 2, 1, 3, 0, 2, 3, 3, 2, 2, 1, 3, 0, 2, 2, 3, 3, 2, 1, 3, 0, 3, 1, 2, 0, 1, 1, 0, 0, 3, 0, 2, 1, 1, 1, 0, 0, 3, 3, 2, 2, 1, 1, 0, 0, 3, 2, 2, 3, 1, 1, 0, 0, 3, 1, 2, 0, 0, 1, 1, 0, 3, 0, 2, 1, 0, 1, 1, 0, 3, 3, 2, 2, 0, 1, 1, 0, 3, 2, 2, 3, 0, 1, 1, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 0, 2, 1, 3, 1, 2, 0, 3, 3, 2, 2, 3, 1, 2, 0, 3, 2, 2, 3, 3, 1, 2, 0, 3, 1, 2, 0, 2, 1, 3, 0, 3, 0, 2, 1, 2, 1, 3, 0, 3, 3, 2, 2, 2, 1, 3, 0, 3, 2, 2, 3, 2, 1, 3, 0, 0, 1, 1, 0, 1, 2, 0, 3, 0, 0, 1, 1, 1, 2, 0, 3, 0, 3, 1, 2, 1, 2, 0, 3, 0, 2, 1, 3, 1, 2, 0, 3, 0, 1, 1, 0, 0, 2, 1, 3, 0, 0, 1, 1, 0, 2, 1, 3, 0, 3, 1, 2, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 1, 1, 0, 3, 2, 2, 3, 0, 0, 1, 1, 3, 2, 2, 3, 0, 3, 1, 2, 3, 2, 2, 3, 0, 2, 1, 3, 3, 2, 2, 3, 0, 1, 1, 0, 2, 2, 3, 3, 0, 0, 1, 1, 2, 2, 3, 3, 0, 3, 1, 2, 2, 2, 3, 3, 0, 2, 1, 3, 2, 2, 3, 3, 1, 1, 0, 0, 1, 2, 0, 3, 1, 0, 0, 1, 1, 2, 0, 3, 1, 3, 0, 2, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 1, 0, 0, 0, 2, 1, 3, 1, 0, 0, 1, 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 1, 2, 0, 3, 0, 2, 1, 3, 1, 1, 0, 0, 3, 2, 2, 3, 1, 0, 0, 1, 3, 2, 2, 3, 1, 3, 0, 2, 3, 2, 2, 3, 1, 2, 0, 3, 3, 2, 2, 3, 1, 1, 0, 0, 2, 2, 3, 3, 1, 0, 0, 1, 2, 2, 3, 3, 1, 3, 0, 2, 2, 2, 3, 3, 1, 2, 0, 3, 2, 2, 3, 3, 2, 1, 3, 0, 1, 2, 0, 3, 2, 0, 3, 1, 1, 2, 0, 3, 2, 3, 3, 2, 1, 2, 0, 3, 2, 2, 3, 3, 1, 2, 0, 3, 2, 1, 3, 0, 0, 2, 1, 3, 2, 0, 3, 1, 0, 2, 1, 3, 2, 3, 3, 2, 0, 2, 1, 3, 2, 2, 3, 3, 0, 2, 1, 3, 2, 1, 3, 0, 3, 2, 2, 3, 2, 0, 3, 1, 3, 2, 2, 3, 2, 3, 3, 2, 3, 2, 2, 3, 2, 2, 3, 3, 3, 2, 2, 3, 2, 1, 3, 0, 2, 2, 3, 3, 2, 0, 3, 1, 2, 2, 3, 3, 2, 3, 3, 2, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 3, 1, 2, 0, 1, 2, 0, 3, 3, 0, 2, 1, 1, 2, 0, 3, 3, 3, 2, 2, 1, 2, 0, 3, 3, 2, 2, 3, 1, 2, 0, 3, 3, 1, 2, 0, 0, 2, 1, 3, 3, 0, 2, 1, 0, 2, 1, 3, 3, 3, 2, 2, 0, 2, 1, 3, 3, 2, 2, 3, 0, 2, 1, 3, 3, 1, 2, 0, 3, 2, 2, 3, 3, 0, 2, 1, 3, 2, 2, 3, 3, 3, 2, 2, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 1, 2, 0, 2, 2, 3, 3, 3, 0, 2, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 2, 2, 3, 2, 2, 3, 3, 0, 1, 1, 0, 1, 3, 0, 2, 0, 0, 1, 1, 1, 3, 0, 2, 0, 3, 1, 2, 1, 3, 0, 2, 0, 2, 1, 3, 1, 3, 0, 2, 0, 1, 1, 0, 0, 3, 1, 2, 0, 0, 1, 1, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 2, 1, 3, 0, 3, 1, 2, 0, 1, 1, 0, 3, 3, 2, 2, 0, 0, 1, 1, 3, 3, 2, 2, 0, 3, 1, 2, 3, 3, 2, 2, 0, 2, 1, 3, 3, 3, 2, 2, 0, 1, 1, 0, 2, 3, 3, 2, 0, 0, 1, 1, 2, 3, 3, 2, 0, 3, 1, 2, 2, 3, 3, 2, 0, 2, 1, 3, 2, 3, 3, 2, 1, 1, 0, 0, 1, 3, 0, 2, 1, 0, 0, 1, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 2, 0, 3, 1, 3, 0, 2, 1, 1, 0, 0, 0, 3, 1, 2, 1, 0, 0, 1, 0, 3, 1, 2, 1, 3, 0, 2, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 1, 1, 0, 0, 3, 3, 2, 2, 1, 0, 0, 1, 3, 3, 2, 2, 1, 3, 0, 2, 3, 3, 2, 2, 1, 2, 0, 3, 3, 3, 2, 2, 1, 1, 0, 0, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 3, 0, 2, 2, 3, 3, 2, 1, 2, 0, 3, 2, 3, 3, 2, 2, 1, 3, 0, 1, 3, 0, 2, 2, 0, 3, 1, 1, 3, 0, 2, 2, 3, 3, 2, 1, 3, 0, 2, 2, 2, 3, 3, 1, 3, 0, 2, 2, 1, 3, 0, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 3, 3, 2, 0, 3, 1, 2, 2, 2, 3, 3, 0, 3, 1, 2, 2, 1, 3, 0, 3, 3, 2, 2, 2, 0, 3, 1, 3, 3, 2, 2, 2, 3, 3, 2, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 1, 3, 0, 2, 3, 3, 2, 2, 0, 3, 1, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 2, 3, 3, 2, 3, 3, 2, 3, 1, 2, 0, 1, 3, 0, 2, 3, 0, 2, 1, 1, 3, 0, 2, 3, 3, 2, 2, 1, 3, 0, 2, 3, 2, 2, 3, 1, 3, 0, 2, 3, 1, 2, 0, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 3, 2, 2, 0, 3, 1, 2, 3, 2, 2, 3, 0, 3, 1, 2, 3, 1, 2, 0, 3, 3, 2, 2, 3, 0, 2, 1, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 2, 2, 3, 3, 3, 2, 2, 3, 1, 2, 0, 2, 3, 3, 2, 3, 0, 2, 1, 2, 3, 3, 2, 3, 3, 2, 2, 2, 3, 3, 2, 3, 2, 2, 3, 2, 3, 3, 2, }; short bbus_gjC_Cg5_gjC_Cg5_ll_col_contr[768*8] = { 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 2, 0, 3, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, 0, 3, 1, 2, 3, 0, 2, 1, }; +#include diff --git a/lib/kernels/PLEGMA_mesonsAll.cuh b/lib/kernels/PLEGMA_mesonsAll.cuh index 6d33dd54..63dcdf9a 100644 --- a/lib/kernels/PLEGMA_mesonsAll.cuh +++ b/lib/kernels/PLEGMA_mesonsAll.cuh @@ -1,5 +1,6 @@ #include #include +#include using namespace plegma; const int N_PAIRS=34; @@ -117,7 +118,9 @@ void contract_mesons_all_host( ProfileStruct &ps, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); +// cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); +d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) { diff --git a/lib/kernels/PLEGMA_scattreductions.cuh b/lib/kernels/PLEGMA_scattreductions.cuh index 0e4547ec..943e8295 100644 --- a/lib/kernels/PLEGMA_scattreductions.cuh +++ b/lib/kernels/PLEGMA_scattreductions.cuh @@ -1,5 +1,5 @@ #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -50,8 +50,8 @@ static void V_reductions_host( ProfileStruct &ps, VRED V, PLEGMA_ScattCorrelator Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); - cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); -// d_partial_block=device_malloc(alloc_size*sizeof(Float2)); +// cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); // Checking for allocation error. In case we return and let the tuner handle the error. auto error= qudaGetLastError(); if(error != QUDA_SUCCESS) { @@ -66,15 +66,17 @@ static void V_reductions_host( ProfileStruct &ps, VRED V, PLEGMA_ScattCorrelator listGammas.size = gammas.size(); if (gammas.size()==0){ -// listGammas.array=device_malloc(sizeof(GAMMAS_SCATT)); + listGammas.array=(GAMMAS_SCATT*)device_malloc(sizeof(GAMMAS_SCATT)); // checkQudaError(); - cudaMalloc((void**)&listGammas.array, sizeof(GAMMAS_SCATT)); +// cudaMalloc((void**)&listGammas.array, sizeof(GAMMAS_SCATT)); + listGammas.array=(GAMMAS_SCATT*)device_malloc(sizeof(GAMMAS_SCATT)); checkQudaError(); } else{ // listGammas.array=device_malloc(gammas.size()*sizeof(GAMMAS_SCATT)); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS_SCATT)); +// cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS_SCATT)); + listGammas.array=(GAMMAS_SCATT*)device_malloc(gammas.size()*sizeof(GAMMAS_SCATT)); auto error= qudaGetLastError(); if(error != QUDA_SUCCESS) { errorQuda("Failed to clear error state %s\n", qudaGetLastErrorString().c_str()); @@ -372,9 +374,9 @@ static void T_reductions_host( ProfileStruct &ps, TRED T, PLEGMA_ScattCorrelator Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; -// d_partial_block=quda::device_malloc_(__func__, quda::file_name(__FILE__), __LINE__,alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); - cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); +// cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); @@ -393,9 +395,11 @@ static void T_reductions_host( ProfileStruct &ps, TRED T, PLEGMA_ScattCorrelator // listGammas_f.array=quda::device_malloc_(__func__, quda::file_name(__FILE__), __LINE__, gammas_f.size()*sizeof(GAMMAS_SCATT)); + listGammas_i.array=(GAMMAS_SCATT*)device_malloc(gammas_i.size()*sizeof(GAMMAS_SCATT)); + listGammas_f.array=(GAMMAS_SCATT*)device_malloc(gammas_i.size()*sizeof(GAMMAS_SCATT)); - cudaMalloc((void**)&listGammas_i.array, gammas_i.size()*sizeof(GAMMAS_SCATT)); - cudaMalloc((void**)&listGammas_f.array, gammas_f.size()*sizeof(GAMMAS_SCATT)); +// cudaMalloc((void**)&listGammas_i.array, gammas_i.size()*sizeof(GAMMAS_SCATT)); +// cudaMalloc((void**)&listGammas_f.array, gammas_f.size()*sizeof(GAMMAS_SCATT)); checkQudaError(); cudaMemcpy(listGammas_i.array, gammas_i.data(), gammas_i.size()*sizeof(GAMMAS_SCATT), cudaMemcpyHostToDevice); cudaMemcpy(listGammas_f.array, gammas_f.data(), gammas_f.size()*sizeof(GAMMAS_SCATT), cudaMemcpyHostToDevice); diff --git a/lib/kernels/PLEGMA_su3field.cuh b/lib/kernels/PLEGMA_su3field.cuh index 43678ee6..6cc93915 100644 --- a/lib/kernels/PLEGMA_su3field.cuh +++ b/lib/kernels/PLEGMA_su3field.cuh @@ -1,5 +1,6 @@ #include #include +#include using namespace plegma; template @@ -174,7 +175,7 @@ static void sum_real_trace_host(ProfileStruct& ps, PLEGMA_Su3field &su3M int gridDimX = ps.tp.grid.x; hostMalloc(h_partial_sum, gridDimX * sizeof(Float) ); - cudaMalloc((void**)&d_partial_sum, gridDimX * sizeof(Float)); + d_partial_sum=(Float*)device_mallocMalloc(gridDimX * sizeof(Float)); // d_partial_sum=quda::device_malloc_(__func__, quda::file_name(__FILE__), __LINE__, gridDimX * sizeof(Float)); sum_real_trace_kernel<<>>(toField2(su3M), d_partial_sum); diff --git a/lib/kernels/PLEGMA_threep_staple.cu b/lib/kernels/PLEGMA_threep_staple.cu index 68a30cc1..86eba2e9 100644 --- a/lib/kernels/PLEGMA_threep_staple.cu +++ b/lib/kernels/PLEGMA_threep_staple.cu @@ -84,7 +84,8 @@ static void threep_staple_host(ProfileStruct &ps, Float2 *result, KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); +// cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); if(HGC_verbosity > 2) @@ -95,7 +96,8 @@ static void threep_staple_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); +// cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part1.cu b/lib/kernels/PLEGMA_threep_threeD_part1.cu index fe01e659..8842c691 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part1.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part1.cu @@ -5,7 +5,7 @@ #include #include #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -48,7 +48,7 @@ __global__ void threep_threeD_part1_device(Float2* block2, Float2 su3_1[N_COLS][N_COLS]; Float2 su3_2[N_COLS][N_COLS]; Float2 su3_3[N_COLS][N_COLS]; - +#if 0 // BEGIN REGION // This has been generated by python/generate_derivative.py // The order has been optmized such that 70 data accesses have been commented out @@ -115,6 +115,7 @@ __global__ void threep_threeD_part1_device(Float2* block2, // + term x-dir2-dir3, x-dir2-dir3, x+dir1-dir2-dir3, x+dir1-dir3, x+dir1 texture1.get(prop1,vid,dir2,dir3); gaugeTex.get(su3_1,dir1,vid,dir2,dir3); gaugeTex.get(su3_2,dir2,vid,dir1,dir2,dir3); gaugeTex.get(su3_3,dir3,vid,dir1,dir3); /*texture2.get(prop2,vid,dir1);*/ partial_trace_mul_Prop_G1_G2_G3_Prop(R,prop1,prop2,su3_1,su3_2,su3_3,mu,nu,c1,c2); +#endif for(int iop = 0; iop < listGammas.size; iop++){ int opId=listGammas.array[iop]; @@ -166,7 +167,8 @@ static void threep_threeD_part1_host(ProfileStruct &ps, Float2 *result, KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); +// cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); if(HGC_verbosity > 2) @@ -177,7 +179,8 @@ static void threep_threeD_part1_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); +// cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part2.cu b/lib/kernels/PLEGMA_threep_threeD_part2.cu index 8790a49f..ab453a04 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part2.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part2.cu @@ -5,7 +5,7 @@ #include #include #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -49,7 +49,7 @@ __global__ void threep_threeD_part2_device(Float2* block2, Float2 su3_1[N_COLS][N_COLS]; Float2 su3_2[N_COLS][N_COLS]; Float2 su3_3[N_COLS][N_COLS]; - +#if 0 // - term x, x-dir1^, x-dir1, x-dir1+dir2, x-dir1+dir2+dir3 texture1.get(prop1,vid); gaugeTex.get(su3_1,dir1,vid,dir1); gaugeTex.get(su3_2,dir2,vid,dir1); gaugeTex.get(su3_3,dir3,vid,dir1,dir2); texture2.get(prop2,vid,dir1,dir2,dir3); partial_trace_mul_Prop_G1_G2_G3_Prop(R,prop1,prop2,su3_1,su3_2,su3_3,mu,nu,c1,c2); @@ -113,7 +113,7 @@ __global__ void threep_threeD_part2_device(Float2* block2, // - term x-dir2-dir3, x-dir1-dir2-dir3^, x-dir1-dir2-dir3, x-dir1-dir3, x-dir1 texture1.get(prop1,vid,dir2,dir3); gaugeTex.get(su3_1,dir1,vid,dir1,dir2,dir3); gaugeTex.get(su3_2,dir2,vid,dir1,dir2,dir3); gaugeTex.get(su3_3,dir3,vid,dir1,dir3); /*texture2.get(prop2,vid,dir1);*/ partial_trace_mul_Prop_G1_G2_G3_Prop(R,prop1,prop2,su3_1,su3_2,su3_3,mu,nu,c1,c2); - +#endif for(int iop = 0; iop < listGammas.size; iop++){ int opId=listGammas.array[iop]; if(notZfac){ @@ -164,8 +164,10 @@ static void threep_threeD_part2_host(ProfileStruct &ps, Float2 *result, KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + //cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); + cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + if(HGC_verbosity > 2) if(corr.hasSource()) @@ -175,7 +177,8 @@ static void threep_threeD_part2_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); +// cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part3.cu b/lib/kernels/PLEGMA_threep_threeD_part3.cu index 68afb1c9..38d8b424 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part3.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part3.cu @@ -5,7 +5,7 @@ #include #include #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -48,7 +48,7 @@ __global__ void threep_threeD_part3_device(Float2* block2, Float2 su3_1[N_COLS][N_COLS]; Float2 su3_2[N_COLS][N_COLS]; Float2 su3_3[N_COLS][N_COLS]; - +#if 0 // - term x+dir1, x^, x, x+dir2, x+dir2+dir3 texture1.get(prop1,vid,dir1); gaugeTex.get(su3_1,dir1,vid); gaugeTex.get(su3_2,dir2,vid); gaugeTex.get(su3_3,dir3,vid,dir2); texture2.get(prop2,vid,dir2,dir3); partial_trace_mul_Prop_G1_G2_G3_Prop(R,prop1,prop2,su3_1,su3_2,su3_3,mu,nu,c1,c2); @@ -112,7 +112,7 @@ __global__ void threep_threeD_part3_device(Float2* block2, // - term x+dir1-dir2-dir3, x-dir2-dir3^, x-dir2-dir3, x-dir3, x texture1.get(prop1,vid,dir1,dir2,dir3); gaugeTex.get(su3_1,dir1,vid,dir2,dir3); gaugeTex.get(su3_2,dir2,vid,dir2,dir3); gaugeTex.get(su3_3,dir3,vid,dir3); /*texture2.get(prop2,vid);*/ partial_trace_mul_Prop_G1_G2_G3_Prop(R,prop1,prop2,su3_1,su3_2,su3_3,mu,nu,c1,c2); - +#endif for(int iop = 0; iop < listGammas.size; iop++){ int opId=listGammas.array[iop]; if(notZfac) { @@ -164,7 +164,9 @@ static void threep_threeD_part3_host(ProfileStruct &ps, Float2 *result, KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); +// cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); + cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); if(HGC_verbosity > 2) @@ -175,7 +177,8 @@ static void threep_threeD_part3_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); +//cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part4.cu b/lib/kernels/PLEGMA_threep_threeD_part4.cu index 942bbecd..e0a0b49d 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part4.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part4.cu @@ -5,7 +5,7 @@ #include #include #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -48,7 +48,7 @@ __global__ void threep_threeD_part4_device(Float2* block2, Float2 su3_1[N_COLS][N_COLS]; Float2 su3_2[N_COLS][N_COLS]; Float2 su3_3[N_COLS][N_COLS]; - +#if 0 // + term x-dir1, x-dir1, x, x+dir2, x+dir2+dir3 texture1.get(prop1,vid,dir1); gaugeTex.get(su3_1,dir1,vid,dir1); gaugeTex.get(su3_2,dir2,vid); gaugeTex.get(su3_3,dir3,vid,dir2); texture2.get(prop2,vid,dir2,dir3); partial_trace_mul_Prop_G1_G2_G3_Prop(R,prop1,prop2,su3_1,su3_2,su3_3,mu,nu,c1,c2); @@ -112,7 +112,7 @@ __global__ void threep_threeD_part4_device(Float2* block2, // + term x-dir1-dir2-dir3, x-dir1-dir2-dir3, x-dir2-dir3, x-dir3, x texture1.get(prop1,vid,dir1,dir2,dir3); gaugeTex.get(su3_1,dir1,vid,dir1,dir2,dir3); gaugeTex.get(su3_2,dir2,vid,dir2,dir3); /*gaugeTex.get(su3_3,dir3,vid,dir3);*/ /*texture2.get(prop2,vid);*/ partial_trace_mul_Prop_G1_G2_G3_Prop(R,prop1,prop2,su3_1,su3_2,su3_3,mu,nu,c1,c2); - +#endif // END REGION for(int iop = 0; iop < listGammas.size; iop++){ @@ -166,7 +166,8 @@ static void threep_threeD_part4_host(ProfileStruct &ps, Float2 *result, KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); +// cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); if(HGC_verbosity > 2) @@ -177,7 +178,9 @@ static void threep_threeD_part4_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + //cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_twoD.cu b/lib/kernels/PLEGMA_threep_twoD.cu index 768d32f3..d99b1d6b 100644 --- a/lib/kernels/PLEGMA_threep_twoD.cu +++ b/lib/kernels/PLEGMA_threep_twoD.cu @@ -5,7 +5,7 @@ #include #include #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -165,7 +165,8 @@ static void threep_twoD_host(ProfileStruct &ps, Float2 *result, PLEGMA_C KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); +// cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); if(HGC_verbosity > 2) @@ -176,7 +177,8 @@ static void threep_twoD_host(ProfileStruct &ps, Float2 *result, PLEGMA_C Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); +// cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2 *)device_malloc(alloc_size * sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_vector_utils.cuh b/lib/kernels/PLEGMA_vector_utils.cuh index 81895d31..1bd35f0b 100644 --- a/lib/kernels/PLEGMA_vector_utils.cuh +++ b/lib/kernels/PLEGMA_vector_utils.cuh @@ -261,8 +261,13 @@ static void compute_rms(const PLEGMA_Vector3D &vec, std::vector &lis int *d_listR2 = nullptr; Float *d_absPsi = nullptr; if(listR2.size() != absPsi.size()) PLEGMA_error("List sizes should match"); - cudaMalloc((void**)&d_listR2, listR2.size() * sizeof(int)); checkQudaError(); - cudaMalloc((void**)&d_absPsi, absPsi.size() * sizeof(Float)); checkQudaError(); +// cudaMalloc((void**)&d_listR2, listR2.size() * sizeof(int)); + d_listR2=(int *)device_malloc(listR2.size() * sizeof(int)); + checkQudaError(); +// cudaMalloc((void**)&d_absPsi, absPsi.size() * sizeof(Float)); + d_absPsi=(Float *)device_malloc(absPsi.size() * sizeof(Float)); + + checkQudaError(); cudaMemcpy(d_listR2,listR2.data(), listR2.size() * sizeof(int), cudaMemcpyHostToDevice); checkQudaError(); cudaMemset(d_absPsi,0,absPsi.size() * sizeof(Float)); checkQudaError(); thrust::counting_iterator first(0); From 40b27d1ddf06dfb9be813cd4927700d0235c493a Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 10 Nov 2022 12:12:22 +0100 Subject: [PATCH 002/168] correcting typos --- lib/PLEGMA_Field.cu | 2 +- lib/kernels/PLEGMA_mesonsAll.cuh | 2 +- lib/kernels/PLEGMA_su3field.cuh | 2 +- lib/kernels/PLEGMA_threep_staple.cu | 2 +- lib/kernels/PLEGMA_threep_threeD_part1.cu | 2 +- lib/kernels/PLEGMA_threep_threeD_part2.cu | 2 +- lib/kernels/PLEGMA_threep_threeD_part3.cu | 2 +- lib/kernels/PLEGMA_threep_threeD_part4.cu | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/PLEGMA_Field.cu b/lib/PLEGMA_Field.cu index 30dd4bd0..2e55fcc9 100644 --- a/lib/PLEGMA_Field.cu +++ b/lib/PLEGMA_Field.cu @@ -744,7 +744,7 @@ void PLEGMA_Field::mulMomentumPhases(std::vector mom, int sign) int D3D4 = mom.size(); int V = D3D4 == 3 ? HGC_localVolume3D : HGC_localVolume; Float2 *x; - x=((Float2) *)device_malloc(V*2*sizeof(Float)); + x=(Float2 *)device_malloc(V*2*sizeof(Float)); //cudaMalloc((void**)&x, V*2*sizeof(Float)); cudaMemset((void*) x,0,V*2*sizeof(Float)); if(checkErr) checkQudaError(); diff --git a/lib/kernels/PLEGMA_mesonsAll.cuh b/lib/kernels/PLEGMA_mesonsAll.cuh index 63dcdf9a..fc800c06 100644 --- a/lib/kernels/PLEGMA_mesonsAll.cuh +++ b/lib/kernels/PLEGMA_mesonsAll.cuh @@ -119,7 +119,7 @@ void contract_mesons_all_host( ProfileStruct &ps, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; // cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); -d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); +d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); diff --git a/lib/kernels/PLEGMA_su3field.cuh b/lib/kernels/PLEGMA_su3field.cuh index 6cc93915..c2c8e17d 100644 --- a/lib/kernels/PLEGMA_su3field.cuh +++ b/lib/kernels/PLEGMA_su3field.cuh @@ -175,7 +175,7 @@ static void sum_real_trace_host(ProfileStruct& ps, PLEGMA_Su3field &su3M int gridDimX = ps.tp.grid.x; hostMalloc(h_partial_sum, gridDimX * sizeof(Float) ); - d_partial_sum=(Float*)device_mallocMalloc(gridDimX * sizeof(Float)); + d_partial_sum=(Float*)device_malloc(gridDimX * sizeof(Float)); // d_partial_sum=quda::device_malloc_(__func__, quda::file_name(__FILE__), __LINE__, gridDimX * sizeof(Float)); sum_real_trace_kernel<<>>(toField2(su3M), d_partial_sum); diff --git a/lib/kernels/PLEGMA_threep_staple.cu b/lib/kernels/PLEGMA_threep_staple.cu index 86eba2e9..18df1ca6 100644 --- a/lib/kernels/PLEGMA_threep_staple.cu +++ b/lib/kernels/PLEGMA_threep_staple.cu @@ -97,7 +97,7 @@ static void threep_staple_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; // cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); - d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part1.cu b/lib/kernels/PLEGMA_threep_threeD_part1.cu index 8842c691..2556d235 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part1.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part1.cu @@ -180,7 +180,7 @@ static void threep_threeD_part1_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; // cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); - d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part2.cu b/lib/kernels/PLEGMA_threep_threeD_part2.cu index ab453a04..5a16a063 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part2.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part2.cu @@ -178,7 +178,7 @@ static void threep_threeD_part2_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; // cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); - d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part3.cu b/lib/kernels/PLEGMA_threep_threeD_part3.cu index 38d8b424..b0ba0e2f 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part3.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part3.cu @@ -178,7 +178,7 @@ static void threep_threeD_part3_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; //cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); - d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_threeD_part4.cu b/lib/kernels/PLEGMA_threep_threeD_part4.cu index e0a0b49d..e6d5ea52 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part4.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part4.cu @@ -179,7 +179,7 @@ static void threep_threeD_part4_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; //cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); - d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); From 42e59da7141930321aad16c93b2f33cbdb74978e Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 15 Nov 2022 16:01:50 +0100 Subject: [PATCH 003/168] correcting possible error in M diagrams for NJN -pion and correcting momentum phases in meson_3pt --- lib/PLEGMA_ScattCorrelator.cu | 4 +++- plegma/mesons_3pt.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index d1e98d2c..473b1d6a 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2406,6 +2406,8 @@ void PLEGMA_ScattCorrelator::M_diagrams( PLEGMA_ScattCorrelator &C assert(this->pList().check_eq(0)); std::vector mom_pi2 = this->pList().pi(0)[0]; + //This is working only when the unique list of pc and pf1 are the same!!!!!!!!!! + //They taking the same set of momenta std::vector> moms_pf2 = this->pList().uniq_p(2); //extract vector p_f1 std::vector> moms_pf1_red = this->pList().uniq_p(1); //list of pf1 momenta needed here @@ -2463,7 +2465,7 @@ void PLEGMA_ScattCorrelator::M_diagrams( PLEGMA_ScattCorrelator &C int i_pf1 = i_pf1s[map[i_mom][1]]; //position of pf1 in moms_pf1 (tempNN) int i_pf2 = map[i_mom][2]; //position of pf2 in pionpion if (CorrNucleon.GList.size() >4){//ensure always zero momentum at the sink - i_pf2=map_minus[i_mom][2]; + i_pf2=map_minus[i_mom][1]; } for( int t=0; t vector1,vector2; vector1.absorb(vectorSource_oet,sourcePositions[isource][DIM_T]); - vector1.mulMomentumPhases(sourceMom,-1); + vector1.mulMomentumPhases(sourceMom,+1); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear0, alphaGauss)); @@ -592,7 +592,7 @@ int main(int argc, char **argv) { PLEGMA_Vector3D vectorAuxF; vectorAuxF.copy(prop); - vectorAuxF.mulMomentumPhases(momentum_f1,-1); // put momentum at the sink + vectorAuxF.mulMomentumPhases(momentum_f1,+1); // put momentum at the sink vectorAuxD1.copy(vectorAuxF); TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1,smearedGauge3D_sink, nSmear, alphaGauss)); vectorInOut.absorb(vectorAuxD2, global_fixSinkTime); From e557e5103b565184455c1c3561f19a771a06ac4e Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 18 Nov 2022 09:19:47 +0100 Subject: [PATCH 004/168] compiliting tetraquarks kernels only when udsc baryons are set --- lib/PLEGMA_Correlator.cu | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/lib/PLEGMA_Correlator.cu b/lib/PLEGMA_Correlator.cu index 8fec9ea6..47b2bd72 100644 --- a/lib/PLEGMA_Correlator.cu +++ b/lib/PLEGMA_Correlator.cu @@ -13,9 +13,9 @@ #include #ifdef PLEGMA_UDSC_BARYONS #include -#endif #include #include +#endif using namespace plegma; @@ -220,7 +220,7 @@ contractTetraquarks(PLEGMA_Propagator &propLT, PLEGMA_Propagator &propCH, PLEGMA_Propagator &propBT, bool only_st, bool only_ch){ - +#ifdef PLEGMA_UDSC_BARYONS shape = {}; description = ""; datasets = {}; @@ -268,6 +268,10 @@ contractTetraquarks(PLEGMA_Propagator &propLT, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks(propLT, propST, propCH, propBT, *this, todo); +#else + PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); +#endif + } @@ -278,7 +282,7 @@ contractTetraquarksBCUD(PLEGMA_Propagator &propLT, PLEGMA_Propagator &propCH, PLEGMA_Propagator &propBT, bool only_st, bool only_ch){ - +#ifdef PLEGMA_UDSC_BARYONS shape = {}; description = ""; datasets = {}; @@ -326,6 +330,10 @@ contractTetraquarksBCUD(PLEGMA_Propagator &propLT, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks_bcud(propLT, propST, propCH, propBT, *this, todo); +#else + PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); +#endif + } @@ -340,6 +348,7 @@ contractTetraquarksStochastic(PLEGMA_Propagator &propLT1, PLEGMA_Propagator &propBT1, PLEGMA_Propagator &propBT2){ +#ifdef PLEGMA_UDSC_BARYONS shape = {}; description = ""; datasets = {}; @@ -380,6 +389,10 @@ contractTetraquarksStochastic(PLEGMA_Propagator &propLT1, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks_stochastic(propLT1, propLT2,propST1, propST2, propBT1, propBT2, *this, todo); +#else + PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); +#endif + } @@ -395,7 +408,7 @@ contractTetraquarksStochasticBCUD(PLEGMA_Propagator &propLT1, PLEGMA_Propagator &propCH2, PLEGMA_Propagator &propBT1, PLEGMA_Propagator &propBT2){ - +#ifdef PLEGMA_UDSC_BARYONS shape = {}; description = ""; datasets = {}; @@ -439,6 +452,10 @@ contractTetraquarksStochasticBCUD(PLEGMA_Propagator &propLT1, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks_bcud_stochastic(propLT1, propLT2,propST1, propST2, propCH1, propCH2, propBT1, propBT2, *this, todo); +#else + PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); +#endif + } @@ -447,7 +464,7 @@ template template void PLEGMA_Correlator:: contractTetraquarkScatteringOpenIndex(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2, std::vector gammas, int s1, std::string Quarks){ - +#ifdef PLEGMA_UDSC_BARYONS if(gammas.size() == 0) PLEGMA_error("List of gammas provided is empty"); @@ -477,6 +494,10 @@ contractTetraquarkScatteringOpenIndex(PLEGMA_Propagator &prop1, initialize(); contract_tetraquark_scattering_open_index(*this,prop1,prop2,gammas, s1); +#else + PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); +#endif + } @@ -485,6 +506,7 @@ template template void PLEGMA_Correlator:: contractTetraquarkScatteringOpenIndexStochastic(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2, std::vector gammas, int randInd1, int randInd2, int s1, std::string Quarks){ +#ifdef PLEGMA_UDSC_BARYONS if(gammas.size() == 0) PLEGMA_error("List of gammas provided is empty"); @@ -511,6 +533,10 @@ contractTetraquarkScatteringOpenIndexStochastic(PLEGMA_Propagator &prop1 // PLEGMA_printf("contractTetraquarkScatteringOpenIndexStochastic is going to run:"); contract_tetraquark_scattering_open_index(*this,prop1,prop2,gammas, s1); +#else + PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); +#endif + } template From 8c18dbc08d491846ccbb32c63b8d605ae0c77d92 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 18 Nov 2022 09:22:46 +0100 Subject: [PATCH 005/168] replacing cudaMalloc with quda-s device_malloc --- lib/kernels/PLEGMA_WFlow.cuh | 5 +++-- lib/kernels/PLEGMA_baryons.cuh | 10 ++++++---- lib/kernels/PLEGMA_bcud_tetraquarks.cu | 14 ++++++++++---- lib/kernels/PLEGMA_heavy_light_tetraquarks.cu | 4 ++-- lib/kernels/PLEGMA_mesons.cuh | 3 ++- lib/kernels/PLEGMA_scattreductionsPiPi.cuh | 8 +++++--- lib/kernels/PLEGMA_threep_qgq.cu | 8 +++++--- 7 files changed, 33 insertions(+), 19 deletions(-) diff --git a/lib/kernels/PLEGMA_WFlow.cuh b/lib/kernels/PLEGMA_WFlow.cuh index 6a015f43..8f472531 100644 --- a/lib/kernels/PLEGMA_WFlow.cuh +++ b/lib/kernels/PLEGMA_WFlow.cuh @@ -1,7 +1,7 @@ #pragma once #include #include - +#include using namespace plegma; template @@ -192,7 +192,8 @@ static FloatG calcPlaqStaplesDef(gauge2 gaugep){ h_partial_plaq = (FloatG*) malloc(gridDim.x * sizeof(FloatG) ); if(h_partial_plaq == NULL) errorQuda("Error allocate memory for host partial plaq"); - cudaMalloc((void**)&d_partial_plaq, gridDim.x * sizeof(FloatG)); + d_partial_plaq=(FloatG*)device_malloc( gridDim.x * sizeof(FloatG)); + //cudaMalloc((void**)&d_partial_plaq, gridDim.x * sizeof(FloatG)); calcPlaqStaplesDef_kernel<<>>( gaugep, d_partial_plaq ); diff --git a/lib/kernels/PLEGMA_baryons.cuh b/lib/kernels/PLEGMA_baryons.cuh index 09f0a2b2..6426b788 100644 --- a/lib/kernels/PLEGMA_baryons.cuh +++ b/lib/kernels/PLEGMA_baryons.cuh @@ -1,7 +1,7 @@ #pragma once #include - +#include enum BARYONS_TYPE{NtoN, #ifdef PLEGMA_LIGHT_BARYONS NtoR, RtoN, RtoR, DELTA_1O2_1, DELTA_1O2_2, DELTA_1O2_3, @@ -189,7 +189,8 @@ static void contract_baryons_host( ProfileStruct &ps, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2*)device_malloc(sizeof(Float2) ); +// cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) { @@ -259,7 +260,8 @@ static void contract_baryons_wall_host( ProfileStruct &ps, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + //cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2*)device_malloc(sizeof(Float2) ); // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) { @@ -385,4 +387,4 @@ static void contract_baryons_wall(PLEGMA_Propagator& prop1, PLEGMA_Propa if(runFT) hostFree(result, (corr.getTotalSize()/N_BARYONS)*sizeof(Float2)); } - \ No newline at end of file + diff --git a/lib/kernels/PLEGMA_bcud_tetraquarks.cu b/lib/kernels/PLEGMA_bcud_tetraquarks.cu index 4c5493d6..cdf49e1a 100644 --- a/lib/kernels/PLEGMA_bcud_tetraquarks.cu +++ b/lib/kernels/PLEGMA_bcud_tetraquarks.cu @@ -89,16 +89,22 @@ void contract_tetraquarks_bcud_host(ProfileStruct &ps, Float2 *d_partial_block = NULL; size_t alloc_size = (runFT==true) ? (volume * (ps.tp.grid.x/time_step)):volume; hostMalloc(h_partial_block, alloc_size * sizeof(Float2)); - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + //cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2*)device_malloc(alloc_size * sizeof(Float2) ); short *idxs, *col_contr; Float2 *vals; int size = 0; for(int j=0; j)); +// cudaMalloc((void**)&idxs, 8*size*sizeof(short)); + idxs=(short*)device_malloc(8*size*sizeof(short)); +// cudaMalloc((void**)&col_contr, 8*size*sizeof(short)); + col_contr=(short*)device_malloc(8*size*sizeof(short)); +// cudaMalloc((void**)&vals, size*sizeof(Float2)); + vals=(Float2*)device_malloc( size*sizeof(Float2)); + + int shift = 0; for(int j=0; j)); //cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); - d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); + d_partial_block=(Float2 *)device_malloc(alloc_size*sizeof(Float2)); short *idxs, *col_contr; @@ -103,7 +103,7 @@ void contract_tetraquarks_host(ProfileStruct &ps, // cudaMalloc((void**)&col_contr, 8*size*sizeof(short)); col_contr=(short*)device_malloc(8*size*sizeof(short)); // cudaMalloc((void**)&vals, size*sizeof(Float2)); - val=(Float2*)device_malloc(8*size*sizeof(Float2)); + vals=(Float2*)device_malloc(8*size*sizeof(Float2)); int shift = 0; for(int j=0; j +#include #pragma once using namespace plegma; const int N_MESONS=10; @@ -510,4 +511,4 @@ static void contract_mesons_fourp_ultralocal_oneendtrick(PLEGMA_Propagator)); } } - \ No newline at end of file + diff --git a/lib/kernels/PLEGMA_scattreductionsPiPi.cuh b/lib/kernels/PLEGMA_scattreductionsPiPi.cuh index 82ff329a..0f4d5000 100644 --- a/lib/kernels/PLEGMA_scattreductionsPiPi.cuh +++ b/lib/kernels/PLEGMA_scattreductionsPiPi.cuh @@ -1,6 +1,6 @@ #include #include <../../include/PLEGMA_gammas.h> - +#include using namespace plegma; template @@ -88,7 +88,8 @@ static void PhixGxPhi_host( ProfileStruct &ps, PLEGMA_ScattCorrelator Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); +// cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + d_partial_block=(Float2*)device_malloc(alloc_size*sizeof(Float2)); // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); @@ -101,7 +102,8 @@ static void PhixGxPhi_host( ProfileStruct &ps, PLEGMA_ScattCorrelator KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS_SCATT)); + listGammas.array=(GAMMAS_SCATT*)device_malloc(gammas.size()*sizeof(GAMMAS_SCATT)); + //cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS_SCATT)); checkQudaError(); cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS_SCATT), cudaMemcpyHostToDevice); checkQudaError(); diff --git a/lib/kernels/PLEGMA_threep_qgq.cu b/lib/kernels/PLEGMA_threep_qgq.cu index bf776aa6..2915f0e3 100644 --- a/lib/kernels/PLEGMA_threep_qgq.cu +++ b/lib/kernels/PLEGMA_threep_qgq.cu @@ -7,7 +7,7 @@ #include #include #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -93,7 +93,8 @@ static void threep_qgq_host(ProfileStruct &ps, Float2 *result, KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + //cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); + listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); if(HGC_verbosity > 2) @@ -104,7 +105,8 @@ static void threep_qgq_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + // cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block=(Float2*)device_malloc( alloc_size * sizeof(Float2) ); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); From f03e892d60992b43cdee266ecb0a43becc080580 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 18 Nov 2022 21:52:17 +0100 Subject: [PATCH 006/168] momentum setting for the threept functions Npi =J = Npi --- include/utils/PLEGMA_params.h | 2 + plegma/nucleon_2pt_3pt_npi.cpp | 483 +++++++++++---------------------- utils/PLEGMA_Options.cpp | 9 +- 3 files changed, 164 insertions(+), 330 deletions(-) diff --git a/include/utils/PLEGMA_params.h b/include/utils/PLEGMA_params.h index 0d1efb4f..5239e9a4 100644 --- a/include/utils/PLEGMA_params.h +++ b/include/utils/PLEGMA_params.h @@ -30,6 +30,8 @@ define(std::string pathListVecs); define(std::vector listVecs); define(std::string pathListSourcePositions); define(std::string pathListMomenta); +define(std::string pathListMomenta_twopt); +define(std::string pathListMomenta_threept); define(std::vector sourcePositions, {}); define(int maxQsq, 64); define(FILE_FORMAT corr_file_format, HDF5_FORMAT); diff --git a/plegma/nucleon_2pt_3pt_npi.cpp b/plegma/nucleon_2pt_3pt_npi.cpp index b5c872d9..dc710f36 100644 --- a/plegma/nucleon_2pt_3pt_npi.cpp +++ b/plegma/nucleon_2pt_3pt_npi.cpp @@ -12,7 +12,7 @@ std::vector threads; using namespace plegma; using namespace quda; -static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename", +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename","momlisttwopt-filename","momlistthreept-filename", "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space", "tSinks","Projs", "threep-filename","confnumber"}; @@ -128,7 +128,7 @@ int main(int argc, char **argv) { contractGauge.copy(gauge); // apply boundary conditions since is needed for the covariant derivative applyBoundaryConditions(contractGauge,true); - } + } updateOptions(LIGHT); TIME(QUDA_solver solver(mu)); @@ -144,16 +144,17 @@ int main(int argc, char **argv) { //Reading the momentum lists - PLEGMA_printf("###Momentum list read from : %s", pathListMomenta.c_str()); - momList sourcemomentumList(3,pathListMomenta,{2,}); - PLEGMA_printf("N momenta in sourcemomentumList: %d",sourcemomentumList.size()); - //We have three types of momenta in the list here + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + momList sourcemomentumList_threept(4,pathListMomenta_threept,{1,2,3,}); + PLEGMA_printf("N momenta in sourcemomentumList: %d",sourcemomentumList_threept.size()); + //We have four types of momenta in the list here //The first three entries are the pi2 pion source momentum //The second three entries are the pf1 nucleon sink momentum - //The third three entries are the pc momentum at the insertion - //In addition the following momentum conversations are imposed + //The third three entries are the pf2 pion sink momentum (it is assumed that pf2 is the same as -pf1) + //The fourth three entries are the pc momentum at the insertion //pf1 + pf2 = 0, momentum at the sink is zero , the the pion momentum //at sink follows from the nucleon momentum + //In addition the following momentum conversations are imposed //pi1 + pi2 = pc so the momentum phase factor is calculated as pc-pi2 //We define the list of momenta such that the total momentum should be the [2] \ //column, the pc, and of coarse it is understand that this refers to the source only. @@ -161,7 +162,7 @@ int main(int argc, char **argv) { - momList sourcemomentumList_twopoint(3,pathListMomenta,{1,2,}); + momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); //For the twopoint functions we have also three momentum //first is pi2 //second is pf1 @@ -170,8 +171,10 @@ int main(int argc, char **argv) { //to get pi1 we have to subtract pi2 from the total momentum - if(sourcemomentumList.empty()) - PLEGMA_error("momentumList empty"); + if(sourcemomentumList_twopt.empty()) + PLEGMA_error("twopt momentumList empty"); + if(sourcemomentumList_threept.empty()) + PLEGMA_error("threept momentumList empty"); PLEGMA_Vector vectorSource_oet; vectorSource_oet.randInit(rand_seed1); @@ -183,15 +186,23 @@ int main(int argc, char **argv) { std::string sourcepositiontext= (std::string)"_" + ssource; free(ssource); - std::vector> mpi2 = sourcemomentumList.uniq_p(0); - momList list_mpi2(1,{mpi2,},{0,}); + std::vector> mpi2_twopt = sourcemomentumList_twopt.uniq_p(0); + momList list_mpi2_twopt(1,{mpi2_twopt,},{0,}); + + std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); + momList list_mpi2_threept(1,{mpi2_threept,},{0,}); - std::vector> mpf1 = sourcemomentumList.uniq_p(1); - momList list_mpf1(1,{mpf1,},{0,}); - PLEGMA_ScattCorrelator corrP0UP(sourcePositions[isource], list_mpi2); - PLEGMA_ScattCorrelator corrP0DN(sourcePositions[isource], list_mpi2); - PLEGMA_ScattCorrelator corrPPUP(sourcePositions[isource], list_mpi2); - PLEGMA_ScattCorrelator corrPPDN(sourcePositions[isource], list_mpi2); + std::vector> mpf1_threept = sourcemomentumList_threept.uniq_p(1); + momList list_mpf1_threept(1,{mpf1_threept,},{0,}); + + std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); + momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); + + + PLEGMA_ScattCorrelator corrP0UP(sourcePositions[isource], list_mpi2_twopt); + PLEGMA_ScattCorrelator corrP0DN(sourcePositions[isource], list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPUP(sourcePositions[isource], list_mpi2_twopt);//this is pi^{+}pi^{+} + PLEGMA_ScattCorrelator corrPPDN(sourcePositions[isource], list_mpi2_twopt);//this is pi^{-}pi^{-} corrP0UP.initialize_diagram(glist_source_meson, glist_sink_meson, "P0UP"); corrP0DN.initialize_diagram(glist_source_meson, glist_sink_meson, "P0DN"); @@ -213,7 +224,7 @@ int main(int argc, char **argv) { auto computeOetPropagator = [&](PLEGMA_Vector& vec_SS, PLEGMA_Vector& vec_SL, double run_mu, WHICHFLAVOR fl, int nSmear, std::vector sourceMom, bool finalize) { - // ensuring mu value + // ensuring mu value if(mu != run_mu) { updateOptions(fl); mu = run_mu; @@ -230,9 +241,13 @@ int main(int argc, char **argv) { vector1.absorb(vectorSource_oet,sourcePositions[isource][DIM_T]); + vector1.mulMomentumPhases(sourceMom,+1);//Here we use the convention momentum +pi at thye source + //Note that this is automatically satisfied for the threept + //when the momenta is applied at the right hand side, so + //not int the sequential case this refers to the meson 3pt function + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vector2.mulMomentumPhases(sourceMom,-1); vectorInOut.absorb(vector2,sourcePositions[isource][DIM_T]); } { @@ -321,8 +336,7 @@ int main(int argc, char **argv) { prop_SS.rotateToPhysicalBase_device(run_mu/abs(run_mu)); prop_SS.applyBoundaries_device(source[DIM_T]); } - }; - + }; char * src_string; asprintf(&src_string, "_sx%02dsy%02dsz%02dst%03d", source[0], source[1], source[2], source[3]); twop_filename = given_twop_filename + src_string + ".h5"; @@ -331,7 +345,6 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUP; PLEGMA_Propagator propDN; - PLEGMA_Vector oet_mom_zero_up_SS; PLEGMA_Vector oet_mom_zero_dn_SS; @@ -339,17 +352,17 @@ int main(int argc, char **argv) { std::vector*> oet_mom_fini_up_SS; std::vector*> oet_mom_fini_dn_SS; - int length_fini_mom=mpi2.size(); + int length_fini_mom=mpi2_twopt.size(); for(int i=0; i< length_fini_mom; ++i) { oet_mom_fini_up_SS.push_back(new PLEGMA_Vector(HOST)); oet_mom_fini_dn_SS.push_back(new PLEGMA_Vector(HOST)); } - PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1); + PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1_twopt); TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); - PLEGMA_ScattCorrelator corrN0(sourcePositions[isource], list_mpf1); + PLEGMA_ScattCorrelator corrN0(sourcePositions[isource], list_mpf1_twopt); TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); @@ -388,8 +401,8 @@ int main(int argc, char **argv) { //Computing T reductions+recombination { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); //PLEGMA_printf("Nucleon T2 reduction\n"); @@ -402,8 +415,8 @@ int main(int argc, char **argv) { //Computing T reductions+recombination { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); //PLEGMA_printf("Nucleon T2 reduction\n"); @@ -414,21 +427,21 @@ int main(int argc, char **argv) { } - + //Section M diagrams 2pt functions { PLEGMA_Vector vectorAuxF_SS; PLEGMA_Vector vectorAuxF_SL; - for(int i_pi2=0; i_pi2 corrM(sourcePositions[isource], filtered_sourcemomentumList_twopoint); + PLEGMA_ScattCorrelator corrM(sourcePositions[isource], filtered_sourcemomentumList_twopoint);//Proton piplus - PLEGMA_ScattCorrelator corrD1if12(sourcePositions[isource], filtered_sourcemomentumList_twopoint); - PLEGMA_ScattCorrelator corrD1if34(sourcePositions[isource], filtered_sourcemomentumList_twopoint); - PLEGMA_ScattCorrelator corrD1if56(sourcePositions[isource], filtered_sourcemomentumList_twopoint); + PLEGMA_ScattCorrelator corrD1if12(sourcePositions[isource], filtered_sourcemomentumList_twopoint);//Proton pizero up + PLEGMA_ScattCorrelator corrD1if34(sourcePositions[isource], filtered_sourcemomentumList_twopoint);//Proton pizero dn + PLEGMA_ScattCorrelator corrD1if56(sourcePositions[isource], filtered_sourcemomentumList_twopoint);//Neutron piplus corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); @@ -441,14 +454,14 @@ int main(int argc, char **argv) { TIME(computeOetPropagator(vectorAuxF_SS, vectorAuxF_SL, mu_ud, LIGHT, nsmearGauss, momentum_i2, false)); - TIME(corrM.M_diagrams( corrNP, oet_mom_zero_up_SS, vectorAuxF_SS )); + TIME(corrM.M_diagrams( corrNP, vectorAuxF_SS, oet_mom_zero_up_SS )); - TIME(corrD1if34.M_diagrams( corrNP, oet_mom_zero_dn_SS, vectorAuxF_SS )); + TIME(corrD1if34.M_diagrams( corrNP, vectorAuxF_SS, oet_mom_zero_dn_SS )); - TIME(corrD1if56.M_diagrams( corrN0, oet_mom_zero_up_SS, vectorAuxF_SS)); + TIME(corrD1if56.M_diagrams( corrN0, vectorAuxF_SS, oet_mom_zero_up_SS )); - TIME(corrPPUP.P_diagrams( oet_mom_zero_up_SS, vectorAuxF_SS, i_pi2, true)); - TIME(corrP0UP.P_diagrams( oet_mom_zero_dn_SS, vectorAuxF_SS, i_pi2, true)); + TIME(corrPPUP.P_diagrams( vectorAuxF_SS, oet_mom_zero_up_SS, i_pi2, true)); + TIME(corrP0UP.P_diagrams( vectorAuxF_SS, oet_mom_zero_dn_SS, i_pi2, true)); vectorAuxF_SS.unload(); oet_mom_fini_up_SS[i_pi2]->copy(vectorAuxF_SS,HOST); @@ -460,11 +473,11 @@ int main(int argc, char **argv) { TIME(computeOetPropagator(vectorAuxF_SS, vectorAuxF_SL, -mu_ud, LIGHT, nsmearGauss, momentum_i2, false)); - TIME(corrP0DN.P_diagrams( oet_mom_zero_up_SS, vectorAuxF_SS, i_pi2, true)); - TIME(corrPPDN.P_diagrams( oet_mom_zero_dn_SS, vectorAuxF_SS, i_pi2, true)); + TIME(corrP0DN.P_diagrams( vectorAuxF_SS, oet_mom_zero_up_SS, i_pi2, true)); + TIME(corrPPDN.P_diagrams( vectorAuxF_SS, oet_mom_zero_dn_SS, i_pi2, true)); - TIME(corrD1if12.M_diagrams( corrNP, oet_mom_zero_up_SS, vectorAuxF_SS )); + TIME(corrD1if12.M_diagrams( corrNP, vectorAuxF_SS, oet_mom_zero_up_SS)); vectorAuxF_SS.unload(); oet_mom_fini_dn_SS[i_pi2]->copy(vectorAuxF_SS,HOST); @@ -476,20 +489,20 @@ int main(int argc, char **argv) { outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M"; - TIME(produceOutput(corrM, outfilename,"4pt",1,NULL)); - TIME(produceOutput(corrD1if12, outfilename,"4pt",1,NULL)); - TIME(produceOutput(corrD1if34, outfilename,"4pt",1,NULL)); - TIME(produceOutput(corrD1if56, outfilename,"4pt",1,NULL)); + TIME(produceOutput(corrM, outfilename,"4pt",1,NULL)); //Proton pi plus + TIME(produceOutput(corrD1if12, outfilename,"4pt",1,NULL));//Proton pi zero up + TIME(produceOutput(corrD1if34, outfilename,"4pt",1,NULL));//Proton pi zero dn + TIME(produceOutput(corrD1if56, outfilename,"4pt",1,NULL));//Neutron pi plus - } - } + } //end of loop mpi2 + }//section M diagram 2pt functions #ifdef PLEGMA_NUCLEON_3PF_FIX_SINK std::vector filter={0,0,0}; - momList filtered_sourcemomentumList_pi20 = sourcemomentumList.extract(filter, 0); + momList filtered_sourcemomentumList_pi20 = sourcemomentumList_threept.extract(filter, 0); for(size_t its = 0; its < tSinks.size(); its++){ int tsinkMtsource = tSinks[its]; @@ -518,7 +531,7 @@ int main(int argc, char **argv) { WHICHPARTICLE nucleon = get_particle(prOrNt); std::vector gammas = {ONE,G1,G2,G3,G4,G5,G5G1,G5G2,G5G3,G5G4};//,S12,S13,S23,S41,S42,S43}; - #if 1 + for (int alpha=0;alpha> pf1_filt = sourcemomentumList.uniq_p(1); - for(int i_pf1=0; i_pf1 vectorAuxF; vectorAuxF.copy(vectorInOut); seqProp.absorb(vectorAuxF, nu, c2); - }//color seq + }//c2 color seq - }//alpha seq + }//nu alpha seq seqProp.apply_gamma(G5); seqProp.conjugate(); - std::vector> mpc = filtered_sinkList.uniq_p(2); + std::vector> mpc = filtered_sinkList.uniq_p(3); momList list_mpc(1,{mpc,},{0,}); PLEGMA_ScattCorrelator corr( source, list_mpc, tsinkMtsource+1); @@ -648,7 +663,7 @@ int main(int argc, char **argv) { } //loop over beta }//loop over alpha - #endif + auto computeOetInvThroughSink = [&](PLEGMA_Vector& vec_SC, double run_mu, PLEGMA_Vector3D& prop, int nSmear, WHICHFLAVOR fl, std::vector momentum_f1, int i_gamma_i2, int i_gamma_f2 ) { // ensuring mu positive if(mu != run_mu) { @@ -663,6 +678,10 @@ int main(int argc, char **argv) { PLEGMA_Vector3D vectorAuxF; vectorAuxF.copy(prop); vectorAuxF.mulMomentumPhases(momentum_f1,-1); // put momentum at the sink + //Here the momentum phase should be - in the end + //We have initially -pf1 so +pf2 + //We have a conjugation in the sequential source + //So in the end we have a minus result vectorAuxD1.copy(vectorAuxF); TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1,smearedGauge3D_sink, nSmear, alphaGauss)); vectorInOut.absorb(vectorAuxD2, global_fixSinkTime); @@ -702,11 +721,7 @@ int main(int argc, char **argv) { auto computeThreep_contract = [&](PLEGMA_ScattCorrelator corrScatt, PLEGMA_Vector& seqProp, PLEGMA_Vector &propF, int i_gamma_i2, int i_gamma_f2, int i_pf1){ - //Note that the conjugation will - //be done automatically in the contraction - //routine basically the ones used in the pion 2pt - //seqProp.conjugate(); - std::vector> mpc = sourcemomentumList.uniq_p(2); + std::vector> mpc = sourcemomentumList_threept.uniq_p(3); momList list_mpc(1,{mpc,},{0,}); seqProp.conjugate(); @@ -721,7 +736,7 @@ int main(int argc, char **argv) { auto computeThreep_meson = [&](double run_mu, PLEGMA_Vector3D& prop, int nSmear, WHICHFLAVOR fl, std::string flstring, std::string name) { std::vector*> inversionThroughSink; - std::vector> pf1_filt= sourcemomentumList.uniq_p(1); + std::vector> pf1_filt= sourcemomentumList_threept.uniq_p(1); int length_fini_mom=pf1_filt.size(); int momgammaif=length_fini_mom*glist_source_meson.size()*glist_sink_meson.size(); @@ -745,9 +760,9 @@ int main(int argc, char **argv) { } - for(int i_pi2=0; i_pi2 corrMP(sourcePositions[isource], filtered_sourcemomentumList, tsinkMtsource+1); PLEGMA_ScattCorrelator corrMN(sourcePositions[isource], filtered_sourcemomentumList, tsinkMtsource+1); @@ -832,10 +847,9 @@ int main(int argc, char **argv) { }; -#if 1 - for(int i_pi2=0; i_pi2 corrM1(sourcePositions[isource], filtered_sourcemomentumList, tsinkMtsource+1); PLEGMA_ScattCorrelator corrM2(sourcePositions[isource], filtered_sourcemomentumList, tsinkMtsource+1); @@ -876,12 +890,12 @@ int main(int argc, char **argv) { oet_fini_dn.copy(*oet_mom_fini_dn_SS[i_pi2], HOST); oet_fini_dn.load(); - TIME(corrM1.M_diagrams( corrUp, oet_mom_zero_dn_SS, oet_fini_up)); - TIME(corrM2.M_diagrams( corrDn, oet_mom_zero_dn_SS, oet_fini_up)); - TIME(corrM3.M_diagrams( corrUp, oet_mom_zero_up_SS, oet_fini_dn)); - TIME(corrM4.M_diagrams( corrDn, oet_mom_zero_up_SS, oet_fini_dn)); - TIME(corrM5.M_diagrams( corrUp, oet_mom_zero_up_SS, oet_fini_up)); - TIME(corrM6.M_diagrams( corrDn, oet_mom_zero_up_SS, oet_fini_up)); + TIME(corrM1.M_diagrams( corrUp, oet_fini_up, oet_mom_zero_dn_SS)); + TIME(corrM2.M_diagrams( corrDn, oet_fini_up, oet_mom_zero_dn_SS)); + TIME(corrM3.M_diagrams( corrUp, oet_fini_dn, oet_mom_zero_up_SS)); + TIME(corrM4.M_diagrams( corrDn, oet_fini_dn, oet_mom_zero_up_SS)); + TIME(corrM5.M_diagrams( corrUp, oet_fini_up, oet_mom_zero_up_SS)); + TIME(corrM6.M_diagrams( corrDn, oet_fini_up, oet_mom_zero_up_SS)); @@ -917,7 +931,6 @@ int main(int argc, char **argv) { TIME(corrM6.writeHDF5(outfilename)); - } else{ @@ -942,266 +955,78 @@ int main(int argc, char **argv) { } - }//momentum pi2 -#endif + }//momentum pi2 - //Note that we compute NJN for the set - //of input momenta pf1 and perform the - //fourier transform for the set of momenta - //pc, however pi is not neccessarily pf1-pc, so - //we do not apply here the momentum phase at - //the source, this hast to be done in postproduction - //TIME(corrUp.apply_phase()); + //Note that we compute NJN for the set + //of input momenta pf1 and perform the + //fourier transform for the set of momenta + //pc, however pi is not neccessarily pf1-pc, so + //we do not apply here the momentum phase at + //the source, this hast to be done in postproduction + //TIME(corrUp.apply_phase()); - //TIME(corrDn.apply_phase()); + //TIME(corrDn.apply_phase()); - if (nucleon==PROTON){ + if (nucleon==PROTON){ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"protonup"; - } - else{ + } + else{ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"neutronup"; - } - TIME(corrUp.writeHDF5(outfilename)); + } + TIME(corrUp.writeHDF5(outfilename)); - if (nucleon==PROTON){ - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"protondn"; - } - else{ + if (nucleon==PROTON){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"protondn"; + } + else{ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"neutrondn"; - } - TIME(corrDn.writeHDF5(outfilename)); - - { - PLEGMA_Vector3D zero_momentum_light; - zero_momentum_light.absorb(oet_mom_zero_up_SS, global_fixSinkTime); - computeThreep_meson(-mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"up", "piplus"); + } + TIME(corrDn.writeHDF5(outfilename)); - zero_momentum_light.absorb(oet_mom_zero_dn_SS, global_fixSinkTime); - computeThreep_meson(+mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"dn", "piplus"); + { + PLEGMA_Vector3D zero_momentum_light; + zero_momentum_light.absorb(oet_mom_zero_up_SS, global_fixSinkTime); + computeThreep_meson(-mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"up", "piplus"); - zero_momentum_light.absorb(oet_mom_zero_dn_SS, global_fixSinkTime); - computeThreep_meson(-mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"up", "pizero"); - - zero_momentum_light.absorb(oet_mom_zero_up_SS, global_fixSinkTime); - computeThreep_meson(+mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"dn", "pizero"); - } + zero_momentum_light.absorb(oet_mom_zero_dn_SS, global_fixSinkTime); + computeThreep_meson(+mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"dn", "piplus"); + zero_momentum_light.absorb(oet_mom_zero_dn_SS, global_fixSinkTime); + computeThreep_meson(-mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"up", "pizero"); + zero_momentum_light.absorb(oet_mom_zero_up_SS, global_fixSinkTime); + computeThreep_meson(+mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"dn", "pizero"); + } #endif - }//tsink - - - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P"; - TIME(corrPPUP.apply_sign("P")); - TIME(corrPPUP.writeHDF5( outfilename )); - TIME(corrPPDN.apply_sign("P")); - TIME(corrPPDN.writeHDF5( outfilename )); - TIME(corrP0UP.apply_sign("P")); - TIME(corrP0UP.writeHDF5( outfilename )); - TIME(corrP0DN.apply_sign("P")); - TIME(corrP0DN.writeHDF5( outfilename )); - - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; - TIME( corrN0.apply_phase()); - TIME( corrN0.apply_sign("N")); - TIME( corrN0.applyBoundaryConditions( true )); - TIME( corrN0.writeHDF5(outfilename)); - - TIME( corrNP.apply_phase() ); - TIME( corrNP.apply_sign("N") ); - TIME( corrNP.applyBoundaryConditions( true ) ); - TIME( corrNP.writeHDF5(outfilename) ); - - - - - + }//tsink + + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P"; + TIME(corrPPUP.apply_sign("P")); + TIME(corrPPUP.writeHDF5( outfilename )); + TIME(corrPPDN.apply_sign("P")); + TIME(corrPPDN.writeHDF5( outfilename )); + TIME(corrP0UP.apply_sign("P")); + TIME(corrP0UP.writeHDF5( outfilename )); + TIME(corrP0DN.apply_sign("P")); + TIME(corrP0DN.writeHDF5( outfilename )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; + TIME( corrN0.apply_phase()); + TIME( corrN0.apply_sign("N")); + TIME( corrN0.applyBoundaryConditions( true )); + TIME( corrN0.writeHDF5(outfilename)); + + TIME( corrNP.apply_phase() ); + TIME( corrNP.apply_sign("N") ); + TIME( corrNP.applyBoundaryConditions( true ) ); + TIME( corrNP.writeHDF5(outfilename) ); - // If twop_filename exists we skip the rest - if(access( twop_filename.c_str(), F_OK ) != -1) { - PLEGMA_printf("File %s already exists. Skipping...", twop_filename.c_str()); - continue; - } - - // propUP.rotateToPhysicalBase_device(+1); -// propDN.rotateToPhysicalBase_device(-1); - propUP.applyBoundaries_device(source[3]); - propDN.applyBoundaries_device(source[3]); - - { - PLEGMA_Correlator corr(corr_space, source, maxQsq); - TIME(corr.contractMesonsNew(propUP, propDN)); - char *dset; - asprintf(&dset, "twop_mesons_new_u[%+1.1e]d[%+1.1e]", mu_ud, -1*mu_ud); - corr.setDatasets((std::vector) {dset}); - free(dset); - TIME(corr.writeFile(twop_filename, corr_file_format)); - - TIME(corr.contractMesonsNew(propUP, propUP)); - asprintf(&dset, "twop_mesons_new_u[%+1.1e]u[%+1.1e]", mu_ud, mu_ud); - corr.setDatasets((std::vector) {dset}); - free(dset); - TIME(corr.writeFile(twop_filename, corr_file_format)); - - TIME(corr.contractMesonsNew(propDN, propDN)); - asprintf(&dset, "twop_mesons_new_d[%+1.1e]d[%+1.1e]", -mu_ud, -mu_ud); - corr.setDatasets((std::vector) {dset}); - free(dset); - TIME(corr.writeFile(twop_filename, corr_file_format)); - - - TIME(corr.contractBaryons(propUP, propDN)); - TIME(corr.writeFile(twop_filename, corr_file_format)); - } - - // Storing only the smaller and then computing on the fly the other - int nSmaller = std::min(mu_s.size(),mu_c.size()); - char cSmaller = (nSmaller==(int)mu_s.size()) ? 's' : 'c'; - - PLEGMA_Propagator none(NONE); - PLEGMA_Propagator propS[nSmaller]; - for(int ismall=0; ismall < nSmaller; ismall++) { - for(int i=0;i 0) { - PLEGMA_Propagator propL; - for(int ilarge=0; ilarge < nLarger; ilarge++) { - double run_mu = (cSmaller!='s') ? mu_s[ilarge] : mu_c[ilarge]; - int nsmear = (cSmaller!='s') ? nsmearGauss_s : nsmearGauss_c; - TIME(computePropagator(propL, none, run_mu, (cSmaller!='s') ? STRANGE : CHARM, nsmear, true)); - - if(nSmaller>0) { - for(int ismall=0; ismall < nSmaller; ismall++) { - PLEGMA_Propagator &propST = (cSmaller=='s') ? propS[ismall] : propL; - PLEGMA_Propagator &propCH = (cSmaller=='c') ? propS[ismall] : propL; - PLEGMA_Correlator corr(corr_space, source, maxQsq); - bool only_st = (ismall>0 && cSmaller=='s') || (ilarge>0 && cSmaller!='s'); - bool only_ch = (ismall>0 && cSmaller=='c') || (ilarge>0 && cSmaller!='c'); -#ifdef PLEGMA_UDSC_BARYONS - TIME(corr.contractBaryonsUDSC(propUP, propDN, propST, propCH, only_st, only_ch)); - char * group; - - asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]s[%+1.1e]c[%+1.1e]%s%s", mu_ud, -1*mu_ud, mu_s[cSmaller=='s'? ismall:ilarge], mu_c[cSmaller=='c'? ismall:ilarge], - only_st ? "_only-s" : "", only_ch ? "_only-c" : ""); - corr.setGroups(group); - free(group); - THREAD(corr.writeFile(twop_filename, corr_file_format)); -#endif - TIME(corr.contractMesonsNew(propST, propCH)); - char *dset; - asprintf(&dset, "twop_mesons_new_s[%+1.1e]c[%+1.1e]", mu_s[cSmaller=='s'? ismall:ilarge], mu_c[cSmaller=='c'? ismall:ilarge]); - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - - TIME(corr.contractMesonsNew(propST, propST)); - asprintf(&dset, "twop_mesons_new_s[%+1.1e]s[%+1.1e]", mu_s[cSmaller=='s'? ismall:ilarge], mu_s[cSmaller=='s'? ismall:ilarge]); - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - - TIME(corr.contractMesonsNew(propCH, propCH)); - asprintf(&dset, "twop_mesons_new_c[%+1.1e]c[%+1.1e]", mu_c[cSmaller=='c'? ismall:ilarge], mu_c[cSmaller=='c'? ismall:ilarge]); - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - - if(!only_ch) { - TIME(corr.contractMesonsNew(propST, propUP)); - asprintf(&dset, "twop_mesons_new_s[%+1.1e]u[%+1.1e]", mu_s[cSmaller=='s'? ismall:ilarge], mu_ud); - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - - TIME(corr.contractMesonsNew(propST, propDN)); - asprintf(&dset, "twop_mesons_new_s[%+1.1e]d[%+1.1e]", mu_s[cSmaller=='s'? ismall:ilarge], -mu_ud); - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - } - - if(!only_st) { - TIME(corr.contractMesonsNew(propCH, propUP)); - asprintf(&dset, "twop_mesons_new_c[%+1.1e]u[%+1.1e]", mu_c[cSmaller=='c'? ismall:ilarge], mu_ud); - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - - TIME(corr.contractMesonsNew(propCH, propDN)); - asprintf(&dset, "twop_mesons_new_c[%+1.1e]d[%+1.1e]", mu_c[cSmaller=='c'? ismall:ilarge], -mu_ud); - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - } - } - } else { - PLEGMA_Propagator none(NONE); - PLEGMA_Propagator &propST = (cSmaller=='s') ? none : propL; - PLEGMA_Propagator &propCH = (cSmaller=='c') ? none : propL; - PLEGMA_Correlator corr(corr_space, source, maxQsq); - bool only_st = (ilarge>0 && cSmaller!='s'); - bool only_ch = (ilarge>0 && cSmaller!='c'); -#ifdef PLEGMA_UDSC_BARYONS - TIME(corr.contractBaryonsUDSC(propUP, propDN, propST, propCH, only_st, only_ch)); - char * group; - - if(cSmaller=='s') { - asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]c[%+1.1e]%s", mu_ud, -1*mu_ud, mu_c[ilarge], only_ch ? "_only-c" : ""); - } else { - asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]s[%+1.1e]%s", mu_ud, -1*mu_ud, mu_s[ilarge], only_st ? "_only-s" : ""); - } - corr.setGroups(group); - free(group); - THREAD(corr.writeFile(twop_filename, corr_file_format)); -#endif - if(!only_ch && !only_st) { - TIME(corr.contractMesonsNew((cSmaller=='s') ? propCH : propST, propUP)); - char *dset; - if(cSmaller=='s') { - asprintf(&dset, "twop_mesons_new_c[%+1.1e]u[%+1.1e]", mu_c[ilarge], mu_ud); - } else { - asprintf(&dset, "twop_mesons_new_s[%+1.1e]u[%+1.1e]", mu_s[ilarge], mu_ud); - } - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - - TIME(corr.contractMesonsNew((cSmaller=='s') ? propCH : propST, propDN)); - if(cSmaller=='s') { - asprintf(&dset, "twop_mesons_new_c[%+1.1e]d[%+1.1e]", mu_c[ilarge], -mu_ud); - } else { - asprintf(&dset, "twop_mesons_new_s[%+1.1e]d[%+1.1e]", mu_s[ilarge], -mu_ud); - } - corr.setDatasets((std::vector) {dset}); - free(dset); - THREAD(corr.writeFile(twop_filename, corr_file_format)); - } - } - } - } else { -#ifdef PLEGMA_UDSC_BARYONS - PLEGMA_Propagator none(NONE); - PLEGMA_Correlator corr(corr_space, source, maxQsq); - TIME(corr.contractBaryonsUDSC(propUP, propDN, none, none)); - char * group; - - asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]", mu_ud, -1*mu_ud); - corr.setGroups(group); - free(group); - THREAD(corr.writeFile(twop_filename, corr_file_format)); -#endif - } - } - while(not threads.empty()) {threads.back().join(); threads.pop_back();} - } - + } //keep track of + }//source positions + }//loop in finalize finalize(); return 0; } diff --git a/utils/PLEGMA_Options.cpp b/utils/PLEGMA_Options.cpp index 11144927..716f5fd4 100644 --- a/utils/PLEGMA_Options.cpp +++ b/utils/PLEGMA_Options.cpp @@ -13,7 +13,7 @@ const std::vector listAvailOptPLEGMA = {"verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", - "nsmear-stout", "alpha-stout", "nsrc", "src-filename", "maxQsq", "momlist-filename", + "nsmear-stout", "alpha-stout", "nsrc", "src-filename", "maxQsq", "momlist-filename","momlisttwopt-filename","momlistthreept-filename", "twop-filename", "threep-filename", "corr-file-format", "corr-space", "tSinks","Projs", "Eig-NeV" #if defined(HAVE_ARPACK) || defined(QUDAEIG) ,"Eig-NkV", "Eig-logFile" @@ -67,6 +67,13 @@ void plegmaOptions(Options &opt, std::vector list, bool update_para if (isInList(list, "momlist-filename")){ opt.set("momlist-filename", "Filename of list of momenta", verbosity, pathListMomenta); } + if (isInList(list, "momlisttwopt-filename")){ + opt.set("momlisttwopt-filename", "Filename of list of momenta", verbosity, pathListMomenta_twopt); + } + if (isInList(list, "momlistthreept-filename")){ + opt.set("momlistthreept-filename", "Filename of list of momenta", verbosity, pathListMomenta_threept); + } + // List of configurations or vectors----------------------------------------------------------------------------- if(isInList(list,"load-gauge-list-filename")){ isFound = opt.set("load-gauge-list-filename", "Filename of the list of the configuration to analyze", verbosity, pathListGaugeConfs); From 13f6016742e433a07dcd88bed9a692a14db5c5ca Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 21 Nov 2022 11:23:25 +0100 Subject: [PATCH 007/168] continue hipify --- lib/PLEGMA_FT.cu | 2 +- lib/PLEGMA_Field.cu | 55 ++++++++++++----------- lib/PLEGMA_Gauge.cu | 14 +++--- lib/PLEGMA_Propagator.cu | 24 +++++----- lib/PLEGMA_ScattCorrelator.cu | 11 ++++- lib/PLEGMA_Su3field.cu | 9 ++-- lib/PLEGMA_Vector.cu | 41 ++++++++--------- lib/kernels/PLEGMA_TMDWF.cuh | 5 ++- lib/kernels/PLEGMA_scattreductions.cuh | 9 ++-- lib/kernels/PLEGMA_threep_threeD_part1.cu | 4 +- lib/kernels/PLEGMA_threep_threeD_part2.cu | 7 +-- lib/kernels/PLEGMA_threep_twoD.cu | 9 ++-- 12 files changed, 103 insertions(+), 87 deletions(-) diff --git a/lib/PLEGMA_FT.cu b/lib/PLEGMA_FT.cu index 31d64a57..13e743a5 100644 --- a/lib/PLEGMA_FT.cu +++ b/lib/PLEGMA_FT.cu @@ -118,7 +118,7 @@ std::shared_ptr PLEGMA_FT::getTexMomList() { cudaTextureObject_t tex; cudaCreateTextureObject(&tex, &resDesc, &texDesc, NULL); - return std::shared_ptr(new tex_mom_list(Nmoms(), tex, devPtr), [](tex_mom_list* moms) { cudaDestroyTextureObject(moms->tex); cudaFree(moms->devPtr);}); + return std::shared_ptr(new tex_mom_list(Nmoms(), tex, devPtr), [](tex_mom_list* moms) { cudaDestroyTextureObject(moms->tex); device_free(moms->devPtr);}); } template diff --git a/lib/PLEGMA_Field.cu b/lib/PLEGMA_Field.cu index 2e55fcc9..c83036f5 100644 --- a/lib/PLEGMA_Field.cu +++ b/lib/PLEGMA_Field.cu @@ -14,6 +14,7 @@ #include #include #include +#include using namespace plegma; #define DEVICE_MEMORY_REPORT @@ -206,14 +207,14 @@ void PLEGMA_Field::unpack(Float *out){ template void PLEGMA_Field::load(){ if(allocation != BOTH) PLEGMA_error("Load from Host to Device needs BOTH allocation"); - cudaMemcpy(d_elem, h_elem, Bytes_total(), cudaMemcpyHostToDevice ); + qudaMemcpy(d_elem, h_elem, Bytes_total(), qudaMemcpyHostToDevice ); if(checkErr) checkQudaError(); } template void PLEGMA_Field::unload() const{ if(allocation != BOTH) PLEGMA_error("Unload from Device to Host needs BOTH allocation"); - cudaMemcpy(h_elem, d_elem, Bytes_total(), cudaMemcpyDeviceToHost); + qudaMemcpy(h_elem, d_elem, Bytes_total(), qudaMemcpyDeviceToHost); if(checkErr) checkQudaError(); } @@ -277,7 +278,7 @@ void PLEGMA_Field::destroy_host(){ template void PLEGMA_Field::destroy_device(){ - cudaFree(d_elem); + device_free(d_elem); if(checkErr) checkQudaError(); d_elem = NULL; #ifdef DEVICE_MEMORY_REPORT @@ -322,7 +323,7 @@ void PLEGMA_Field::zero_host(){ template void PLEGMA_Field::zero_device(){ - if(isAllocDevice)cudaMemset(d_elem,0,Bytes_total_plus_ghost()); + if(isAllocDevice)qudaMemset(d_elem,0,Bytes_total_plus_ghost()); } template @@ -433,7 +434,7 @@ void PLEGMA_Field::communicateSideGhost(short dir, ORIENTATION sign, ACTI int disp; size_t nbytes = HGC_surface3D[i]/scaleT*field_length*2*sizeof(Float); - cudaMemcpy(pointer_send, pointer_device, nbytes, cudaMemcpyDeviceToHost); + qudaMemcpy(pointer_send, pointer_device, nbytes, qudaMemcpyDeviceToHost); if(checkErr) checkQudaError(); disp = (s==DIR_PLUS) ? +1 : -1; @@ -454,7 +455,7 @@ void PLEGMA_Field::communicateSideGhost(short dir, ORIENTATION sign, ACTI if(isAll && sign==DIR_BOTH) { Float *host = h_ext_ghost_r; Float *device = d_elem+total_length*field_length*2; - cudaMemcpy(device, host, Bytes_ghost(),cudaMemcpyHostToDevice); + qudaMemcpy(device, host, Bytes_ghost(),qudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } else { for(short i=0; i::communicateSideGhost(short dir, ORIENTATION sign, ACTI if(sign == s || sign==DIR_BOTH){ Float *host = h_ext_ghost_r + HGC_sideGhost[dir][s]/scaleT*field_length*2; Float *device = d_elem + (HGC_sideGhost[dir][s]/scaleT+total_length)*field_length*2; - cudaMemcpy(device, host, HGC_surface3D[dir]/scaleT*field_length*2*sizeof(Float), - cudaMemcpyHostToDevice); + qudaMemcpy(device, host, HGC_surface3D[dir]/scaleT*field_length*2*sizeof(Float), + qudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } } @@ -505,7 +506,7 @@ void PLEGMA_Field::communicateCornerGhost(short dir, ORIENTATION sign, AC int disp[N_DIMS] = {0}; size_t nbytes = HGC_surface2D[OFF2(i,j)]/scaleT*field_length*2*sizeof(Float); - cudaMemcpy(pointer_send, pointer_device, nbytes, cudaMemcpyDeviceToHost); + qudaMemcpy(pointer_send, pointer_device, nbytes, qudaMemcpyDeviceToHost); if(checkErr) checkQudaError(); // communicating @@ -530,7 +531,7 @@ void PLEGMA_Field::communicateCornerGhost(short dir, ORIENTATION sign, AC if(isAll && sign==DIR_BOTH) { Float *hostCorner = h_ext_ghost_corner_r; Float *device = d_elem+(total_length+ghost_length)*field_length*2; - cudaMemcpy(device,hostCorner,Bytes_ghostCorner(),cudaMemcpyHostToDevice); + qudaMemcpy(device,hostCorner,Bytes_ghostCorner(),qudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } else { for(short i=0; i::communicateCornerGhost(short dir, ORIENTATION sign, AC if(sign == s1 || sign == s2 || sign==DIR_BOTH) { Float *hostCorner = h_ext_ghost_corner_r + HGC_cornerGhost[OFF2SIGN(i,j,s1,s2)]/scaleT*field_length*2; Float *device = d_elem+(HGC_cornerGhost[OFF2SIGN(i,j,s1,s2)]/scaleT+total_length+ghost_length)*field_length*2; - cudaMemcpy(device, hostCorner, HGC_surface2D[OFF2(i,j)]/scaleT*field_length*2*sizeof(Float), - cudaMemcpyHostToDevice); + qudaMemcpy(device, hostCorner, HGC_surface2D[OFF2(i,j)]/scaleT*field_length*2*sizeof(Float), + qudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } } @@ -583,7 +584,7 @@ void PLEGMA_Field::communicateVertexGhost(short dir, ORIENTATION sign, AC int disp[N_DIMS] = {0}; size_t nbytes = HGC_surface1D[OFF3(i,j,k)]/scaleT*field_length*2*sizeof(Float); - cudaMemcpy(pointer_send, pointer_device, nbytes, cudaMemcpyDeviceToHost); + qudaMemcpy(pointer_send, pointer_device, nbytes, qudaMemcpyDeviceToHost); if(checkErr) checkQudaError(); // communicating @@ -610,7 +611,7 @@ void PLEGMA_Field::communicateVertexGhost(short dir, ORIENTATION sign, AC if(isAll && sign==DIR_BOTH) { Float *hostVertex = h_ext_ghost_vertex_r; Float *device = d_elem+(total_length+ghost_length)*field_length*2; - cudaMemcpy(device,hostVertex,Bytes_ghostVertex(),cudaMemcpyHostToDevice); + qudaMemcpy(device,hostVertex,Bytes_ghostVertex(),qudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } else { for(short i=0; i::communicateVertexGhost(short dir, ORIENTATION sign, AC if(sign == s1 || sign == s2 || sign == s3 || sign==DIR_BOTH) { Float *hostVertex = h_ext_ghost_vertex_r + HGC_vertexGhost[OFF3SIGN(i,j,k,s1,s2,s3)]/scaleT*field_length*2; Float *device = d_elem+(HGC_vertexGhost[OFF3SIGN(i,j,k,s1,s2,s3)]/scaleT+total_length+ghost_length+ghost_corner_length)*field_length*2; - cudaMemcpy(device, hostVertex, HGC_surface1D[OFF3(i,j,k)]/scaleT*field_length*2*sizeof(Float), - cudaMemcpyHostToDevice); + qudaMemcpy(device, hostVertex, HGC_surface1D[OFF3(i,j,k)]/scaleT*field_length*2*sizeof(Float), + qudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } } @@ -746,13 +747,13 @@ void PLEGMA_Field::mulMomentumPhases(std::vector mom, int sign) Float2 *x; x=(Float2 *)device_malloc(V*2*sizeof(Float)); //cudaMalloc((void**)&x, V*2*sizeof(Float)); - cudaMemset((void*) x,0,V*2*sizeof(Float)); + qudaMemset((void*) x,0,V*2*sizeof(Float)); if(checkErr) checkQudaError(); std::vector momF(mom.begin(), mom.end()); createMomField(x, momF, D3D4, sign); for(int dof = 0; dof < field_length; dof++) plegma::elemWiseMul(V,(Float*) x, d_elem + dof*total_length*2); - cudaFree(x); + device_free(x); } template @@ -802,8 +803,8 @@ static void cudaCopyOrCast(PLEGMA_Field &fieldOut, PLEGMA_Field(fieldOut), toField2(fieldIn)); else - cudaMemcpy(fieldOut.D_elem(), fieldIn.D_elem(), fieldIn.Bytes_total(), - cudaMemcpyDeviceToDevice); + qudaMemcpy(fieldOut.D_elem(), fieldIn.D_elem(), fieldIn.Bytes_total(), + qudaMemcpyDeviceToDevice); checkQudaError(); } @@ -873,7 +874,7 @@ void PLEGMA_Field::absorb(const PLEGMA_Field3D &field, int global_ for(int i = 0; i < this->Field_length(); i++) { pointer_src = (field.D_elem() + i*V3); pointer_dst = (this->D_elem() + i*V4 + my_it*V3); - cudaMemcpy(pointer_dst, pointer_src, V3 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); } checkQudaError(); } @@ -1020,11 +1021,11 @@ void PLEGMA_Field::absorbTimeslice(PLEGMA_Field &srcfield, int glo for(int i = 0 ; i < this->field_length; i++){ if( forcetozero ) - cudaMemset( this->d_elem + i*V4*2, 0, V4*2*sizeof(Float)); + qudaMemset( this->d_elem + i*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + i*V4*2 + my_it*V3*2); pointer_src = (srcfield.D_elem() + i*V4*2 + my_it*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -1077,18 +1078,18 @@ void PLEGMA_Field3D::absorb(const PLEGMA_Field &field, int global_ pointer_dst = (this->D_elem() + i*V3); if(this->activeTimeSlice) { pointer_src = (field.D_elem() + i*V4 + my_it*V3); - cudaMemcpy(pointer_dst, pointer_src, V3 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); } if (broadcast == true){ int time_rank=global_it/HGC_localL[3]; Float *temp=(Float *)malloc(sizeof(Float)*V3); - cudaMemcpy(temp, pointer_dst, V3* sizeof(Float), cudaMemcpyDeviceToHost); + qudaMemcpy(temp, pointer_dst, V3* sizeof(Float), qudaMemcpyDeviceToHost); MPI_Bcast(temp, V3 , MPI_Type(), time_rank, HGC_timeComm); - cudaMemcpy(pointer_dst, temp, V3* sizeof(Float), cudaMemcpyHostToDevice); + qudaMemcpy(pointer_dst, temp, V3* sizeof(Float), qudaMemcpyHostToDevice); free(temp); } if (broadcast == false && !(this->activeTimeSlice)){ - cudaMemset(pointer_dst, 0, V3 * sizeof(Float)); + qudaMemset(pointer_dst, 0, V3 * sizeof(Float)); } } checkQudaError(); diff --git a/lib/PLEGMA_Gauge.cu b/lib/PLEGMA_Gauge.cu index e79ca310..46fb2d4e 100644 --- a/lib/PLEGMA_Gauge.cu +++ b/lib/PLEGMA_Gauge.cu @@ -8,7 +8,7 @@ #include #include #include - +#include using namespace plegma; @@ -106,8 +106,8 @@ Float PLEGMA_Gauge::calculatePlaqCorners(){ template void PLEGMA_Gauge::absorbDir_device(PLEGMA_Su3field &su,int dir){ - cudaMemcpy(this->d_elem + dir*(su.Field_length())*(su.Total_length())*2 , su.D_elem(), - su.Bytes_total(), cudaMemcpyDeviceToDevice); + qudaMemcpy(this->d_elem + dir*(su.Field_length())*(su.Total_length())*2 , su.D_elem(), + su.Bytes_total(), qudaMemcpyDeviceToDevice); checkQudaError(); } @@ -121,7 +121,7 @@ void PLEGMA_Gauge::absorbDir_host(PLEGMA_Su3field &su,int dir){ template void PLEGMA_Gauge::stoutSmearing(PLEGMA_Gauge &uin, int nSmear, double rho, int D3D4, bool S4D){ if(nSmear < 1){ - cudaMemcpy(this->D_elem(), uin.D_elem(), this->Bytes_total(), cudaMemcpyDeviceToDevice); + qudaMemcpy(this->D_elem(), uin.D_elem(), this->Bytes_total(), qudaMemcpyDeviceToDevice); checkQudaError(); return; } @@ -157,7 +157,7 @@ void PLEGMA_Gauge::stoutSmearing(PLEGMA_Gauge &uin, int nSmear, do for(int idir = 0 ; idir < D3D4; idir++) this->absorbDir_device(*(u_s1[idir]), idir); if(D3D4 == 3){// || S4D int offset = 3*(tmp1.Field_length())*(tmp1.Total_length())*2; - cudaMemcpy(this->D_elem() + offset, uin.D_elem() + offset, tmp1.Bytes_total(), cudaMemcpyDeviceToDevice ); + qudaMemcpy(this->D_elem() + offset, uin.D_elem() + offset, tmp1.Bytes_total(), qudaMemcpyDeviceToDevice ); checkQudaError(); } for(int idir = 0; idir < D3D4 ; idir++){ @@ -185,7 +185,7 @@ void PLEGMA_Gauge::momPhase(Float phase[N_DIMS],int mom[N_DIMS]){ template void PLEGMA_Gauge::APEsmearing(PLEGMA_Gauge &uin, int nSmear, double alpha, int D3D4){ if(nSmear < 1){ - cudaMemcpy(this->D_elem(), uin.D_elem(), this->Bytes_total(), cudaMemcpyDeviceToDevice); + qudaMemcpy(this->D_elem(), uin.D_elem(), this->Bytes_total(), qudaMemcpyDeviceToDevice); checkQudaError(); return; } @@ -219,7 +219,7 @@ void PLEGMA_Gauge::APEsmearing(PLEGMA_Gauge &uin, int nSmear, doub for(int idir = 0 ; idir < D3D4; idir++) this->absorbDir_device(*(u_s1[idir]), idir); if(D3D4 == 3){ int offset = 3*(tmp1.Field_length())*(tmp1.Total_length())*2; - cudaMemcpy(this->D_elem() + offset, uin.D_elem() + offset, tmp1.Bytes_total(), cudaMemcpyDeviceToDevice ); + qudaMemcpy(this->D_elem() + offset, uin.D_elem() + offset, tmp1.Bytes_total(), qudaMemcpyDeviceToDevice ); checkQudaError(); } diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index 50b57804..dfe52dcb 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -24,7 +24,7 @@ absorbVectorToHost(PLEGMA_Vector &vec, int nu, int c2){ c1*N_COLS*HGC_localVolume*2 + c2*HGC_localVolume*2); pointVec_dev = vec.D_elem() + mu*N_COLS*HGC_localVolume*2 + c1*HGC_localVolume*2; - cudaMemcpy(pointProp_host,pointVec_dev,HGC_localVolume*2*sizeof(Float),cudaMemcpyDeviceToHost); + qudaMemcpy(pointProp_host,pointVec_dev,HGC_localVolume*2*sizeof(Float),qudaMemcpyDeviceToHost); } checkQudaError(); } @@ -42,8 +42,8 @@ void PLEGMA_Propagator::absorb(PLEGMA_Vector &vec, int nu, int c2) c1*N_COLS*HGC_localVolume*2 + c2*HGC_localVolume*2); pointVec_dev = vec.D_elem() + mu*N_COLS*HGC_localVolume*2 + c1*HGC_localVolume*2; - cudaMemcpy(pointProp_dev,pointVec_dev,HGC_localVolume*2*sizeof(Float), - cudaMemcpyDeviceToDevice); + qudaMemcpy(pointProp_dev,pointVec_dev,HGC_localVolume*2*sizeof(Float), + qudaMemcpyDeviceToDevice); } checkQudaError(); } @@ -60,11 +60,11 @@ void PLEGMA_Propagator::absorb(PLEGMA_Vector &vec, int global_it, Float *pointer_dst = NULL; for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ - cudaMemset(this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2, 0, V4*2*sizeof(Float)); + qudaMemset(this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2 + my_it*V3*2); pointer_src = (vec.D_elem() + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -83,11 +83,11 @@ void PLEGMA_Propagator::absorb(PLEGMA_Vector3D &vec, int global_it Float *pointer_dst = NULL; for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ - cudaMemset(this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2, 0, V4*2*sizeof(Float)); + qudaMemset(this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2 + my_it*V3*2); pointer_src = (vec.D_elem() + mu*N_COLS*V3*2 + c1*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -229,9 +229,9 @@ absorbTimeSliceFromHost(PLEGMA_Propagator &prop, c2*HGC_localVolume + timeslice*V3 + iv3)*2 + ipart]; - cudaMemcpy(this->d_elem,this->h_elem, + qudaMemcpy(this->d_elem,this->h_elem, N_SPINS*N_SPINS*N_COLS*N_COLS*V3*2*sizeof(Float), - cudaMemcpyHostToDevice); + qudaMemcpyHostToDevice); checkQudaError(); } @@ -251,10 +251,10 @@ void PLEGMA_Propagator3D::absorb(PLEGMA_Vector &vec, int global_it pointer_dst = (this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V3*2 + nu*N_COLS*N_COLS*V3*2 + c1*N_COLS*V3*2 + c2*V3*2); if(is_myIt){ pointer_src = (vec.D_elem() + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } else - cudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); + qudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); } checkQudaError(); } @@ -270,7 +270,7 @@ void PLEGMA_Propagator3D::absorb(PLEGMA_Vector3D &vec, int nu, int for(int c1 = 0 ; c1 < N_COLS ; c1++){ pointer_dst = (this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V3*2 + nu*N_COLS*N_COLS*V3*2 + c1*N_COLS*V3*2 + c2*V3*2); pointer_src = (vec.D_elem() + mu*N_COLS*V3*2 + c1*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } checkQudaError(); } diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 473b1d6a..80edc340 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2237,6 +2237,9 @@ void PLEGMA_ScattCorrelator::P_diagrams( PLEGMA_Vector &Phi_0, PLE vectortmp.apply_gamma_scatt(G_i2,RIGHT); std::vector tmpGf2 = apply_gamma5_scatt_gamma( this->GList[1], LEFT); + double norm1=Phi_0.norm(); + double norm2=Phi_1.norm(); + PLEGMA_printf("NOrm inside P diagram %e %e\n", norm1, norm2); pipi_aux.PhiPhi( Phi_0, tmpGf2, Phi_1); //T x N_moms x n_gammas_f2 Float g[2]; g[0]=-1;//eq 13 @@ -2245,13 +2248,17 @@ void PLEGMA_ScattCorrelator::P_diagrams( PLEGMA_Vector &Phi_0, PLE if(i_pi2==-1){ for( int im=0; imCorr(t,im,gi2,gf2), g, pipi_aux.Corr(t,im,gf2), 1); + } } else{ for( int t=0; tCorr(t,i_pi2,gi2,gf2), g, pipi_aux.Corr(t,0,gf2), 1); + } } }//loop over G_i2 matrix diff --git a/lib/PLEGMA_Su3field.cu b/lib/PLEGMA_Su3field.cu index c853ada1..7111574f 100644 --- a/lib/PLEGMA_Su3field.cu +++ b/lib/PLEGMA_Su3field.cu @@ -3,6 +3,7 @@ #include #include #include +#include using namespace plegma; //--------------------------// @@ -15,8 +16,8 @@ PLEGMA_Su3field::PLEGMA_Su3field(ALLOCATION_FLAG alloc_flag, GHOST_FLAG g template void PLEGMA_Su3field::absorbDir_device(PLEGMA_Gauge &u,int dir){ - cudaMemcpy(this->d_elem, u.D_elem()+dir*(this->field_length)*(this->total_length)*2, - this->Bytes_total(), cudaMemcpyDeviceToDevice); + qudaMemcpy(this->d_elem, u.D_elem()+dir*(this->field_length)*(this->total_length)*2, + this->Bytes_total(), qudaMemcpyDeviceToDevice); checkQudaError(); } @@ -132,7 +133,7 @@ void PLEGMA_Su3field::staples(PLEGMA_Su3field **u, int dir, PLEGMA this->add(tmp2,rho); } tmp1.shift(*this,4+dir); - cudaMemcpy(this->D_elem(), tmp1.D_elem(), this->Bytes_total(), cudaMemcpyDeviceToDevice); + qudaMemcpy(this->D_elem(), tmp1.D_elem(), this->Bytes_total(), qudaMemcpyDeviceToDevice); checkQudaError(); } @@ -146,7 +147,7 @@ void PLEGMA_Su3field::wilsonLineUpdate(PLEGMA_Su3field &inOut, PLE * to build a Wilson line in +x direction you should provide dirOr=4+0. */ if( !((dirOr >= 0) && (dirOr <= 7)) ) PLEGMA_error("Error you provided a direction which is not supported"); - cudaMemcpy(tmp.D_elem(), inOut.D_elem(), tmp.Bytes_total(), cudaMemcpyDeviceToDevice); + qudaMemcpy(tmp.D_elem(), inOut.D_elem(), tmp.Bytes_total(), qudaMemcpyDeviceToDevice); checkQudaError(); if(dirOr > 3){ // x->->->-> diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 6293f96c..335b013d 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -11,6 +11,7 @@ #include #endif #include +#include using namespace plegma; using namespace quda; @@ -68,8 +69,8 @@ void PLEGMA_Vector::gaussianSmearing(PLEGMA_Vector &vecIn, } } if( (nsmearGauss%2) == 0) - cudaMemcpy(this->D_elem(),vecIn.D_elem(), - this->Bytes_total(),cudaMemcpyDeviceToDevice); + qudaMemcpy(this->D_elem(),vecIn.D_elem(), + this->Bytes_total(),qudaMemcpyDeviceToDevice); checkQudaError(); @@ -133,11 +134,11 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator3D &prop, int global_i Float *pointer_dst = NULL; for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ - cudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); + qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V3*2 + nu*N_COLS*N_COLS*V3*2 + c1*N_COLS*V3*2 + c2*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -156,11 +157,11 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator &prop, int global_it, Float *pointer_dst = NULL; for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ - cudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); + qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2 + my_it*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -177,7 +178,7 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator &prop, int nu , int c for(int c1 = 0 ; c1 < N_COLS ; c1++){ pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2); pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2); - cudaMemcpy(pointer_dst, pointer_src, V4*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V4*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } checkQudaError(); } @@ -191,7 +192,7 @@ void PLEGMA_Vector::dilutespin(PLEGMA_Vector &vecIn, int spin){ for(int c1 = 0 ; c1 < N_COLS ; c1++){ if(mu == spin){ pointer_src = (vecIn.D_elem() + (c1 + mu*N_COLS)*HGC_localVolume*2); - cudaMemcpy((this->d_elem + ((c1 + mu*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy((this->d_elem + ((c1 + mu*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } checkQudaError(); @@ -206,7 +207,7 @@ void PLEGMA_Vector::dilutecolor(PLEGMA_Vector &vecIn, int color){ for(int c1 = 0 ; c1 < N_COLS ; c1++){ if(c1 == color){ pointer_src = (vecIn.D_elem() + (c1 + mu*N_COLS)*HGC_localVolume*2); - cudaMemcpy((this->d_elem + ((c1 + mu*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy((this->d_elem + ((c1 + mu*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } checkQudaError(); @@ -222,7 +223,7 @@ void PLEGMA_Vector::dilutespincolor(PLEGMA_Vector &vecIn, int spin for(int c1 = 0 ; c1 < N_COLS ; c1++){ if(c1 == color && mu == spin){ pointer_src = (vecIn.D_elem() + (c1 + mu*N_COLS)*HGC_localVolume*2); - cudaMemcpy((this->d_elem + ((c1 + mu*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy((this->d_elem + ((c1 + mu*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } checkQudaError(); @@ -235,7 +236,7 @@ void PLEGMA_Vector::diluteSpinDisplace(PLEGMA_Vector &vecIn, int s this->zero_device(); for(int c1 = 0 ; c1 < N_COLS ; c1++){ pointer_src = (vecIn.D_elem() + (c1 + spin2*N_COLS)*HGC_localVolume*2); - cudaMemcpy((this->d_elem + ((c1 + spin1*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy((this->d_elem + ((c1 + spin1*N_COLS)*HGC_localVolume)*2), pointer_src, HGC_localVolume*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } checkQudaError(); @@ -268,15 +269,15 @@ void PLEGMA_Vector::pointSource(const site& sourceposition, int spin, int temp[0] = 1.0; if( where == BOTH ){ this->h_elem[((spin*N_COLS+color)*HGC_localVolume + id)*2] = 1.0; - cudaMemcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), - cudaMemcpyHostToDevice ); + qudaMemcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), + qudaMemcpyHostToDevice ); } else if (where == HOST){ this->h_elem[((spin*N_COLS+color)*this->Total_length() + id)*2] = 1.0; } else if (where == DEVICE){ - cudaMemcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), - cudaMemcpyHostToDevice ); + qudaMemcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), + qudaMemcpyHostToDevice ); } else{ PLEGMA_error("Not supported %d\n",where); @@ -390,7 +391,7 @@ namespace plegma{ for(int c1 = 0 ; c1 < N_COLS ; c1++){ pointer_dst = (this->d_elem + mu*N_COLS*V3*2 + c1*V3*2); pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V3*2 + nu*N_COLS*N_COLS*V3*2 + c1*N_COLS*V3*2 + c2*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } checkQudaError(); } @@ -413,7 +414,7 @@ namespace plegma{ pointer_dst = (this->d_elem + mu*N_COLS*V3*2 + c1*V3*2); if(is_myIt){ pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2 + my_it*V3*2); - cudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), cudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } if (broadcast == true){ @@ -421,15 +422,15 @@ namespace plegma{ // printf("Time rank %d\n",time_rank); // fflush(stdout); Float *temp=(Float *)malloc(sizeof(Float)*V3*2); - cudaMemcpy(temp, pointer_dst, V3*2 * sizeof(Float), cudaMemcpyDeviceToHost); + qudaMemcpy(temp, pointer_dst, V3*2 * sizeof(Float), qudaMemcpyDeviceToHost); MPI_Bcast(temp, V3*2 , MPI_Type(), time_rank, HGC_timeComm); // printf("Temp 0 %e\n",temp[0]); // fflush(stdout); - cudaMemcpy(pointer_dst, temp, V3*2 * sizeof(Float), cudaMemcpyHostToDevice); + qudaMemcpy(pointer_dst, temp, V3*2 * sizeof(Float), qudaMemcpyHostToDevice); free(temp); } if (broadcast == false && is_myIt ==false){ - cudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); + qudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); } } diff --git a/lib/kernels/PLEGMA_TMDWF.cuh b/lib/kernels/PLEGMA_TMDWF.cuh index 03fa6284..555aebcc 100644 --- a/lib/kernels/PLEGMA_TMDWF.cuh +++ b/lib/kernels/PLEGMA_TMDWF.cuh @@ -1,5 +1,6 @@ #include #include +#include using namespace plegma; const int N_TMDWF_MESONS=1; // TODO: This is hard to extend. These variables should replaced by compile-time functions. @@ -116,7 +117,7 @@ void contract_TMDWF_mesons_host( ProfileStruct &ps, (*propTex1, *propTex2, *stapleTex ,d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms); error=cudaPeekAtLastError(); if(error != cudaSuccess) break; - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) break; if(runFT==true) { @@ -135,7 +136,7 @@ void contract_TMDWF_mesons_host( ProfileStruct &ps, } } hostFree(h_partial_block, alloc_size*sizeof(FloatC)); - cudaFree(d_partial_block); + device_free(d_partial_block); } template diff --git a/lib/kernels/PLEGMA_scattreductions.cuh b/lib/kernels/PLEGMA_scattreductions.cuh index 943e8295..4debfc09 100644 --- a/lib/kernels/PLEGMA_scattreductions.cuh +++ b/lib/kernels/PLEGMA_scattreductions.cuh @@ -431,9 +431,12 @@ static void T_reductions_host( ProfileStruct &ps, TRED T, PLEGMA_ScattCorrelator } } hostFree(h_partial_block, alloc_size*sizeof(Float2)); - cudaFree(d_partial_block); - cudaFree(listGammas_i.array); - cudaFree(listGammas_f.array); + device_free(d_partial_block); + device_free(listGammas_i.array); + device_free(listGammas_f.array); + //cudaFree(d_partial_block); + //cudaFree(listGammas_i.array); + //cudaFree(listGammas_f.array); } diff --git a/lib/kernels/PLEGMA_threep_threeD_part1.cu b/lib/kernels/PLEGMA_threep_threeD_part1.cu index 2556d235..46f96d4d 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part1.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part1.cu @@ -245,8 +245,8 @@ static void threep_threeD_part1_host(ProfileStruct &ps, Float2 *result, exit: hostFree(h_partial_block, alloc_size*sizeof(FloatC)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } template diff --git a/lib/kernels/PLEGMA_threep_threeD_part2.cu b/lib/kernels/PLEGMA_threep_threeD_part2.cu index 5a16a063..8a59cd31 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part2.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part2.cu @@ -6,6 +6,7 @@ #include #include #include +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -166,7 +167,7 @@ static void threep_threeD_part2_host(ProfileStruct &ps, Float2 *result, listGammas.size = gammas.size(); //cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), qudaMemcpyHostToDevice); if(HGC_verbosity > 2) @@ -242,8 +243,8 @@ static void threep_threeD_part2_host(ProfileStruct &ps, Float2 *result, exit: hostFree(h_partial_block, alloc_size*sizeof(FloatC)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } template diff --git a/lib/kernels/PLEGMA_threep_twoD.cu b/lib/kernels/PLEGMA_threep_twoD.cu index d99b1d6b..3fde0846 100644 --- a/lib/kernels/PLEGMA_threep_twoD.cu +++ b/lib/kernels/PLEGMA_threep_twoD.cu @@ -6,6 +6,7 @@ #include #include #include +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -167,7 +168,7 @@ static void threep_twoD_host(ProfileStruct &ps, Float2 *result, PLEGMA_C listGammas.size = gammas.size(); listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); // cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), qudaMemcpyHostToDevice); if(HGC_verbosity > 2) if(corr.hasSource()) @@ -209,7 +210,7 @@ static void threep_twoD_host(ProfileStruct &ps, Float2 *result, PLEGMA_C source, signProps, runFT, *moms, dir1,dir2,mu,nu,c1,c2); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2), qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; if(runFT==true){ @@ -232,8 +233,8 @@ static void threep_twoD_host(ProfileStruct &ps, Float2 *result, PLEGMA_C exit: hostFree(h_partial_block, alloc_size*sizeof(FloatC)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } template From 92677e91736e94b6d80539b104cecbc4bd969ed4 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 21 Nov 2022 14:09:49 +0100 Subject: [PATCH 008/168] update nucleon 2pt 3pt --- plegma/nucleon_2pt_3pt_npi.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plegma/nucleon_2pt_3pt_npi.cpp b/plegma/nucleon_2pt_3pt_npi.cpp index dc710f36..3c1d7227 100644 --- a/plegma/nucleon_2pt_3pt_npi.cpp +++ b/plegma/nucleon_2pt_3pt_npi.cpp @@ -422,8 +422,8 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon T2 reduction\n"); TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); + TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); } @@ -460,6 +460,11 @@ int main(int argc, char **argv) { TIME(corrD1if56.M_diagrams( corrN0, vectorAuxF_SS, oet_mom_zero_up_SS )); + double norm1=vectorAuxF_SS.norm(); + double norm2=oet_mom_zero_up_SS.norm(); + PLEGMA_printf("norm1 %e norm2 %e\n",norm1,norm2); + + TIME(corrPPUP.P_diagrams( vectorAuxF_SS, oet_mom_zero_up_SS, i_pi2, true)); TIME(corrP0UP.P_diagrams( vectorAuxF_SS, oet_mom_zero_dn_SS, i_pi2, true)); From 2c6edb84ddba91f9ead5ccc1cf9a94959bb81992 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 21 Nov 2022 18:21:17 +0100 Subject: [PATCH 009/168] continue hipify --- include/PLEGMA_BLAS.h | 5 +++-- lib/kernels/PLEGMA_bcud_tetraquarks.cu | 10 +++++----- lib/kernels/PLEGMA_heavy_light_tetraquarks.cu | 9 +++++---- ...A_heavy_light_tetraquarks_open_contractions.cu | 15 ++++++++------- lib/kernels/PLEGMA_scattreductions.cuh | 11 ++++++----- lib/kernels/PLEGMA_scattreductionsPiPi.cuh | 15 +++++++++------ lib/kernels/PLEGMA_su3field.cuh | 5 +++-- lib/kernels/PLEGMA_threep_staple.cu | 6 +++--- lib/kernels/PLEGMA_threep_threeD_part3.cu | 9 +++++---- lib/kernels/PLEGMA_threep_threeD_part4.cu | 9 +++++---- plegma/qLoops.cpp | 3 ++- plegma/qLoops_WilsonLine.cpp | 3 ++- utils/PLEGMA_eigSolver.cpp | 9 +++++---- 13 files changed, 61 insertions(+), 48 deletions(-) diff --git a/include/PLEGMA_BLAS.h b/include/PLEGMA_BLAS.h index af5cee1a..862f758d 100644 --- a/include/PLEGMA_BLAS.h +++ b/include/PLEGMA_BLAS.h @@ -14,6 +14,7 @@ #include #include #include +#include #pragma once enum OPER_MATR_BLAS {NOTRANS, TRANS, DAGGER}; namespace cBLAS{ @@ -233,7 +234,7 @@ namespace cuBLAS{ if(trans == NOTRANS) PLEGMA_error("Use gemv without MPI comm"); if(comm == MPI_COMM_NULL) PLEGMA_error("Communicator is NULL and cannot be used for MPI reduction"); cuBLAS::gemv_(trans, m, n, alpha, A, x, beta, y); - cudaMemcpy(yHost,y,n*2*sizeof(Float),cudaMemcpyDeviceToHost); + qudaMemcpy(yHost,y,n*2*sizeof(Float),qudaMemcpyDeviceToHost); checkQudaError(); int mpiErr = MPI_Allreduce(MPI_IN_PLACE,yHost,n*2,MPI_Type(yHost),MPI_SUM,comm); if(mpiErr != MPI_SUCCESS) PLEGMA_error("MPI_Allreduce failed with error %d\n", mpiErr); @@ -245,7 +246,7 @@ namespace cuBLAS{ inline void gemv(OPER_MATR_BLAS trans, int m, int n, Float alpha[2], Float* A, Float* x, Float beta[2], Float* y, MPI_Comm comm){ Float yHost[n*2]; cuBLAS::gemv(trans,m, n, alpha, A, x, beta, y, yHost,comm); - cudaMemcpy(y,yHost,sizeof(yHost),cudaMemcpyHostToDevice); + qudaMemcpy(y,yHost,sizeof(yHost),qudaMemcpyHostToDevice); checkQudaError(); } } diff --git a/lib/kernels/PLEGMA_bcud_tetraquarks.cu b/lib/kernels/PLEGMA_bcud_tetraquarks.cu index cdf49e1a..acba8f22 100644 --- a/lib/kernels/PLEGMA_bcud_tetraquarks.cu +++ b/lib/kernels/PLEGMA_bcud_tetraquarks.cu @@ -1,6 +1,6 @@ #include #include - +#include template __global__ void contract_props_bcud(propTex texProp1, propTex texProp2, propTex texProp3, @@ -107,9 +107,9 @@ void contract_tetraquarks_bcud_host(ProfileStruct &ps, int shift = 0; for(int j=0; j), cudaMemcpyHostToDevice); + qudaMemcpy(idxs+8*shift, TETRA_bcud_prop_prods_idxs[i][j], 8*TETRA_bcud_prop_prods_count[i][j]*sizeof(short), qudaMemcpyHostToDevice); + qudaMemcpy(col_contr+8*shift, TETRA_bcud_prop_prods_col_contr[i][j], 8*TETRA_bcud_prop_prods_count[i][j]*sizeof(short), qudaMemcpyHostToDevice); + qudaMemcpy(vals+shift, TETRA_bcud_prop_prods_vals[i][j], TETRA_bcud_prop_prods_count[i][j]*sizeof(Float2), qudaMemcpyHostToDevice); shift += TETRA_bcud_prop_prods_count[i][j]; } @@ -132,7 +132,7 @@ void contract_tetraquarks_bcud_host(ProfileStruct &ps, (*propTex1, *propTex2, *propTex3, *propTex4, d_partial_block, TETRA_bcud_prop_prods_count[i][j], idxs+8*shift, col_contr+8*shift, vals+shift, source, runFT, *moms, it, std::min(t_size-it, time_step), maxT); - cudaMemcpy(h_partial_block , d_partial_block , alloc_size*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block , d_partial_block , alloc_size*sizeof(Float2), qudaMemcpyDeviceToHost); if(runFT==true){ int accumX = ps.tp.grid.x/time_step; Float2 *reduction = result + (j*t_size + it)*volume3D; diff --git a/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu b/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu index 0a560142..2b5717c8 100644 --- a/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu +++ b/lib/kernels/PLEGMA_heavy_light_tetraquarks.cu @@ -1,6 +1,7 @@ #include #include #include +#include template __global__ void contract_props(propTex texProp1, propTex texProp2, propTex texProp3, @@ -107,9 +108,9 @@ void contract_tetraquarks_host(ProfileStruct &ps, int shift = 0; for(int j=0; j), cudaMemcpyHostToDevice); + qudaMemcpy(idxs+8*shift, TETRA_prop_prods_idxs[i][j], 8*TETRA_prop_prods_count[i][j]*sizeof(short), qudaMemcpyHostToDevice); + qudaMemcpy(col_contr+8*shift, TETRA_prop_prods_col_contr[i][j], 8*TETRA_prop_prods_count[i][j]*sizeof(short), qudaMemcpyHostToDevice); + qudaMemcpy(vals+shift, TETRA_prop_prods_vals[i][j], TETRA_prop_prods_count[i][j]*sizeof(Float2), qudaMemcpyHostToDevice); shift += TETRA_prop_prods_count[i][j]; } @@ -132,7 +133,7 @@ void contract_tetraquarks_host(ProfileStruct &ps, (*propTex1, *propTex2, *propTex3, *propTex4, d_partial_block, TETRA_prop_prods_count[i][j], idxs+8*shift, col_contr+8*shift, vals+shift, source, runFT, *moms, it, std::min(t_size-it, time_step), maxT); - cudaMemcpy(h_partial_block , d_partial_block , alloc_size*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block , d_partial_block , alloc_size*sizeof(Float2), qudaMemcpyDeviceToHost); if(runFT==true){ int accumX = ps.tp.grid.x/time_step; Float2 *reduction = result + (j*t_size + it)*volume3D; diff --git a/lib/kernels/PLEGMA_heavy_light_tetraquarks_open_contractions.cu b/lib/kernels/PLEGMA_heavy_light_tetraquarks_open_contractions.cu index 9a25b2a1..537b8654 100644 --- a/lib/kernels/PLEGMA_heavy_light_tetraquarks_open_contractions.cu +++ b/lib/kernels/PLEGMA_heavy_light_tetraquarks_open_contractions.cu @@ -3,7 +3,8 @@ #include #include #include - +#include +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -104,8 +105,8 @@ static void tetraquark_open_index_host(ProfileStruct &ps, Float2 *result KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + listGammas.array= (GAMMAS*) device_malloc(gammas.size()*sizeof(GAMMAS)); + qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), qudaMemcpyHostToDevice); if(HGC_verbosity > 2) if(corr.hasSource()) @@ -115,7 +116,7 @@ static void tetraquark_open_index_host(ProfileStruct &ps, Float2 *result Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + d_partial_block = (Float2*)device_malloc( alloc_size * sizeof(Float2) ); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture(prop1); @@ -132,7 +133,7 @@ static void tetraquark_open_index_host(ProfileStruct &ps, Float2 *result (d_partial_block, *propTex1, *propTex2, listGammas, it, t_step, maxT, source, runFT, *moms, s1); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; - cudaMemcpy(h_partial_block , d_partial_block , (alloc_size/time_step)*t_step*sizeof(Float2) , cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block , d_partial_block , (alloc_size/time_step)*t_step*sizeof(Float2) , qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; if(runFT==true){ @@ -154,8 +155,8 @@ static void tetraquark_open_index_host(ProfileStruct &ps, Float2 *result exit: hostFree(h_partial_block, alloc_size*sizeof(FloatC)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } template diff --git a/lib/kernels/PLEGMA_scattreductions.cuh b/lib/kernels/PLEGMA_scattreductions.cuh index 4debfc09..710253b4 100644 --- a/lib/kernels/PLEGMA_scattreductions.cuh +++ b/lib/kernels/PLEGMA_scattreductions.cuh @@ -1,5 +1,6 @@ #include #include +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -92,7 +93,7 @@ static void V_reductions_host( ProfileStruct &ps, VRED V, PLEGMA_ScattCorrelator return; } -// cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS_SCATT), cudaMemcpyHostToDevice); +// qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS_SCATT), qudaMemcpyHostToDevice); } //loop over the bunches of timeslices passed to device @@ -112,7 +113,7 @@ static void V_reductions_host( ProfileStruct &ps, VRED V, PLEGMA_ScattCorrelator //if(error != cudaSuccess) { PLEGMA_printf("Error after V_kernels_wrapper, it=%d tsize=%d error=%d string%s\n",it,t_size,error, cudaGetErrorString(error)); break;} //copy partial summed 3dfourier back to host d_partial -> h_partial (device->host) - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), qudaMemcpyDeviceToHost); //error=cudaPeekAtLastError(); //if(error != cudaSuccess) { PLEGMA_printf("Error after copying back partial_block, it=%d\n",it); break;} @@ -401,8 +402,8 @@ static void T_reductions_host( ProfileStruct &ps, TRED T, PLEGMA_ScattCorrelator // cudaMalloc((void**)&listGammas_i.array, gammas_i.size()*sizeof(GAMMAS_SCATT)); // cudaMalloc((void**)&listGammas_f.array, gammas_f.size()*sizeof(GAMMAS_SCATT)); checkQudaError(); - cudaMemcpy(listGammas_i.array, gammas_i.data(), gammas_i.size()*sizeof(GAMMAS_SCATT), cudaMemcpyHostToDevice); - cudaMemcpy(listGammas_f.array, gammas_f.data(), gammas_f.size()*sizeof(GAMMAS_SCATT), cudaMemcpyHostToDevice); + qudaMemcpy(listGammas_i.array, gammas_i.data(), gammas_i.size()*sizeof(GAMMAS_SCATT), qudaMemcpyHostToDevice); + qudaMemcpy(listGammas_f.array, gammas_f.data(), gammas_f.size()*sizeof(GAMMAS_SCATT), qudaMemcpyHostToDevice); checkQudaError(); if(HGC_verbosity > 2){ PLEGMA_printf("site_size= %d\n", listGammas_f.size*listGammas_i.size*N_SPINS*N_SPINS); @@ -418,7 +419,7 @@ static void T_reductions_host( ProfileStruct &ps, TRED T, PLEGMA_ScattCorrelator error=cudaPeekAtLastError(); if(error != cudaSuccess) { PLEGMA_printf("ERROR1\n"); break;} - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) { PLEGMA_printf("ERROR2\n"); break;} diff --git a/lib/kernels/PLEGMA_scattreductionsPiPi.cuh b/lib/kernels/PLEGMA_scattreductionsPiPi.cuh index 0f4d5000..d5de7cd5 100644 --- a/lib/kernels/PLEGMA_scattreductionsPiPi.cuh +++ b/lib/kernels/PLEGMA_scattreductionsPiPi.cuh @@ -1,6 +1,7 @@ #include #include <../../include/PLEGMA_gammas.h> #include +#include using namespace plegma; template @@ -18,7 +19,7 @@ __global__ void PhixGxPhi_kernel( vectorTex vectorPhi0, KernelArr accum[16]; for(int i = 0 ; i < 16 ; i++){ accum[i].x = 0.; - accum[i].x = 0.; + accum[i].y = 0.; } @@ -44,8 +45,10 @@ __global__ void PhixGxPhi_kernel( vectorTex vectorPhi0, KernelArr factor = g[gId][nz_e]; #pragma unroll - for(int a=0; a listGammas.array=(GAMMAS_SCATT*)device_malloc(gammas.size()*sizeof(GAMMAS_SCATT)); //cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS_SCATT)); checkQudaError(); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS_SCATT), cudaMemcpyHostToDevice); + qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS_SCATT), qudaMemcpyHostToDevice); checkQudaError(); if(HGC_verbosity > 2) PLEGMA_printf("site_size= %d\n", listGammas.size*N_SPINS*N_COLS); @@ -123,7 +126,7 @@ static void PhixGxPhi_host( ProfileStruct &ps, PLEGMA_ScattCorrelator error=cudaPeekAtLastError(); if(error != cudaSuccess) { PLEGMA_printf("ERROR1\n"); break;} - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) { PLEGMA_printf("ERROR2\n"); break;} @@ -136,8 +139,8 @@ static void PhixGxPhi_host( ProfileStruct &ps, PLEGMA_ScattCorrelator } } hostFree(h_partial_block, alloc_size*sizeof(Float2)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } diff --git a/lib/kernels/PLEGMA_su3field.cuh b/lib/kernels/PLEGMA_su3field.cuh index c2c8e17d..0a47f6be 100644 --- a/lib/kernels/PLEGMA_su3field.cuh +++ b/lib/kernels/PLEGMA_su3field.cuh @@ -1,6 +1,7 @@ #include #include #include +#include using namespace plegma; template @@ -180,8 +181,8 @@ static void sum_real_trace_host(ProfileStruct& ps, PLEGMA_Su3field &su3M sum_real_trace_kernel<<>>(toField2(su3M), d_partial_sum); - cudaMemcpy(h_partial_sum, d_partial_sum , gridDimX * sizeof(Float) , cudaMemcpyDeviceToHost); - cudaFree(d_partial_sum); + qudaMemcpy(h_partial_sum, d_partial_sum , gridDimX * sizeof(Float) , qudaMemcpyDeviceToHost); + device_free(d_partial_sum); checkQudaError(); for(int i = 0 ; i < gridDimX ; i++) diff --git a/lib/kernels/PLEGMA_threep_staple.cu b/lib/kernels/PLEGMA_threep_staple.cu index 18df1ca6..923f27ef 100644 --- a/lib/kernels/PLEGMA_threep_staple.cu +++ b/lib/kernels/PLEGMA_threep_staple.cu @@ -4,7 +4,7 @@ #include #include #include - +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -86,7 +86,7 @@ static void threep_staple_host(ProfileStruct &ps, Float2 *result, listGammas.size = gammas.size(); // cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), qudaMemcpyHostToDevice); if(HGC_verbosity > 2) if(corr.hasSource()) @@ -124,7 +124,7 @@ static void threep_staple_host(ProfileStruct &ps, Float2 *result, source, signProps, runFT, *moms, mu,nu,c1,c2); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2) , cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2) , qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; if(runFT==true){ diff --git a/lib/kernels/PLEGMA_threep_threeD_part3.cu b/lib/kernels/PLEGMA_threep_threeD_part3.cu index b0ba0e2f..c0aa8327 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part3.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part3.cu @@ -6,6 +6,7 @@ #include #include #include +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -167,7 +168,7 @@ static void threep_threeD_part3_host(ProfileStruct &ps, Float2 *result, // cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), qudaMemcpyHostToDevice); if(HGC_verbosity > 2) if(corr.hasSource()) @@ -220,7 +221,7 @@ static void threep_threeD_part3_host(ProfileStruct &ps, Float2 *result, source, signProps, runFT, *moms, dir1,dir2,dir3,mu,nu,c1,c2); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2), qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; if(runFT==true){ @@ -242,8 +243,8 @@ static void threep_threeD_part3_host(ProfileStruct &ps, Float2 *result, exit: hostFree(h_partial_block, alloc_size*sizeof(FloatC)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } template diff --git a/lib/kernels/PLEGMA_threep_threeD_part4.cu b/lib/kernels/PLEGMA_threep_threeD_part4.cu index e6d5ea52..a8f5cbd7 100644 --- a/lib/kernels/PLEGMA_threep_threeD_part4.cu +++ b/lib/kernels/PLEGMA_threep_threeD_part4.cu @@ -6,6 +6,7 @@ #include #include #include +#include using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -168,7 +169,7 @@ static void threep_threeD_part4_host(ProfileStruct &ps, Float2 *result, listGammas.size = gammas.size(); listGammas.array=(GAMMAS*)device_malloc(gammas.size()*sizeof(GAMMAS)); // cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + qudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), qudaMemcpyHostToDevice); if(HGC_verbosity > 2) if(corr.hasSource()) @@ -222,7 +223,7 @@ static void threep_threeD_part4_host(ProfileStruct &ps, Float2 *result, source, signProps, runFT, *moms, dir1,dir2,dir3,mu,nu,c1,c2); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; - cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2), cudaMemcpyDeviceToHost); + qudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*t_step*sizeof(Float2), qudaMemcpyDeviceToHost); error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; if(runFT==true){ @@ -244,8 +245,8 @@ static void threep_threeD_part4_host(ProfileStruct &ps, Float2 *result, exit: hostFree(h_partial_block, alloc_size*sizeof(FloatC)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } template diff --git a/plegma/qLoops.cpp b/plegma/qLoops.cpp index dabbd4e7..ef17a15a 100644 --- a/plegma/qLoops.cpp +++ b/plegma/qLoops.cpp @@ -2,6 +2,7 @@ #include #include #include +#include using namespace plegma; using namespace quda; @@ -239,7 +240,7 @@ int main(int argc, char **argv) double eigVal = std::get<0>(eigSol->getEigVals()[i]); long int iorder = std::get<3>(eigSol->getEigVals()[i]); double *eigVec = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; - cudaMemcpy(phi.D_elem(), eigVec, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); + qudaMemcpy(phi.D_elem(), eigVec, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); checkQudaError(); if(oneDLoops || twoDLoops) qloops_std.oneEnd_trick(phi,phi,tmp,qLtmp,gauge,-1./eigVal,true); //standard one-end trick else qloops_std.oneEnd_trick(phi,phi,-1./eigVal,true); //standard one-end trick diff --git a/plegma/qLoops_WilsonLine.cpp b/plegma/qLoops_WilsonLine.cpp index 46cd3135..275d1d66 100644 --- a/plegma/qLoops_WilsonLine.cpp +++ b/plegma/qLoops_WilsonLine.cpp @@ -2,6 +2,7 @@ #include #include #include +#include using namespace plegma; using namespace quda; @@ -181,7 +182,7 @@ int main(int argc, char **argv) if(mu_h>0.) eigVal += 4.*inv_params.kappa*inv_params.kappa*(mu_h*mu_h-mu*mu); long int iorder = std::get<3>(eigSol->getEigVals()[i]); double *eigVec = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; - cudaMemcpy(phi.D_elem(), eigVec, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); + qudaMemcpy(phi.D_elem(), eigVec, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); checkQudaError(); phi_r.copy(phi); qloops_std.oneEnd_trick_wilsonLine(phi,phi_r,-1./eigVal,gaugeStout,ft_std); diff --git a/utils/PLEGMA_eigSolver.cpp b/utils/PLEGMA_eigSolver.cpp index 4391668f..8c1f1a66 100644 --- a/utils/PLEGMA_eigSolver.cpp +++ b/utils/PLEGMA_eigSolver.cpp @@ -2,6 +2,7 @@ #include #include #include +#include using namespace plegma; using namespace quda; @@ -150,7 +151,7 @@ static void applyOperator(double *out, double *in, int size_per_Vec){ #else void EigSolver::applyOperator(double *out, double *in){ #endif - cudaMemcpy(d_in->D_elem(),in,bytes_per_Vec,cudaMemcpyHostToDevice); + qudaMemcpy(d_in->D_elem(),in,bytes_per_Vec,qudaMemcpyHostToDevice); checkQudaError(); if(!G_isACC) dOp->apply(*d_out,*d_in); @@ -188,7 +189,7 @@ void EigSolver::applyOperator(double *out, double *in){ } } } - cudaMemcpy(out,d_out->D_elem(),bytes_per_Vec,cudaMemcpyDeviceToHost); + qudaMemcpy(out,d_out->D_elem(),bytes_per_Vec,qudaMemcpyDeviceToHost); checkQudaError(); } @@ -427,7 +428,7 @@ void EigSolver::computeEigVals(){ double* ptr_tmp = h_eigVecs; for(int j = 0 ; j < p.NeV; j++){ double one[2] = {1.,0.}; - cudaMemcpy(tmp1->D_elem(),ptr_tmp,bytes_per_Vec,cudaMemcpyHostToDevice); + qudaMemcpy(tmp1->D_elem(),ptr_tmp,bytes_per_Vec,qudaMemcpyHostToDevice); checkQudaError(); dOp->apply(*tmp2,*tmp1); std::complex eval = cuBLAS::dot(size_per_Vec, tmp1->D_elem(), tmp2->D_elem(), HGC_fullComm); @@ -493,7 +494,7 @@ void EigSolver::dumpEvalsVdagG5V(std::string filename){ std::vector VdagG5V; double* ptr_tmp = h_eigVecs; for (int j = 0; j < p.NeV; ++j) { - cudaMemcpy(g5V.D_elem(),ptr_tmp,bytes_per_Vec,cudaMemcpyHostToDevice); + qudaMemcpy(g5V.D_elem(),ptr_tmp,bytes_per_Vec,qudaMemcpyHostToDevice); checkQudaError(); V.copy(g5V); g5V.apply_gamma(G5); From 93c3174d2e08e423ba6597bc173a740abc327cf0 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 5 Dec 2022 15:43:49 +0100 Subject: [PATCH 010/168] pack propagator as sink routine to the library --- include/PLEGMA_Propagator.h | 9 +++++++++ lib/PLEGMA_Propagator.cu | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/PLEGMA_Propagator.h b/include/PLEGMA_Propagator.h index 5eaa1f99..982e261c 100644 --- a/include/PLEGMA_Propagator.h +++ b/include/PLEGMA_Propagator.h @@ -95,6 +95,15 @@ namespace plegma { **/ void absorb(PLEGMA_Vector3D &vec, int nu, int c2); + /** + @brief packing the sinktime slice in all other time slices + @param the initial propagator to be broadcasted + @param PLEGMA_Propagator in initial propagator to be broadcasted + @param int sinktimeslice the sinktime slice to be broadcasted + **/ + void pack_propagator_as_sink(PLEGMA_Propagator in, int sinktimeslice); + + }; } diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index dfe52dcb..8ff36cd9 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -98,6 +98,27 @@ template void PLEGMA_Propagator::applyBoundaries_device(int t0){ apply_boundaries(this->d_elem, t0); } +template +void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator in, int sinktimeslice){ + for (int isc=0; isc<12; ++isc){ + + PLEGMA_Vector stmp; + PLEGMA_Vector3D vector1; + + stmp.zero_where(DEVICE); + stmp.zero_where(HOST); + + vector1.absorb(in, sinktimeslice, isc/3, isc%3,true); + + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + stmp.absorb(vector1, timeidx, false); + } + + + this->absorb(stmp, isc/3, isc%3); + } +} + template void PLEGMA_Propagator::rotateToPhysicalBase_device(int sign){ From 55c5688992cadfe4658d72d0fcffaed608185263 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 6 Dec 2022 11:22:09 +0200 Subject: [PATCH 011/168] adding packing routines for fermions --- include/PLEGMA_Propagator.h | 19 ++++++++++--------- include/PLEGMA_Vector.h | 2 ++ lib/PLEGMA_Vector.cu | 24 +++++++++++++++++++++--- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/include/PLEGMA_Propagator.h b/include/PLEGMA_Propagator.h index 982e261c..8716bbc1 100644 --- a/include/PLEGMA_Propagator.h +++ b/include/PLEGMA_Propagator.h @@ -53,6 +53,16 @@ namespace plegma { @return void **/ void absorb(PLEGMA_Vector3D &vec, int global_it, int nu, int c2); + + /** + @brief packing the sinktime slice in all other time slices + @param the initial propagator to be broadcasted + @param PLEGMA_Propagator in initial propagator to be broadcasted + @param int sinktimeslice the sinktime slice to be broadcasted + **/ + void pack_propagator_as_sink(PLEGMA_Propagator in, int sinktimeslice); + + void applyBoundaries_device(int t0); void rotateToPhysicalBase_host(int sign); @@ -95,15 +105,6 @@ namespace plegma { **/ void absorb(PLEGMA_Vector3D &vec, int nu, int c2); - /** - @brief packing the sinktime slice in all other time slices - @param the initial propagator to be broadcasted - @param PLEGMA_Propagator in initial propagator to be broadcasted - @param int sinktimeslice the sinktime slice to be broadcasted - **/ - void pack_propagator_as_sink(PLEGMA_Propagator in, int sinktimeslice); - - }; } diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index bb87bfa0..3aa8f8b3 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -95,6 +95,8 @@ namespace plegma { void rotate_uk_ch_g5g4(); void covD(PLEGMA_Vector &vecIn, PLEGMA_Gauge &gauge, int dirOr); void mulGV(PLEGMA_Vector &vecIn, PLEGMA_Su3field &u); + void pack_fermion_from_sink(std::vector*> &stochastic_vector, int sinktime); + }; template void copyToQUDA(quda::ColorSpinorField *cudaVector, Float* delem, bool isEv = false); // delem is a device pointer diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 335b013d..3a4946d1 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -243,6 +243,25 @@ void PLEGMA_Vector::diluteSpinDisplace(PLEGMA_Vector &vecIn, int s } +template +void PLEGMA_Vector::pack_fermion_from_sink(std::vector*> &stochastic_vector, int sinktime){ + PLEGMA_Vector stmp; + + stmp.zero_where(DEVICE); + stmp.zero_where(HOST); + + + PLEGMA_Vector temporary; + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + temporary.copy(*stochastic_vector[timeidx], HOST); + temporary.load(); + stmp.absorbTimeSlice(temporary, sinktime, false); + } + + this->copy(stmp); + +} + template @@ -396,12 +415,10 @@ namespace plegma{ checkQudaError(); } - // vec3D <- Prop4D + // vec3D <- vec4D template void PLEGMA_Vector3D::absorb(PLEGMA_Propagator &prop, int global_it, int nu , int c2, bool broadcast){ if(global_it >= HGC_totalL[3]) PLEGMA_error("The global time slice you provided exceed the temporal extent\n"); - printf("I am in absorb\n"); - fflush(stdout); int my_it = global_it - HGC_procPosition[3] * HGC_localL[3]; bool is_myIt = (my_it >= 0) && ( my_it < HGC_localL[3] ); this->activeTimeSlice = is_myIt; @@ -438,6 +455,7 @@ namespace plegma{ } + template std::vector PLEGMA_Vector3D::rms(std::vector listR2, const site& sourceposition) const{ if(listR2.size() <= 0) PLEGMA_error("Provided list of r2 is empty"); From 56bf3fb1a581a48a199d02b3fdc4a13ed4ea5fc7 Mon Sep 17 00:00:00 2001 From: pittlerf Date: Tue, 6 Dec 2022 14:53:07 +0100 Subject: [PATCH 012/168] correcting pack_fermion_to_sink --- include/PLEGMA_Vector.h | 8 ++++- lib/PLEGMA_Propagator.cu | 2 +- lib/PLEGMA_Vector.cu | 67 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 69 insertions(+), 8 deletions(-) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index 3aa8f8b3..e042fcb3 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -95,7 +95,10 @@ namespace plegma { void rotate_uk_ch_g5g4(); void covD(PLEGMA_Vector &vecIn, PLEGMA_Gauge &gauge, int dirOr); void mulGV(PLEGMA_Vector &vecIn, PLEGMA_Su3field &u); - void pack_fermion_from_sink(std::vector*> &stochastic_vector, int sinktime); + void pack_fermion_to_sink(std::vector*> &stochastic_vector, int sinktime); + + void absorb(PLEGMA_Vector3D &vec, int global_it, bool broadcast=false); + }; @@ -137,6 +140,9 @@ namespace plegma { **/ void absorb(PLEGMA_Propagator &prop, int global_it, int nu, int c2, bool broadcast=false); + void absorb(PLEGMA_Vector &vec, int global_it, bool broadcast=false); + + void gaussianSmearing(PLEGMA_Vector3D &vecIn, PLEGMA_Gauge3D &gauge, int nsmearGauss, Float alphaGauss) { this->activeTimeSlice = vecIn.activeTimeSlice; return ((PLEGMA_Vector*) this)->gaussianSmearing(vecIn,gauge,nsmearGauss,alphaGauss); diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index 8ff36cd9..cb5c2e94 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -111,7 +111,7 @@ void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator vector1.absorb(in, sinktimeslice, isc/3, isc%3,true); for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - stmp.absorb(vector1, timeidx, false); + stmp.absorbTimeslice(vector1, timeidx, false); } diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 3a4946d1..94615a1d 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -168,6 +168,29 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator &prop, int global_it, checkQudaError(); } +//vec4D <- vec3D (it) +template +void PLEGMA_Vector::absorb(PLEGMA_Vector3D &vec, int global_it, bool broadcast){ + if(global_it >= HGC_totalL[3]) PLEGMA_error("The global time slice you provided exceed the temporal extent\n"); + int my_it = global_it - HGC_procPosition[3] * HGC_localL[3]; + bool is_myIt = (my_it >= 0) && ( my_it < HGC_localL[3] ); + int V3 = HGC_localVolume/HGC_localL[3]; + int V4 = HGC_localVolume; + Float *pointer_src = NULL; + Float *pointer_dst = NULL; + for(int mu = 0 ; mu < N_SPINS ; mu++) + for(int c1 = 0 ; c1 < N_COLS ; c1++){ + //qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); + if(is_myIt){ + pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); + pointer_src = (vec.D_elem() + mu*N_COLS*V3*2 + c1*V3*2); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + } + } + comm_barrier(); + checkQudaError(); +} + // vec4D <- prop4D template void PLEGMA_Vector::absorb(PLEGMA_Propagator &prop, int nu , int c2){ @@ -244,18 +267,21 @@ void PLEGMA_Vector::diluteSpinDisplace(PLEGMA_Vector &vecIn, int s template -void PLEGMA_Vector::pack_fermion_from_sink(std::vector*> &stochastic_vector, int sinktime){ +void PLEGMA_Vector::pack_fermion_to_sink(std::vector*> &stochastic_vector, int sinktime){ PLEGMA_Vector stmp; stmp.zero_where(DEVICE); stmp.zero_where(HOST); - PLEGMA_Vector temporary; + PLEGMA_Vector temporary4D; + PLEGMA_Vector3D temporary3D; for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - temporary.copy(*stochastic_vector[timeidx], HOST); - temporary.load(); - stmp.absorbTimeSlice(temporary, sinktime, false); + temporary4D.copy(*stochastic_vector[timeidx], HOST); + temporary4D.load(); + temporary3D.absorb(temporary4D, sinktime ); + temporary4D.absorb(temporary3D, timeidx ); + stmp.absorbTimeslice(temporary4D, timeidx, false); } this->copy(stmp); @@ -415,7 +441,7 @@ namespace plegma{ checkQudaError(); } - // vec3D <- vec4D + // vec3D <- prop4D template void PLEGMA_Vector3D::absorb(PLEGMA_Propagator &prop, int global_it, int nu , int c2, bool broadcast){ if(global_it >= HGC_totalL[3]) PLEGMA_error("The global time slice you provided exceed the temporal extent\n"); @@ -455,6 +481,35 @@ namespace plegma{ } + // vec3D <- vec4D + template + void PLEGMA_Vector3D::absorb(PLEGMA_Vector &prop, int global_it, bool broadcast){ + if(global_it >= HGC_totalL[3]) PLEGMA_error("The global time slice you provided exceed the temporal extent\n"); + int my_it = global_it - HGC_procPosition[3] * HGC_localL[3]; + bool is_myIt = (my_it >= 0) && ( my_it < HGC_localL[3] ); + this->activeTimeSlice = is_myIt; + int V3 = HGC_localVolume/HGC_localL[3]; + int V4 = HGC_localVolume; + Float *pointer_src = NULL; + Float *pointer_dst = NULL; + for(int mu = 0 ; mu < N_SPINS ; mu++) + for(int c1 = 0 ; c1 < N_COLS ; c1++) + { + pointer_dst = (this->d_elem + mu*N_COLS*V3*2 + c1*V3*2); + if(is_myIt){ + pointer_src = (prop.D_elem() + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); + qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + } + else{ + qudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); + } + } + + checkQudaError(); + + } + + template std::vector PLEGMA_Vector3D::rms(std::vector listR2, const site& sourceposition) const{ From db3716b18d7e45a8f72168cba077247a6cbcf34c Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 9 Dec 2022 10:11:32 +0100 Subject: [PATCH 013/168] N J Npi calculation --- include/PLEGMA_Propagator.h | 2 +- lib/PLEGMA_Propagator.cu | 2 +- plegma/nucleon_3pt_n_npi.cpp | 841 +++++++++++++++++++++++++++++++++++ 3 files changed, 843 insertions(+), 2 deletions(-) create mode 100644 plegma/nucleon_3pt_n_npi.cpp diff --git a/include/PLEGMA_Propagator.h b/include/PLEGMA_Propagator.h index 8716bbc1..d164a398 100644 --- a/include/PLEGMA_Propagator.h +++ b/include/PLEGMA_Propagator.h @@ -60,7 +60,7 @@ namespace plegma { @param PLEGMA_Propagator in initial propagator to be broadcasted @param int sinktimeslice the sinktime slice to be broadcasted **/ - void pack_propagator_as_sink(PLEGMA_Propagator in, int sinktimeslice); + void pack_propagator_as_sink(PLEGMA_Propagator &in, int sinktimeslice); diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index cb5c2e94..1ecc35c4 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -99,7 +99,7 @@ void PLEGMA_Propagator::applyBoundaries_device(int t0){ apply_boundaries(this->d_elem, t0); } template -void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator in, int sinktimeslice){ +void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator &in, int sinktimeslice){ for (int isc=0; isc<12; ++isc){ PLEGMA_Vector stmp; diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp new file mode 100644 index 00000000..a3ebff87 --- /dev/null +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -0,0 +1,841 @@ +#include +#include + +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) saveTuneCache(false); TIME(fnc) + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename","momlisttwopt-filename","momlistthreept-filename", + "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space", "tSinks","Projs", "threep-filename","confnumber", "nstochSamples"}; + + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *coherent_source_table_timeslice ){ + source.apply_phase(); + source.apply_sign(diagram_name); + source.applyBoundaryConditions( true , n_coherent_source, coherent_source_table_timeslice); + source.normalize_nstoch(n_stochastic_samples); + source.writeHDF5( outputFilename ); + + } + + + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *coherent_source_table_timeslice + ){ + source.apply_phase(); + source.apply_sign(diagram_name); + source.applyBoundaryConditions( true, n_coherent_source, coherent_source_table_timeslice ); + source.writeHDF5( outputFilename ); + + } + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name + ){ + source.apply_phase(); + source.apply_sign(diagram_name); + source.applyBoundaryConditions( true ); + source.writeHDF5( outputFilename ); + } + + +int main(int argc, char **argv) { + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + std::vector mu_s; + std::vector mu_c; + int rand_seed1=1234; + int confnumber_int; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i glist_source_nucleon={CG_5}; + std::vector glist_sink_nucleon={CG_5}; + + std::vector glist_sink_meson={G_5}; + std::vector glist_source_meson={G_5}; + + std::vector glist_source_nucleon_unpaired={ID}; + std::vector glist_sink_nucleon_unpaired={ID}; + std::vector glist_insertion = {ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4};//,S12,S13,S23,S41,S42,S43}; + + std::vector gammas = {ONE,G1,G2,G3,G4,G5,G5G1,G5G2,G5G3,G5G4}; + + + int n_stochastic_samples; + + + auto add_options = [&](Options& options) { + options.set("src-input-file", "Use the file to update option at every source. The file searched is [src-input-file]+str(n) where n is the source (0, 1, ...)", verbosity, srcInputFile); + options.set("start-src", "The index of the source position where to start the calculation", verbosity, startSource); + options.set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + options.set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + options.set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); + }; + //=========================================================================================================// + initializePLEGMA(); + + { + PLEGMA_Gauge smearedGauge(BOTH); + PLEGMA_Gauge contractGauge(BOTH); + { + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + // Gauge for contractions + contractGauge.copy(gauge); + // apply boundary conditions since is needed for the covariant derivative + applyBoundaryConditions(contractGauge,true); + } + + updateOptions(LIGHT); + TIME(QUDA_solver solver(mu)); + + std::string given_twop_filename = twop_filename; + std::string given_threep_filename = threep_filename; + + //Get the confnumber for latfile + char *ssource; + asprintf(&ssource,"%04d", confnumber_int); + std::string confnumber= ssource; + free(ssource); + + + //Reading the momentum lists + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + momList sourcemomentumList_threept(4,pathListMomenta_threept,{1,2,3,}); + PLEGMA_printf("N momenta in sourcemomentumList: %d",sourcemomentumList_threept.size()); + //We have four types of momenta in the list here + //The first three entries are the pi2 pion source momentum + //The second three entries are the pf1 nucleon sink momentum + //The third three entries are the pf2 pion sink momentum (it is assumed that pf2 is the same as -pf1) + //The fourth three entries are the pc momentum at the insertion + //pf1 + pf2 = 0, momentum at the sink is zero , the the pion momentum + //at sink follows from the nucleon momentum + //In addition the following momentum conversations are imposed + //pi1 + pi2 = pc so the momentum phase factor is calculated as pc-pi2 + //We define the list of momenta such that the total momentum should be the [2] \ + //column, the pc, and of coarse it is understand that this refers to the source only. + //At the sink we have always zero momentum + + + + momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); + //For the twopoint functions we have also three momentum + //first is pi2 + //second is pf1 + //third is pf2 + //and in this case the total momentum is defined as the sum of pf1 and pf2 + //to get pi1 we have to subtract pi2 from the total momentum + + + if(sourcemomentumList_twopt.empty()) + PLEGMA_error("twopt momentumList empty"); + if(sourcemomentumList_threept.empty()) + PLEGMA_error("threept momentumList empty"); + + std::vector> mpi2_twopt = sourcemomentumList_twopt.uniq_p(0); + momList list_mpi2_twopt(1,{mpi2_twopt,},{0,}); + + std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); + momList list_mpi2_threept(1,{mpi2_threept,},{0,}); + + std::vector> mpf1_threept = sourcemomentumList_threept.uniq_p(1); + momList list_mpf1_threept(1,{mpf1_threept,},{0,}); + + std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); + momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); + + std::vector> mpc = sourcemomentumList_threept.uniq_p(3); + momList list_mpc(1,{mpc,},{0,}); + + + PLEGMA_Vector vectorSource_stochastic; + vectorSource_stochastic.randInit(rand_seed1); + + //Computing with ubaru insertion + //Step (1) produce the stochastic sample + //Step (2) produce standard point to all propagators + //Step (3) produce sequential through the source + //Step (4) produce stochastic propagators pieces + //Step (5) doing the recombination + //Step (6) doing the one end trick calculation for the Z diagrams + + std::vector*> stochastic_sources; + + for(int i=0; i< n_stochastic_samples; ++i) { + stochastic_sources.push_back(new PLEGMA_Vector(HOST)); + vectorSource_stochastic.stochastic_Z(nroots); + vectorSource_stochastic.unload(); + stochastic_sources[i]->copy(vectorSource_stochastic,HOST); + vectorSource_stochastic.load(); + } + + for(int isource = startSource; isource < numSourcePositions; isource++){ + + site& source = sourcePositions[isource]; + + site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); + updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); + + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source[DIM_T]); + + asprintf(&ssource,"sx%02dsy%02dsz%02dst%03d", sourcePositions[isource][0], sourcePositions[isource][1], sourcePositions[isource][2], sourcePositions[isource][3]); + std::string sourcepositiontext= (std::string)"_" + ssource; + free(ssource); + + + auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, + double run_mu, WHICHFLAVOR fl, int nSmear, bool finalize) { + // ensuring mu value + if(mu != run_mu) { + updateOptions(fl); + mu = run_mu; + solver.UpdateSolver(); + } + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorInOut; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut.absorb(vector2,source[DIM_T]); + } + // Inverting + PLEGMA_printf("Going to invert %s for component %d\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + TIME(solver.solve(vectorInOut, vectorInOut)); + + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + + if(prop_SL.getAllocation() != NONE) { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorInOut); + prop_SL.absorb(vectorAuxF, isc/3, isc%3); + } + { // Smearing the solution + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop_SS.absorb(vectorAuxF, isc/3, isc%3); + } + } + if(finalize) { + prop_SS.rotateToPhysicalBase_device(run_mu/abs(run_mu)); + prop_SS.applyBoundaries_device(source[DIM_T]); + } + }; + + PLEGMA_Propagator propUP; + PLEGMA_Propagator propDN; + + PLEGMA_Propagator propUP_SL; + PLEGMA_Propagator propDN_SL; + + + PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1_twopt); + TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + + PLEGMA_ScattCorrelator corrN0(sourcePositions[isource], list_mpf1_twopt); + TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + + bool computed_light = false; + // If twop_filename exists we hold the computation of the light props + if(access( twop_filename.c_str(), F_OK ) == -1) { + TIME(computePropagator(propUP, propUP_SL, mu_ud, LIGHT, nsmearGauss, false)); + TIME(computePropagator(propDN, propDN_SL, -mu_ud, LIGHT, nsmearGauss, false)); + computed_light = true; + } + + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + + } + + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } + + //We implement the UD part first + //The neutron piplus at the source + + + int sequential_time_source=source[DIM_T]; + + //We implement the following factors in this part of the calculation + //source piplus + //B9-12 + std::vector*> reductions_UU_V3_GAMMAC_TUD; + + //W17,19 + std::vector*> reductions_DD_V4_GAMMAF1D_TUD; + + //W18,20 + std::vector*> reductions_DD_V2_GAMMAF1D_TUD; + + //W21,23 + std::vector*> reductions_DD_V2_GAMMAF1TUD_U; + + //W22,24 + std::vector*> reductions_DD_V2_GAMMAF1U_TUD; + + //source pizero u + //B3-6 + std::vector*> reductions_UU_V3_GAMMAC_TUU; + + //W5,6 + std::vector*> reductions_DD_V4_GAMMAF1D_TUU; + + //W7,8 + std::vector*> reductions_DD_V2_GAMMAF1D_TUU; + + //W13,15 + std::vector*> reductions_DD_V2_GAMMAF1TUU_U; + + //W14,16 + std::vector*> reductions_DD_V2_GAMMAF1U_TUU; + + //source pizero d + + //B7,8 + std::vector*> reductions_UU_V3_GAMMAC_TDD; + + //W10,12 + std::vector*> reductions_DD_V4_GAMMAF1TDD_U; + + //W9,11 + std::vector*> reductions_DD_V2_GAMMAF1TDD_U; + + + + + for(int i=0; i< n_stochastic_samples; ++i) { + for (int j=0; j(source_reduction, list_mpc)); + + reductions_UU_V3_GAMMAC_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + + reductions_UU_V3_GAMMAC_TDD.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + + + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors V3"); + exit(1); + } + for (int k=0; k(source_reduction, list_mpf1_threept)); + reductions_DD_V2_GAMMAF1D_TUD.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + reductions_DD_V2_GAMMAF1TUD_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_DD_V2_GAMMAF1U_TUD.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + reductions_DD_V4_GAMMAF1D_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_DD_V2_GAMMAF1D_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + reductions_DD_V2_GAMMAF1TUU_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_DD_V2_GAMMAF1U_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + + reductions_DD_V2_GAMMAF1TDD_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_DD_V4_GAMMAF1TDD_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + + + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors V2 V4"); + exit(1); + } + } + } + } + + //We first have a loop over all unique the source meson momentum p_i2 + for (int i_mpi2=0; i_mpi2> mptot_filt = filtered_sourcemomentumList.uniq_p(4); + std::vector> mpi2_filt ; + mpi2_filt.assign(mptot_filt.size(),momentum_i2); + momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); + + PLEGMA_ScattCorrelator reductionsT1(source_reduction, sourcemomentumList_threept.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2(source_reduction, sourcemomentumList_threept.uniq_p(1)); + + + PLEGMA_Propagator propTS; + + //we first implemenet UD + //Ensure mu is positive + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propDN, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, sequential_time_source); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vector2.mulMomentumPhases(momentum_i2,1); + vectorAuxD.absorb(vector2,sequential_time_source); + } + vectorAuxD2.absorbTimeslice(vectorAuxD,sequential_time_source, false); + + //Perform multiplication with glist_sink_meson[0] + vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); + + //Computing sequential propagators UD T_fii with insertion + //glist_sink_meson[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,+1); + //performing smearing + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS.absorb(vectorAuxF, isc/3, isc%3); + } + + PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus2(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus3(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus4(source, list_mpi2ptot); + + corrTproton_neutronpiplus1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); + + corrTproton_neutronpiplus2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq12"); + + corrTproton_neutronpiplus3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq13"); + + corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS, propUP, propDN)); + TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS, propDN, propUP)); + TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propTS, propDN)); + TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propDN, propTS)); + TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + + //creating factors + + for (int i=0; iV3( vectorSource_stochastic, glist_insertion, propTS, true)); + + + for (int k=0; k= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; + PLEGMA_Propagator propTS_as_sink; + propTS_as_sink.pack_propagator_as_sink(propTS, global_fixSinkTime); + + PLEGMA_Propagator propSINGLE_as_sink; + propSINGLE_as_sink.pack_propagator_as_sink(propDN, global_fixSinkTime); + + vectorSource_stochastic.apply_gamma5(); + + //V2 + TIME(reductions_DD_V2_GAMMAF1D_TUD[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + //V4 + TIME(reductions_DD_V4_GAMMAF1D_TUD[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V4( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + + propSINGLE_as_sink.pack_propagator_as_sink(propUP, global_fixSinkTime); + + //V2 + TIME(reductions_DD_V2_GAMMAF1TUD_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propTS_as_sink, propSINGLE_as_sink, false)); + TIME(reductions_DD_V2_GAMMAF1U_TUD[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + }//loop over source sink separations + + }//loop over stochastic samples + + //pi zero at the source (U part) + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propUP, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, sequential_time_source); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vector2.mulMomentumPhases(momentum_i2,1); + vectorAuxD.absorb(vector2,sequential_time_source); + } + vectorAuxD2.absorbTimeslice(vectorAuxD,sequential_time_source, false); + + //Perform multiplication with glist_sink_meson[0] + vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); + + //Computing sequential propagators UD T_fii with insertion + //glist_sink_meson[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert UP for sequential propagator UP for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,+1); + //performing smearing + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS.absorb(vectorAuxF, isc/3, isc%3); + } + + PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); + + corrTproton_protonpizero1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq21"); + + corrTproton_protonpizero2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq22"); + + corrTproton_protonpizero3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq23"); + + corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS, propUP, propDN)); + TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS, propDN, propUP)); + TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propDN, propTS)); + TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + + TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP, propDN, propTS)); + TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + + //creating factors + + for (int i=0; iV3( vectorSource_stochastic, glist_insertion, propTS, true)); + + + for (int k=0; k= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; + PLEGMA_Propagator propTS_as_sink; + propTS_as_sink.pack_propagator_as_sink(propTS, global_fixSinkTime); + + PLEGMA_Propagator propSINGLE_as_sink; + propSINGLE_as_sink.pack_propagator_as_sink(propDN, global_fixSinkTime); + + + //V2 + TIME(reductions_DD_V2_GAMMAF1D_TUU[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + //V4 + TIME(reductions_DD_V4_GAMMAF1D_TUU[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V4( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + + propSINGLE_as_sink.pack_propagator_as_sink(propUP, global_fixSinkTime); + + //V2 + TIME(reductions_DD_V2_GAMMAF1TUU_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propTS_as_sink, propSINGLE_as_sink, false)); + TIME(reductions_DD_V2_GAMMAF1U_TUU[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + }//loop over source sink separations + + }//loop over stochastic samples + + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propDN, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, sequential_time_source); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vector2.mulMomentumPhases(momentum_i2,1); + vectorAuxD.absorb(vector2,sequential_time_source); + } + vectorAuxD2.absorbTimeslice(vectorAuxD,sequential_time_source, false); + + //Perform multiplication with glist_sink_meson[0] + vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,-1); + + //Computing sequential propagators UD T_fii with insertion + //glist_sink_meson[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert DN for sequential propagator DN for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,-1); + //performing smearing + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS.absorb(vectorAuxF, isc/3, isc%3); + } + + PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); + + corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); + + corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propTS, propUP)); + TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, false )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP, propTS, propDN)); + TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); + + //creating factors + + for (int i=0; iV3( vectorSource_stochastic, glist_insertion, propTS, true)); + + + for (int k=0; k= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; + PLEGMA_Propagator propTS_as_sink; + propTS_as_sink.pack_propagator_as_sink(propTS, global_fixSinkTime); + + PLEGMA_Propagator propSINGLE_as_sink; + propSINGLE_as_sink.pack_propagator_as_sink(propDN, global_fixSinkTime); + + vectorSource_stochastic.apply_gamma5(); + + //V2 + TIME(reductions_DD_V2_GAMMAF1TDD_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + //V4 + TIME(reductions_DD_V4_GAMMAF1TDD_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V4( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + + + }//loop over source sink separations + + }//loop over stochastic samples + + }//loop over source meson momentum + + /********************************************* + * + * + * Part II Stochastic inversion and contraction + * with stochastic propagators + * this will do not involve any + * sequential propagator + * + *********************************************/ + + //UU stochastic piece + for (int i=0; i*> stochastic_propags; + + for(int i=0; i< HGC_totalL[DIM_T]; ++i) { + stochastic_propags.push_back(new PLEGMA_Vector(HOST)); + } + + + + //Step(1) load the souce from the host memory + PLEGMA_Vector vectorSource_stochastic; + PLEGMA_Vector vectorAuxD1,vectorAuxD2; + + vectorSource_stochastic.copy(*stochastic_sources[i],HOST); + vectorSource_stochastic.load(); + + vectorAuxD1.copy(vectorSource_stochastic); + + //Step(2) Smearing all the time slice + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(3) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(4) pick out a particular timeslice from the source + vectorAuxD2.absorbTimeslice(vectorAuxD1, timeidx); + + //Step(5) Solve + TIME(solver.solve(vectorAuxD2, vectorAuxD2)); + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2, +1)); + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(8) Save the propagator to the host memory + vectorAuxD2.unload(); + stochastic_propags[i]->copy(vectorAuxD2,HOST); + vectorAuxD2.load(); + + + } + + //Neutron pi plus V3 reductions + //V3 + + PLEGMA_Vector vectorPropagator_stochastic; + + + for (int k=0; k= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; + vectorPropagator_stochastic.pack_fermion_to_sink(stochastic_propags, global_fixSinkTime); + + //TIME(reductions_UU_V3_GAMMAC_TDD[i_mpi2*n_stochastic_samples+i]->V3( vectorPropagator_stochastic, glist_insertion, propUP, true)); + + + } + + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; + TIME( corrN0.apply_phase()); + TIME( corrN0.apply_sign("N")); + TIME( corrN0.applyBoundaryConditions( true )); + TIME( corrN0.writeHDF5(outfilename)); + + TIME( corrNP.apply_phase() ); + TIME( corrNP.apply_sign("N") ); + TIME( corrNP.applyBoundaryConditions( true ) ); + TIME( corrNP.writeHDF5(outfilename) ); + + } //keep track of + }//source positions + }//loop in finalize + finalize(); + return 0; +} From c9360367e885959c495386afd7e2feb5ba48e4d3 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sun, 11 Dec 2022 20:20:53 +0100 Subject: [PATCH 014/168] B,W diagrams for N- J-Npi --- include/PLEGMA_Propagator.h | 11 +- include/PLEGMA_Vector.h | 3 + lib/PLEGMA_Propagator.cu | 35 +- lib/PLEGMA_Vector.cu | 21 + plegma/nucleon_3pt_n_npi.cpp | 995 +++++++++++++++++++++++------------ 5 files changed, 722 insertions(+), 343 deletions(-) diff --git a/include/PLEGMA_Propagator.h b/include/PLEGMA_Propagator.h index d164a398..0da42c9a 100644 --- a/include/PLEGMA_Propagator.h +++ b/include/PLEGMA_Propagator.h @@ -60,7 +60,16 @@ namespace plegma { @param PLEGMA_Propagator in initial propagator to be broadcasted @param int sinktimeslice the sinktime slice to be broadcasted **/ - void pack_propagator_as_sink(PLEGMA_Propagator &in, int sinktimeslice); + void pack_propagator_as_sink(PLEGMA_Propagator &in, int sinktimeslice, int max_source_sink_separations, bool initial); + + /** + @brief packing the sinktime slice in all other time slices + @param the initial propagator to be broadcasted + @param PLEGMA_Propagator in initial propagator to be broadcasted + @param int sinktimeslice the sinktime slice to be broadcasted + **/ + void pack_propagator_from_source_to_sink(PLEGMA_Propagator &in, int sinktimeslice, int source_sink_separations, bool initial); + diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index e042fcb3..f9e15835 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -97,6 +97,9 @@ namespace plegma { void mulGV(PLEGMA_Vector &vecIn, PLEGMA_Su3field &u); void pack_fermion_to_sink(std::vector*> &stochastic_vector, int sinktime); + void pack_propagator_from_source_to_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize); + + void absorb(PLEGMA_Vector3D &vec, int global_it, bool broadcast=false); diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index 1ecc35c4..cb5928cf 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -99,25 +99,50 @@ void PLEGMA_Propagator::applyBoundaries_device(int t0){ apply_boundaries(this->d_elem, t0); } template -void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator &in, int sinktimeslice){ +void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator &in, int sinktimeslice, int source_sink_separation, bool initialize){ for (int isc=0; isc<12; ++isc){ PLEGMA_Vector stmp; PLEGMA_Vector3D vector1; - stmp.zero_where(DEVICE); - stmp.zero_where(HOST); + if (initialize==true){ + stmp.zero_where(DEVICE); + stmp.zero_where(HOST); + } vector1.absorb(in, sinktimeslice, isc/3, isc%3,true); - for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - stmp.absorbTimeslice(vector1, timeidx, false); + for (int dt=0; dtabsorb(stmp, isc/3, isc%3); } } +template +void PLEGMA_Propagator::pack_propagator_from_source_to_sink(PLEGMA_Propagator &in, int sinktimeslice, int source_sink_separation, bool initialize){ + for (int isc=0; isc<12; ++isc){ + + PLEGMA_Vector stmp; + PLEGMA_Vector3D vector1; + + if (initialize==true){ + stmp.zero_where(DEVICE); + stmp.zero_where(HOST); + } + + for (int dt=0; dtabsorb(stmp, isc/3, isc%3); + } +} + template diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 94615a1d..f45bfe8d 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -288,6 +288,27 @@ void PLEGMA_Vector::pack_fermion_to_sink(std::vector } +template +void PLEGMA_Vector::pack_propagator_from_source_to_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize){ + + PLEGMA_Vector stmp; + PLEGMA_Vector3D vector1; + + if (initialize==true){ + stmp.zero_where(DEVICE); + stmp.zero_where(HOST); + } + + for (int dt=0; dtcopy(stmp); +} + + template diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index a3ebff87..58341727 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -84,10 +84,8 @@ int main(int argc, char **argv) { std::vector glist_sink_nucleon_unpaired={ID}; std::vector glist_insertion = {ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4};//,S12,S13,S23,S41,S42,S43}; - std::vector gammas = {ONE,G1,G2,G3,G4,G5,G5G1,G5G2,G5G3,G5G4}; - - int n_stochastic_samples; + int max_source_sink_separations; auto add_options = [&](Options& options) { @@ -96,10 +94,14 @@ int main(int argc, char **argv) { options.set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); options.set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); options.set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); + options.set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); + }; //=========================================================================================================// initializePLEGMA(); + + { PLEGMA_Gauge smearedGauge(BOTH); PLEGMA_Gauge contractGauge(BOTH); @@ -186,27 +188,177 @@ int main(int argc, char **argv) { momList list_mpc(1,{mpc,},{0,}); + int parallel_sources=HGC_totalL[3]/max_source_sink_separations; + std::vector lookuptable; + + for (int i=0; i vectorSource_stochastic; vectorSource_stochastic.randInit(rand_seed1); //Computing with ubaru insertion //Step (1) produce the stochastic sample - //Step (2) produce standard point to all propagators - //Step (3) produce sequential through the source - //Step (4) produce stochastic propagators pieces - //Step (5) doing the recombination - //Step (6) doing the one end trick calculation for the Z diagrams + //Step (2) produce the stochastic propagators + //Step (3) produce standard point to all propagators + //Step (4) produce factors with point to all + //Step (5) produce sequential through the source with momenta pi2 + //Step (6) produce factors with the sequential + //Step (7) doing the recombination + //Step (8) doing the one end trick calculation for the Z diagrams std::vector*> stochastic_sources; - for(int i=0; i< n_stochastic_samples; ++i) { + std::vector*> stochastic_propags_UP; + + std::vector*> stochastic_propags_DN; + + + /****************************************************** + * + *Step 1: Producing the stochastic sources + * + ******************************************************/ + + for (int i=0; i(HOST)); vectorSource_stochastic.stochastic_Z(nroots); vectorSource_stochastic.unload(); stochastic_sources[i]->copy(vectorSource_stochastic,HOST); vectorSource_stochastic.load(); + } + /****************************************************** + * + *Step 2: Producing the stochastic propagators + * + ******************************************************/ + + if(mu<0) + { + mu = -mu; + solver.UpdateSolver(); + } + + + for (int isource=0; isource smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, timeSlice ); + for(int i=0; i< n_stochastic_samples; ++i) { + vectorSource_stochastic.copy( *stochastic_sources[i], HOST); + vectorSource_stochastic.load(); + PLEGMA_Vector vectorInOut, vectorAuxD1; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vectorInOut.copy(vectorSource_stochastic); + vector1.absorb(vectorInOut,timeSlice); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorInOut.absorb(vector2,timeSlice); + } + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); + + //Step(5) pick out a particular timeslice from the source + vectorInOut.absorbTimeslice(vectorAuxD1, timeSlice); + + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorInOut.unload(); + stochastic_propags_UP.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_UP[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + vectorInOut.load(); + + } + lookuptable[timeSlice]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; + } + } + } + } + + if(mu>0) + { + mu = -mu; + solver.UpdateSolver(); + } + + + + for (int isource=0; isource smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, timeSlice ); + for(int i=0; i< n_stochastic_samples; ++i) { + vectorSource_stochastic.copy( *stochastic_sources[i], HOST); + vectorSource_stochastic.load(); + PLEGMA_Vector vectorInOut,vectorAuxD1; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vectorInOut.copy(vectorSource_stochastic); + vector1.absorb(vectorInOut,timeSlice); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorInOut.absorb(vector2,timeSlice); + } + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); + + //Step(5) pick out a particular timeslice from the source + vectorInOut.absorbTimeslice(vectorAuxD1, timeSlice); + + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorInOut.unload(); + stochastic_propags_DN.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_DN[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + vectorInOut.load(); + + } + lookuptable[(source[3]+tSinks[k]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; + } + } + } + } + + + /****************************************************** + * + * Step 3: Computing the point to all propagators + * + ******************************************************/ + + for(int isource = startSource; isource < numSourcePositions; isource++){ site& source = sourcePositions[isource]; @@ -225,7 +377,7 @@ int main(int argc, char **argv) { auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, - double run_mu, WHICHFLAVOR fl, int nSmear, bool finalize) { + double run_mu, WHICHFLAVOR fl, int nSmear, site &source_location, bool finalize) { // ensuring mu value if(mu != run_mu) { updateOptions(fl); @@ -236,7 +388,7 @@ int main(int argc, char **argv) { PLEGMA_Vector vectorInOut; { // Smearing the source PLEGMA_Vector3D vector1, vector2; - vector1.pointSource(source, isc/3, isc%3, DEVICE); + vector1.pointSource(source_location, isc/3, isc%3, DEVICE); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); vectorInOut.absorb(vector2,source[DIM_T]); } @@ -277,52 +429,77 @@ int main(int argc, char **argv) { } }; - PLEGMA_Propagator propUP; - PLEGMA_Propagator propDN; + PLEGMA_Propagator propUP_SS_packed; + PLEGMA_Propagator propDN_SS_packed; + + PLEGMA_Propagator propUP_SL_packed; + PLEGMA_Propagator propDN_SL_packed; - PLEGMA_Propagator propUP_SL; - PLEGMA_Propagator propDN_SL; + - PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1_twopt); - TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + for (int i=0; i propUP_SS; + PLEGMA_Propagator propDN_SS; - PLEGMA_ScattCorrelator corrN0(sourcePositions[isource], list_mpf1_twopt); - TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + PLEGMA_Propagator propUP_SL; + PLEGMA_Propagator propDN_SL; - bool computed_light = false; - // If twop_filename exists we hold the computation of the light props - if(access( twop_filename.c_str(), F_OK ) == -1) { - TIME(computePropagator(propUP, propUP_SL, mu_ud, LIGHT, nsmearGauss, false)); - TIME(computePropagator(propDN, propDN_SL, -mu_ud, LIGHT, nsmearGauss, false)); - computed_light = true; - } + site& source_local = sourcePositions[isource]; + source_local[3]=(sourcePositions[isource][3]+i*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - //Computing T reductions+recombination - { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); + site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + source_local_reduction[3]=(sourcePositions[isource][3]+i*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - } + + PLEGMA_ScattCorrelator corrNP(source_local, list_mpf1_twopt); + TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + + PLEGMA_ScattCorrelator corrN0(source_local, list_mpf1_twopt); + TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + + bool computed_light = false; + // If twop_filename exists we hold the computation of the light props + if(access( twop_filename.c_str(), F_OK ) == -1) { + TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); + TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); + computed_light = true; + } + + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + + } //Computing T reductions+recombination - { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); + { + PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } + + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); + propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); + + propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); + propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); + + } //We implement the UD part first @@ -331,117 +508,178 @@ int main(int argc, char **argv) { int sequential_time_source=source[DIM_T]; - //We implement the following factors in this part of the calculation - //source piplus - //B9-12 - std::vector*> reductions_UU_V3_GAMMAC_TUD; + //We can compute V2 contractions for B and V3 contraction for W first + //without having to compute it for all the iterations in the loop + //over the sequential momentum + //Provided we have the same pf1,pf2 pairs for all pi2 sequential momentum + //For the saved V2 and V3 reductions we have to use all possible unique pf1 and pf2 - //W17,19 - std::vector*> reductions_DD_V4_GAMMAF1D_TUD; + //Here the prefix UU means that reduction is based phi and xi, without the gamma_5 + //We replace U(x_f2,x_f1) with phi(x_f2) xi^dagger(x_f1) + //phi goes to V2 reduction and xi goes to V3 reduction - //W18,20 - std::vector*> reductions_DD_V2_GAMMAF1D_TUD; + std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U;//implemented - //W21,23 - std::vector*> reductions_DD_V2_GAMMAF1TUD_U; + //Here the prefix DD means that reduction is based phi*g5 and xi*g5 + //We replace D(x_f2,x_f1) with xi(x_f2)*gamma_5* phi^dagger(x_f1) *gamma_5 + //phi goes to V3 reduction and xi goes to V2 reduction - //W22,24 - std::vector*> reductions_DD_V2_GAMMAF1U_TUD; + std::vector*> reductions_DD_V3_GAMMAF2D;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented - //source pizero u - //B3-6 - std::vector*> reductions_UU_V3_GAMMAC_TUU; + for(int i=0; i< n_stochastic_samples; ++i) { + for (int k=0; k< tSinks.size(); ++k){ + try + { + reductions_DD_V2_GAMMAF1U_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_UU_V2_GAMMAF1D_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_UU_V4_GAMMAF1U_D.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); - //W5,6 - std::vector*> reductions_DD_V4_GAMMAF1D_TUU; + reductions_UU_V3_GAMMAF2U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + reductions_DD_V3_GAMMAF2D.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); - //W7,8 - std::vector*> reductions_DD_V2_GAMMAF1D_TUU; + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors"); + exit(1); + } + } + } - //W13,15 - std::vector*> reductions_DD_V2_GAMMAF1TUU_U; + for (int i_sample=0; i_sample*> reductions_DD_V2_GAMMAF1U_TUU; + PLEGMA_Vector stochastic_source; + stochastic_source.copy(*stochastic_sources[i_sample],HOST); + stochastic_source.load(); - //source pizero d - - //B7,8 - std::vector*> reductions_UU_V3_GAMMAC_TDD; - //W10,12 - std::vector*> reductions_DD_V4_GAMMAF1TDD_U; + for (int k=0; k< tSinks.size();++k){ - //W9,11 - std::vector*> reductions_DD_V2_GAMMAF1TDD_U; - + stochastic_source.apply_gamma5(); + //For U(xf1,xf2) + //B3,B5,B9,B11 + PLEGMA_Propagator propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + { + for (int j=0; j= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + } + } + TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); - for(int i=0; i< n_stochastic_samples; ++i) { - for (int j=0; j(source_reduction, list_mpc)); - - reductions_UU_V3_GAMMAC_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); - reductions_UU_V3_GAMMAC_TDD.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + //B4,B6 + //B10,B12 + TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, false)); + //W5,W6,W7,W8 + //W9,W10,W11,W12,W17,W18,W19,W20 + PLEGMA_Vector stochastic_propagator_packed; + for (int j=0; j temporary; + temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); + } - } - catch(std::bad_alloc&){ - PLEGMA_printf("Memory allocation fails to store factors V3"); - exit(1); - } - for (int k=0; k(source_reduction, list_mpf1_threept)); - reductions_DD_V2_GAMMAF1D_TUD.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + TIME(reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k]->V3( stochastic_propagator_packed, glist_insertion, propUP_SL_packed, true)); - reductions_DD_V2_GAMMAF1TUD_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); - reductions_DD_V2_GAMMAF1U_TUD.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + //For D(xf1,xf2) - reductions_DD_V4_GAMMAF1D_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); - reductions_DD_V2_GAMMAF1D_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + stochastic_propagator_packed.apply_gamma5(); - reductions_DD_V2_GAMMAF1TUU_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); - reductions_DD_V2_GAMMAF1U_TUU.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + for (int j=0; j temporary; + temporary.copy(*stochastic_propags_UP[lookuptable[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); + } - reductions_DD_V2_GAMMAF1TDD_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); - reductions_DD_V4_GAMMAF1TDD_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + stochastic_propagator_packed.apply_gamma5(); + //W13,W14,W15,W16 + //W21,W22,W23,W24 + TIME(reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k]->V3( stochastic_propagator_packed, glist_insertion, propDN_SL_packed, true)); - } - catch(std::bad_alloc&){ - PLEGMA_printf("Memory allocation fails to store factors V2 V4"); - exit(1); - } - } - } - } + //B7,B8 + //B1,B2 + TIME(reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k]->V2( stochastic_source, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); + + } //end of for source sink separations + } //end of for stochastic samples - //We first have a loop over all unique the source meson momentum p_i2 - for (int i_mpi2=0; i_mpi2 reductionsV2(source_reduction, list_mpf1_threept); - std::vector> mptot_filt = filtered_sourcemomentumList.uniq_p(4); - std::vector> mpi2_filt ; - mpi2_filt.assign(mptot_filt.size(),momentum_i2); - momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); + std::vector> mptot_filt = filtered_sourcemomentumList.uniq_p(4); + std::vector> mpi2_filt ; + mpi2_filt.assign(mptot_filt.size(),momentum_i2); + momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); + + PLEGMA_ScattCorrelator reductionsT1(source_reduction, mpf1_threept); + PLEGMA_ScattCorrelator reductionsT2(source_reduction, mpf1_threept); + + PLEGMA_ScattCorrelator reductionsV3(source_reduction, list_mpc); + + + PLEGMA_ScattCorrelator corrB3(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB4(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB6(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrW5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW6(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW8(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrW13(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW14(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW15(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW16(source, filtered_sourcemomentumList); + + corrB3.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); + corrB4.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); + corrB5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B5"); + corrB6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B6"); + + + corrW5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W5"); + corrW6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W6"); + corrW7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W7"); + corrW8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W8"); + + + corrW13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W13"); + corrW14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W14"); + corrW15.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); + corrW16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); - PLEGMA_ScattCorrelator reductionsT1(source_reduction, sourcemomentumList_threept.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2(source_reduction, sourcemomentumList_threept.uniq_p(1)); + PLEGMA_Propagator propTS_SS_packed; + + for (int i_source_parallel=0; i_source_parallel < HGC_totalL[3]/max_source_sink_separations;++i_source_parallel){ + PLEGMA_Propagator propTS; //we first implemenet UD @@ -451,24 +689,23 @@ int main(int argc, char **argv) { solver.UpdateSolver(); } - //pi plus at the source for(int isc = 0 ; isc < 12 ; isc++){ PLEGMA_Vector vectorAuxD; PLEGMA_Vector vectorAuxF; PLEGMA_Vector vectorAuxD2; //Performing the smearing - - { + { PLEGMA_Vector3D vector1, vector2; - vectorAuxF.absorb(propDN, isc/3, isc%3); + vectorAuxF.absorb(propUP_SS_packed, isc/3, isc%3); vectorAuxD.copy(vectorAuxF); - vector1.absorb( vectorAuxD, sequential_time_source); + vector1.absorb( vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vector2.mulMomentumPhases(momentum_i2,1); - vectorAuxD.absorb(vector2,sequential_time_source); + vectorAuxD.absorb(vector2, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } - vectorAuxD2.absorbTimeslice(vectorAuxD,sequential_time_source, false); + + vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_sink_meson[0] vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); @@ -486,92 +723,148 @@ int main(int argc, char **argv) { TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); vectorAuxF.copy(vectorAuxD); propTS.absorb(vectorAuxF, isc/3, isc%3); + } - PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_neutronpiplus2(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_neutronpiplus3(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_neutronpiplus4(source, list_mpi2ptot); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + - corrTproton_neutronpiplus1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); - corrTproton_neutronpiplus2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq12"); + PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); - corrTproton_neutronpiplus3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq13"); + corrTproton_protonpizero1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq21"); - corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); + corrTproton_protonpizero2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq22"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS, propUP, propDN)); - TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + corrTproton_protonpizero3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq23"); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS, propDN, propUP)); - TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propTS, propDN)); - TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); + TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, false, true, false )); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propDN, propTS)); - TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, false, false, true )); - //creating factors + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, false, false, false )); - for (int i=0; iV3( vectorSource_stochastic, glist_insertion, propTS, true)); + PLEGMA_Vector stochastic_propagator_packed; + for (int k=0; k propTS_SS_packed_to_sink; + { + for (int i_source_parallel=0; i_source_parallel= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propTS_SS_packed_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + } + } - for (int k=0; k propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + { + for (int j=0; j= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + } + } + + for (int i_sample=0; i_sample temporary; + temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + + stochastic_propagator_packed.apply_gamma5(); + + //V3 + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true)); + TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true)); + TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true)); + TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true)); + TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true)); - int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; - PLEGMA_Propagator propTS_as_sink; - propTS_as_sink.pack_propagator_as_sink(propTS, global_fixSinkTime); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + stochastic_propagator_packed.apply_gamma5(); - PLEGMA_Propagator propSINGLE_as_sink; - propSINGLE_as_sink.pack_propagator_as_sink(propDN, global_fixSinkTime); - vectorSource_stochastic.apply_gamma5(); - //V2 - TIME(reductions_DD_V2_GAMMAF1D_TUD[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - //V4 - TIME(reductions_DD_V4_GAMMAF1D_TUD[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V4( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true)); + TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true)); - propSINGLE_as_sink.pack_propagator_as_sink(propUP, global_fixSinkTime); + TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - //V2 - TIME(reductions_DD_V2_GAMMAF1TUD_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propTS_as_sink, propSINGLE_as_sink, false)); - TIME(reductions_DD_V2_GAMMAF1U_TUD[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true)); + TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true)); - }//loop over source sink separations + TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false));//checked + + TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true)); + TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true)); + + TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false));//checked + TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true)); + TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true)); }//loop over stochastic samples - //pi zero at the source (U part) + }//loop over source sink separations + + // ensuring mu positive + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + for (int i_source_parallel=0; i_source_parallel < HGC_totalL[3]/max_source_sink_separations;++i_source_parallel){ + + PLEGMA_Propagator propTS; + + //we first implemenet UU pizero UP + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + //pi plus at the source for(int isc = 0 ; isc < 12 ; isc++){ PLEGMA_Vector vectorAuxD; PLEGMA_Vector vectorAuxF; PLEGMA_Vector vectorAuxD2; //Performing the smearing - { PLEGMA_Vector3D vector1, vector2; - vectorAuxF.absorb(propUP, isc/3, isc%3); + vectorAuxF.absorb(propDN_SS_packed, isc/3, isc%3); vectorAuxD.copy(vectorAuxF); - vector1.absorb( vectorAuxD, sequential_time_source); + vector1.absorb( vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vector2.mulMomentumPhases(momentum_i2,1); - vectorAuxD.absorb(vector2,sequential_time_source); + vectorAuxD.absorb(vector2, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } - vectorAuxD2.absorbTimeslice(vectorAuxD,sequential_time_source, false); + + vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_sink_meson[0] vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); @@ -580,7 +873,7 @@ int main(int argc, char **argv) { //Computing sequential propagators UD T_fii with insertion //glist_sink_meson[0]=gamma_5 and momentum momentum_i2 - PLEGMA_printf("Going to invert UP for sequential propagator UP for component %d\n", isc); + PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); //performing the inversion TIME(solver.solve(vectorAuxD, vectorAuxD)); //performing rotation to physical base @@ -589,92 +882,165 @@ int main(int argc, char **argv) { TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); vectorAuxF.copy(vectorAuxD); propTS.absorb(vectorAuxF, isc/3, isc%3); + } - PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + - corrTproton_protonpizero1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq21"); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus2(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus3(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus4(source, list_mpi2ptot); - corrTproton_protonpizero2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq22"); + corrTproton_neutronpiplus1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); - corrTproton_protonpizero3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq23"); + corrTproton_neutronpiplus2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq12"); - corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); + corrTproton_neutronpiplus3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq13"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS, propUP, propDN)); - TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS, propDN, propUP)); - TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); + TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, false, true, false )); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propDN, propTS)); - TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, false, false, true )); - TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP, propDN, propTS)); - TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT1, false, false, false )); - //creating factors + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true)); - for (int i=0; i corrB9(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrB10(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrB11(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrB12(source, list_mpf1_threept); - vectorSource_stochastic.copy(*stochastic_sources[i],HOST); - vectorSource_stochastic.load(); + PLEGMA_ScattCorrelator corrW17(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrW18(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrW19(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrW20(source, list_mpf1_threept); - vectorSource_stochastic.apply_gamma5(); + PLEGMA_ScattCorrelator corrW21(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrW22(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrW23(source, list_mpf1_threept); + PLEGMA_ScattCorrelator corrW24(source, list_mpf1_threept); - //V3 - TIME(reductions_UU_V3_GAMMAC_TUU[i_mpi2*n_stochastic_samples+i]->V3( vectorSource_stochastic, glist_insertion, propTS, true)); + corrB9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B9"); + corrB10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B10"); + corrB11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B11"); + corrB12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B12"); + corrW17.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W17"); + corrW18.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W18"); + corrW19.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W19"); + corrW20.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W20"); - for (int k=0; k propTS_SS_packed_to_sink; + { + for (int i_source_parallel=0; i_source_parallel= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propTS_SS_packed_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + } + } - int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; - PLEGMA_Propagator propTS_as_sink; - propTS_as_sink.pack_propagator_as_sink(propTS, global_fixSinkTime); + PLEGMA_Propagator propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + { + for (int j=0; j= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + } + } + + for (int i_sample=0; i_sample stochastic_propagator_packed; + for (int i_source_parallel=0; i_source_parallel temporary; + temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + + stochastic_propagator_packed.apply_gamma5(); - PLEGMA_Propagator propSINGLE_as_sink; - propSINGLE_as_sink.pack_propagator_as_sink(propDN, global_fixSinkTime); + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true )); + TIME( corrB9.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true)); + TIME(corrB10.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true)); + TIME(corrB11.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true)); + TIME(corrB12.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true)); - //V2 - TIME(reductions_DD_V2_GAMMAF1D_TUU[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + stochastic_propagator_packed.apply_gamma5(); - //V4 - TIME(reductions_DD_V4_GAMMAF1D_TUU[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V4( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); + TIME(corrW17.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true)); + TIME(corrW19.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true)); - propSINGLE_as_sink.pack_propagator_as_sink(propUP, global_fixSinkTime); + TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); + TIME(corrW18.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true)); + TIME(corrW20.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true)); - //V2 - TIME(reductions_DD_V2_GAMMAF1TUU_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propTS_as_sink, propSINGLE_as_sink, false)); - TIME(reductions_DD_V2_GAMMAF1U_TUU[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); + TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false)); + TIME(corrW22.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true)); + TIME(corrW24.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true)); - }//loop over source sink separations + TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - }//loop over stochastic samples + TIME(corrW21.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true)); + TIME(corrW23.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true)); - for(int isc = 0 ; isc < 12 ; isc++){ + } //loop over stochastic samples + + } //loop over source sink separations + + for (int i_source_parallel=0; i_source_parallel < HGC_totalL[3]/max_source_sink_separations;++i_source_parallel){ + + PLEGMA_Propagator propTS; + + //we first implemenet DD pizero DN + if(mu>0) { + mu*=-1.; + solver.UpdateSolver(); + } + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ PLEGMA_Vector vectorAuxD; PLEGMA_Vector vectorAuxF; PLEGMA_Vector vectorAuxD2; //Performing the smearing - { PLEGMA_Vector3D vector1, vector2; - vectorAuxF.absorb(propDN, isc/3, isc%3); + vectorAuxF.absorb(propDN_SS_packed, isc/3, isc%3); vectorAuxD.copy(vectorAuxF); - vector1.absorb( vectorAuxD, sequential_time_source); + vector1.absorb( vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vector2.mulMomentumPhases(momentum_i2,1); - vectorAuxD.absorb(vector2,sequential_time_source); + vectorAuxD.absorb(vector2, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } - vectorAuxD2.absorbTimeslice(vectorAuxD,sequential_time_source, false); + + vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_sink_meson[0] vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); @@ -683,7 +1049,7 @@ int main(int argc, char **argv) { //Computing sequential propagators UD T_fii with insertion //glist_sink_meson[0]=gamma_5 and momentum momentum_i2 - PLEGMA_printf("Going to invert DN for sequential propagator DN for component %d\n", isc); + PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); //performing the inversion TIME(solver.solve(vectorAuxD, vectorAuxD)); //performing rotation to physical base @@ -692,149 +1058,104 @@ int main(int argc, char **argv) { TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); vectorAuxF.copy(vectorAuxD); propTS.absorb(vectorAuxF, isc/3, isc%3); + } - PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } - corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); + PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); - corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); + corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP, propTS, propUP)); - TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, false )); + corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP, propTS, propDN)); - TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, false )); - //creating factors + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); - for (int i=0; i corrB7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB8(source, filtered_sourcemomentumList); - vectorSource_stochastic.copy(*stochastic_sources[i],HOST); - vectorSource_stochastic.load(); + PLEGMA_ScattCorrelator corrW9(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW10(source,filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW11(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW12(source, filtered_sourcemomentumList); - //V3 - TIME(reductions_UU_V3_GAMMAC_TDD[i_mpi2*n_stochastic_samples+i]->V3( vectorSource_stochastic, glist_insertion, propTS, true)); + corrB7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); + corrB8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); + corrW9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W9"); + corrW10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W10"); + corrW11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W11"); + corrW12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W12"); - for (int k=0; k propTS_SS_packed_to_sink; + { + for (int i_source_parallel=0; i_source_parallel= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propTS_SS_packed_to_sink.pack_propagator_as_sink(propTS_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + } + } - int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; - PLEGMA_Propagator propTS_as_sink; - propTS_as_sink.pack_propagator_as_sink(propTS, global_fixSinkTime); - - PLEGMA_Propagator propSINGLE_as_sink; - propSINGLE_as_sink.pack_propagator_as_sink(propDN, global_fixSinkTime); - - vectorSource_stochastic.apply_gamma5(); - - //V2 - TIME(reductions_DD_V2_GAMMAF1TDD_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V2( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); - - //V4 - TIME(reductions_DD_V4_GAMMAF1TDD_U[(i_mpi2*n_stochastic_samples+i)*tSinks.size()+k]->V4( vectorSource_stochastic, glist_sink_nucleon, propSINGLE_as_sink, propTS_as_sink, false)); - - - }//loop over source sink separations - - }//loop over stochastic samples - - }//loop over source meson momentum - - /********************************************* - * - * - * Part II Stochastic inversion and contraction - * with stochastic propagators - * this will do not involve any - * sequential propagator - * - *********************************************/ - - //UU stochastic piece - for (int i=0; i propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + { + for (int j=0; j= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + } + } - std::vector*> stochastic_propags; + for (int i_sample=0; i_sample stochastic_propagator_packed; + for (int i_source_parallel=0; i_source_parallel temporary; + temporary.copy(*stochastic_propags_UP[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); - for(int i=0; i< HGC_totalL[DIM_T]; ++i) { - stochastic_propags.push_back(new PLEGMA_Vector(HOST)); - } + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + stochastic_propagator_packed.apply_gamma5(); + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true)); - //Step(1) load the souce from the host memory - PLEGMA_Vector vectorSource_stochastic; - PLEGMA_Vector vectorAuxD1,vectorAuxD2; + TIME(corrB7.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true)); + TIME(corrB8.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true)); - vectorSource_stochastic.copy(*stochastic_sources[i],HOST); - vectorSource_stochastic.load(); - - vectorAuxD1.copy(vectorSource_stochastic); - - //Step(2) Smearing all the time slice - TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - - //Step(3) We rotate the source to the physical basis - TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); - - PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); - for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - //Step(4) pick out a particular timeslice from the source - vectorAuxD2.absorbTimeslice(vectorAuxD1, timeidx); - - //Step(5) Solve - TIME(solver.solve(vectorAuxD2, vectorAuxD2)); - - //Step(6) We rotate back the propagator to the physical basis - TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2, +1)); - //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - - //Step(8) Save the propagator to the host memory - vectorAuxD2.unload(); - stochastic_propags[i]->copy(vectorAuxD2,HOST); - vectorAuxD2.load(); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + stochastic_propagator_packed.apply_gamma5(); + TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - } + TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true)); + TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true)); - //Neutron pi plus V3 reductions - //V3 - - PLEGMA_Vector vectorPropagator_stochastic; + TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - - for (int k=0; k= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true)); + TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true)); - int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; - vectorPropagator_stochastic.pack_fermion_to_sink(stochastic_propags, global_fixSinkTime); - - //TIME(reductions_UU_V3_GAMMAC_TDD[i_mpi2*n_stochastic_samples+i]->V3( vectorPropagator_stochastic, glist_insertion, propUP, true)); + } //loop over stochastic samples - - } + } //loop over tSinks + }//loop over mpi2 - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; - TIME( corrN0.apply_phase()); - TIME( corrN0.apply_sign("N")); - TIME( corrN0.applyBoundaryConditions( true )); - TIME( corrN0.writeHDF5(outfilename)); + }//loop over source sink - TIME( corrNP.apply_phase() ); - TIME( corrNP.apply_sign("N") ); - TIME( corrNP.applyBoundaryConditions( true ) ); - TIME( corrNP.writeHDF5(outfilename) ); - - } //keep track of - }//source positions }//loop in finalize finalize(); return 0; From e8268e58d414be6c19829c8efb9ab4f91dee55d5 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sun, 11 Dec 2022 22:52:56 +0100 Subject: [PATCH 015/168] working on the threept functions --- plegma/CMakeLists.txt | 6 + plegma/nucleon_3pt_n_npi.cpp | 464 +++++++++++++++++++++++------------ 2 files changed, 319 insertions(+), 151 deletions(-) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 708f62b2..c2a9c252 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -103,6 +103,10 @@ target_link_libraries(Dilution ${PLEGMA_LIBS}) cuda_add_executable(testLinksSmearings EXCLUDE_FROM_ALL testLinksSmearings.cpp) target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) +cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) +target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) + + cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) @@ -164,6 +168,8 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(piNdiagrams ${PLEGMA_LIBS}) cuda_add_executable(nucleon_delta_test EXCLUDE_FROM_ALL nucleon_delta_test.cpp) target_link_libraries(nucleon_delta_test ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi EXCLUDE_FROM_ALL nucleon_3pt_n_npi.cpp) + target_link_libraries(nucleon_3pt_n_npi ${PLEGMA_LIBS}) cuda_add_executable(piNdiagrams_oet piNdiagrams_oet.cpp) target_link_libraries(piNdiagrams_oet ${PLEGMA_LIBS}) cuda_add_executable(checking_Doet checking_Doet.cpp) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 58341727..9cef72cc 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -15,46 +15,27 @@ using namespace quda; static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename","momlisttwopt-filename","momlistthreept-filename", "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space", "tSinks","Projs", "threep-filename","confnumber", "nstochSamples"}; +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); -void produceOutput( PLEGMA_ScattCorrelator source, - std::string outputFilename, - std::string diagram_name, - int n_stochastic_samples, - int n_coherent_source, - int *coherent_source_table_timeslice ){ - source.apply_phase(); - source.apply_sign(diagram_name); - source.applyBoundaryConditions( true , n_coherent_source, coherent_source_table_timeslice); - source.normalize_nstoch(n_stochastic_samples); - source.writeHDF5( outputFilename ); - - } - - - -void produceOutput( PLEGMA_ScattCorrelator source, - std::string outputFilename, - std::string diagram_name, - int n_coherent_source, - int *coherent_source_table_timeslice - ){ - source.apply_phase(); - source.apply_sign(diagram_name); - source.applyBoundaryConditions( true, n_coherent_source, coherent_source_table_timeslice ); - source.writeHDF5( outputFilename ); - - } - -void produceOutput( PLEGMA_ScattCorrelator source, - std::string outputFilename, - std::string diagram_name - ){ - source.apply_phase(); - source.apply_sign(diagram_name); - source.applyBoundaryConditions( true ); - source.writeHDF5( outputFilename ); - } +} +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.writeHDF5( outputFilename )); +} int main(int argc, char **argv) { initializeOptions(argc, argv, true, listOpt); @@ -77,7 +58,6 @@ int main(int argc, char **argv) { std::vector glist_source_nucleon={CG_5}; std::vector glist_sink_nucleon={CG_5}; - std::vector glist_sink_meson={G_5}; std::vector glist_source_meson={G_5}; std::vector glist_source_nucleon_unpaired={ID}; @@ -248,7 +228,7 @@ int main(int argc, char **argv) { solver.UpdateSolver(); } - + int countindex=0; for (int isource=0; isource(HOST)); - stochastic_propags_UP[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + stochastic_propags_UP[countindex]->copy(vectorInOut, HOST); + countindex++; + //(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); vectorInOut.load(); } - lookuptable[timeSlice]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; + lookuptable[timeSlice]=countindex/n_stochastic_samples; } } } @@ -303,7 +285,7 @@ int main(int argc, char **argv) { } - + countindex=0; for (int isource=0; isource(HOST)); - stochastic_propags_DN[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + stochastic_propags_DN[countindex]->copy(vectorInOut, HOST); + countindex++; + + //stochastic_propags_DN[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); vectorInOut.load(); } - lookuptable[(source[3]+tSinks[k]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; + //lookuptable[(source[3]+tSinks[k]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; + lookuptable[timeSlice]=countindex/n_stochastic_samples; } } } @@ -641,40 +627,65 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV3(source_reduction, list_mpc); + std::vector*> corrB3,corrB4,corrB5,corrB6; + std::vector*> corrW5,corrW6,corrW7,corrW8; + std::vector*> corrW13,corrW14,corrW15,corrW16; - PLEGMA_ScattCorrelator corrB3(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrB4(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrB5(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrB6(source, filtered_sourcemomentumList); - - PLEGMA_ScattCorrelator corrW5(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW6(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW7(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW8(source, filtered_sourcemomentumList); - - PLEGMA_ScattCorrelator corrW13(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW14(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW15(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW16(source, filtered_sourcemomentumList); - - corrB3.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); - corrB4.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); - corrB5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B5"); - corrB6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B6"); - - - corrW5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W5"); - corrW6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W6"); - corrW7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W7"); - corrW8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W8"); + for (int k=0; k< tSinks.size(); ++k){ + try + { + corrB3.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrB4.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrB5.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrB6.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W13"); - corrW14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W14"); - corrW15.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); - corrW16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); + corrW5.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW6.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW7.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW8.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW13.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW14.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW15.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW16.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors"); + exit(1); + } + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"B3_deltat_%d",tSinks[k]); + corrB3[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B4_deltat_%d",tSinks[k]); + corrB4[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B5_deltat_%d",tSinks[k]); + corrB5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B6_deltat_%d",tSinks[k]); + corrB6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W5_deltat_%d",tSinks[k]); + corrW5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W6_deltat_%d",tSinks[k]); + corrW6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W7_deltat_%d",tSinks[k]); + corrW7[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W8_deltat_%d",tSinks[k]); + corrW8[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W13_deltat_%d",tSinks[k]); + corrW13[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W14_deltat_%d",tSinks[k]); + corrW14[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W15_deltat_%d",tSinks[k]); + corrW15[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W16_deltat_%d",tSinks[k]); + corrW16[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + free(ssource); + } PLEGMA_Propagator propTS_SS_packed; @@ -707,13 +718,13 @@ int main(int argc, char **argv) { vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); - //Perform multiplication with glist_sink_meson[0] - vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); + //Perform multiplication with glist_insertion[0] + vectorAuxD2.apply_gamma_scatt(glist_insertion[0]); //Perform rotation to the physical basis vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); //Computing sequential propagators UD T_fii with insertion - //glist_sink_meson[0]=gamma_5 and momentum momentum_i2 + //glist_insertion[0]=gamma_5 and momentum momentum_i2 PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); //performing the inversion TIME(solver.solve(vectorAuxD, vectorAuxD)); @@ -797,10 +808,10 @@ int main(int argc, char **argv) { //V3 TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true)); - TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true)); - TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true)); - TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true)); - TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true)); + TIME(corrB3[k]->B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true)); + TIME(corrB4[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true)); + TIME(corrB5[k]->B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true)); + TIME(corrB6[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -810,28 +821,47 @@ int main(int argc, char **argv) { TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true)); + TIME(corrW5[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true)); - TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true)); + TIME(corrW7[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true)); - TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true)); + TIME(corrW6[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true)); + TIME(corrW8[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false));//checked - TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true)); - TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true)); + TIME(corrW13[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true)); + TIME(corrW15[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true)); - TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true)); + TIME(corrW14[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true)); + TIME(corrW16[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true)); }//loop over stochastic samples }//loop over source sink separations + for (int k=0; k corrB9(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrB10(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrB11(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrB12(source, list_mpf1_threept); + std::vector*> corrB9,corrB10,corrB11,corrB12; + std::vector*> corrW17,corrW18,corrW19,corrW20; + std::vector*> corrW21,corrW22,corrW23,corrW24; - PLEGMA_ScattCorrelator corrW17(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrW18(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrW19(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrW20(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrW21(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrW22(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrW23(source, list_mpf1_threept); - PLEGMA_ScattCorrelator corrW24(source, list_mpf1_threept); + for (int k=0; k< tSinks.size(); ++k){ + try + { + corrB9.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrB10.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrB11.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrB12.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B9"); - corrB10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B10"); - corrB11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B11"); - corrB12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B12"); + corrW17.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW18.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW19.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW20.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW17.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W17"); - corrW18.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W18"); - corrW19.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W19"); - corrW20.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W20"); + corrW21.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW22.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW23.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW24.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors"); + exit(1); + } + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"B9_deltat_%d",tSinks[k]); + corrB3[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B10_deltat_%d",tSinks[k]); + corrB4[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B11_deltat_%d",tSinks[k]); + corrB5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B12_deltat_%d",tSinks[k]); + corrB6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W17_deltat_%d",tSinks[k]); + corrW5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W18_deltat_%d",tSinks[k]); + corrW6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W19_deltat_%d",tSinks[k]); + corrW7[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W20_deltat_%d",tSinks[k]); + corrW8[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W21_deltat_%d",tSinks[k]); + corrW13[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W22_deltat_%d",tSinks[k]); + corrW14[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W23_deltat_%d",tSinks[k]); + corrW15[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W24_deltat_%d",tSinks[k]); + corrW16[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + free(ssource); + + } - corrW21.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W21"); - corrW22.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W22"); - corrW23.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W23"); - corrW24.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W24"); for (int k=0; kB_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true)); + TIME(corrB10[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true)); + TIME(corrB11[k]->B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true)); + TIME(corrB12[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -994,26 +1056,46 @@ int main(int argc, char **argv) { TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW17.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true)); - TIME(corrW19.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true)); + TIME(corrW17[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true)); + TIME(corrW19[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW18.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true)); - TIME(corrW20.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true)); + TIME(corrW18[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true)); + TIME(corrW20[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW22.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true)); - TIME(corrW24.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true)); + TIME(corrW22[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true)); + TIME(corrW24[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME(corrW21.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true)); - TIME(corrW23.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true)); + TIME(corrW21[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true)); + TIME(corrW23[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true)); } //loop over stochastic samples } //loop over source sink separations + for (int k=0; k propTS; @@ -1042,13 +1124,13 @@ int main(int argc, char **argv) { vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); - //Perform multiplication with glist_sink_meson[0] - vectorAuxD2.apply_gamma_scatt(glist_sink_meson[0]); + //Perform multiplication with glist_insertion[0] + vectorAuxD2.apply_gamma_scatt(glist_insertion[0]); //Perform rotation to the physical basis vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,-1); //Computing sequential propagators UD T_fii with insertion - //glist_sink_meson[0]=gamma_5 and momentum momentum_i2 + //glist_insertion[0]=gamma_5 and momentum momentum_i2 PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); //performing the inversion TIME(solver.solve(vectorAuxD, vectorAuxD)); @@ -1077,21 +1159,54 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); - PLEGMA_ScattCorrelator corrB7(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrB8(source, filtered_sourcemomentumList); + std::vector*> corrB7,corrB8; + std::vector*> corrW9,corrW10,corrW11,corrW12; - PLEGMA_ScattCorrelator corrW9(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW10(source,filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW11(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrW12(source, filtered_sourcemomentumList); + for (int k=0; k< tSinks.size(); ++k){ + try + { + corrB7.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrB8.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); - corrB8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); + corrW9.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW10.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW11.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + corrW12.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W9"); - corrW10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W10"); - corrW11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W11"); - corrW12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W12"); + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors"); + exit(1); + } + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"B7_deltat_%d",tSinks[k]); + corrB3[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B8_deltat_%d",tSinks[k]); + corrB4[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W9_deltat_%d",tSinks[k]); + corrW13[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W10_deltat_%d",tSinks[k]); + corrW14[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W11_deltat_%d",tSinks[k]); + corrW15[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W12_deltat_%d",tSinks[k]); + corrW16[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + free(ssource); + + + corrB7[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B9"); + corrB8[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B10"); + + + corrW9[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W17"); + corrW10[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W18"); + corrW11[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W19"); + corrW12[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W20"); + + } for (int k=0; k propTS_SS_packed_to_sink; @@ -1129,10 +1244,10 @@ int main(int argc, char **argv) { stochastic_propagator_packed.apply_gamma5(); - TIME(reductionsV3.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true)); + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true)); - TIME(corrB7.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true)); - TIME(corrB8.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true)); + TIME(corrB7[k]->B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true)); + TIME(corrB8[k]->B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1140,21 +1255,68 @@ int main(int argc, char **argv) { TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true)); - TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true)); + TIME( corrW9[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true)); + TIME(corrW11[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true)); TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true)); - TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true)); + TIME(corrW10[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true)); + TIME(corrW12[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true)); } //loop over stochastic samples + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; + TIME(produceOutput(*corrB7[k], outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(*corrB8[k], outfilename, "4pt", n_stochastic_samples)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; + TIME(produceOutput(*corrW9[k], outfilename,"4pt", n_stochastic_samples));//because of V4 + TIME(produceOutput(*corrW10[k], outfilename,"4pt", n_stochastic_samples));//because of V4 + TIME(produceOutput(*corrW11[k], outfilename,"4pt", n_stochastic_samples)); + TIME(produceOutput(*corrW12[k], outfilename,"4pt", n_stochastic_samples)); + + } //loop over tSinks + for (int k=0; k Date: Mon, 12 Dec 2022 08:34:11 +0100 Subject: [PATCH 016/168] removing debug printf --- lib/PLEGMA_ScattCorrelator.cu | 3 --- lib/kernels/PLEGMA_scattreductionsPiPi.cuh | 1 - 2 files changed, 4 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 80edc340..8a039cf9 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2239,7 +2239,6 @@ void PLEGMA_ScattCorrelator::P_diagrams( PLEGMA_Vector &Phi_0, PLE std::vector tmpGf2 = apply_gamma5_scatt_gamma( this->GList[1], LEFT); double norm1=Phi_0.norm(); double norm2=Phi_1.norm(); - PLEGMA_printf("NOrm inside P diagram %e %e\n", norm1, norm2); pipi_aux.PhiPhi( Phi_0, tmpGf2, Phi_1); //T x N_moms x n_gammas_f2 Float g[2]; g[0]=-1;//eq 13 @@ -2249,14 +2248,12 @@ void PLEGMA_ScattCorrelator::P_diagrams( PLEGMA_Vector &Phi_0, PLE for( int im=0; imCorr(t,im,gi2,gf2), g, pipi_aux.Corr(t,im,gf2), 1); } } else{ for( int t=0; tCorr(t,i_pi2,gi2,gf2), g, pipi_aux.Corr(t,0,gf2), 1); } } diff --git a/lib/kernels/PLEGMA_scattreductionsPiPi.cuh b/lib/kernels/PLEGMA_scattreductionsPiPi.cuh index d5de7cd5..a3a88dbc 100644 --- a/lib/kernels/PLEGMA_scattreductionsPiPi.cuh +++ b/lib/kernels/PLEGMA_scattreductionsPiPi.cuh @@ -47,7 +47,6 @@ __global__ void PhixGxPhi_kernel( vectorTex vectorPhi0, KernelArr Date: Mon, 12 Dec 2022 08:35:47 +0100 Subject: [PATCH 017/168] changing the order of propagators in M7/M8 Thanks Yan --- plegma/nucleon_2pt_3pt_npi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plegma/nucleon_2pt_3pt_npi.cpp b/plegma/nucleon_2pt_3pt_npi.cpp index 3c1d7227..03cda1da 100644 --- a/plegma/nucleon_2pt_3pt_npi.cpp +++ b/plegma/nucleon_2pt_3pt_npi.cpp @@ -944,8 +944,8 @@ int main(int argc, char **argv) { oet_fini_up.copy(*oet_mom_fini_up_SS[i_pi2], HOST); oet_fini_up.load(); - TIME(corrM7.M_diagrams( corrUp, oet_mom_zero_up_SS, oet_fini_up )); - TIME(corrM8.M_diagrams( corrDn, oet_mom_zero_up_SS, oet_fini_up )); + TIME(corrM7.M_diagrams( corrUp, oet_fini_up, oet_mom_zero_up_SS )); + TIME(corrM8.M_diagrams( corrDn, oet_fini_up, oet_mom_zero_up_SS )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"neutronup_piplus"; TIME(corrM7.apply_sign("NJNP")); From 971790a022f67fb5ac744dcf5395c132000a0afa Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 12 Dec 2022 17:53:23 +0100 Subject: [PATCH 018/168] correcting comm_get_rank_from_coords --- lib/PLEGMA_ScattCorrelator.cu | 28 +++++++++++++++++----------- lib/PLEGMA_Vector.cu | 4 ++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 8a039cf9..954ecdcd 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -6,8 +6,14 @@ #include #include #include +#include #include using namespace plegma; +using namespace quda; + +Communicator &get_current_communicator(); + + bool gammas_isSym( std::vector &Gammas ){ bool res = true; @@ -377,7 +383,7 @@ Float *PLEGMA_ScattCorrelator::get_source_time_slice(){ memcpy(ptr, this->H_elem()+t_source_local*size_timeslice, sizeof(Float)*size_timeslice); int coords[4]; for(int i = 0 ; i < N_DIMS; i++) coords[i] = this->getSource()[i] / HGC_localL[i]; - int rankHas = quda::comm_rank_from_coords(HGC_default_topo, coords); + int rankHas = comm_rank_from_coords(coords); int mpiErr = MPI_Bcast(ptr, size_timeslice, MPI_Type(), rankHas, HGC_fullComm); if(mpiErr != MPI_SUCCESS) PLEGMA_error("MPI_Bcast failed with error %d\n", mpiErr); @@ -390,12 +396,12 @@ template Float *PLEGMA_ScattCorrelator::get_time_slice(int global_time_index){ const int size_of_glist =this->GList.size(); int size_timeslice= this->Nmoms(); - //printf("Nmoms %d \n", this->Nmoms()); - //printf("Global time index %d\n",global_time_index); + printf("Nmoms %d \n", this->Nmoms()); + printf("Global time index %d\n",global_time_index); for (int i=0; i< size_of_glist; ++i){ size_timeslice *= this->GList[i].size(); } - //printf("Size timeslice %d\n",size_timeslice); + printf("Size timeslice %d\n",size_timeslice); std::size_t n_t = this->labels.find("s"); if (n_t!=std::string::npos){ size_timeslice *= 32; @@ -406,18 +412,18 @@ Float *PLEGMA_ScattCorrelator::get_time_slice(int global_time_index){ Float *ptr=((Float *)malloc(sizeof(Float)*size_timeslice)); const int t_source_local= global_time_index%HGC_localL[DIM_T]; memcpy(ptr, this->H_elem()+t_source_local*size_timeslice, sizeof(Float)*size_timeslice); - //printf("ptr %e\n",ptr[0]); + printf("ptr %e\n",ptr[0]); int coords[4]; for(int i = 0 ; i < (N_DIMS-1); i++) coords[i] = 0; coords[N_DIMS-1]=global_time_index / HGC_localL[N_DIMS-1]; - int rankHas = comm_rank_from_coords(HGC_default_topo, coords); - //printf("rankHas %d\n",rankHas); + int rankHas = quda::comm_rank_from_coords(coords); + printf("rankHas %d\n",rankHas); MPI_Barrier(HGC_fullComm); int mpiErr = MPI_Bcast(ptr, size_timeslice, MPI_Type(), rankHas, HGC_fullComm); if(mpiErr != MPI_SUCCESS) PLEGMA_error("MPI_Bcast failed with error %d\n", mpiErr); - //printf("ptrafter %e\n",ptr[0]); - //fflush(stdout); - //MPI_Barrier(HGC_fullComm); + printf("ptrafter %e\n",ptr[0]); + fflush(stdout); + MPI_Barrier(HGC_fullComm); return ptr; } @@ -3511,7 +3517,7 @@ void PLEGMA_ScattCorrelator::absorbTimeslice(PLEGMA_ScattCorrelatorH_elem(), in_dofs_src*out_dofs_src , MPI_Type(), rankHas, HGC_fullComm); if(mpiErr != MPI_SUCCESS) PLEGMA_error("MPI_Bcast failed with error %d\n", mpiErr); diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index f45bfe8d..c28f65f3 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -374,7 +374,7 @@ std::shared_ptr PLEGMA_Vector::getPointSource( const site& sourcep int coords[4]; for(int i = 0 ; i < N_DIMS; i++) coords[i] = sourceposition[i] / HGC_localL[i]; - int rankHas = comm_rank_from_coords(HGC_default_topo, coords); + int rankHas = comm_rank_from_coords(coords); if (comm_rank()==rankHas){ for (int spin=0; spin(), rankHas, HGC_fullComm); if(mpiErr != MPI_SUCCESS) PLEGMA_error("MPI_Bcast failed with error %d\n", mpiErr); return absPsi; From 82fd193fc186d6204954bdc2909f76543cc0396f Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 12 Dec 2022 17:53:50 +0100 Subject: [PATCH 019/168] version for xcheck with Yan Li --- plegma/nucleon_2pt_3pt_npi.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/plegma/nucleon_2pt_3pt_npi.cpp b/plegma/nucleon_2pt_3pt_npi.cpp index 03cda1da..1bf18879 100644 --- a/plegma/nucleon_2pt_3pt_npi.cpp +++ b/plegma/nucleon_2pt_3pt_npi.cpp @@ -504,7 +504,6 @@ int main(int argc, char **argv) { -#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK std::vector filter={0,0,0}; momList filtered_sourcemomentumList_pi20 = sourcemomentumList_threept.extract(filter, 0); @@ -1003,7 +1002,6 @@ int main(int argc, char **argv) { computeThreep_meson(+mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"dn", "pizero"); } -#endif }//tsink From b6a55e80a2d7931a86adc5f4a840b3473cc12f4c Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 13 Dec 2022 11:50:03 +0100 Subject: [PATCH 020/168] correcting from source to sink and as sink for both PLEGMA Vector and PLEGMA_Propagator --- include/PLEGMA_Vector.h | 3 +++ lib/PLEGMA_Propagator.cu | 2 +- lib/PLEGMA_Vector.cu | 23 ++++++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index f9e15835..81933ceb 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -99,6 +99,9 @@ namespace plegma { void pack_propagator_from_source_to_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize); + void pack_propagator_as_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize); + + void absorb(PLEGMA_Vector3D &vec, int global_it, bool broadcast=false); diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index cb5928cf..dfd93b16 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -135,7 +135,7 @@ void PLEGMA_Propagator::pack_propagator_from_source_to_sink(PLEGMA_Propag for (int dt=0; dt::pack_fermion_to_sink(std::vector } template -void PLEGMA_Vector::pack_propagator_from_source_to_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize){ +void PLEGMA_Vector::pack_propagator_as_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize){ PLEGMA_Vector stmp; PLEGMA_Vector3D vector1; @@ -309,6 +309,27 @@ void PLEGMA_Vector::pack_propagator_from_source_to_sink(PLEGMA_Vector +void PLEGMA_Vector::pack_propagator_from_source_to_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize){ + + PLEGMA_Vector stmp; + PLEGMA_Vector3D vector1; + + if (initialize==true){ + stmp.zero_where(DEVICE); + stmp.zero_where(HOST); + } + + for (int dt=0; dtcopy(stmp); +} + + template From 54539c6b7bda6baa44ed9ff4261803944cfdd34c Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 13 Dec 2022 11:51:24 +0100 Subject: [PATCH 021/168] including Z_diagrams for std vectors of ScattCorrelator object --- include/PLEGMA_ScattCorrelator.h | 2 + lib/PLEGMA_ScattCorrelator.cu | 93 ++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index be3d3558..084999cf 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -263,6 +263,8 @@ namespace plegma { void W_diagrams_oet(PLEGMA_ScattCorrelator &srcV6, std::shared_ptr &Phi0, std::vector*> &Phi_1, int input_mom_f2, int diagram_index, bool accum=false); void Z_diagrams( std::array,4> (&srcV3), std::array,4> (&srcV2),int diagramm_index, bool accum=false ); + void Z_diagrams(std::vector*> (&srcV3), std::vector*> (&srcV2), int diagramm_index, bool accum=false ); + void Z_diagrams_without_dilution( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagramm_index, bool accum=false ); void Z_diagrams_without_dilution_check(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int i_g_i2, diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 954ecdcd..dc7faee2 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2133,6 +2133,99 @@ void PLEGMA_ScattCorrelator::Z_diagrams(std::array +void PLEGMA_ScattCorrelator::Z_diagrams(std::vector*> (&srcV3), + std::vector*> (&srcV2), + int diagramm_index, bool accum ){ + + if( (diagramm_index <1) || (diagramm_index >20 ) ) + PLEGMA_error("diagramm_index %d out of range (1..20)\n",diagramm_index); + + this->clear_output(!accum); + + for (int g2=0; g2GList[3].size(); ++g2 ){ + //GAMMAS_SCATT gammai2 = this->GList[3][g2]; + GAMMAS_SCATT gammai2_t_gamma5 = apply_g5( this->GList[3][g2], RIGHT); + for (int n=0; n<4; ++n){ + int kappa = gammaInd_scatt[gammai2_t_gamma5][n][0]; + int lambda =gammaInd_scatt[gammai2_t_gamma5][n][1]; + Float g[2]; + g[1] = -gamma_scatt[gammai2_t_gamma5][n][1]; //-1 from eqs. (41),(44),(47),(50) + g[0] = -gamma_scatt[gammai2_t_gamma5][n][0]; //-1 from eqs. (41),(44),(47),(50) + + switch (diagramm_index){ + case 1: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false); //checked FP + break; + case 2: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + break; + case 3: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false);//checked FP + break; + case 4: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + break; + case 5: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + break; + case 6: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false);//checked FP + break; + case 7: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false);//checked FP + break; + case 8: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + break; + case 9: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, false, g, true); //checked FP + break; + case 10: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, true); //checked FP + break; + case 11: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, true, g, false); //checked FP + break; + case 12: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, false, g2, true, g, false); //checked FP + break; + case 13: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, false, g, false); //checked FP + break; + case 14: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, false); //checked FP + break; + case 15: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, true); //checked FP + break; + case 16: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, false, g, true); //checked FP + break; + case 17: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, true, g, false);//checked FP + break; + case 18: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, false, g, false);//checked FP + break; + case 19: + this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, false, g2, true, g, false); //checked FP + break; + case 20: + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, false);//checked FP + break; + default: + PLEGMA_error("This value of Z diagram index does not exists, please check your inputs in piNdiagrams.cpp"); + }//switch (Diagram index) + + }//n -> nonzero elems of Gi2 + }//loop over G_i2 matrix + +} + + + //here pi2 is looped outside in the building of the stocastic propagator. NB for moms_red I expect that pi2 is the same! Phi_0[s] is the stocastic propagator at zero momentum and spin s, Phi_1 with momentum pi2 //GList only 2 gammas G_i2, G_f2 template From 9a1795717b730bac620dc1660e866b27854ff523 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 13 Dec 2022 11:51:42 +0100 Subject: [PATCH 022/168] including Z diagrams --- plegma/nucleon_3pt_n_npi.cpp | 524 ++++++++++++++++++++++++++++++++--- 1 file changed, 486 insertions(+), 38 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 9cef72cc..ac9978fe 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -180,9 +180,13 @@ int main(int argc, char **argv) { // } // } - PLEGMA_Vector vectorSource_stochastic; + PLEGMA_Vector vectorSource_stochastic; vectorSource_stochastic.randInit(rand_seed1); + PLEGMA_Vector vectorStoc_source_oet; + vectorStoc_source_oet.randInit(rand_seed1); + + //Computing with ubaru insertion //Step (1) produce the stochastic sample //Step (2) produce the stochastic propagators @@ -199,6 +203,25 @@ int main(int argc, char **argv) { std::vector*> stochastic_propags_DN; + std::vector*> stochastic_oet_prop_u_zero_mom; + + std::vector*> stochastic_oet_prop_u_fini_mom; + + std::vector*> stochastic_oet_prop_d_zero_mom; + + std::vector*> stochastic_oet_prop_d_fini_mom; + + for(int i=0; i< 4; ++i) { + + stochastic_oet_prop_u_fini_mom.push_back(new PLEGMA_Vector(HOST)); + stochastic_oet_prop_u_zero_mom.push_back(new PLEGMA_Vector(HOST)); + stochastic_oet_prop_d_zero_mom.push_back(new PLEGMA_Vector(HOST)); + stochastic_oet_prop_d_fini_mom.push_back(new PLEGMA_Vector(HOST)); + + } + + + /****************************************************** * @@ -424,7 +447,7 @@ int main(int argc, char **argv) { - for (int i=0; i propUP_SS; PLEGMA_Propagator propDN_SS; @@ -432,10 +455,10 @@ int main(int argc, char **argv) { PLEGMA_Propagator propDN_SL; site& source_local = sourcePositions[isource]; - source_local[3]=(sourcePositions[isource][3]+i*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + source_local[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); - source_local_reduction[3]=(sourcePositions[isource][3]+i*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + source_local_reduction[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; PLEGMA_ScattCorrelator corrNP(source_local, list_mpf1_twopt); @@ -479,11 +502,11 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon diagram ready\n"); } - propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); - propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); - propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i == 0 ? true : false); + propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -549,17 +572,15 @@ int main(int argc, char **argv) { //B3,B5,B9,B11 PLEGMA_Propagator propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; - { - for (int j=0; j= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); - int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); - propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); - } + for (int j=0; j= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); } - + TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); @@ -570,7 +591,7 @@ int main(int argc, char **argv) { //W5,W6,W7,W8 //W9,W10,W11,W12,W17,W18,W19,W20 PLEGMA_Vector stochastic_propagator_packed; - for (int j=0; j temporary; temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); @@ -587,7 +608,7 @@ int main(int argc, char **argv) { stochastic_propagator_packed.apply_gamma5(); - for (int j=0; j temporary; temporary.copy(*stochastic_propags_UP[lookuptable[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); @@ -607,6 +628,200 @@ int main(int argc, char **argv) { } //end of for source sink separations } //end of for stochastic samples + + vectorStoc_source_oet.stochastic_Z(nroots); + +#if 1 + + { + + //Doing for +mu for the UP propagator spin dilution oet + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + for (int l=0; l vectortmp1; + PLEGMA_Vector vectortmp2; + PLEGMA_Vector vectorSave_diluted; + + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorStoc_source_oet, sequential_time_source+l*max_source_sink_separations); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, sequential_time_source); + + } + + //Dilution + vectortmp2.dilutespin(vectortmp1,0); + + //Save the smeared,transformed and diluted source for non-zero momentum oet. + vectorSave_diluted.copy(vectortmp2); + + for (int spinindex=0; spinindex<4; ++spinindex){ + //Transforming to physical base for the UP quark + vectortmp2.rotateToPhysicalBasis(vectorSave_diluted,+1); + //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); + //Doing the zero momentum stochastic propagator with spin dilution + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,+1); + //Gaussian smearing of the propagator + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + PLEGMA_Vector temporary1,temporary2; + temporary1.copy(*stochastic_oet_prop_u_zero_mom[spinindex],HOST); + temporary1.load(); + temporary2.copy(vectortmp2); + temporary1.pack_propagator_from_source_to_sink(temporary2, source_local[3], max_source_sink_separations, l == 0 ? true : false); + temporary1.unload(); + stochastic_oet_prop_u_zero_mom[spinindex]->copy(temporary1,HOST); + + // vectortmp2.writeLIME(outfile_V+confnumber+"propagator_up"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); + + vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); + vectorSave_diluted.copy(vectortmp1); + } //end of loop in spin indices + + } //end of loop on parallel sources + + //Doing for -mu for the DN propagator spin dilution oet + if(mu>0) { + mu*=-1.; + solver.UpdateSolver(); + } + + for (int l=0; l vectortmp1; + PLEGMA_Vector vectortmp2; + PLEGMA_Vector vectorSave_diluted; + + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorStoc_source_oet, sequential_time_source+l*max_source_sink_separations); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, sequential_time_source); + + } + + //Dilution + vectortmp2.dilutespin(vectortmp1,0); + + //Save the smeared,transformed and diluted source for non-zero momentum oet. + vectorSave_diluted.copy(vectortmp2); + + + for (int spinindex=0; spinindex<4; ++spinindex){ + //Transforming to physical base for the DN quark + vectortmp2.rotateToPhysicalBasis(vectorSave_diluted,-1); + //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); + //Doing the zero momentum stochastic propagator with spin dilution + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,-1); + //Gaussian smearing of the propagator + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + PLEGMA_Vector temporary1,temporary2; + temporary1.copy(*stochastic_oet_prop_d_zero_mom[spinindex],HOST); + temporary1.load(); + temporary2.copy(vectortmp2); + temporary1.pack_propagator_from_source_to_sink(temporary2, source_local[3], max_source_sink_separations, l == 0 ? true : false); + temporary1.unload(); + stochastic_oet_prop_u_zero_mom[spinindex]->copy(temporary1,HOST); + //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); + vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); + vectorSave_diluted.copy(vectortmp1); + }//end of loop on spin indices + } //end of loop on parallel sources + }//end of do_stochastic_oet + +#endif + + std::vector*> reductionsV3_diluted_U_DN; + std::vector*> reductionsV3_diluted_D_UP; + std::vector*> reductionsV4_diluted_STOCHU_DN_UP; + std::vector*> reductionsV2_diluted_STOCHU_DN_UP; + std::vector*> reductionsV2_diluted_STOCHD_UP_UP; + + for (int spinindex=0;spinindex<4;++spinindex){ + try + { + reductionsV3_diluted_U_DN.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + reductionsV3_diluted_D_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store V3 factors oet"); + exit(1); + } + + for (k=0; k(source_reduction, list_mpf1_threept)); + reductionsV2_diluted_STOCHU_DN_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductionsV2_diluted_STOCHD_UP_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store V24 factors oet"); + exit(1); + } + } + } + for (k=0; k propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + for (int j=0; j= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + } + + + for (int spinindex=0;spinindex<4;++spinindex){ + PLEGMA_Vector st_oet_u_zero; + PLEGMA_Vector st_oet_d_zero; + + st_oet_u_zero.copy(*stochastic_oet_prop_u_zero_mom[spinindex],HOST); + st_oet_u_zero.load(); + st_oet_d_zero.copy(*stochastic_oet_prop_d_zero_mom[spinindex],HOST); + st_oet_d_zero.load(); + + PLEGMA_Vector st_oet_u_zeropacked_to_sink; + PLEGMA_Vector st_oet_d_zeropacked_to_sink; + + for (int j=0; j= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + st_oet_u_zeropacked_to_sink.pack_propagator_as_sink(st_oet_u_zero, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + st_oet_d_zeropacked_to_sink.pack_propagator_as_sink(st_oet_d_zero, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + } + + + + TIME(reductionsV2_diluted_STOCHU_DN_UP[4*k+spinindex].V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2_diluted_STOCHD_UP_UP[4*k+spinindex].V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV4_diluted_STOCHU_DN_UP[4*k+spinindex].V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + + } + } //We first have a loop over all unique the source meson momentum p_i2 for (int i_mpi2=0; i_mpi2 propTS_SS_packed; - for (int i_source_parallel=0; i_source_parallel < HGC_totalL[3]/max_source_sink_separations;++i_source_parallel){ + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS; @@ -774,7 +989,7 @@ int main(int argc, char **argv) { PLEGMA_Propagator propTS_SS_packed_to_sink; { - for (int i_source_parallel=0; i_source_parallel= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); @@ -786,7 +1001,7 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; { - for (int j=0; j= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); @@ -797,7 +1012,7 @@ int main(int argc, char **argv) { } for (int i_sample=0; i_sample temporary; temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); @@ -868,7 +1083,7 @@ int main(int argc, char **argv) { solver.UpdateSolver(); } - for (int i_source_parallel=0; i_source_parallel < HGC_totalL[3]/max_source_sink_separations;++i_source_parallel){ + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS; @@ -1021,20 +1236,18 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; - { - for (int j=0; j= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); - int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); - propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); - } + for (int j=0; j= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); } for (int i_sample=0; i_sample stochastic_propagator_packed; - for (int i_source_parallel=0; i_source_parallel temporary; temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); @@ -1096,7 +1309,7 @@ int main(int argc, char **argv) { } - for (int i_source_parallel=0; i_source_parallel < HGC_totalL[3]/max_source_sink_separations;++i_source_parallel){ + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS; @@ -1211,7 +1424,7 @@ int main(int argc, char **argv) { for (int k=0; k propTS_SS_packed_to_sink; { - for (int i_source_parallel=0; i_source_parallel= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); @@ -1223,7 +1436,7 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; { - for (int j=0; j= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); @@ -1291,6 +1504,232 @@ int main(int argc, char **argv) { } + if ((momentum_i2[0] != 0) || (momentum_i2[1] != 0) || (momentum_i2[2] != 0)){ + PLEGMA_Vector vectortmp1; + PLEGMA_Vector vectortmp2; + PLEGMA_Vector vectorSource_finite_mom; + + //Doing for +mu for the UP propagator spin dilution oet + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + + for (int l=0; l tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); + + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorSource_finite_mom, source_local[3]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorSource_finite_mom.absorb(vector2, source_local[3]); + + } + + for (int spinindex=0; spinindex<4; ++spinindex){ + + //Transforming to physical base for the UP quark + vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,+1); + + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + + //Rotate back immediately to the physical basis + vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); + + //performing smearing + TIME(vectortmp1.gaussianSmearing(vectortmp2, smearedGauge, nsmearGauss, alphaGauss)); + PLEGMA_Vector temporary1,temporary2; + temporary1.copy(*stochastic_oet_prop_u_fini_mom[spinindex],HOST); + temporary1.load(); + temporary2.copy(vectortmp2); + temporary1.pack_propagator_from_source_to_sink(temporary2, source_local[3], max_source_sink_separations, l == 0 ? true : false); + temporary1.unload(); + stochastic_oet_prop_u_fini_mom[spinindex]->copy(temporary1,HOST); + + vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); + vectorSource_finite_mom.copy(vectortmp1); + + } //end of spin dilution + + } // end of parallel sources + + //Doing for +mu for the DN propagator spin dilution oet + if(mu>0) { + mu*=-1.; + solver.UpdateSolver(); + } + + + for (int l=0; l tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); + + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorSource_finite_mom, source_local[3]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorSource_finite_mom.absorb(vector2, source_local[3]); + + } + + for (int spinindex=0; spinindex<4; ++spinindex){ + + //Transforming to physical base for the UP quark + vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,-1); + + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + + //Rotate back immediately to the physical basis + vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); + + //performing smearing + TIME(vectortmp1.gaussianSmearing(vectortmp2, smearedGauge, nsmearGauss, alphaGauss)); + PLEGMA_Vector temporary1,temporary2; + temporary1.copy(*stochastic_oet_prop_d_fini_mom[spinindex],HOST); + temporary1.load(); + temporary2.copy(vectortmp2); + temporary1.pack_propagator_from_source_to_sink(temporary2, source_local[3], max_source_sink_separations, l == 0 ? true : false); + temporary1.unload(); + stochastic_oet_prop_d_fini_mom[spinindex]->copy(temporary1,HOST); + + vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); + vectorSource_finite_mom.copy(vectortmp1); + + } //end of spin dilution + + } // end of parallel sources + + }//end of if momentum zero + + + for (int i=0; i< 4; ++i){ + PLEGMA_Vector st_oet_d_fini; + if ((momentum_i2[0] != 0) || (momentum_i2[1] != 0) || (momentum_i2[2] != 0)){ + st_oet_d_fini.copy(*stochastic_oet_prop_d_fini_mom[i],HOST); + } + else{ + st_oet_d_fini.copy(*stochastic_oet_prop_d_zero_mom[i],HOST); + } + st_oet_d_fini.load(); + + st_oet_d_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_D_UP[i]->V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); + + } + + for (int i=0; i< 4; ++i){ + PLEGMA_Vector st_oet_u_fini; + if ((momentum_i2[0] != 0) || (momentum_i2[1] != 0) || (momentum_i2[2] != 0)){ + st_oet_u_fini.copy(*stochastic_oet_prop_u_fini_mom[i],HOST); + } + else{ + st_oet_u_fini.copy(*stochastic_oet_prop_u_zero_mom[i],HOST); + } + st_oet_u_fini.load(); + + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_UP[i]->V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); + + } + + + for (int k=0; k corrZ5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ6(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ8(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrZ9(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ10(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrZ11(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ12(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ13(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ14(source, filtered_sourcemomentumList); + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"Z5_deltat_%d",tSinks[k]); + corrZ5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z6_deltat_%d",tSinks[k]); + corrZ6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z7_deltat_%d",tSinks[k]); + corrZ7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z8_deltat_%d",tSinks[k]); + corrZ8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z9_deltat_%d",tSinks[k]); + corrZ9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z10_deltat_%d",tSinks[k]); + corrZ10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z11_deltat_%d",tSinks[k]); + corrZ11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z12_deltat_%d",tSinks[k]); + corrZ12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z13_deltat_%d",tSinks[k]); + corrZ13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z14_deltat_%d",tSinks[k]); + corrZ14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + TIME(corrZ5.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 5 )); + TIME(corrZ7.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 7 )); + + TIME(corrZ6.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 6 )); + TIME(corrZ8.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 8 )); + + TIME(corrZ9.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP, 9 )); + TIME(corrZ10.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP, 10)); + + + TIME(corrZ11.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP, 11 )); + TIME(corrZ13.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP, 13 )); + + TIME(corrZ12.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP, 12 )); + TIME(corrZ14.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP, 14 )); + + TIME(produceOutput(corrZ5, outfilename, "4pt")); + TIME(produceOutput(corrZ6, outfilename, "4pt")); + TIME(produceOutput(corrZ7, outfilename, "4pt")); + TIME(produceOutput(corrZ8, outfilename, "4pt")); + + TIME(produceOutput(corrZ9, outfilename, "4pt")); + TIME(produceOutput(corrZ10, outfilename,"4pt")); + + TIME(produceOutput(corrZ11, outfilename,"4pt")); + TIME(produceOutput(corrZ12, outfilename,"4pt")); + TIME(produceOutput(corrZ13, outfilename,"4pt")); + TIME(produceOutput(corrZ14, outfilename,"4pt")); + + + }//end for loop source sink separations + }//loop over mpi2 for(int i_samples=0; i_samples< n_stochastic_samples; ++i_samples) { @@ -1313,11 +1752,20 @@ int main(int argc, char **argv) { for(int i=0; i< n_stochastic_samples; ++i) { stochastic_sources.pop_back(); } + for (int i=0; i Date: Tue, 13 Dec 2022 16:13:19 +0100 Subject: [PATCH 023/168] do not store the final diagrams for all source sink separations --- plegma/nucleon_3pt_n_npi.cpp | 399 ++++++++++++++--------------------- 1 file changed, 159 insertions(+), 240 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index ac9978fe..b223fa22 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -767,7 +767,7 @@ int main(int argc, char **argv) { exit(1); } - for (k=0; k(source_reduction, list_mpf1_threept)); @@ -780,7 +780,7 @@ int main(int argc, char **argv) { } } } - for (k=0; k propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; for (int j=0; jV2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2_diluted_STOCHD_UP_UP[4*k+spinindex]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV4_diluted_STOCHU_DN_UP[4*k+spinindex]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); } } @@ -841,66 +841,6 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsT2(source_reduction, mpf1_threept); PLEGMA_ScattCorrelator reductionsV3(source_reduction, list_mpc); - - std::vector*> corrB3,corrB4,corrB5,corrB6; - std::vector*> corrW5,corrW6,corrW7,corrW8; - std::vector*> corrW13,corrW14,corrW15,corrW16; - - - for (int k=0; k< tSinks.size(); ++k){ - try - { - corrB3.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB4.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB5.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB6.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - - corrW5.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW6.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW7.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW8.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - - corrW13.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW14.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW15.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW16.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - - } - catch(std::bad_alloc&){ - PLEGMA_printf("Memory allocation fails to store factors"); - exit(1); - } - - ssource=(char *)malloc(sizeof(char)*100); - sprintf(ssource,"B3_deltat_%d",tSinks[k]); - corrB3[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"B4_deltat_%d",tSinks[k]); - corrB4[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"B5_deltat_%d",tSinks[k]); - corrB5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"B6_deltat_%d",tSinks[k]); - corrB6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - - sprintf(ssource,"W5_deltat_%d",tSinks[k]); - corrW5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"W6_deltat_%d",tSinks[k]); - corrW6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"W7_deltat_%d",tSinks[k]); - corrW7[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"W8_deltat_%d",tSinks[k]); - corrW8[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - - sprintf(ssource,"W13_deltat_%d",tSinks[k]); - corrW13[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"W14_deltat_%d",tSinks[k]); - corrW14[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"W15_deltat_%d",tSinks[k]); - corrW15[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"W16_deltat_%d",tSinks[k]); - corrW16[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - - free(ssource); - } PLEGMA_Propagator propTS_SS_packed; @@ -986,16 +926,61 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int k=0; k corrB3(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB4(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB6(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrW5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW6(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW8(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrW13(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW14(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW15(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW16(source, filtered_sourcemomentumList); + + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"B3_deltat_%d",tSinks[k]); + corrB3.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B4_deltat_%d",tSinks[k]); + corrB4.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B5_deltat_%d",tSinks[k]); + corrB5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B6_deltat_%d",tSinks[k]); + corrB6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W5_deltat_%d",tSinks[k]); + corrW5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W6_deltat_%d",tSinks[k]); + corrW6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W7_deltat_%d",tSinks[k]); + corrW7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W8_deltat_%d",tSinks[k]); + corrW8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W13_deltat_%d",tSinks[k]); + corrW13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W14_deltat_%d",tSinks[k]); + corrW14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W15_deltat_%d",tSinks[k]); + corrW15.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W16_deltat_%d",tSinks[k]); + corrW16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + free(ssource); + PLEGMA_Propagator propTS_SS_packed_to_sink; - { - for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ - int tsinkMtsource = tSinks[k]; - if(tsinkMtsource >= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); - int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - propTS_SS_packed_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); - } + + for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propTS_SS_packed_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); } PLEGMA_Propagator propUPpacked_to_sink; @@ -1023,10 +1008,10 @@ int main(int argc, char **argv) { //V3 TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true)); - TIME(corrB3[k]->B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true)); - TIME(corrB4[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true)); - TIME(corrB5[k]->B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true)); - TIME(corrB6[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true)); + TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true)); + TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true)); + TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true)); + TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1036,46 +1021,28 @@ int main(int argc, char **argv) { TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW5[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true)); + TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true)); - TIME(corrW7[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true)); + TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW6[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true)); - TIME(corrW8[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true)); + TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true)); + TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false));//checked - TIME(corrW13[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true)); - TIME(corrW15[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true)); + TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true)); + TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW14[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true)); - TIME(corrW16[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true)); + TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true)); + TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true)); }//loop over stochastic samples }//loop over source sink separations - for (int k=0; k*> corrB9,corrB10,corrB11,corrB12; - std::vector*> corrW17,corrW18,corrW19,corrW20; - std::vector*> corrW21,corrW22,corrW23,corrW24; - - for (int k=0; k< tSinks.size(); ++k){ - try - { - corrB9.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB10.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB11.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB12.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + + PLEGMA_ScattCorrelator corrB9(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB10(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB11(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB12(source, filtered_sourcemomentumList); - corrW17.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW18.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW19.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW20.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + PLEGMA_ScattCorrelator corrW17(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW18(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW19(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW20(source, filtered_sourcemomentumList); - corrW21.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW22.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW23.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW24.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + PLEGMA_ScattCorrelator corrW21(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW22(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW23(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW24(source, filtered_sourcemomentumList); - } - catch(std::bad_alloc&){ - PLEGMA_printf("Memory allocation fails to store factors"); - exit(1); - } ssource=(char *)malloc(sizeof(char)*100); sprintf(ssource,"B9_deltat_%d",tSinks[k]); - corrB3[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrB9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"B10_deltat_%d",tSinks[k]); - corrB4[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrB10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"B11_deltat_%d",tSinks[k]); - corrB5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrB11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"B12_deltat_%d",tSinks[k]); - corrB6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrB12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W17_deltat_%d",tSinks[k]); - corrW5[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW17.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W18_deltat_%d",tSinks[k]); - corrW6[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW18.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W19_deltat_%d",tSinks[k]); - corrW7[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW19.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W20_deltat_%d",tSinks[k]); - corrW8[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW20.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W21_deltat_%d",tSinks[k]); - corrW13[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW21.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W22_deltat_%d",tSinks[k]); - corrW14[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW22.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W23_deltat_%d",tSinks[k]); - corrW15[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW23.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W24_deltat_%d",tSinks[k]); - corrW16[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW24.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); free(ssource); - } - - - - for (int k=0; k propTS_SS_packed_to_sink; { for (int i_source_parallel=0; i_source_parallelB_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true)); - TIME(corrB10[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true)); - TIME(corrB11[k]->B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true)); - TIME(corrB12[k]->B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true)); + TIME( corrB9.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true)); + TIME(corrB10.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true)); + TIME(corrB11.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true)); + TIME(corrB12.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1269,45 +1220,26 @@ int main(int argc, char **argv) { TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW17[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true)); - TIME(corrW19[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true)); + TIME(corrW17.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true)); + TIME(corrW19.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW18[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true)); - TIME(corrW20[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true)); + TIME(corrW18.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true)); + TIME(corrW20.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW22[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true)); - TIME(corrW24[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true)); + TIME(corrW22.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true)); + TIME(corrW24.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true)); TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME(corrW21[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true)); - TIME(corrW23[k]->W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true)); + TIME(corrW21.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true)); + TIME(corrW23.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true)); } //loop over stochastic samples } //loop over source sink separations - for (int k=0; k*> corrB7,corrB8; - std::vector*> corrW9,corrW10,corrW11,corrW12; - for (int k=0; k< tSinks.size(); ++k){ - try - { - corrB7.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrB8.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW9.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW10.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW11.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); - corrW12.push_back(new PLEGMA_ScattCorrelator(source, filtered_sourcemomentumList)); + PLEGMA_ScattCorrelator corrB7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB8(source, filtered_sourcemomentumList); - } - catch(std::bad_alloc&){ - PLEGMA_printf("Memory allocation fails to store factors"); - exit(1); - } + PLEGMA_ScattCorrelator corrW9(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW10(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW11(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW12(source, filtered_sourcemomentumList); ssource=(char *)malloc(sizeof(char)*100); sprintf(ssource,"B7_deltat_%d",tSinks[k]); - corrB3[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrB7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"B8_deltat_%d",tSinks[k]); - corrB4[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrB8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W9_deltat_%d",tSinks[k]); - corrW13[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W10_deltat_%d",tSinks[k]); - corrW14[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W11_deltat_%d",tSinks[k]); - corrW15[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"W12_deltat_%d",tSinks[k]); - corrW16[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + corrW12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); free(ssource); - corrB7[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B9"); - corrB8[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B10"); - + corrB7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B9"); + corrB8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B10"); - corrW9[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W17"); - corrW10[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W18"); - corrW11[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W19"); - corrW12[k]->initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W20"); - } + corrW9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W17"); + corrW10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W18"); + corrW11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W19"); + corrW12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W20"); - for (int k=0; k propTS_SS_packed_to_sink; { for (int i_source_parallel=0; i_source_parallel propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; - { - for (int j=0; j< parallel_sources;++j){ - int tsinkMtsource = tSinks[k]; - if(tsinkMtsource >= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); - int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); - propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); - } + + for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); } + for (int i_sample=0; i_sample stochastic_propagator_packed; @@ -1459,8 +1378,8 @@ int main(int argc, char **argv) { TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true)); - TIME(corrB7[k]->B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true)); - TIME(corrB8[k]->B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true)); + TIME(corrB7.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true)); + TIME(corrB8.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1468,41 +1387,29 @@ int main(int argc, char **argv) { TIME(reductionsV2.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME( corrW9[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true)); - TIME(corrW11[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true)); + TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true)); + TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true)); TIME(reductionsV2.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME(corrW10[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true)); - TIME(corrW12[k]->W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true)); + TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true)); + TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true)); } //loop over stochastic samples outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; - TIME(produceOutput(*corrB7[k], outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(*corrB8[k], outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB7, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB8, outfilename, "4pt", n_stochastic_samples)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; - TIME(produceOutput(*corrW9[k], outfilename,"4pt", n_stochastic_samples));//because of V4 - TIME(produceOutput(*corrW10[k], outfilename,"4pt", n_stochastic_samples));//because of V4 - TIME(produceOutput(*corrW11[k], outfilename,"4pt", n_stochastic_samples)); - TIME(produceOutput(*corrW12[k], outfilename,"4pt", n_stochastic_samples)); + TIME(produceOutput(corrW9 , outfilename,"4pt", n_stochastic_samples));//because of V4 + TIME(produceOutput(corrW10, outfilename,"4pt", n_stochastic_samples));//because of V4 + TIME(produceOutput(corrW11, outfilename,"4pt", n_stochastic_samples)); + TIME(produceOutput(corrW12, outfilename,"4pt", n_stochastic_samples)); } //loop over tSinks - for (int k=0; k vectortmp1; @@ -1652,7 +1559,7 @@ int main(int argc, char **argv) { st_oet_u_fini.apply_gamma5(); - TIME(reductionsV3_diluted_U_UP[i]->V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); + TIME(reductionsV3_diluted_U_DN[i]->V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); } @@ -1732,6 +1639,18 @@ int main(int argc, char **argv) { }//loop over mpi2 + for (int spinindex=0;spinindex<4;++spinindex){ + reductionsV3_diluted_U_DN.pop_back(); + reductionsV3_diluted_D_UP.pop_back(); + + for (int k=0; k Date: Tue, 13 Dec 2022 21:02:24 +0100 Subject: [PATCH 024/168] correcting typos and small mistakes --- lib/PLEGMA_Propagator.cu | 4 +- lib/PLEGMA_Vector.cu | 4 +- plegma/nucleon_3pt_n_npi.cpp | 78 +++++++++++++++++++++--------------- 3 files changed, 50 insertions(+), 36 deletions(-) diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index dfd93b16..d11e0151 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -114,7 +114,7 @@ void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator for (int dt=0; dt::pack_propagator_from_source_to_sink(PLEGMA_Propag for (int dt=0; dtabsorb(stmp, isc/3, isc%3); diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index ca1306e0..21cc92fe 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -302,7 +302,7 @@ void PLEGMA_Vector::pack_propagator_as_sink(PLEGMA_Vector &in, int for (int dt=0; dtcopy(stmp); @@ -323,7 +323,7 @@ void PLEGMA_Vector::pack_propagator_from_source_to_sink(PLEGMA_Vectorcopy(stmp); diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index b223fa22..8b9d8222 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -43,6 +43,7 @@ int main(int argc, char **argv) { std::vector mu_s; std::vector mu_c; int rand_seed1=1234; + int rand_seed2=5678; int confnumber_int; double mu_ud = mu; double mu_ud_factor[QUDA_MAX_MG_LEVEL]; @@ -68,15 +69,13 @@ int main(int argc, char **argv) { int max_source_sink_separations; - auto add_options = [&](Options& options) { - options.set("src-input-file", "Use the file to update option at every source. The file searched is [src-input-file]+str(n) where n is the source (0, 1, ...)", verbosity, srcInputFile); - options.set("start-src", "The index of the source position where to start the calculation", verbosity, startSource); - options.set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); - options.set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); - options.set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); - options.set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + HGC_options->set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); + HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + HGC_options->set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + HGC_options->set("seed2", "Seed for intiialization of stochastic sources", verbosity, rand_seed2); - }; //=========================================================================================================// initializePLEGMA(); @@ -169,16 +168,15 @@ int main(int argc, char **argv) { int parallel_sources=HGC_totalL[3]/max_source_sink_separations; - std::vector lookuptable; + std::vector lookuptable_UP; + std::vector lookuptable_DN; + - for (int i=0; i vectorSource_stochastic; vectorSource_stochastic.randInit(rand_seed1); @@ -256,7 +254,7 @@ int main(int argc, char **argv) { site& source = sourcePositions[isource]; for (int k=0; k smearedGauge3D; smearedGauge3D.absorb(smearedGauge, timeSlice ); @@ -295,12 +293,11 @@ int main(int argc, char **argv) { vectorInOut.load(); } - lookuptable[timeSlice]=countindex/n_stochastic_samples; + lookuptable_UP[timeSlice]=(countindex-1)/n_stochastic_samples; } } } } - if(mu>0) { mu = -mu; @@ -313,7 +310,7 @@ int main(int argc, char **argv) { site& source = sourcePositions[isource]; for (int k=0; k smearedGauge3D; smearedGauge3D.absorb(smearedGauge, timeSlice ); @@ -354,7 +351,7 @@ int main(int argc, char **argv) { } //lookuptable[(source[3]+tSinks[k]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; - lookuptable[timeSlice]=countindex/n_stochastic_samples; + lookuptable_DN[timeSlice]=(countindex-1)/n_stochastic_samples; } } } @@ -375,7 +372,7 @@ int main(int argc, char **argv) { site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); - updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); + //updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source[DIM_T]); @@ -456,6 +453,7 @@ int main(int argc, char **argv) { site& source_local = sourcePositions[isource]; source_local[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + int sink_local=(sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); source_local_reduction[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; @@ -502,13 +500,25 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon diagram ready\n"); } - propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; + TIME( corrN0.apply_phase()); + TIME( corrN0.apply_sign("N")); + TIME( corrN0.applyBoundaryConditions( true )); + TIME( corrN0.writeHDF5(outfilename)); - propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SS, source_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + TIME( corrNP.apply_phase() ); + TIME( corrNP.apply_sign("N") ); + TIME( corrNP.applyBoundaryConditions( true ) ); + TIME( corrNP.writeHDF5(outfilename) ); + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); + + propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); + + printf("Packing step %d\n", i_source_parallel); } //We implement the UD part first @@ -593,7 +603,11 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int j=0; j temporary; - temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + + //PLEGMA_printf("Look up table %d TIMESlice %d j %d\n", lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]], + // (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],j); + //fflush(stdout); + temporary.copy(*stochastic_propags_DN[lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); } @@ -610,7 +624,7 @@ int main(int argc, char **argv) { for (int j=0; j temporary; - temporary.copy(*stochastic_propags_UP[lookuptable[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_UP[lookuptable_UP[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); } @@ -999,7 +1013,7 @@ int main(int argc, char **argv) { for (int i_sample=0; i_sample temporary; - temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_DN[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1200,7 +1214,7 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int i_source_parallel=0; i_source_parallel temporary; - temporary.copy(*stochastic_propags_DN[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_DN[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1369,7 +1383,7 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int i_source_parallel=0; i_source_parallel temporary; - temporary.copy(*stochastic_propags_UP[lookuptable[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_UP[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } From fc1dbbf5da618e4c21510e302d13371e111ff6b0 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 13 Dec 2022 21:23:07 +0100 Subject: [PATCH 025/168] V3 kernel for all the insertion gammas, correcting meson gamma initial --- lib/kernels/PLEGMA_scattreductionsV.cu | 2 +- plegma/nucleon_3pt_n_npi.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/kernels/PLEGMA_scattreductionsV.cu b/lib/kernels/PLEGMA_scattreductionsV.cu index 4df68d87..82fd751a 100644 --- a/lib/kernels/PLEGMA_scattreductionsV.cu +++ b/lib/kernels/PLEGMA_scattreductionsV.cu @@ -58,7 +58,7 @@ void V_kernels_wrapper( ProfileStruct &ps, VRED V, Float2 *block2, // case(7): V_kernels<(unsigned int)7,FloatOut,FloatV,FloatP>( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi, S1, S2 ); break; // case(8): V_kernels<(unsigned int)8,FloatOut,FloatV,FloatP>( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi, S1, S2 ); break; // case(9): V_kernels<(unsigned int)9,FloatOut,FloatV,FloatP>( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi, S1, S2 ); break; - // case(10): V_kernels<(unsigned int)10,FloatOut,FloatV,FloatP>( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi, S1, S2 ); break; + case(10): V_kernels( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi1, Phi2, S1, S2 ); break; // case(11): V_kernels<(unsigned int)11,FloatOut,FloatV,FloatP>( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi, S1, S2 ); break; // case(12): V_kernels<(unsigned int)12,FloatOut,FloatV,FloatP>( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi, S1, S2 ); break; // case(13): V_kernels<(unsigned int)13,FloatOut,FloatV,FloatP>( ps, V, block2, it, time_step, maxT, source, moms, listGammas, Phi, S1, S2 ); break; diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 8b9d8222..acb56b68 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -888,7 +888,7 @@ int main(int argc, char **argv) { vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_insertion[0] - vectorAuxD2.apply_gamma_scatt(glist_insertion[0]); + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); //Perform rotation to the physical basis vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); @@ -1093,7 +1093,7 @@ int main(int argc, char **argv) { vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_insertion[0] - vectorAuxD2.apply_gamma_scatt(glist_insertion[0]); + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); //Perform rotation to the physical basis vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); @@ -1284,7 +1284,7 @@ int main(int argc, char **argv) { vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_insertion[0] - vectorAuxD2.apply_gamma_scatt(glist_insertion[0]); + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); //Perform rotation to the physical basis vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,-1); From 0c886759e5e224417db4d317ec6ecf8fe7ab84d7 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 14 Dec 2022 15:03:20 +0100 Subject: [PATCH 026/168] temporary solution for Z diagrams in the NJNpi case --- include/PLEGMA_ScattCorrelator.h | 2 +- lib/PLEGMA_ScattCorrelator.cu | 88 ++++++++++++++++---------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 084999cf..47679947 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -263,7 +263,7 @@ namespace plegma { void W_diagrams_oet(PLEGMA_ScattCorrelator &srcV6, std::shared_ptr &Phi0, std::vector*> &Phi_1, int input_mom_f2, int diagram_index, bool accum=false); void Z_diagrams( std::array,4> (&srcV3), std::array,4> (&srcV2),int diagramm_index, bool accum=false ); - void Z_diagrams(std::vector*> (&srcV3), std::vector*> (&srcV2), int diagramm_index, bool accum=false ); + void Z_diagrams(std::vector*> (&srcV3), std::vector*> (&srcV2),int srcV2index, int diagramm_index, bool accum=false ); void Z_diagrams_without_dilution( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagramm_index, bool accum=false ); void Z_diagrams_without_dilution_check(PLEGMA_ScattCorrelator &srcV3, diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index dc7faee2..e35481b3 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2044,8 +2044,8 @@ void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorr } template -void PLEGMA_ScattCorrelator::Z_diagrams(std::array,4> (&srcV3), - std::array,4> (&srcV2), +void PLEGMA_ScattCorrelator::Z_diagrams(std::vector*> (&srcV3), + std::vector*> (&srcV2),int srcV2index, int diagramm_index, bool accum ){ if( (diagramm_index <1) || (diagramm_index >20 ) ) @@ -2065,64 +2065,64 @@ void PLEGMA_ScattCorrelator::Z_diagrams(std::arrayV3V2reduction( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 1, false, g2, true, g, false); //checked FP break; case 2: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, true, g, false);//checked FP break; case 3: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 1, false, g2, true, g, false);//checked FP break; case 4: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, true, g, false);//checked FP break; case 5: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, true, g, false);//checked FP break; case 6: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false);//checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 1, false, g2, true, g, false);//checked FP break; case 7: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 1, false, g2, true, g, false);//checked FP break; case 8: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, true, g, false);//checked FP break; case 9: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, false, g, true); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 2, true, g2, false, g, true); //checked FP break; case 10: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, true); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, false, g, true); //checked FP break; case 11: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, true, g, false); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 2, true, g2, true, g, false); //checked FP break; case 12: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, false, g2, true, g, false); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 2, false, g2, true, g, false); //checked FP break; case 13: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, false, g, false); //checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 1, false, g2, false, g, false); //checked FP break; case 14: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false); //checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, false, g, false); //checked FP break; case 15: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, true); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, false, g, true); //checked FP break; case 16: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, false, g, true); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 2, true, g2, false, g, true); //checked FP break; case 17: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, true, g, false);//checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 2, true, g2, true, g, false);//checked FP break; case 18: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, false, g, false);//checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 1, false, g2, false, g, false);//checked FP break; case 19: - this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, false, g2, true, g, false); //checked FP + this->V3V2reduction( *srcV3[lambda], *srcV2[srcV2index+kappa], 2, false, g2, true, g, false); //checked FP break; case 20: - this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false);//checked FP + this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[srcV2index+kappa], 0, false, g2, false, g, false);//checked FP break; default: PLEGMA_error("This value of Z diagram index does not exists, please check your inputs in piNdiagrams.cpp"); @@ -2135,8 +2135,8 @@ void PLEGMA_ScattCorrelator::Z_diagrams(std::array -void PLEGMA_ScattCorrelator::Z_diagrams(std::vector*> (&srcV3), - std::vector*> (&srcV2), +void PLEGMA_ScattCorrelator::Z_diagrams(std::array,4> (&srcV3), + std::array,4> (&srcV2), int diagramm_index, bool accum ){ if( (diagramm_index <1) || (diagramm_index >20 ) ) @@ -2156,64 +2156,64 @@ void PLEGMA_ScattCorrelator::Z_diagrams(std::vectorV3V2reduction( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false); //checked FP break; case 2: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP break; case 3: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false);//checked FP break; case 4: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP break; case 5: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP break; case 6: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false);//checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false);//checked FP break; case 7: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, true, g, false);//checked FP break; case 8: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, true, g, false);//checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, true, g, false);//checked FP break; case 9: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, false, g, true); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, false, g, true); //checked FP break; case 10: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, true); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, true); //checked FP break; case 11: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, true, g, false); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, true, g, false); //checked FP break; case 12: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, false, g2, true, g, false); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, false, g2, true, g, false); //checked FP break; case 13: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, false, g, false); //checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, false, g, false); //checked FP break; case 14: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, false); //checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false); //checked FP break; case 15: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, true); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, true); //checked FP break; case 16: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, false, g, true); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, false, g, true); //checked FP break; case 17: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, true, g2, true, g, false);//checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, true, g, false);//checked FP break; case 18: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 1, false, g2, false, g, false);//checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, false, g, false);//checked FP break; case 19: - this->V3V2reduction( *srcV3[lambda], *srcV2[kappa], 2, false, g2, true, g, false); //checked FP + this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, false, g2, true, g, false); //checked FP break; case 20: - this->V3V2reduction_matrix( *srcV3[lambda], *srcV2[kappa], 0, false, g2, false, g, false);//checked FP + this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false);//checked FP break; default: PLEGMA_error("This value of Z diagram index does not exists, please check your inputs in piNdiagrams.cpp"); From 46f17225b430f0e6ac997ec02475c7a3f8f67a92 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 14 Dec 2022 15:04:21 +0100 Subject: [PATCH 027/168] setting the fermion always unsmeared at the insertion and smeared at sink and source --- plegma/nucleon_3pt_n_npi.cpp | 137 ++++++++++++++++++++++------------- 1 file changed, 87 insertions(+), 50 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index acb56b68..9b7ead7e 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -197,9 +197,9 @@ int main(int argc, char **argv) { std::vector*> stochastic_sources; - std::vector*> stochastic_propags_UP; + std::vector*> stochastic_propags_UP_SL; - std::vector*> stochastic_propags_DN; + std::vector*> stochastic_propags_DN_SL; std::vector*> stochastic_oet_prop_u_zero_mom; @@ -283,11 +283,11 @@ int main(int argc, char **argv) { TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); //Step(7) Smearing all the time slice in the propagator - TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); vectorInOut.unload(); - stochastic_propags_UP.push_back(new PLEGMA_Vector(HOST)); - stochastic_propags_UP[countindex]->copy(vectorInOut, HOST); + stochastic_propags_UP_SL.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_UP_SL[countindex]->copy(vectorAuxD1, HOST); countindex++; //(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); vectorInOut.load(); @@ -339,14 +339,14 @@ int main(int argc, char **argv) { TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); //Step(7) Smearing all the time slice in the propagator - TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - vectorInOut.unload(); - stochastic_propags_DN.push_back(new PLEGMA_Vector(HOST)); - stochastic_propags_DN[countindex]->copy(vectorInOut, HOST); + vectorAuxD1.unload(); + stochastic_propags_DN_SL.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_DN_SL[countindex]->copy(vectorAuxD1, HOST); countindex++; - //stochastic_propags_DN[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + //stochastic_propags_DN_SL[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); vectorInOut.load(); } @@ -607,7 +607,7 @@ int main(int argc, char **argv) { //PLEGMA_printf("Look up table %d TIMESlice %d j %d\n", lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]], // (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],j); //fflush(stdout); - temporary.copy(*stochastic_propags_DN[lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); } @@ -624,7 +624,7 @@ int main(int argc, char **argv) { for (int j=0; j temporary; - temporary.copy(*stochastic_propags_UP[lookuptable_UP[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); } @@ -857,10 +857,14 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV3(source_reduction, list_mpc); PLEGMA_Propagator propTS_SS_packed; + PLEGMA_Propagator propTS_SL_packed; + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ - PLEGMA_Propagator propTS; + PLEGMA_Propagator propTS_SS; + PLEGMA_Propagator propTS_SL; + //we first implemenet UD //Ensure mu is positive @@ -894,19 +898,23 @@ int main(int argc, char **argv) { //Computing sequential propagators UD T_fii with insertion //glist_insertion[0]=gamma_5 and momentum momentum_i2 - PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); + PLEGMA_printf("Going to invert UP for sequential propagator UP for component %d\n", isc); //performing the inversion TIME(solver.solve(vectorAuxD, vectorAuxD)); //performing rotation to physical base vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,+1); //performing smearing + vectorAuxF.copy(vectorAuxD2); + propTS_SL.absorb(vectorAuxF, isc/3, isc%3); TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); vectorAuxF.copy(vectorAuxD); - propTS.absorb(vectorAuxF, isc/3, isc%3); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } @@ -994,7 +1002,7 @@ int main(int argc, char **argv) { if(tsinkMtsource >= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - propTS_SS_packed_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + propTS_SS_packed_to_sink.pack_propagator_as_sink(propTS_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); } PLEGMA_Propagator propUPpacked_to_sink; @@ -1013,7 +1021,7 @@ int main(int argc, char **argv) { for (int i_sample=0; i_sample temporary; - temporary.copy(*stochastic_propags_DN[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1021,7 +1029,8 @@ int main(int argc, char **argv) { stochastic_propagator_packed.apply_gamma5(); //V3 - TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true)); + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true)); + TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true)); TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true)); TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true)); @@ -1055,6 +1064,24 @@ int main(int argc, char **argv) { }//loop over stochastic samples + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; + TIME(produceOutput(corrB3, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB4, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB5, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB6, outfilename, "4pt", n_stochastic_samples)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; + TIME(produceOutput(corrW5, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW6, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW7, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW8, outfilename, "4pt", n_stochastic_samples)); + + TIME(produceOutput(corrW13, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW14, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW15, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW16, outfilename, "4pt", n_stochastic_samples)); + + }//loop over source sink separations @@ -1066,7 +1093,9 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ - PLEGMA_Propagator propTS; + PLEGMA_Propagator propTS_SS; + PLEGMA_Propagator propTS_SL; + //we first implemenet UU pizero UP if(mu<0) { @@ -1111,7 +1140,9 @@ int main(int argc, char **argv) { } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } @@ -1195,7 +1226,7 @@ int main(int argc, char **argv) { if(tsinkMtsource >= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - propTS_SS_packed_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + propTS_SS_packed_to_sink.pack_propagator_as_sink(propTS_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); } } @@ -1214,14 +1245,14 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int i_source_parallel=0; i_source_parallel temporary; - temporary.copy(*stochastic_propags_DN[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); - TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true )); + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true )); TIME( corrB9.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true)); TIME(corrB10.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true)); @@ -1257,7 +1288,9 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ - PLEGMA_Propagator propTS; + PLEGMA_Propagator propTS_SS; + PLEGMA_Propagator propTS_SL; + //we first implemenet DD pizero DN if(mu>0) { @@ -1296,13 +1329,17 @@ int main(int argc, char **argv) { //performing rotation to physical base vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,-1); //performing smearing + vectorAuxF.copy(vectorAuxD); + propTS_SL.absorb(vectorAuxF, isc/3, isc%3); TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); vectorAuxF.copy(vectorAuxD); - propTS.absorb(vectorAuxF, isc/3, isc%3); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); @@ -1367,7 +1404,6 @@ int main(int argc, char **argv) { } PLEGMA_Propagator propUPpacked_to_sink; - PLEGMA_Propagator propDNpacked_to_sink; for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ int tsinkMtsource = tSinks[k]; @@ -1375,7 +1411,6 @@ int main(int argc, char **argv) { PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); - propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); } @@ -1383,7 +1418,7 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int i_source_parallel=0; i_source_parallel temporary; - temporary.copy(*stochastic_propags_UP[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1444,10 +1479,6 @@ int main(int argc, char **argv) { vectortmp1.dilutespin(vectorStoc_source_oet,0); vectorSource_finite_mom.copy(vectortmp1); - std::vector tmp_4Dmom= momentum_i2 ; - tmp_4Dmom.push_back(0); - vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); - { // Smearing the source @@ -1457,6 +1488,11 @@ int main(int argc, char **argv) { vectorSource_finite_mom.absorb(vector2, source_local[3]); } + std::vector tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); + + for (int spinindex=0; spinindex<4; ++spinindex){ @@ -1500,10 +1536,6 @@ int main(int argc, char **argv) { vectortmp1.dilutespin(vectorStoc_source_oet,0); vectorSource_finite_mom.copy(vectortmp1); - std::vector tmp_4Dmom= momentum_i2 ; - tmp_4Dmom.push_back(0); - vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); - { // Smearing the source @@ -1514,6 +1546,10 @@ int main(int argc, char **argv) { } + std::vector tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); + for (int spinindex=0; spinindex<4; ++spinindex){ //Transforming to physical base for the UP quark @@ -1619,21 +1655,22 @@ int main(int argc, char **argv) { sprintf(ssource,"Z14_deltat_%d",tSinks[k]); corrZ14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - TIME(corrZ5.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 5 )); - TIME(corrZ7.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 7 )); + PLEGMA_ScattCorrelator* pointer= reductionsV2_diluted_STOCHU_DN_UP; + TIME(corrZ5.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV2_diluted_STOCHU_DN_UP, 4*k, 5 )); + TIME(corrZ7.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV2_diluted_STOCHU_DN_UP, 4*k, 7 )); - TIME(corrZ6.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 6 )); - TIME(corrZ8.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 8 )); + TIME(corrZ6.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV4_diluted_STOCHU_DN_UP, 4*k, 6 )); + TIME(corrZ8.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV4_diluted_STOCHU_DN_UP, 4*k, 8 )); - TIME(corrZ9.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP, 9 )); - TIME(corrZ10.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP, 10)); + TIME(corrZ9.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHD_UP_UP,4*k, 9 )); + TIME(corrZ10.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHD_UP_UP,4*k, 10)); - TIME(corrZ11.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP, 11 )); - TIME(corrZ13.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP, 13 )); + TIME(corrZ11.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHU_DN_UP,4*k, 11 )); + TIME(corrZ13.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHU_DN_UP,4*k, 13 )); - TIME(corrZ12.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP, 12 )); - TIME(corrZ14.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP, 14 )); + TIME(corrZ12.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV4_diluted_STOCHU_DN_UP,4*k, 12 )); + TIME(corrZ14.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV4_diluted_STOCHU_DN_UP,4*k, 14 )); TIME(produceOutput(corrZ5, outfilename, "4pt")); TIME(produceOutput(corrZ6, outfilename, "4pt")); @@ -1687,8 +1724,8 @@ int main(int argc, char **argv) { } for (int i=0; i Date: Wed, 14 Dec 2022 16:29:11 +0100 Subject: [PATCH 028/168] correcting some typos --- plegma/nucleon_3pt_n_npi.cpp | 112 +++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 43 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 9b7ead7e..4174d86e 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -518,7 +518,6 @@ int main(int argc, char **argv) { propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); - printf("Packing step %d\n", i_source_parallel); } //We implement the UD part first @@ -609,7 +608,7 @@ int main(int argc, char **argv) { //fflush(stdout); temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); @@ -626,7 +625,7 @@ int main(int argc, char **argv) { PLEGMA_Vector temporary; temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); @@ -644,6 +643,8 @@ int main(int argc, char **argv) { } //end of for stochastic samples vectorStoc_source_oet.stochastic_Z(nroots); + PLEGMA_printf("DONE stochastic factors\n"); + #if 1 @@ -657,6 +658,8 @@ int main(int argc, char **argv) { for (int l=0; l vectortmp1; PLEGMA_Vector vectortmp2; @@ -666,9 +669,9 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; - vector1.absorb(vectorStoc_source_oet, sequential_time_source+l*max_source_sink_separations); + vector1.absorb(vectorStoc_source_oet, source_local[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vectortmp1.absorb(vector2, sequential_time_source); + vectortmp1.absorb(vector2, source_local[3]); } @@ -693,11 +696,11 @@ int main(int argc, char **argv) { temporary1.copy(*stochastic_oet_prop_u_zero_mom[spinindex],HOST); temporary1.load(); temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2, source_local[3], max_source_sink_separations, l == 0 ? true : false); + temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); stochastic_oet_prop_u_zero_mom[spinindex]->copy(temporary1,HOST); - // vectortmp2.writeLIME(outfile_V+confnumber+"propagator_up"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); + //temporary1.writeLIME(outfile_V+confnumber+"propagator_up"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); vectorSave_diluted.copy(vectortmp1); @@ -705,6 +708,8 @@ int main(int argc, char **argv) { } //end of loop on parallel sources + PLEGMA_printf("DONE OET zero mom up\n"); + //Doing for -mu for the DN propagator spin dilution oet if(mu>0) { mu*=-1.; @@ -715,6 +720,8 @@ int main(int argc, char **argv) { site& source_local = sourcePositions[isource]; source_local[3]=(sourcePositions[isource][3]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + int sink_local=(sourcePositions[isource][3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + PLEGMA_Vector vectortmp1; PLEGMA_Vector vectortmp2; PLEGMA_Vector vectorSave_diluted; @@ -723,9 +730,9 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; - vector1.absorb(vectorStoc_source_oet, sequential_time_source+l*max_source_sink_separations); + vector1.absorb(vectorStoc_source_oet, source_local[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vectortmp1.absorb(vector2, sequential_time_source); + vectortmp1.absorb(vector2, source_local[3]); } @@ -751,7 +758,7 @@ int main(int argc, char **argv) { temporary1.copy(*stochastic_oet_prop_d_zero_mom[spinindex],HOST); temporary1.load(); temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2, source_local[3], max_source_sink_separations, l == 0 ? true : false); + temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); stochastic_oet_prop_u_zero_mom[spinindex]->copy(temporary1,HOST); //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); @@ -760,6 +767,8 @@ int main(int argc, char **argv) { }//end of loop on spin indices } //end of loop on parallel sources }//end of do_stochastic_oet + + PLEGMA_printf("DONE OET zero mom dn\n"); #endif @@ -912,8 +921,8 @@ int main(int argc, char **argv) { } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -944,6 +953,12 @@ int main(int argc, char **argv) { TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + TIME(produceOutput(corrTproton_protonpizero1, outfilename, "T")); + TIME(produceOutput(corrTproton_protonpizero2, outfilename, "T")); + TIME(produceOutput(corrTproton_protonpizero3, outfilename, "T")); + TIME(produceOutput(corrTproton_protonpizero4, outfilename, "T")); + + //creating factors PLEGMA_Vector stochastic_propagator_packed; @@ -1023,7 +1038,7 @@ int main(int argc, char **argv) { PLEGMA_Vector temporary; temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); @@ -1133,15 +1148,18 @@ int main(int argc, char **argv) { TIME(solver.solve(vectorAuxD, vectorAuxD)); //performing rotation to physical base vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,+1); + vectorAuxF.copy(vectorAuxD2); + propTS_SL.absorb(vectorAuxF, isc/3, isc%3); + //performing smearing TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); vectorAuxF.copy(vectorAuxD); - propTS.absorb(vectorAuxF, isc/3, isc%3); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1171,6 +1189,15 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + TIME(produceOutput(corrTproton_neutronpiplus1, outfilename, "T")); + TIME(produceOutput(corrTproton_neutronpiplus2, outfilename, "T")); + TIME(produceOutput(corrTproton_neutronpiplus3, outfilename, "T")); + TIME(produceOutput(corrTproton_neutronpiplus4, outfilename, "T")); + + + + + for (int k=0; k< tSinks.size(); ++k){ PLEGMA_ScattCorrelator corrB9(source, filtered_sourcemomentumList); @@ -1247,7 +1274,7 @@ int main(int argc, char **argv) { PLEGMA_Vector temporary; temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); @@ -1337,8 +1364,8 @@ int main(int argc, char **argv) { } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1355,6 +1382,9 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(produceOutput(corrTproton_protonpizero5, outfilename, "T")); + TIME(produceOutput(corrTproton_protonpizero6, outfilename, "T")); + for (int k=0; k< tSinks.size(); ++k){ PLEGMA_ScattCorrelator corrB7(source, filtered_sourcemomentumList); @@ -1382,16 +1412,6 @@ int main(int argc, char **argv) { free(ssource); - - corrB7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B9"); - corrB8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "B10"); - - - corrW9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W17"); - corrW10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W18"); - corrW11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W19"); - corrW12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", "W20"); - PLEGMA_Propagator propTS_SS_packed_to_sink; { for (int i_source_parallel=0; i_source_parallel temporary; temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); @@ -1475,6 +1495,8 @@ int main(int argc, char **argv) { for (int l=0; lcopy(temporary1,HOST); @@ -1532,6 +1554,8 @@ int main(int argc, char **argv) { for (int l=0; lcopy(temporary1,HOST); @@ -1654,23 +1678,25 @@ int main(int argc, char **argv) { corrZ13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); sprintf(ssource,"Z14_deltat_%d",tSinks[k]); corrZ14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + free(ssource); + + TIME(corrZ5.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 4*k, 5 )); + TIME(corrZ7.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 4*k, 7 )); - PLEGMA_ScattCorrelator* pointer= reductionsV2_diluted_STOCHU_DN_UP; - TIME(corrZ5.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV2_diluted_STOCHU_DN_UP, 4*k, 5 )); - TIME(corrZ7.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV2_diluted_STOCHU_DN_UP, 4*k, 7 )); + TIME(corrZ6.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 4*k, 6 )); + TIME(corrZ8.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 4*k, 8 )); - TIME(corrZ6.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV4_diluted_STOCHU_DN_UP, 4*k, 6 )); - TIME(corrZ8.Z_diagrams( reductionsV3_diluted_D_UP, &reductionsV4_diluted_STOCHU_DN_UP, 4*k, 8 )); + TIME(corrZ9.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,4*k, 9 )); + TIME(corrZ10.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,4*k, 10)); - TIME(corrZ9.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHD_UP_UP,4*k, 9 )); - TIME(corrZ10.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHD_UP_UP,4*k, 10)); + TIME(corrZ11.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,4*k, 11 )); + TIME(corrZ13.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,4*k, 13 )); - TIME(corrZ11.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHU_DN_UP,4*k, 11 )); - TIME(corrZ13.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV2_diluted_STOCHU_DN_UP,4*k, 13 )); + TIME(corrZ12.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,4*k, 12 )); + TIME(corrZ14.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,4*k, 14 )); - TIME(corrZ12.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV4_diluted_STOCHU_DN_UP,4*k, 12 )); - TIME(corrZ14.Z_diagrams( reductionsV3_diluted_U_DN, &reductionsV4_diluted_STOCHU_DN_UP,4*k, 14 )); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z"; TIME(produceOutput(corrZ5, outfilename, "4pt")); TIME(produceOutput(corrZ6, outfilename, "4pt")); From 8a5a76c851b0f426d073b4a2a5885b658f9fdeff Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 15 Dec 2022 18:10:06 +0100 Subject: [PATCH 029/168] correcting error in packing --- lib/PLEGMA_Propagator.cu | 7 +++++++ lib/PLEGMA_Vector.cu | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index d11e0151..203e450a 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -109,6 +109,10 @@ void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator stmp.zero_where(DEVICE); stmp.zero_where(HOST); } + else{ + stmp.absorb(*this,isc/3, isc%3); + } + vector1.absorb(in, sinktimeslice, isc/3, isc%3,true); @@ -132,6 +136,9 @@ void PLEGMA_Propagator::pack_propagator_from_source_to_sink(PLEGMA_Propag stmp.zero_where(DEVICE); stmp.zero_where(HOST); } + else{ + stmp.absorb(*this,isc/3, isc%3); + } for (int dt=0; dt::pack_propagator_as_sink(PLEGMA_Vector &in, int stmp.zero_where(DEVICE); stmp.zero_where(HOST); } + else{ + stmp.copy(*this); + } + for (int dt=0; dt::pack_propagator_from_source_to_sink(PLEGMA_Vector Date: Thu, 15 Dec 2022 18:10:45 +0100 Subject: [PATCH 030/168] including boundary condition for the 3pt function --- include/PLEGMA_ScattCorrelator.h | 2 ++ lib/PLEGMA_ScattCorrelator.cu | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 47679947..0d11f6a0 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -306,6 +306,8 @@ namespace plegma { void multiply_by_time_slice(std::shared_ptr&); void applyBoundaryConditions( bool antiperiodic, int n_coherent_source=1, int *attract_look_up_table=NULL ); + void applyBoundaryConditions_3pt( bool antiperiodic, int source_sink_separation,int max_source_sink_separation ); + void apply_phase( ); diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index e35481b3..9cd26dfd 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -3381,6 +3381,42 @@ void PLEGMA_ScattCorrelator::applyBoundaryConditions( bool antiperiodic, } } +template +void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiodic, int source_sink_separation,int max_source_sink_separation ) { + + if(!antiperiodic) return; + + std::size_t n_t = this->labels.find("t"); + assert(n_t!=std::string::npos); + int parallel_sources=HGC_totalL[DIM_T]/max_source_sink_separation; + + int TIME = this->localT(); + if (TIME==0) return; + int in_dofs = std::accumulate(ranges.begin()+n_t+1, ranges.end(), 2, std::multiplies()); + int out_dofs = ranges[0]*offsets[0]/TIME/in_dofs; + int maxT = this->endT() - this->startT(); + + for( int t=0; t=maxT) ? (this->source[DIM_T]%HGC_localL[DIM_T]) + t - maxT : t; + int t_global = HGC_procPosition[DIM_T] * HGC_localL[DIM_T] + t_local; + int actualSource; + for (int j=0; jsource[DIM_T]+j*max_source_sink_separation+HGC_totalL[DIM_T])%HGC_totalL[DIM_T]; + if (t_global>=((possible_source+max_source_sink_separation+HGC_totalL[DIM_T])%HGC_totalL[DIM_T])){ + break; + } + } + if (actualSource+source_sink_separation>HGC_totalL[DIM_T]){ + for( int o_dofs=0; o_dofsH_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs) = -*(this->H_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs); + } + } + } + } +} + + template void PLEGMA_ScattCorrelator::apply_phase(){ From 540baae12d68cd816da056c9365890c1fe1694b4 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 15 Dec 2022 18:11:32 +0100 Subject: [PATCH 031/168] correcting typos including some debugging --- plegma/nucleon_3pt_n_npi.cpp | 97 ++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 4174d86e..3f934617 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -27,6 +27,18 @@ void produceOutput( PLEGMA_ScattCorrelator source, } +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + void produceOutput( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name @@ -233,8 +245,14 @@ int main(int argc, char **argv) { vectorSource_stochastic.stochastic_Z(nroots); vectorSource_stochastic.unload(); stochastic_sources[i]->copy(vectorSource_stochastic,HOST); + + PLEGMA_printf("Save the stochastic source for sample %d\n",i); + std::string nstoch=std::to_string(i); + vectorSource_stochastic.writeHDF5("stochastic_source"+nstoch); + vectorSource_stochastic.load(); + } /****************************************************** @@ -285,12 +303,17 @@ int main(int argc, char **argv) { //Step(7) Smearing all the time slice in the propagator //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - vectorInOut.unload(); + vectorAuxD1.unload(); + PLEGMA_printf("Save the stochastic source for sample %d\n",i); + std::string nstoch=std::to_string(i); + vectorAuxD1.writeHDF5("stochastic_propagators_UP"+nstoch); + + //writeHDF5(outfilename) stochastic_propags_UP_SL.push_back(new PLEGMA_Vector(HOST)); stochastic_propags_UP_SL[countindex]->copy(vectorAuxD1, HOST); countindex++; //(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); - vectorInOut.load(); + vectorAuxD1.load(); } lookuptable_UP[timeSlice]=(countindex-1)/n_stochastic_samples; @@ -342,12 +365,16 @@ int main(int argc, char **argv) { //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); vectorAuxD1.unload(); + PLEGMA_printf("Save the stochastic source for sample %d\n",i); + std::string nstoch=std::to_string(i); + vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch); + stochastic_propags_DN_SL.push_back(new PLEGMA_Vector(HOST)); stochastic_propags_DN_SL[countindex]->copy(vectorAuxD1, HOST); countindex++; //stochastic_propags_DN_SL[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); - vectorInOut.load(); + vectorAuxD1.load(); } //lookuptable[(source[3]+tSinks[k]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; @@ -519,6 +546,46 @@ int main(int argc, char **argv) { propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); } + { + PLEGMA_printf("Save propagator for the up and dn quark\n"); + PLEGMA_Vector vectorAuxPrint(BOTH); + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propUP_SL_packed,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("propUPSL_packed_s"+spin+"_c"+col); + } + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propUP_SS_packed,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("propUPSS_packed_s"+spin+"_c"+col); + } + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propDN_SL_packed,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("propDNSL_packed_s"+spin+"_c"+col); + } + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propDN_SS_packed,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("propDNSS_packed_s"+spin+"_c"+col); + } + } + + + + //We implement the UD part first //The neutron piplus at the source @@ -1189,6 +1256,8 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + TIME(produceOutput(corrTproton_neutronpiplus1, outfilename, "T")); TIME(produceOutput(corrTproton_neutronpiplus2, outfilename, "T")); TIME(produceOutput(corrTproton_neutronpiplus3, outfilename, "T")); @@ -1310,6 +1379,26 @@ int main(int argc, char **argv) { } //loop over stochastic samples + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; + TIME(produceOutput(corrB9, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB10, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB11, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB12, outfilename, "4pt", n_stochastic_samples)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; + TIME(produceOutput(corrW17, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW18, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW19, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW20, outfilename, "4pt", n_stochastic_samples)); + + TIME(produceOutput(corrW21, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW22, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW23, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW24, outfilename, "4pt", n_stochastic_samples)); + + + + } //loop over source sink separations @@ -1382,6 +1471,8 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + TIME(produceOutput(corrTproton_protonpizero5, outfilename, "T")); TIME(produceOutput(corrTproton_protonpizero6, outfilename, "T")); From 33b350aad6447c0bb527c7d89e457b7f407a19ae Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 16 Dec 2022 08:57:26 +0100 Subject: [PATCH 032/168] correcting typo --- lib/PLEGMA_ScattCorrelator.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 9cd26dfd..9e672819 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -3402,7 +3402,7 @@ void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiod int actualSource; for (int j=0; jsource[DIM_T]+j*max_source_sink_separation+HGC_totalL[DIM_T])%HGC_totalL[DIM_T]; - if (t_global>=((possible_source+max_source_sink_separation+HGC_totalL[DIM_T])%HGC_totalL[DIM_T])){ + if (t_global>=((actualSource+max_source_sink_separation+HGC_totalL[DIM_T])%HGC_totalL[DIM_T])){ break; } } From 444d31fb1b6c8be8b95c70692909712734788d15 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 16 Dec 2022 08:57:49 +0100 Subject: [PATCH 033/168] adding load after each copy from HOST --- plegma/nucleon_3pt_n_npi.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 3f934617..ed1068d3 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -829,6 +829,7 @@ int main(int argc, char **argv) { temporary1.unload(); stochastic_oet_prop_u_zero_mom[spinindex]->copy(temporary1,HOST); //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); + temporary1.load(); vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); vectorSave_diluted.copy(vectortmp1); }//end of loop on spin indices @@ -1104,6 +1105,7 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel temporary; temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1342,6 +1344,7 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel temporary; temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1530,6 +1533,7 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel temporary; temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1627,6 +1631,7 @@ int main(int argc, char **argv) { temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); stochastic_oet_prop_u_fini_mom[spinindex]->copy(temporary1,HOST); + temporary1.load(); vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); vectorSource_finite_mom.copy(vectortmp1); @@ -1685,6 +1690,7 @@ int main(int argc, char **argv) { temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); stochastic_oet_prop_d_fini_mom[spinindex]->copy(temporary1,HOST); + temporar1.load(); vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); vectorSource_finite_mom.copy(vectortmp1); From bb33f98b838e890d4ee004fa198189053486e79f Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 16 Dec 2022 11:04:28 +0100 Subject: [PATCH 034/168] free some memory place with quda device free --- lib/kernels/PLEGMA_scattreductions.cuh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kernels/PLEGMA_scattreductions.cuh b/lib/kernels/PLEGMA_scattreductions.cuh index 710253b4..7645ca51 100644 --- a/lib/kernels/PLEGMA_scattreductions.cuh +++ b/lib/kernels/PLEGMA_scattreductions.cuh @@ -133,8 +133,8 @@ static void V_reductions_host( ProfileStruct &ps, VRED V, PLEGMA_ScattCorrelator //free allocated memory hostFree(h_partial_block, alloc_size*sizeof(Float2)); - cudaFree(d_partial_block); - cudaFree(listGammas.array); + device_free(d_partial_block); + device_free(listGammas.array); } From 3fe9a8a70665f166e68a4fe9af79ef54d490d84c Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 16 Dec 2022 11:05:04 +0100 Subject: [PATCH 035/168] apply the correct Boundary condition and correct some typos --- plegma/nucleon_3pt_n_npi.cpp | 227 +++++++++++++++++++---------------- 1 file changed, 122 insertions(+), 105 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index ed1068d3..b7c030cc 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -30,10 +30,12 @@ void produceOutput( PLEGMA_ScattCorrelator source, void produceOutput_3pt( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, - int n_stochastic_samples){ + int n_stochastic_samples, + int source_sink_separation, + int max_source_sink_separation){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions( true )); + TIME(source.applyBoundaryConditions_3pt( true, source_sink_separation, max_source_sink_separation )); TIME(source.normalize_nstoch(n_stochastic_samples)); TIME(source.writeHDF5( outputFilename )); @@ -48,6 +50,19 @@ void produceOutput( PLEGMA_ScattCorrelator source, TIME(source.applyBoundaryConditions( true )); TIME(source.writeHDF5( outputFilename )); } + +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int source_sink_separation, + int max_source_sink_separation + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions_3pt( true, source_sink_separation, max_source_sink_separation )); + TIME(source.writeHDF5( outputFilename )); +} + int main(int argc, char **argv) { initializeOptions(argc, argv, true, listOpt); @@ -213,20 +228,23 @@ int main(int argc, char **argv) { std::vector*> stochastic_propags_DN_SL; - std::vector*> stochastic_oet_prop_u_zero_mom; + std::vector*> stochastic_oet_prop_u_zero_mom_SS; - std::vector*> stochastic_oet_prop_u_fini_mom; + std::vector*> stochastic_oet_prop_d_zero_mom_SS; - std::vector*> stochastic_oet_prop_d_zero_mom; + std::vector*> stochastic_oet_prop_u_fini_mom_SL; + + std::vector*> stochastic_oet_prop_d_fini_mom_SL; - std::vector*> stochastic_oet_prop_d_fini_mom; for(int i=0; i< 4; ++i) { - stochastic_oet_prop_u_fini_mom.push_back(new PLEGMA_Vector(HOST)); - stochastic_oet_prop_u_zero_mom.push_back(new PLEGMA_Vector(HOST)); - stochastic_oet_prop_d_zero_mom.push_back(new PLEGMA_Vector(HOST)); - stochastic_oet_prop_d_fini_mom.push_back(new PLEGMA_Vector(HOST)); + stochastic_oet_prop_u_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); + stochastic_oet_prop_d_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); + + stochastic_oet_prop_u_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); + stochastic_oet_prop_d_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); + } @@ -538,6 +556,20 @@ int main(int argc, char **argv) { TIME( corrNP.applyBoundaryConditions( true ) ); TIME( corrNP.writeHDF5(outfilename) ); + { + PLEGMA_printf("Save propagator for the up and dn quark\n"); + PLEGMA_Vector vectorAuxPrint(BOTH); + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propUP_SL,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("propUPSL_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); + } + } + + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -545,7 +577,7 @@ int main(int argc, char **argv) { propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); - } + } //parallel source position { PLEGMA_printf("Save propagator for the up and dn quark\n"); PLEGMA_Vector vectorAuxPrint(BOTH); @@ -584,15 +616,9 @@ int main(int argc, char **argv) { } - - - //We implement the UD part first //The neutron piplus at the source - - int sequential_time_source=source[DIM_T]; - //We can compute V2 contractions for B and V3 contraction for W first //without having to compute it for all the iterations in the loop //over the sequential momentum @@ -648,10 +674,10 @@ int main(int argc, char **argv) { //B3,B5,B9,B11 PLEGMA_Propagator propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); for (int j=0; j= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); @@ -760,12 +786,13 @@ int main(int argc, char **argv) { //Gaussian smearing of the propagator TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); PLEGMA_Vector temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_u_zero_mom[spinindex],HOST); + temporary1.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); temporary1.load(); temporary2.copy(vectortmp2); temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); - stochastic_oet_prop_u_zero_mom[spinindex]->copy(temporary1,HOST); + stochastic_oet_prop_u_zero_mom_SS[spinindex]->copy(temporary1,HOST); + temporary1.load(); //temporary1.writeLIME(outfile_V+confnumber+"propagator_up"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); @@ -822,12 +849,12 @@ int main(int argc, char **argv) { //Gaussian smearing of the propagator TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); PLEGMA_Vector temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_d_zero_mom[spinindex],HOST); + temporary1.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); temporary1.load(); temporary2.copy(vectortmp2); temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); - stochastic_oet_prop_u_zero_mom[spinindex]->copy(temporary1,HOST); + stochastic_oet_prop_d_zero_mom_SS[spinindex]->copy(temporary1,HOST); //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); temporary1.load(); vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); @@ -874,10 +901,10 @@ int main(int argc, char **argv) { for (int k=0; k propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); for (int j=0; j= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); @@ -888,18 +915,15 @@ int main(int argc, char **argv) { PLEGMA_Vector st_oet_u_zero; PLEGMA_Vector st_oet_d_zero; - st_oet_u_zero.copy(*stochastic_oet_prop_u_zero_mom[spinindex],HOST); + st_oet_u_zero.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); st_oet_u_zero.load(); - st_oet_d_zero.copy(*stochastic_oet_prop_d_zero_mom[spinindex],HOST); + st_oet_d_zero.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); st_oet_d_zero.load(); PLEGMA_Vector st_oet_u_zeropacked_to_sink; PLEGMA_Vector st_oet_d_zeropacked_to_sink; for (int j=0; j= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; st_oet_u_zeropacked_to_sink.pack_propagator_as_sink(st_oet_u_zero, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); st_oet_d_zeropacked_to_sink.pack_propagator_as_sink(st_oet_d_zero, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); @@ -1021,6 +1045,9 @@ int main(int argc, char **argv) { TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + + TIME(produceOutput(corrTproton_protonpizero1, outfilename, "T")); TIME(produceOutput(corrTproton_protonpizero2, outfilename, "T")); TIME(produceOutput(corrTproton_protonpizero3, outfilename, "T")); @@ -1149,21 +1176,21 @@ int main(int argc, char **argv) { }//loop over stochastic samples outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; - TIME(produceOutput(corrB3, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrB4, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrB5, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrB6, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrB3, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB4, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB5, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB6, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; - TIME(produceOutput(corrW5, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW6, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW7, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW8, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrW5, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW6, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW7, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW8, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); - TIME(produceOutput(corrW13, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW14, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW15, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW16, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrW13, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW14, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW15, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW16, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); }//loop over source sink separations @@ -1383,21 +1410,21 @@ int main(int argc, char **argv) { } //loop over stochastic samples outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; - TIME(produceOutput(corrB9, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrB10, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrB11, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrB12, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrB9, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB10, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB11, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB12, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; - TIME(produceOutput(corrW17, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW18, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW19, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW20, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrW17, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW18, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW19, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW20, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput(corrW21, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW22, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW23, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrW24, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrW21, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW22, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW23, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW24, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); @@ -1562,20 +1589,20 @@ int main(int argc, char **argv) { } //loop over stochastic samples outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; - TIME(produceOutput(corrB7, outfilename, "4pt", n_stochastic_samples)); - TIME(produceOutput(corrB8, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrB7, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB8, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; - TIME(produceOutput(corrW9 , outfilename,"4pt", n_stochastic_samples));//because of V4 - TIME(produceOutput(corrW10, outfilename,"4pt", n_stochastic_samples));//because of V4 - TIME(produceOutput(corrW11, outfilename,"4pt", n_stochastic_samples)); - TIME(produceOutput(corrW12, outfilename,"4pt", n_stochastic_samples)); + TIME(produceOutput_3pt(corrW9 , outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations ));//because of V4 + TIME(produceOutput_3pt(corrW10, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations ));//because of V4 + TIME(produceOutput_3pt(corrW11, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW12, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); } //loop over tSinks - if ((momentum_i2[0] != 0) || (momentum_i2[1] != 0) || (momentum_i2[2] != 0)){ + { //Finite momentum oet PLEGMA_Vector vectortmp1; PLEGMA_Vector vectortmp2; PLEGMA_Vector vectorSource_finite_mom; @@ -1622,16 +1649,16 @@ int main(int argc, char **argv) { //Rotate back immediately to the physical basis vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); - //performing smearing - TIME(vectortmp1.gaussianSmearing(vectortmp2, smearedGauge, nsmearGauss, alphaGauss)); PLEGMA_Vector temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_u_fini_mom[spinindex],HOST); + temporary1.copy(*stochastic_oet_prop_u_fini_mom_SL[spinindex],HOST); temporary1.load(); temporary2.copy(vectortmp2); temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); - stochastic_oet_prop_u_fini_mom[spinindex]->copy(temporary1,HOST); - temporary1.load(); + stochastic_oet_prop_u_fini_mom_SL[spinindex]->copy(temporary1,HOST); + temporary1.load(); + + vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); vectorSource_finite_mom.copy(vectortmp1); @@ -1681,16 +1708,14 @@ int main(int argc, char **argv) { //Rotate back immediately to the physical basis vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); - //performing smearing - TIME(vectortmp1.gaussianSmearing(vectortmp2, smearedGauge, nsmearGauss, alphaGauss)); PLEGMA_Vector temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_d_fini_mom[spinindex],HOST); - temporary1.load(); + temporary1.copy(*stochastic_oet_prop_d_fini_mom_SL[spinindex],HOST); + temporary1.load(); temporary2.copy(vectortmp2); temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); - temporary1.unload(); - stochastic_oet_prop_d_fini_mom[spinindex]->copy(temporary1,HOST); - temporar1.load(); + temporary1.unload(); + stochastic_oet_prop_d_fini_mom_SL[spinindex]->copy(temporary1,HOST); + temporary1.load(); vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); vectorSource_finite_mom.copy(vectortmp1); @@ -1699,17 +1724,12 @@ int main(int argc, char **argv) { } // end of parallel sources - }//end of if momentum zero + }//end of finite momentum oet for (int i=0; i< 4; ++i){ PLEGMA_Vector st_oet_d_fini; - if ((momentum_i2[0] != 0) || (momentum_i2[1] != 0) || (momentum_i2[2] != 0)){ - st_oet_d_fini.copy(*stochastic_oet_prop_d_fini_mom[i],HOST); - } - else{ - st_oet_d_fini.copy(*stochastic_oet_prop_d_zero_mom[i],HOST); - } + st_oet_d_fini.copy(*stochastic_oet_prop_d_fini_mom_SL[i],HOST); st_oet_d_fini.load(); st_oet_d_fini.apply_gamma5(); @@ -1720,19 +1740,14 @@ int main(int argc, char **argv) { for (int i=0; i< 4; ++i){ PLEGMA_Vector st_oet_u_fini; - if ((momentum_i2[0] != 0) || (momentum_i2[1] != 0) || (momentum_i2[2] != 0)){ - st_oet_u_fini.copy(*stochastic_oet_prop_u_fini_mom[i],HOST); - } - else{ - st_oet_u_fini.copy(*stochastic_oet_prop_u_zero_mom[i],HOST); - } - st_oet_u_fini.load(); + st_oet_u_fini.copy(*stochastic_oet_prop_u_fini_mom_SL[i],HOST); + st_oet_u_fini.load(); - st_oet_u_fini.apply_gamma5(); + st_oet_u_fini.apply_gamma5(); TIME(reductionsV3_diluted_U_DN[i]->V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); + } - } for (int k=0; k Date: Sun, 18 Dec 2022 23:11:25 +0100 Subject: [PATCH 036/168] small rewriting of from_source_to_sink routine for propagators --- lib/PLEGMA_Propagator.cu | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index 203e450a..400f039d 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -127,26 +127,13 @@ void PLEGMA_Propagator::pack_propagator_as_sink(PLEGMA_Propagator } template void PLEGMA_Propagator::pack_propagator_from_source_to_sink(PLEGMA_Propagator &in, int sinktimeslice, int source_sink_separation, bool initialize){ - for (int isc=0; isc<12; ++isc){ - PLEGMA_Vector stmp; - PLEGMA_Vector3D vector1; - - if (initialize==true){ - stmp.zero_where(DEVICE); - stmp.zero_where(HOST); - } - else{ - stmp.absorb(*this,isc/3, isc%3); - } - - for (int dt=0; dtabsorb(stmp, isc/3, isc%3); + for (int ii=0;ii<12;++ii){ + PLEGMA_Vector temporary1,temporary2; + temporary1.absorb(in,ii/3,ii%3); + temporary2.absorb(*this,ii/3,ii%3); + temporary2.pack_propagator_from_source_to_sink(temporary1,sinktimeslice, source_sink_separation, initialize); + this->absorb(temporary2,ii/3,ii%3); } } From f30163e635116e8a4e84b57bab0d35fcc778e7f7 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sun, 18 Dec 2022 23:12:34 +0100 Subject: [PATCH 037/168] correcting two bugs: 1 in the absorb of doing the point to all, another one is the sink timeSlice in the packing routines --- plegma/nucleon_3pt_n_npi.cpp | 83 +++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index b7c030cc..808d4031 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -324,7 +324,7 @@ int main(int argc, char **argv) { vectorAuxD1.unload(); PLEGMA_printf("Save the stochastic source for sample %d\n",i); std::string nstoch=std::to_string(i); - vectorAuxD1.writeHDF5("stochastic_propagators_UP"+nstoch); + vectorAuxD1.writeHDF5("stochastic_propagators_UP"+nstoch+"_t"+std::to_string(timeSlice)); //writeHDF5(outfilename) stochastic_propags_UP_SL.push_back(new PLEGMA_Vector(HOST)); @@ -385,7 +385,7 @@ int main(int argc, char **argv) { vectorAuxD1.unload(); PLEGMA_printf("Save the stochastic source for sample %d\n",i); std::string nstoch=std::to_string(i); - vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch); + vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch+"_t"+std::to_string(timeSlice)); stochastic_propags_DN_SL.push_back(new PLEGMA_Vector(HOST)); stochastic_propags_DN_SL[countindex]->copy(vectorAuxD1, HOST); @@ -412,7 +412,7 @@ int main(int argc, char **argv) { for(int isource = startSource; isource < numSourcePositions; isource++){ - site& source = sourcePositions[isource]; + site source = sourcePositions[isource]; site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); @@ -440,8 +440,11 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; vector1.pointSource(source_location, isc/3, isc%3, DEVICE); + double tmp=vector1.norm(); + PLEGMA_printf("Norm of source location %d is %e\n",source_location[3],tmp); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); - vectorInOut.absorb(vector2,source[DIM_T]); + + vectorInOut.absorb(vector2,source_location[DIM_T]); } // Inverting PLEGMA_printf("Going to invert %s for component %d\n", @@ -498,7 +501,6 @@ int main(int argc, char **argv) { site& source_local = sourcePositions[isource]; source_local[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - int sink_local=(sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); source_local_reduction[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; @@ -510,13 +512,11 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrN0(source_local, list_mpf1_twopt); TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); - bool computed_light = false; + // If twop_filename exists we hold the computation of the light props - if(access( twop_filename.c_str(), F_OK ) == -1) { - TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); - TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); - computed_light = true; - } + PLEGMA_printf("TESTING %d\n",source_local[DIM_T]); + TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); + TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); //Computing T reductions+recombination { @@ -563,19 +563,44 @@ int main(int argc, char **argv) { std::string spin=std::to_string(isc/3); std::string col=std::to_string(isc%3); - vectorAuxPrint.absorb(propUP_SL,isc/3,isc%3); + vectorAuxPrint.absorb(propUP_SS,isc/3,isc%3); vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("propUPSL_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); + vectorAuxPrint.writeHDF5("propUPSS_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); } } + /*for (int ii=0;ii<12;++ii){ + PLEGMA_Vector temporary1,temporary2; + temporary1.absorb(propUP_SS,ii/3,ii%3); + temporary2.absorb(propUP_SS_packed,ii/3,ii%3); + if (ii==0){ + temporary1.unload(); + temporary1.writeHDF5("propUPtest_source_j"+std::to_string(i_source_parallel)); + temporary1.load(); + } + if (ii==0){ + temporary2.unload(); + temporary2.writeHDF5("propUPtest_before_j"+std::to_string(i_source_parallel)); + temporary2.load(); + } + temporary2.pack_propagator_from_source_to_sink(temporary1, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + if (ii==0){ + temporary2.unload(); + temporary2.writeHDF5("propUPtest_after_j"+std::to_string(i_source_parallel)); + temporary2.load(); + } + propUP_SS_packed.absorb(temporary2,ii/3,ii%3); + }*/ - propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); - propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); + //int sink_local=(sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + //PLEGMA_printf("sink local %d another right %d\n", sink_local, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +// stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); - propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); - propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, sink_local, max_source_sink_separations, i_source_parallel == 0 ? true : false); + propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } //parallel source position { @@ -717,10 +742,17 @@ int main(int argc, char **argv) { for (int j=0; j temporary; temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); + temporary.writeHDF5("source_for_packing_j"+std::to_string(j)+"_stoch"+std::to_string(i_sample)); temporary.load(); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); } + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.writeHDF5("stochastic_up_packed_SL_ns"+std::to_string(i_sample)); + stochastic_propagator_packed.load(); + stochastic_propagator_packed.apply_gamma5(); @@ -751,7 +783,7 @@ int main(int argc, char **argv) { for (int l=0; l vectortmp1; @@ -789,7 +821,7 @@ int main(int argc, char **argv) { temporary1.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); temporary1.load(); temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); + temporary1.pack_propagator_from_source_to_sink(temporary2, (source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); stochastic_oet_prop_u_zero_mom_SS[spinindex]->copy(temporary1,HOST); temporary1.load(); @@ -814,7 +846,7 @@ int main(int argc, char **argv) { site& source_local = sourcePositions[isource]; source_local[3]=(sourcePositions[isource][3]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - int sink_local=(sourcePositions[isource][3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + //int sink_local=(sourcePositions[isource][3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; PLEGMA_Vector vectortmp1; PLEGMA_Vector vectortmp2; @@ -852,7 +884,7 @@ int main(int argc, char **argv) { temporary1.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); temporary1.load(); temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2, sink_local, max_source_sink_separations, l == 0 ? true : false); + temporary1.pack_propagator_from_source_to_sink(temporary2, (source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, l == 0 ? true : false); temporary1.unload(); stochastic_oet_prop_d_zero_mom_SS[spinindex]->copy(temporary1,HOST); //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); @@ -1020,6 +1052,7 @@ int main(int argc, char **argv) { + PLEGMA_printf("source %d\n",source[3]); PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); @@ -1617,7 +1650,7 @@ int main(int argc, char **argv) { for (int l=0; lcopy(temporary1,HOST); temporary1.load(); @@ -1677,7 +1710,7 @@ int main(int argc, char **argv) { for (int l=0; lcopy(temporary1,HOST); temporary1.load(); From 47df23fff726a558e3d2cc7d0daef95475e739e0 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 19 Dec 2022 16:22:24 +0100 Subject: [PATCH 038/168] before V2,V4 reduction in B,W diagrams pack stochastic propagators to the sink --- plegma/nucleon_3pt_n_npi.cpp | 56 +++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 808d4031..6cdfdbe2 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -692,8 +692,13 @@ int main(int argc, char **argv) { for (int k=0; k< tSinks.size();++k){ + + PLEGMA_Vector stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallelV2( stochastic_source, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); //B4,B6 //B10,B12 - TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, false)); + TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, false)); //W5,W6,W7,W8 //W9,W10,W11,W12,W17,W18,W19,W20 @@ -762,7 +767,7 @@ int main(int argc, char **argv) { //B7,B8 //B1,B2 - TIME(reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k]->V2( stochastic_source, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); } //end of for source sink separations } //end of for stochastic samples @@ -1182,27 +1187,32 @@ int main(int argc, char **argv) { stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); - stochastic_propagator_packed.apply_gamma5(); + PLEGMA_Vector stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallel stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallel stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallel Date: Thu, 22 Dec 2022 08:17:46 +0100 Subject: [PATCH 039/168] Z diagrams without oet --- include/PLEGMA_ScattCorrelator.h | 2 + lib/PLEGMA_ScattCorrelator.cu | 84 ++++ plegma/nucleon_3pt_n_npi.cpp | 662 ++++++++++++++++++++----------- 3 files changed, 509 insertions(+), 239 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 0d11f6a0..568c02d1 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -266,6 +266,8 @@ namespace plegma { void Z_diagrams(std::vector*> (&srcV3), std::vector*> (&srcV2),int srcV2index, int diagramm_index, bool accum=false ); void Z_diagrams_without_dilution( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagramm_index, bool accum=false ); + void Z_diagrams_without_dilution( PLEGMA_ScattCorrelator &srcV3, std::vector*> (&srcV2), int srcV2index, int diagramm_index, bool accum=false ); + void Z_diagrams_without_dilution_check(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int i_g_i2, std::string proporder, int diagram_number, bool transp_i1, bool transp_f1, bool accum ); diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 9e672819..9ca7f5f0 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2043,6 +2043,90 @@ void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorr }//switch (Diagram index) } + +template +void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorrelator &srcV3, + std::vector*> &(srcV2), int srcV2index, + int diagramm_index, bool accum ){ + //if( (diagramm_index != 1) && (diagramm_index !=2 ) && (diagramm_index != 3) && (diagramm_index != 4) ) + // PLEGMA_error("diagramm_index %d out of range (1,2,3 or 4)\n",diagramm_index); + + this->clear_output(!accum); + int i_g_i2=0; + Float factor[2]={-1.,0.};//-1 from eqs. (28),(31),(34),(37), .... + switch (diagramm_index){ + case 1: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor,false); //checked FP + break; + case 2: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + break; + case 3: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false);//checked FP + break; + case 4: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + break; + case 5: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + break; + case 6: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false);//checked FP + break; + case 7: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false);//checked FP + break; + case 8: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + break; + case 9: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true); //checked FP + break; + case 10: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true); //checked FP + break; + case 11: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false); //checked FP + break; + case 12: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false,i_g_i2, true, factor, false); //checked FP + break; + case 13: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false); //checked FP + break; + case 14: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false); //checked FP + break; + case 15: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true);//checked FP + //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, true); //checked FP + break; + case 16: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true);//checked FP + //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, false, g, true); //checked FP + break; + case 17: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false);//checked FP + //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, true, g, false);//checked FP + break; + case 18: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false);//checked FP + //this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, false, g, false);//checked FP + break; + case 19: + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false, i_g_i2, true, factor, false);//checked FP + //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, false, g2, true, g, false); //checked FP + break; + case 20: + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false);//checked FP + //this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false);//checked FP + break; + default: + PLEGMA_error("This value of Z diagram index does not exists, please check your inputs in piNdiagrams.cpp"); + }//switch (Diagram index) +} + + template void PLEGMA_ScattCorrelator::Z_diagrams(std::vector*> (&srcV3), std::vector*> (&srcV2),int srcV2index, diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 6cdfdbe2..e2fe332c 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -228,25 +228,32 @@ int main(int argc, char **argv) { std::vector*> stochastic_propags_DN_SL; - std::vector*> stochastic_oet_prop_u_zero_mom_SS; + //std::vector*> stochastic_oet_prop_u_zero_mom_SS; - std::vector*> stochastic_oet_prop_d_zero_mom_SS; + //std::vector*> stochastic_oet_prop_d_zero_mom_SS; - std::vector*> stochastic_oet_prop_u_fini_mom_SL; + //std::vector*> stochastic_oet_prop_u_fini_mom_SL; - std::vector*> stochastic_oet_prop_d_fini_mom_SL; + //std::vector*> stochastic_oet_prop_d_fini_mom_SL; + PLEGMA_Vector stochastic_oet_prop_u_zero_mom_SS; + PLEGMA_Vector stochastic_oet_prop_d_zero_mom_SS; - for(int i=0; i< 4; ++i) { + PLEGMA_Vector stochastic_oet_prop_u_fini_mom_SL; - stochastic_oet_prop_u_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); - stochastic_oet_prop_d_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); + PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SL; - stochastic_oet_prop_u_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); - stochastic_oet_prop_d_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); + //for(int i=0; i< 4; ++i) { - } + //stochastic_oet_prop_u_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); + //stochastic_oet_prop_d_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); + + //stochastic_oet_prop_u_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); + //stochastic_oet_prop_d_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); + + + //} @@ -292,6 +299,7 @@ int main(int argc, char **argv) { for (int l=0; l smearedGauge3D; smearedGauge3D.absorb(smearedGauge, timeSlice ); for(int i=0; i< n_stochastic_samples; ++i) { @@ -319,6 +327,8 @@ int main(int argc, char **argv) { TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); //Step(7) Smearing all the time slice in the propagator + //We do not perform smearing for stochastic propagator + //because it always ends at the insertion //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); vectorAuxD1.unload(); @@ -353,6 +363,7 @@ int main(int argc, char **argv) { for (int l=0; l smearedGauge3D; smearedGauge3D.absorb(smearedGauge, timeSlice ); for(int i=0; i< n_stochastic_samples; ++i) { @@ -416,6 +427,9 @@ int main(int argc, char **argv) { site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + + PLEGMA_printf("PACKING SourceCheck 3 %d %d\n", source[3], sourcePositions[isource][3]); + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); //updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); @@ -499,8 +513,18 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUP_SL; PLEGMA_Propagator propDN_SL; - site& source_local = sourcePositions[isource]; - source_local[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + //site source_local = sourcePositions[isource]; + //source_local[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site source_local; + source_local[0] = sourcePositions[isource][0]; + source_local[1] = sourcePositions[isource][1]; + source_local[2] = sourcePositions[isource][2]; + source_local[3] = (sourcePositions[isource][DIM_T]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site source_localPtSinkMtSource; + source_localPtSinkMtSource[0] = sourcePositions[isource][0]; + source_localPtSinkMtSource[1] = sourcePositions[isource][1]; + source_localPtSinkMtSource[2] = sourcePositions[isource][2]; + source_localPtSinkMtSource[3] = (sourcePositions[isource][DIM_T]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); source_local_reduction[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; @@ -514,7 +538,7 @@ int main(int argc, char **argv) { // If twop_filename exists we hold the computation of the light props - PLEGMA_printf("TESTING %d\n",source_local[DIM_T]); + PLEGMA_printf("PACKING NUCLEON %d %d %d\n",sourcePositions[isource][DIM_T], source_local[3],source_localPtSinkMtSource[3]); TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); @@ -595,12 +619,12 @@ int main(int argc, char **argv) { //int sink_local=(sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; //PLEGMA_printf("sink local %d another right %d\n", sink_local, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); - propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); // stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); - propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } //parallel source position { @@ -641,6 +665,15 @@ int main(int argc, char **argv) { } + /****************************************************** + * + * Step 4: Computing the factors from the point to all + * and + * stochastic pieces + * + ******************************************************/ + + //We implement the UD part first //The neutron piplus at the source @@ -695,7 +728,14 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_source_packed; for (int i_source_parallel=0; i_source_parallel= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); - for (int j=0; jV2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); @@ -723,15 +769,25 @@ int main(int argc, char **argv) { //W5,W6,W7,W8 //W9,W10,W11,W12,W17,W18,W19,W20 PLEGMA_Vector stochastic_propagator_packed; - for (int j=0; j temporary; - - //PLEGMA_printf("Look up table %d TIMESlice %d j %d\n", lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]], - // (source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],j); - //fflush(stdout); - temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + site maxinsertion_local; + maxinsertion_local[0] = sourcePositions[isource][0]; + maxinsertion_local[1] = sourcePositions[isource][1]; + maxinsertion_local[2] = sourcePositions[isource][2]; + maxinsertion_local[3] = (sourcePositions[isource][DIM_T]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site sink_local; + sink_local[0] = sourcePositions[isource][0]; + sink_local[1] = sourcePositions[isource][1]; + sink_local[2] = sourcePositions[isource][2]; + sink_local[3] = (sourcePositions[isource][DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + PLEGMA_printf("PACKING stochastic source for V3 single dn %d\n",maxinsertion_local[3]); + PLEGMA_printf("PACKING stochastic source for V3 single dn %d\n",sink_local[3]); + + temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[sink_local[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); @@ -744,14 +800,28 @@ int main(int argc, char **argv) { stochastic_propagator_packed.apply_gamma5(); - for (int j=0; j temporary; - temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + site maxinsertion_local; + maxinsertion_local[0] = sourcePositions[isource][0]; + maxinsertion_local[1] = sourcePositions[isource][1]; + maxinsertion_local[2] = sourcePositions[isource][2]; + maxinsertion_local[3] = (sourcePositions[isource][DIM_T]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site sink_local; + sink_local[0] = sourcePositions[isource][0]; + sink_local[1] = sourcePositions[isource][1]; + sink_local[2] = sourcePositions[isource][2]; + sink_local[3] = (sourcePositions[isource][DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + PLEGMA_printf("PACKING stochastic source for V3 single up %d\n",maxinsertion_local[3]); + PLEGMA_printf("PACKING stochastic source for V3 single up %d\n",sink_local[3]); + + temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[sink_local[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - temporary.writeHDF5("source_for_packing_j"+std::to_string(j)+"_stoch"+std::to_string(i_sample)); + temporary.writeHDF5("source_for_packing_j"+std::to_string(i_source_parallel)+"_stoch"+std::to_string(i_sample)); temporary.load(); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.unload(); @@ -777,6 +847,13 @@ int main(int argc, char **argv) { #if 1 + /****************************************************** + * + * Step 5: Computing OET propagators for UP DN + * + * + ******************************************************/ + { @@ -785,9 +862,17 @@ int main(int argc, char **argv) { mu*=-1.; solver.UpdateSolver(); } - for (int l=0; l temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); - temporary1.load(); - temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2, (source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, l == 0 ? true : false); - temporary1.unload(); - stochastic_oet_prop_u_zero_mom_SS[spinindex]->copy(temporary1,HOST); - temporary1.load(); - - //temporary1.writeLIME(outfile_V+confnumber+"propagator_up"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); - - vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); - vectorSave_diluted.copy(vectortmp1); - } //end of loop in spin indices + //vectorSave_diluted.copy(vectortmp2); + + //for (int spinindex=0; spinindex<4; ++spinindex){ + //Transforming to physical base for the UP quark + vectortmp1.unload(); + vectortmp1.writeHDF5("source_for_up_oet_t"+std::to_string(source_local[3])); + vectortmp1.load(); + vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); + + //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); + //Doing the zero momentum stochastic propagator with spin dilution + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,+1); + //Gaussian smearing of the propagator + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + //PLEGMA_Vector temporary1,temporary2; + //temporary1.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); + //temporary1.load(); + //temporary2.copy(vectortmp2); + + //temporary1.pack_propagator_from_source_to_sink(temporary2, maxinsertion_local[3], max_source_sink_separations, l == 0 ? true : false); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_u_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + PLEGMA_printf("PACKING stochastic oet up %d\n",maxinsertion_local[3]); + //temporary1.unload(); + //stochastic_oet_prop_u_zero_mom_SS[spinindex]->copy(temporary1,HOST); + // temporary1.load(); + + //temporary1.writeLIME(outfile_V+confnumber+"propagator_up"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); + + //vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); + //vectorSave_diluted.copy(vectortmp1); + //} //end of loop in spin indices } //end of loop on parallel sources @@ -847,10 +942,17 @@ int main(int argc, char **argv) { solver.UpdateSolver(); } - for (int l=0; l vectortmp1; @@ -868,113 +970,153 @@ int main(int argc, char **argv) { } //Dilution - vectortmp2.dilutespin(vectortmp1,0); + //vectortmp2.dilutespin(vectortmp1,0); //Save the smeared,transformed and diluted source for non-zero momentum oet. - vectorSave_diluted.copy(vectortmp2); + //vectorSave_diluted.copy(vectortmp2); - for (int spinindex=0; spinindex<4; ++spinindex){ + //for (int spinindex=0; spinindex<4; ++spinindex){ //Transforming to physical base for the DN quark - vectortmp2.rotateToPhysicalBasis(vectorSave_diluted,-1); - //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); - //Doing the zero momentum stochastic propagator with spin dilution - //Doing the inversion - TIME(solver.solve(vectortmp2, vectortmp2)); - //Rotate back immediately to the physical basis - vectortmp1.rotateToPhysicalBasis(vectortmp2,-1); - //Gaussian smearing of the propagator - TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); - PLEGMA_Vector temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); - temporary1.load(); - temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2, (source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, l == 0 ? true : false); - temporary1.unload(); - stochastic_oet_prop_d_zero_mom_SS[spinindex]->copy(temporary1,HOST); - //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); - temporary1.load(); - vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); - vectorSave_diluted.copy(vectortmp1); - }//end of loop on spin indices + //vectortmp2.rotateToPhysicalBasis(vectorSave_diluted,-1); + vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); + //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); + //Doing the zero momentum stochastic propagator with spin dilution + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,-1); + //Gaussian smearing of the propagator + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + //PLEGMA_Vector temporary1,temporary2; + //temporary1.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); + //temporary1.load(); + //temporary2.copy(vectortmp2); + //PLEGMA_printf("PACKING stochastic oet dn %d\n",maxinsertion_local[3]); + + //temporary1.pack_propagator_from_source_to_sink(temporary2, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_d_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + //temporary1.unload(); + //stochastic_oet_prop_d_zero_mom_SS[spinindex]->copy(temporary1,HOST); + //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); + // temporary1.load(); + //vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); + //vectorSave_diluted.copy(vectortmp1); + //}//end of loop on spin indices } //end of loop on parallel sources }//end of do_stochastic_oet PLEGMA_printf("DONE OET zero mom dn\n"); #endif + /****************************************************** + * + * Step 4: Computing the zero momentum oet factors + * i.e. V2 and V4 reductions + * + * + ******************************************************/ - std::vector*> reductionsV3_diluted_U_DN; - std::vector*> reductionsV3_diluted_D_UP; - std::vector*> reductionsV4_diluted_STOCHU_DN_UP; - std::vector*> reductionsV2_diluted_STOCHU_DN_UP; - std::vector*> reductionsV2_diluted_STOCHD_UP_UP; - - for (int spinindex=0;spinindex<4;++spinindex){ - try - { - reductionsV3_diluted_U_DN.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); - reductionsV3_diluted_D_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); - - } - catch(std::bad_alloc&){ - PLEGMA_printf("Memory allocation fails to store V3 factors oet"); - exit(1); - } - for (int k=0; k(source_reduction, list_mpf1_threept)); - reductionsV2_diluted_STOCHU_DN_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); - reductionsV2_diluted_STOCHD_UP_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); - } - catch(std::bad_alloc&){ - PLEGMA_printf("Memory allocation fails to store V24 factors oet"); - exit(1); - } - } - } - for (int k=0; k propUPpacked_to_sink; - PLEGMA_Propagator propDNpacked_to_sink; - int tsinkMtsource = tSinks[k]; - if(tsinkMtsource >= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); - for (int j=0; j*> reductionsV3_diluted_U_DN; + // std::vector*> reductionsV3_diluted_D_UP; + // std::vector*> reductionsV4_diluted_STOCHU_DN_UP; + // std::vector*> reductionsV2_diluted_STOCHU_DN_UP; + // std::vector*> reductionsV2_diluted_STOCHD_UP_UP; + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP(source_reduction, list_mpc); + std::vector*> reductionsV4_diluted_STOCHU_DN_UP; + std::vector*> reductionsV2_diluted_STOCHU_DN_UP; + std::vector*> reductionsV2_diluted_STOCHD_UP_UP; + + // for (int spinindex=0;spinindex<4;++spinindex){ + // try + // { + // reductionsV3_diluted_U_DN.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + // reductionsV3_diluted_D_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + // + // } + // catch(std::bad_alloc&){ + // PLEGMA_printf("Memory allocation fails to store V3 factors oet"); + // exit(1); + // } + + for (int k=0; k(source_reduction, list_mpf1_threept)); + reductionsV2_diluted_STOCHU_DN_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductionsV2_diluted_STOCHD_UP_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store V24 factors oet"); + exit(1); + } + // } + } + for (int k=0; k propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + for (int i_source_parallel=0; i_source_parallel st_oet_u_zero; + //PLEGMA_Vector st_oet_d_zero; + + //st_oet_u_zero.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); + //st_oet_u_zero.load(); + //st_oet_d_zero.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); + //st_oet_d_zero.load(); + + PLEGMA_Vector st_oet_u_zeropacked_to_sink; + PLEGMA_Vector st_oet_d_zeropacked_to_sink; + + for (int i_source_parallel=0; i_source_parallel st_oet_u_zero; - PLEGMA_Vector st_oet_d_zero; - - st_oet_u_zero.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); - st_oet_u_zero.load(); - st_oet_d_zero.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); - st_oet_d_zero.load(); - - PLEGMA_Vector st_oet_u_zeropacked_to_sink; - PLEGMA_Vector st_oet_d_zeropacked_to_sink; - - for (int j=0; jV2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); - TIME(reductionsV2_diluted_STOCHD_UP_UP[4*k+spinindex]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); - TIME(reductionsV4_diluted_STOCHU_DN_UP[4*k+spinindex]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); - - } + TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2_diluted_STOCHD_UP_UP[k]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV4_diluted_STOCHU_DN_UP[k]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + } + /****************************************************** + * + * Step 4: Computing the sequential for the UU part + * proton pizero up + * + * + ******************************************************/ + + //We first have a loop over all unique the source meson momentum p_i2 for (int i_mpi2=0; i_mpi2 corrTproton_protonpizero1(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); @@ -1148,8 +1291,9 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ int tsinkMtsource = tSinks[k]; if(tsinkMtsource >= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); - int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + PLEGMA_printf("PACKING to sink%d\n",global_fixSinkTime); propTS_SS_packed_to_sink.pack_propagator_as_sink(propTS_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); } @@ -1161,6 +1305,7 @@ int main(int argc, char **argv) { if(tsinkMtsource >= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); } @@ -1297,6 +1442,9 @@ int main(int argc, char **argv) { } + PLEGMA_printf("PACKING %d\n",(sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -1398,6 +1546,7 @@ int main(int argc, char **argv) { } } + PLEGMA_Propagator propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; for (int j=0; j stochastic_propagator_packed; for (int i_source_parallel=0; i_source_parallel temporary; + PLEGMA_printf("SOURCE check SOURCE position[3] %d source[3] %d\n", sourcePositions[isource][3],source[3]); temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); + if (i_sample==0){ + PLEGMA_Vector vectorAuxPrint; + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propTS_SL_packed,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("corrB12_propTS_SL_packed_"+spin+"_c"+col); + } + + stochastic_propagator_packed.writeHDF5("corrB12_stochastic_propagator"); + } + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true )); TIME( corrB9.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true)); TIME(corrB10.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true)); TIME(corrB11.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true)); + reductionsV3.writeHDF5("corrB12_V3_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); + reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->writeHDF5("corrB12_V4_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); + TIME(corrB12.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); @@ -1626,6 +1793,7 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_source_packed; for (int i_source_parallel=0; i_source_parallel tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); { // Smearing the source @@ -1687,40 +1860,42 @@ int main(int argc, char **argv) { vectorSource_finite_mom.absorb(vector2, source_local[3]); } - std::vector tmp_4Dmom= momentum_i2 ; - tmp_4Dmom.push_back(0); - vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); - for (int spinindex=0; spinindex<4; ++spinindex){ + //for (int spinindex=0; spinindex<4; ++spinindex){ //Transforming to physical base for the UP quark - vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,+1); + vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,+1); + + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); - //Doing the inversion - TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,+1); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp1); + stochastic_oet_prop_u_fini_mom_SL.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } - //Rotate back immediately to the physical basis - vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); - PLEGMA_Vector temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_u_fini_mom_SL[spinindex],HOST); - temporary1.load(); - temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2,(source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, l == 0 ? true : false); - temporary1.unload(); - stochastic_oet_prop_u_fini_mom_SL[spinindex]->copy(temporary1,HOST); - temporary1.load(); + //PLEGMA_Vector temporary1,temporary2; + //temporary1.copy(*stochastic_oet_prop_u_fini_mom_SL[spinindex],HOST); + //temporary1.load(); + //temporary2.copy(vectortmp2); + //temporary1.pack_propagator_from_source_to_sink(temporary2,(source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, l == 0 ? true : false); + //temporary1.unload(); + //stochastic_oet_prop_u_fini_mom_SL[spinindex]->copy(temporary1,HOST); + //temporary1.load(); - vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); - vectorSource_finite_mom.copy(vectortmp1); + //vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); + //vectorSource_finite_mom.copy(vectortmp1); - } //end of spin dilution + //} //end of spin dilution - } // end of parallel sources + //} // end of parallel sources //Doing for +mu for the DN propagator spin dilution oet if(mu>0) { @@ -1729,15 +1904,20 @@ int main(int argc, char **argv) { } - for (int l=0; l tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); { // Smearing the source @@ -1748,59 +1928,63 @@ int main(int argc, char **argv) { } - std::vector tmp_4Dmom= momentum_i2 ; - tmp_4Dmom.push_back(0); - vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); - for (int spinindex=0; spinindex<4; ++spinindex){ + //for (int spinindex=0; spinindex<4; ++spinindex){ - //Transforming to physical base for the UP quark - vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,-1); + //Transforming to physical base for the UP quark + vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,-1); + + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); - //Doing the inversion - TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,-1); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp1); + stochastic_oet_prop_d_fini_mom_SL.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],max_source_sink_separations, i_source_parallel == 0 ? true : false); - //Rotate back immediately to the physical basis - vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); - PLEGMA_Vector temporary1,temporary2; - temporary1.copy(*stochastic_oet_prop_d_fini_mom_SL[spinindex],HOST); - temporary1.load(); - temporary2.copy(vectortmp2); - temporary1.pack_propagator_from_source_to_sink(temporary2,(source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],max_source_sink_separations, l == 0 ? true : false); - temporary1.unload(); - stochastic_oet_prop_d_fini_mom_SL[spinindex]->copy(temporary1,HOST); - temporary1.load(); + //PLEGMA_Vector temporary1,temporary2; + //temporary1.copy(*stochastic_oet_prop_d_fini_mom_SL[spinindex],HOST); + //temporary1.load(); + //temporary2.copy(vectortmp2); + //temporary1.pack_propagator_from_source_to_sink(temporary2,(source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],max_source_sink_separations, l == 0 ? true : false); + //temporary1.unload(); + //stochastic_oet_prop_d_fini_mom_SL[spinindex]->copy(temporary1,HOST); + //temporary1.load(); - vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); - vectorSource_finite_mom.copy(vectortmp1); + //vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); + //vectorSource_finite_mom.copy(vectortmp1); - } //end of spin dilution + //} //end of spin dilution } // end of parallel sources }//end of finite momentum oet - for (int i=0; i< 4; ++i){ + //for (int i=0; i< 4; ++i){ + { PLEGMA_Vector st_oet_d_fini; - st_oet_d_fini.copy(*stochastic_oet_prop_d_fini_mom_SL[i],HOST); - st_oet_d_fini.load(); + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SL); + // st_oet_d_fini.copy(*stochastic_oet_prop_d_fini_mom_SL[i],HOST); + // st_oet_d_fini.load(); st_oet_d_fini.apply_gamma5(); - TIME(reductionsV3_diluted_D_UP[i]->V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); + TIME(reductionsV3_diluted_D_UP.V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); } - for (int i=0; i< 4; ++i){ + //for (int i=0; i< 4; ++i){ + { PLEGMA_Vector st_oet_u_fini; - st_oet_u_fini.copy(*stochastic_oet_prop_u_fini_mom_SL[i],HOST); - st_oet_u_fini.load(); + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SL); + //st_oet_u_fini.load(); st_oet_u_fini.apply_gamma5(); - TIME(reductionsV3_diluted_U_DN[i]->V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); + TIME(reductionsV3_diluted_U_DN.V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); } @@ -1847,21 +2031,21 @@ int main(int argc, char **argv) { corrZ14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); free(ssource); - TIME(corrZ5.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 4*k, 5 )); - TIME(corrZ7.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, 4*k, 7 )); + TIME(corrZ5.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 5 )); + TIME(corrZ7.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 7 )); - TIME(corrZ6.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 4*k, 6 )); - TIME(corrZ8.Z_diagrams( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, 4*k, 8 )); + TIME(corrZ6.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 6 )); + TIME(corrZ8.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 8 )); - TIME(corrZ9.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,4*k, 9 )); - TIME(corrZ10.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,4*k, 10)); + TIME(corrZ9.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 9 )); + TIME(corrZ10.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 10)); - TIME(corrZ11.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,4*k, 11 )); - TIME(corrZ13.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,4*k, 13 )); + TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11 )); + TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13 )); - TIME(corrZ12.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,4*k, 12 )); - TIME(corrZ14.Z_diagrams( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,4*k, 14 )); + TIME(corrZ12.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 12 )); + TIME(corrZ14.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 14 )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z"; @@ -1883,16 +2067,16 @@ int main(int argc, char **argv) { }//loop over mpi2 - for (int spinindex=0;spinindex<4;++spinindex){ - reductionsV3_diluted_U_DN.pop_back(); - reductionsV3_diluted_D_UP.pop_back(); + //for (int spinindex=0;spinindex<4;++spinindex){ + // reductionsV3_diluted_U_DN.pop_back(); + // reductionsV3_diluted_D_UP.pop_back(); - for (int k=0; k Date: Fri, 23 Dec 2022 10:37:16 +0100 Subject: [PATCH 040/168] adding possibility mom column 3 in V3V2reductions for Diagrams NjNpi --- include/PLEGMA_ScattCorrelator.h | 10 +- lib/PLEGMA_ScattCorrelator.cu | 160 ++++++++++++++++--------------- 2 files changed, 88 insertions(+), 82 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 568c02d1..6e062af8 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -202,7 +202,7 @@ namespace plegma { //manipulation //Note that in the case of oet B, W diagram g0 refers not to gamma_i2 but to gamma_f2 - void V3V2reduction( PLEGMA_ScattCorrelator &srcV3,PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transp_i1=false, Float* factor=NULL, bool transp_f1=false, bool oet=false ); + void V3V2reduction( PLEGMA_ScattCorrelator &srcV3,PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transp_i1=false, Float* factor=NULL, bool transp_f1=false, bool oet=false, bool threept=false ); void V5V6reduction(PLEGMA_ScattCorrelator &srcV6, std::shared_ptr &Phi0, @@ -212,7 +212,7 @@ namespace plegma { bool transp=false, bool transpgamma_i1=false, bool transgamma_f1=false, Float *factor=NULL); - void V3V2reduction_matrix( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transp_i1=false, Float* factor=NULL, bool transp_f1=false, bool oet=false ); + void V3V2reduction_matrix( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transp_i1=false, Float* factor=NULL, bool transp_f1=false, bool oet=false, bool threept=false ); void V5V6reduction_matrix( PLEGMA_ScattCorrelator &srcV6, std::shared_ptr &Phi0, @@ -258,15 +258,15 @@ namespace plegma { //diagrams - void B_diagrams( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum=false, bool oet=false ); - void W_diagrams( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagramm_index, bool accum=false ); + void B_diagrams( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum=false, bool oet=false, bool threept=false ); + void W_diagrams( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagramm_index, bool accum=false, bool threept=false ); void W_diagrams_oet(PLEGMA_ScattCorrelator &srcV6, std::shared_ptr &Phi0, std::vector*> &Phi_1, int input_mom_f2, int diagram_index, bool accum=false); void Z_diagrams( std::array,4> (&srcV3), std::array,4> (&srcV2),int diagramm_index, bool accum=false ); void Z_diagrams(std::vector*> (&srcV3), std::vector*> (&srcV2),int srcV2index, int diagramm_index, bool accum=false ); void Z_diagrams_without_dilution( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagramm_index, bool accum=false ); - void Z_diagrams_without_dilution( PLEGMA_ScattCorrelator &srcV3, std::vector*> (&srcV2), int srcV2index, int diagramm_index, bool accum=false ); + void Z_diagrams_without_dilution( PLEGMA_ScattCorrelator &srcV3, std::vector*> (&srcV2), int srcV2index, int diagramm_index, bool accum=false, bool threept=false); void Z_diagrams_without_dilution_check(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int i_g_i2, diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 9ca7f5f0..6158a707 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -469,7 +469,7 @@ std::shared_ptr PLEGMA_ScattCorrelator::average_all_time_slices(){ //Contracts V3^a_c x Gammas_cd x V2^a_{abd}. Gammas_i list of gammas between V3, V2. //called by aux PLEGMA_ScattCorrelator with shape PTGGGGGGSS template -void PLEGMA_ScattCorrelator::V3V2reduction( PLEGMA_ScattCorrelator &srcV3,PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transpgamma_i1, Float* factor, bool transpgamma_f1, bool oet) { +void PLEGMA_ScattCorrelator::V3V2reduction( PLEGMA_ScattCorrelator &srcV3,PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transpgamma_i1, Float* factor, bool transpgamma_f1, bool oet, bool threept) { //checks std::string exp_shape="tmggggggss"; @@ -506,6 +506,9 @@ void PLEGMA_ScattCorrelator::V3V2reduction( PLEGMA_ScattCorrelator }else{ i_mom_i2_f2= imap[i_m][2]; } + if (threept == true){ + i_mom_i2_f2=imap[i_m][3]; + } for(int t=0; t < TIME; ++t){ for (int g1=0 ; g1 < n_gammas_i1 ; ++g1 ){//pi for (int g2=0 ; g2 < n_gammas_f1 ; ++g2 ){//pf1 @@ -567,7 +570,7 @@ void PLEGMA_ScattCorrelator::V3V2reduction( PLEGMA_ScattCorrelator template -void PLEGMA_ScattCorrelator::V3V2reduction_matrix( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transpgamma_i1, Float* factor, bool transpgamma_f1, bool oet) { +void PLEGMA_ScattCorrelator::V3V2reduction_matrix( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int index_abs, bool transp, int g0, bool transpgamma_i1, Float* factor, bool transpgamma_f1, bool oet, bool threept) { //checks std::string exp_shape="tmggggggss"; @@ -602,6 +605,9 @@ void PLEGMA_ScattCorrelator::V3V2reduction_matrix( PLEGMA_ScattCorrelator }else { i_mom_i2_f2= imap[i_m][2]; } + if (threept==true){ + i_mom_i2_f2= imap[i_m][3]; + } Float V3aux[N_SPINS*N_SPINS*N_COLS*2]; Float temp_colorvector[N_COLS*2]; Float temp[N_SPINS*N_SPINS*2]; @@ -1613,7 +1619,7 @@ void PLEGMA_ScattCorrelator::D1ii_diagrams(PLEGMA_ScattCorrelator } template -void PLEGMA_ScattCorrelator::B_diagrams(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum, bool oet) { +void PLEGMA_ScattCorrelator::B_diagrams(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum, bool oet, bool threept) { if(ig_i2 >= this->GList[3].size()) PLEGMA_error("ig_i2 = %d but Gi2 list size is %d\n", ig_i2, this->GList[3].size() ); @@ -1623,64 +1629,64 @@ void PLEGMA_ScattCorrelator::B_diagrams(PLEGMA_ScattCorrelator &sr switch( diagram_index ){ case 1: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true, oet); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true, oet, threept); //checked FP break; case 2: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true, oet); //checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true, oet, threept); //checked FP break; case 3: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, false, oet); //checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, false, oet, threept); //checked FP break; case 4: - this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, true, oet); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, true, oet, threept); //checked FP break; case 5: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, false, oet); //checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, false, oet, threept); //checked FP break; case 6: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, true, oet); //checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, true, oet, threept); //checked FP break; case 7: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true, oet);//checked FP + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true, oet, threept);//checked FP break; case 8: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true, oet);//checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true, oet, threept);//checked FP break; case 9: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, false, oet);//checked FP + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, false, oet, threept);//checked FP break; case 10: - this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, true, factor, true, oet);//checked FP + this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, true, factor, true, oet, threept);//checked FP break; case 11: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false, oet);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false, oet, threept);//checked FP break; case 12: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, true, factor, true, oet);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, true, factor, true, oet, threept);//checked FP break; case 13: - this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, true, factor, false, oet);//checked FP + this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, true, factor, false, oet, threept);//checked FP break; case 14: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, true, factor, false, oet);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, true, factor, false, oet, threept);//checked FP break; case 15: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, false, oet);//checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, false, oet, threept);//checked FP break; case 16: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, false, oet);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, false, oet, threept);//checked FP break; case 17: - this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, false, oet); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, false, oet, threept); //checked FP break; case 18: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, false, oet); //checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, false, oet, threept); //checked FP break; case 19: - this->V3V2reduction( srcV3, srcV2, 2, true , ig_i2, true, factor, false, oet); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, true , ig_i2, true, factor, false, oet, threept); //checked FP break; case 20: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false, oet);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false, oet, threept);//checked FP break; default: PLEGMA_error("This value of B diagram index does not exists, please check your inputs in piNdiagrams.cpp"); @@ -1804,7 +1810,7 @@ void PLEGMA_ScattCorrelator::W_diagrams_oet(PLEGMA_ScattCorrelator template -void PLEGMA_ScattCorrelator::W_diagrams(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum){ +void PLEGMA_ScattCorrelator::W_diagrams(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum, bool threept){ //if( (diagramm_index != 1) && (diagramm_index !=2 ) && (diagramm_index != 3) && (diagramm_index != 4) ) // PLEGMA_error("diagramm_index %d out of range (1,2,3 or 4)\n",diagramm_index); @@ -1816,104 +1822,104 @@ void PLEGMA_ScattCorrelator::W_diagrams(PLEGMA_ScattCorrelator &sr switch( diagram_index ){ case 1: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 2: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, true);//checked FP,last true because of transp(G_f1) + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, true, false, threept);//checked FP,last true because of transp(G_f1) break; case 3: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, true);//checked FP,last true because of transp(G_f1) + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, true, false, threept);//checked FP,last true because of transp(G_f1) break; case 4: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, true);//checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, true, false, threept);//checked FP,last true because of transp(G_f1) break; case 5: case 12: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, true, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, true, factor, false, false, threept);//checked FP break; case 6: case 11: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, false, false, threept);//checked FP break; case 7: case 10: - this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, true, factor, false, false, threept);//checked FP break; case 8: case 9: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, false, false, threept);//checked FP break; case 13: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 14: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 15: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 16: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 17: - this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, false, factor, false, false, threept); //checked FP break; case 18: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, false, false, threept); //checked FP break; case 19: - this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, false, factor, false, false, threept); //checked FP break; case 20: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, false, false, threept); //checked FP break; case 21: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 22: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, true, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 23: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, true); //checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, true, false, threept); //checked FP,last true because of transp(G_f1) break; case 24: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, true);//checked FP,last true because of transp(G_f1) + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, true, factor, true, false, threept);//checked FP,last true because of transp(G_f1) break; case 25: - this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 1, false, ig_i2, false, factor, false, false, threept); //checked FP break; case 26: - this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, false, factor, false, false, threept); //checked FP break; case 27: - this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, false, false, threept); //checked FP break; case 28: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, false); //checked FP + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, false, false, threept); //checked FP break; case 29: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, false, false, threept);//checked FP break; case 30: - this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, false, false, threept);//checked FP break; case 31: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false, false, threept);//checked FP break; case 32: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, false, false, threept);//checked FP break; case 33: - this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, false, false, threept);//checked FP break; case 34: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, false, false, threept);//checked FP break; case 35: - this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, true, factor, false, false, threept);//checked FP break; case 36: - this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, srcV2, 1, false, ig_i2, false, factor, false, false, threept);//checked FP break; default: PLEGMA_error("This value of W diagram index does not exists, please check your inputs in piNdiagrams.cpp"); @@ -2047,7 +2053,7 @@ void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorr template void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorrelator &srcV3, std::vector*> &(srcV2), int srcV2index, - int diagramm_index, bool accum ){ + int diagramm_index, bool accum, bool threept ){ //if( (diagramm_index != 1) && (diagramm_index !=2 ) && (diagramm_index != 3) && (diagramm_index != 4) ) // PLEGMA_error("diagramm_index %d out of range (1,2,3 or 4)\n",diagramm_index); @@ -2056,69 +2062,69 @@ void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorr Float factor[2]={-1.,0.};//-1 from eqs. (28),(31),(34),(37), .... switch (diagramm_index){ case 1: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor,false); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor,false, threept); //checked FP break; case 2: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP break; case 3: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, threept);//checked FP break; case 4: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP break; case 5: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP break; case 6: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, threept);//checked FP break; case 7: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, threept);//checked FP break; case 8: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP break; case 9: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true, threept); //checked FP break; case 10: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true, threept); //checked FP break; case 11: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false, threept); //checked FP break; case 12: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false,i_g_i2, true, factor, false); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false,i_g_i2, true, factor, false, threept); //checked FP break; case 13: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false); //checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false, threept); //checked FP break; case 14: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false); //checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false, threept); //checked FP break; case 15: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, true); //checked FP break; case 16: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, false, g, true); //checked FP break; case 17: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, true, g, false);//checked FP break; case 18: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false, threept);//checked FP //this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, false, g, false);//checked FP break; case 19: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false, i_g_i2, true, factor, false);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false, i_g_i2, true, factor, false, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, false, g2, true, g, false); //checked FP break; case 20: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false, threept);//checked FP //this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false);//checked FP break; default: From 8b8e09f63baee34fa695b20358d8d258dd931c29 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 23 Dec 2022 10:37:42 +0100 Subject: [PATCH 041/168] correcting smearing --- plegma/nucleon_3pt_n_npi.cpp | 172 ++++++++++++++++++++--------------- 1 file changed, 97 insertions(+), 75 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index e2fe332c..e8794e34 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -295,6 +295,7 @@ int main(int argc, char **argv) { int countindex=0; for (int isource=0; isource smearedGauge3D; - smearedGauge3D.absorb(smearedGauge, source[DIM_T]); - asprintf(&ssource,"sx%02dsy%02dsz%02dst%03d", sourcePositions[isource][0], sourcePositions[isource][1], sourcePositions[isource][2], sourcePositions[isource][3]); std::string sourcepositiontext= (std::string)"_" + ssource; free(ssource); @@ -443,6 +441,8 @@ int main(int argc, char **argv) { auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, double run_mu, WHICHFLAVOR fl, int nSmear, site &source_location, bool finalize) { + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_location[DIM_T]); // ensuring mu value if(mu != run_mu) { updateOptions(fl); @@ -503,10 +503,8 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUP_SL_packed; PLEGMA_Propagator propDN_SL_packed; - - - for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + PLEGMA_Propagator propUP_SS; PLEGMA_Propagator propDN_SS; @@ -538,7 +536,6 @@ int main(int argc, char **argv) { // If twop_filename exists we hold the computation of the light props - PLEGMA_printf("PACKING NUCLEON %d %d %d\n",sourcePositions[isource][DIM_T], source_local[3],source_localPtSinkMtSource[3]); TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); @@ -617,8 +614,7 @@ int main(int argc, char **argv) { propUP_SS_packed.absorb(temporary2,ii/3,ii%3); }*/ - //int sink_local=(sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - //PLEGMA_printf("sink local %d another right %d\n", sink_local, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); // stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); @@ -627,6 +623,7 @@ int main(int argc, char **argv) { propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } //parallel source position + { PLEGMA_printf("Save propagator for the up and dn quark\n"); PLEGMA_Vector vectorAuxPrint(BOTH); @@ -725,6 +722,9 @@ int main(int argc, char **argv) { for (int k=0; k< tSinks.size();++k){ + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); PLEGMA_Vector stochastic_source_packed; for (int i_source_parallel=0; i_source_parallel propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; - int tsinkMtsource = tSinks[k]; - if(tsinkMtsource >= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); for (int i_source_parallel=0; i_source_parallel vector1, vector2; vector1.absorb(vectorStoc_source_oet, source_local[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vectortmp1.absorb(vector2, source_local[3]); @@ -899,7 +889,7 @@ int main(int argc, char **argv) { //for (int spinindex=0; spinindex<4; ++spinindex){ //Transforming to physical base for the UP quark vectortmp1.unload(); - vectortmp1.writeHDF5("source_for_up_oet_t"+std::to_string(source_local[3])); + vectortmp1.writeHDF5("source_for_up_zero_mom_oet_t"+std::to_string(source_local[3])); vectortmp1.load(); vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); @@ -921,7 +911,6 @@ int main(int argc, char **argv) { vectorAuxF.copy(vectortmp2); stochastic_oet_prop_u_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - PLEGMA_printf("PACKING stochastic oet up %d\n",maxinsertion_local[3]); //temporary1.unload(); //stochastic_oet_prop_u_zero_mom_SS[spinindex]->copy(temporary1,HOST); // temporary1.load(); @@ -932,7 +921,12 @@ int main(int argc, char **argv) { //vectorSave_diluted.copy(vectortmp1); //} //end of loop in spin indices - } //end of loop on parallel sources + } //end of loop on parallel sources + + stochastic_oet_prop_u_zero_mom_SS.unload(); + stochastic_oet_prop_u_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_u"); + stochastic_oet_prop_u_zero_mom_SS.load(); + PLEGMA_printf("DONE OET zero mom up\n"); @@ -944,14 +938,14 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel vector1, vector2; vector1.absorb(vectorStoc_source_oet, source_local[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vectortmp1.absorb(vector2, source_local[3]); - } //Dilution @@ -1008,6 +1003,11 @@ int main(int argc, char **argv) { //}//end of loop on spin indices } //end of loop on parallel sources }//end of do_stochastic_oet + + stochastic_oet_prop_d_zero_mom_SS.unload(); + stochastic_oet_prop_d_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_d"); + stochastic_oet_prop_d_zero_mom_SS.load(); + PLEGMA_printf("DONE OET zero mom dn\n"); @@ -1020,7 +1020,6 @@ int main(int argc, char **argv) { * ******************************************************/ - // std::vector*> reductionsV3_diluted_U_DN; // std::vector*> reductionsV3_diluted_D_UP; // std::vector*> reductionsV4_diluted_STOCHU_DN_UP; @@ -1068,13 +1067,12 @@ int main(int argc, char **argv) { sink_local[0] = sourcePositions[isource][0]; sink_local[1] = sourcePositions[isource][1]; sink_local[2] = sourcePositions[isource][2]; - sink_local[3] = (sourcePositions[isource][DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + sink_local[3] = (source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; //int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); } - //for (int spinindex=0;spinindex<4;++spinindex){ //PLEGMA_Vector st_oet_u_zero; //PLEGMA_Vector st_oet_d_zero; @@ -1092,10 +1090,9 @@ int main(int argc, char **argv) { sink_local[0] = sourcePositions[isource][0]; sink_local[1] = sourcePositions[isource][1]; sink_local[2] = sourcePositions[isource][2]; - sink_local[3] = (sourcePositions[isource][DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + sink_local[3] = (source[DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; //int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - PLEGMA_printf("PACKING V24oet oet %d\n",sink_local[3]); st_oet_u_zeropacked_to_sink.pack_propagator_as_sink(stochastic_oet_prop_u_zero_mom_SS, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); st_oet_d_zeropacked_to_sink.pack_propagator_as_sink(stochastic_oet_prop_d_zero_mom_SS, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); } @@ -1139,7 +1136,6 @@ int main(int argc, char **argv) { PLEGMA_Propagator propTS_SS_packed; PLEGMA_Propagator propTS_SL_packed; - for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS_SS; @@ -1163,15 +1159,15 @@ int main(int argc, char **argv) { PLEGMA_Vector3D vector1, vector2; vectorAuxF.absorb(propUP_SS_packed, isc/3, isc%3); vectorAuxD.copy(vectorAuxF); - vector1.absorb( vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vector2.mulMomentumPhases(momentum_i2,1); - vectorAuxD.absorb(vector2, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } - vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); - - PLEGMA_printf("PACKING UUseq %d\n",(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + vectorAuxD2.absorbTimeslice(vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_insertion[0] vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); @@ -1194,8 +1190,8 @@ int main(int argc, char **argv) { } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1239,6 +1235,9 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int k=0; k= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); PLEGMA_ScattCorrelator corrB3(source, filtered_sourcemomentumList); PLEGMA_ScattCorrelator corrB4(source, filtered_sourcemomentumList); @@ -1285,15 +1284,13 @@ int main(int argc, char **argv) { corrW16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); free(ssource); + PLEGMA_printf("SOURCE check SOURCE position[3] %d source[3] %d\n", sourcePositions[isource][3],source[3]); + PLEGMA_Propagator propTS_SS_packed_to_sink; for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ - int tsinkMtsource = tSinks[k]; - if(tsinkMtsource >= HGC_totalL[3]) - PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - PLEGMA_printf("PACKING to sink%d\n",global_fixSinkTime); propTS_SS_packed_to_sink.pack_propagator_as_sink(propTS_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); } @@ -1412,10 +1409,12 @@ int main(int argc, char **argv) { PLEGMA_Vector3D vector1, vector2; vectorAuxF.absorb(propDN_SS_packed, isc/3, isc%3); vectorAuxD.copy(vectorAuxF); - vector1.absorb( vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vector2.mulMomentumPhases(momentum_i2,1); - vectorAuxD.absorb(vector2, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); @@ -1442,15 +1441,15 @@ int main(int argc, char **argv) { } - PLEGMA_printf("PACKING %d\n",(sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } + PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus2(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus3(source, list_mpi2ptot); @@ -1562,7 +1561,6 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; for (int i_source_parallel=0; i_source_parallel temporary; - PLEGMA_printf("SOURCE check SOURCE position[3] %d source[3] %d\n", sourcePositions[isource][3],source[3]); temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); @@ -1670,13 +1668,15 @@ int main(int argc, char **argv) { PLEGMA_Vector3D vector1, vector2; vectorAuxF.absorb(propDN_SS_packed, isc/3, isc%3); vectorAuxD.copy(vectorAuxF); - vector1.absorb( vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vector2.mulMomentumPhases(momentum_i2,1); - vectorAuxD.absorb(vector2, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } - vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); + vectorAuxD2.absorbTimeslice(vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); //Perform multiplication with glist_insertion[0] vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); @@ -1699,8 +1699,8 @@ int main(int argc, char **argv) { } - propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1778,7 +1778,7 @@ int main(int argc, char **argv) { temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } stochastic_propagator_packed.apply_gamma5(); @@ -1838,8 +1838,8 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel tmp_4Dmom= momentum_i2 ; tmp_4Dmom.push_back(0); vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); + vectortmp1.zero_device(); { // Smearing the source PLEGMA_Vector3D vector1, vector2; vector1.absorb(vectorSource_finite_mom, source_local[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vectorSource_finite_mom.absorb(vector2, source_local[3]); + vectortmp1.absorb(vector2, source_local[3],true); + PLEGMA_printf("Source local %d\n",source_local[3]); + vectortmp1.unload(); + vectortmp1.writeHDF5("source_for_up_fini_mom_oet_t"+std::to_string(source_local[3])); + vectortmp1.load(); } - - //for (int spinindex=0; spinindex<4; ++spinindex){ //Transforming to physical base for the UP quark - vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,+1); + vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); //Doing the inversion TIME(solver.solve(vectortmp2, vectortmp2)); @@ -1878,6 +1886,10 @@ int main(int argc, char **argv) { stochastic_oet_prop_u_fini_mom_SL.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } + stochastic_oet_prop_u_fini_mom_SL.unload(); + stochastic_oet_prop_u_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_u"); + stochastic_oet_prop_u_fini_mom_SL.load(); + //PLEGMA_Vector temporary1,temporary2; //temporary1.copy(*stochastic_oet_prop_u_fini_mom_SL[spinindex],HOST); @@ -1905,8 +1917,9 @@ int main(int argc, char **argv) { for (int i_source_parallel=0; i_source_parallel vector1, vector2; vector1.absorb(vectorSource_finite_mom, source_local[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vectorSource_finite_mom.absorb(vector2, source_local[3]); + vectortmp1.absorb(vector2, source_local[3]); } @@ -1932,7 +1947,7 @@ int main(int argc, char **argv) { //for (int spinindex=0; spinindex<4; ++spinindex){ //Transforming to physical base for the UP quark - vectortmp2.rotateToPhysicalBasis(vectorSource_finite_mom,-1); + vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); //Doing the inversion TIME(solver.solve(vectortmp2, vectortmp2)); @@ -1962,6 +1977,11 @@ int main(int argc, char **argv) { }//end of finite momentum oet + stochastic_oet_prop_d_fini_mom_SL.unload(); + stochastic_oet_prop_d_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_d"); + stochastic_oet_prop_d_fini_mom_SL.load(); + + //for (int i=0; i< 4; ++i){ { @@ -2041,6 +2061,8 @@ int main(int argc, char **argv) { TIME(corrZ10.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 10)); + reductionsV3_diluted_U_DN.writeHDF5("corr_Z11_reductionsV3_diluted_U_DN"); + reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("corr_Z11_reductionsV2_diluted_STOCHU_DN_UP_"+std::to_string(tSinks[k])); TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11 )); TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13 )); From a0247f7f5da044a0e789695ea64e409e57511500 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 29 Dec 2022 13:22:49 +0100 Subject: [PATCH 042/168] adding 2pt functions --- plegma/nucleon_3pt_n_npi.cpp | 862 +++++++++++++++++++++++++++++------ 1 file changed, 733 insertions(+), 129 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index e8794e34..4b36277a 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -27,6 +27,21 @@ void produceOutput( PLEGMA_ScattCorrelator source, } +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *attract_look_up_table){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table ); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + + void produceOutput_3pt( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, @@ -51,6 +66,19 @@ void produceOutput( PLEGMA_ScattCorrelator source, TIME(source.writeHDF5( outputFilename )); } +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *attract_look_up_table + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); + TIME(source.writeHDF5( outputFilename )); +} + + void produceOutput_3pt( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, @@ -87,6 +115,7 @@ int main(int argc, char **argv) { std::vector glist_sink_nucleon={CG_5}; std::vector glist_source_meson={G_5}; + std::vector glist_sink_meson={G_5}; std::vector glist_source_nucleon_unpaired={ID}; std::vector glist_sink_nucleon_unpaired={ID}; @@ -147,8 +176,8 @@ int main(int argc, char **argv) { //Reading the momentum lists PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); - momList sourcemomentumList_threept(4,pathListMomenta_threept,{1,2,3,}); - PLEGMA_printf("N momenta in sourcemomentumList: %d",sourcemomentumList_threept.size()); + momList sourcemomentumList_threept(4,pathListMomenta_threept,{1,2,3}); + PLEGMA_printf("N momenta in sourcemomentumList: %d\n",sourcemomentumList_threept.size()); //We have four types of momenta in the list here //The first three entries are the pi2 pion source momentum //The second three entries are the pf1 nucleon sink momentum @@ -160,9 +189,7 @@ int main(int argc, char **argv) { //pi1 + pi2 = pc so the momentum phase factor is calculated as pc-pi2 //We define the list of momenta such that the total momentum should be the [2] \ //column, the pc, and of coarse it is understand that this refers to the source only. - //At the sink we have always zero momentum - - + //At the sink we have always zero momentum momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); //For the twopoint functions we have also three momentum @@ -193,6 +220,11 @@ int main(int argc, char **argv) { std::vector> mpc = sourcemomentumList_threept.uniq_p(3); momList list_mpc(1,{mpc,},{0,}); + std::vector> mpf2_twopt = sourcemomentumList_twopt.uniq_p(2); + momList list_mpf2_twopt(1,{mpf2_twopt,},{0,}); + + + int parallel_sources=HGC_totalL[3]/max_source_sink_separations; std::vector lookuptable_UP; @@ -204,6 +236,11 @@ int main(int argc, char **argv) { lookuptable_DN.push_back(-1); } + int *attract_lookup_table; + attract_lookup_table=(int *)malloc(sizeof(int)*HGC_totalL[3]); + + + PLEGMA_Vector vectorSource_stochastic; vectorSource_stochastic.randInit(rand_seed1); @@ -224,6 +261,8 @@ int main(int argc, char **argv) { std::vector*> stochastic_sources; + std::vector*> stochastic_propagator_2pt_SS; + std::vector*> stochastic_propags_UP_SL; std::vector*> stochastic_propags_DN_SL; @@ -243,6 +282,11 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SL; + PLEGMA_Vector stochastic_oet_prop_u_fini_mom_SS; + + PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SS; + + //for(int i=0; i< 4; ++i) { @@ -267,6 +311,7 @@ int main(int argc, char **argv) { for (int i=0; i(HOST)); + stochastic_propagator_2pt_SS.push_back(new PLEGMA_Vector(HOST)); vectorSource_stochastic.stochastic_Z(nroots); vectorSource_stochastic.unload(); stochastic_sources[i]->copy(vectorSource_stochastic,HOST); @@ -286,6 +331,54 @@ int main(int argc, char **argv) { * ******************************************************/ + for (int i=0; i vectorInOut, vectorAuxD1,vectorAuxD2; + + vectorAuxD1.copy(*stochastic_sources[i], HOST); + vectorAuxD1.load(); + + //Step(3) Smearing all the time slice + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + //In vectorAuxD2 we store the results for the inversion + vectorAuxD2.scale(0.0); + + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(5) pick out a particular timeslice from the source + vectorInOut.absorbTimeslice(vectorAuxD1, timeidx); + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + //Step(7) absorbing the particular timeslice to a 4d vector + vectorAuxD2.absorbTimeslice(vectorInOut, timeidx, false); + } + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(8) Save the propagator to the disk + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD2); + vectorAuxF.unload(); + vectorAuxF.writeLIME("globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber); + } + + //Step(9) Save the propagator to the host memory + vectorAuxD2.unload(); + stochastic_propagator_2pt_SS[i]->copy(vectorAuxD2,HOST); + vectorAuxD2.load(); + + } + + + if(mu<0) { mu = -mu; @@ -364,7 +457,6 @@ int main(int argc, char **argv) { for (int l=0; l smearedGauge3D; smearedGauge3D.absorb(smearedGauge, timeSlice ); for(int i=0; i< n_stochastic_samples; ++i) { @@ -394,11 +486,12 @@ int main(int argc, char **argv) { //Step(7) Smearing all the time slice in the propagator //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - vectorAuxD1.unload(); - PLEGMA_printf("Save the stochastic source for sample %d\n",i); - std::string nstoch=std::to_string(i); - vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch+"_t"+std::to_string(timeSlice)); + //vectorAuxD1.unload(); + //PLEGMA_printf("Save the stochastic source for sample %d\n",i); + //std::string nstoch=std::to_string(i); + //vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch+"_t"+std::to_string(timeSlice)); + vectorAuxD1.unload(); stochastic_propags_DN_SL.push_back(new PLEGMA_Vector(HOST)); stochastic_propags_DN_SL[countindex]->copy(vectorAuxD1, HOST); countindex++; @@ -429,8 +522,6 @@ int main(int argc, char **argv) { site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); - - PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); //updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); @@ -454,8 +545,8 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; vector1.pointSource(source_location, isc/3, isc%3, DEVICE); - double tmp=vector1.norm(); - PLEGMA_printf("Norm of source location %d is %e\n",source_location[3],tmp); + //double tmp=vector1.norm(); + //PLEGMA_printf("Norm of source location %d is %e\n",source_location[3],tmp); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); vectorInOut.absorb(vector2,source_location[DIM_T]); @@ -503,6 +594,11 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUP_SL_packed; PLEGMA_Propagator propDN_SL_packed; + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + for (int sink=0; sink propUP_SS; @@ -589,31 +685,6 @@ int main(int argc, char **argv) { vectorAuxPrint.writeHDF5("propUPSS_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); } } - - - /*for (int ii=0;ii<12;++ii){ - PLEGMA_Vector temporary1,temporary2; - temporary1.absorb(propUP_SS,ii/3,ii%3); - temporary2.absorb(propUP_SS_packed,ii/3,ii%3); - if (ii==0){ - temporary1.unload(); - temporary1.writeHDF5("propUPtest_source_j"+std::to_string(i_source_parallel)); - temporary1.load(); - } - if (ii==0){ - temporary2.unload(); - temporary2.writeHDF5("propUPtest_before_j"+std::to_string(i_source_parallel)); - temporary2.load(); - } - temporary2.pack_propagator_from_source_to_sink(temporary1, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - if (ii==0){ - temporary2.unload(); - temporary2.writeHDF5("propUPtest_after_j"+std::to_string(i_source_parallel)); - temporary2.load(); - } - propUP_SS_packed.absorb(temporary2,ii/3,ii%3); - }*/ - propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -624,6 +695,40 @@ int main(int argc, char **argv) { } //parallel source position + PLEGMA_ScattCorrelator corrNP_packed(source, list_mpf1_twopt); + TIME(corrNP_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP_packed.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + + } + + + PLEGMA_ScattCorrelator corrN0_packed(source, list_mpf1_twopt); + TIME(corrN0_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0_packed.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } + +/* + { PLEGMA_printf("Save propagator for the up and dn quark\n"); PLEGMA_Vector vectorAuxPrint(BOTH); @@ -660,7 +765,7 @@ int main(int argc, char **argv) { vectorAuxPrint.writeHDF5("propDNSS_packed_s"+spin+"_c"+col); } } - + */ /****************************************************** * @@ -685,22 +790,44 @@ int main(int argc, char **argv) { //phi goes to V2 reduction and xi goes to V3 reduction std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented + std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented + //Here the prefix DD means that reduction is based phi*g5 and xi*g5 //We replace D(x_f2,x_f1) with xi(x_f2)*gamma_5* phi^dagger(x_f1) *gamma_5 //phi goes to V3 reduction and xi goes to V2 reduction std::vector*> reductions_DD_V3_GAMMAF2D;//implemented + std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt;//implemented + for(int i=0; i< n_stochastic_samples; ++i) { + reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + + reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + + + for (int k=0; k< tSinks.size(); ++k){ try { reductions_DD_V2_GAMMAF1U_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); reductions_UU_V2_GAMMAF1D_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_UU_V4_GAMMAF1U_D.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); reductions_UU_V3_GAMMAF2U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); @@ -756,6 +883,32 @@ int main(int argc, char **argv) { TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + if (k==0){ + PLEGMA_Vector stoch_piece; + stoch_piece.unload(); + stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stoch_piece.load(); + TIME(reductions_UU_V2_GAMMAF1D_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, false)); + + TIME(reductions_UU_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, false)); + + + stoch_piece.apply_gamma5(); + TIME(reductions_DD_V3_GAMMAF2D_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); + + stoch_piece.unload(); + stoch_piece.copy(*stochastic_sources[i_sample], HOST); + stoch_piece.load(); + + TIME(reductions_UU_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + + stoch_piece.apply_gamma5(); + TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, false)); + + + + } + //B4,B6 //B10,B12 @@ -805,17 +958,18 @@ int main(int argc, char **argv) { sink_local[2] = sourcePositions[isource][2]; sink_local[3] = (sourcePositions[isource][DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + temporary.unload(); temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[sink_local[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - temporary.writeHDF5("source_for_packing_j"+std::to_string(i_source_parallel)+"_stoch"+std::to_string(i_sample)); - temporary.load(); + //temporary.writeHDF5("source_for_packing_j"+std::to_string(i_source_parallel)+"_stoch"+std::to_string(i_sample)); + //temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } - stochastic_propagator_packed.unload(); - stochastic_propagator_packed.writeHDF5("stochastic_up_packed_SL_ns"+std::to_string(i_sample)); - stochastic_propagator_packed.load(); + //stochastic_propagator_packed.unload(); + //stochastic_propagator_packed.writeHDF5("stochastic_up_packed_SL_ns"+std::to_string(i_sample)); + //stochastic_propagator_packed.load(); stochastic_propagator_packed.apply_gamma5(); @@ -888,9 +1042,9 @@ int main(int argc, char **argv) { //for (int spinindex=0; spinindex<4; ++spinindex){ //Transforming to physical base for the UP quark - vectortmp1.unload(); - vectortmp1.writeHDF5("source_for_up_zero_mom_oet_t"+std::to_string(source_local[3])); - vectortmp1.load(); + //vectortmp1.unload(); + //vectortmp1.writeHDF5("source_for_up_zero_mom_oet_t"+std::to_string(source_local[3])); + //vectortmp1.load(); vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); @@ -923,9 +1077,9 @@ int main(int argc, char **argv) { } //end of loop on parallel sources - stochastic_oet_prop_u_zero_mom_SS.unload(); - stochastic_oet_prop_u_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_u"); - stochastic_oet_prop_u_zero_mom_SS.load(); + //stochastic_oet_prop_u_zero_mom_SS.unload(); + //stochastic_oet_prop_u_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_u"); + //stochastic_oet_prop_u_zero_mom_SS.load(); PLEGMA_printf("DONE OET zero mom up\n"); @@ -1004,9 +1158,9 @@ int main(int argc, char **argv) { } //end of loop on parallel sources }//end of do_stochastic_oet - stochastic_oet_prop_d_zero_mom_SS.unload(); - stochastic_oet_prop_d_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_d"); - stochastic_oet_prop_d_zero_mom_SS.load(); + //stochastic_oet_prop_d_zero_mom_SS.unload(); + //stochastic_oet_prop_d_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_d"); + //stochastic_oet_prop_d_zero_mom_SS.load(); PLEGMA_printf("DONE OET zero mom dn\n"); @@ -1027,9 +1181,19 @@ int main(int argc, char **argv) { // std::vector*> reductionsV2_diluted_STOCHD_UP_UP; PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN(source_reduction, list_mpc); PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP(source_reduction, list_mpc); + + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt(source_reduction, list_mpf2_twopt); + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt(source_reduction, list_mpf2_twopt); + std::vector*> reductionsV4_diluted_STOCHU_DN_UP; std::vector*> reductionsV2_diluted_STOCHU_DN_UP; std::vector*> reductionsV2_diluted_STOCHD_UP_UP; + + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHU_DN_UP_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_UP_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt(source_reduction, list_mpf1_twopt); + + // for (int spinindex=0;spinindex<4;++spinindex){ // try @@ -1102,9 +1266,42 @@ int main(int argc, char **argv) { TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); TIME(reductionsV2_diluted_STOCHD_UP_UP[k]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); TIME(reductionsV4_diluted_STOCHU_DN_UP[k]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + + if (k==0){ + + for (int i_source_parallel=0; i_source_parallel corrP0UP(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrP0DN(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPUP(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPDN(source, list_mpi2_twopt); + + corrP0UP.initialize_diagram(glist_source_meson, glist_sink_meson, "P0UP"); + corrP0DN.initialize_diagram(glist_source_meson, glist_sink_meson, "P0DN"); + corrPPUP.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + corrPPDN.initialize_diagram(glist_source_meson, glist_sink_meson, "PPDN"); + + + /****************************************************** * * Step 4: Computing the sequential for the UU part @@ -1120,18 +1317,36 @@ int main(int argc, char **argv) { auto &momentum_i2 = mpi2_threept[i_mpi2]; //List of momenta corresponding to a fix value of p_i2 momList filtered_sourcemomentumList = sourcemomentumList_threept.extract(momentum_i2, 0); + + momList filtered_sourcemomentumList_2pt = sourcemomentumList_twopt.extract(momentum_i2, 0); + + + int Nlist=filtered_sourcemomentumList.N_list(); PLEGMA_ScattCorrelator reductionsV2(source_reduction, list_mpf1_threept); + PLEGMA_ScattCorrelator reductionsV2_2pt(source_reduction, list_mpf1_twopt); + - std::vector> mptot_filt = filtered_sourcemomentumList.uniq_p(4); + std::vector> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); + std::vector> mpi2_filt ; mpi2_filt.assign(mptot_filt.size(),momentum_i2); + PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); - PLEGMA_ScattCorrelator reductionsT1(source_reduction, mpf1_threept); - PLEGMA_ScattCorrelator reductionsT2(source_reduction, mpf1_threept); + PLEGMA_ScattCorrelator corrM( source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if12(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if34(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if56(source, filtered_sourcemomentumList_2pt); + + + PLEGMA_ScattCorrelator reductionsT1(source_reduction, mptot_filt); + PLEGMA_ScattCorrelator reductionsT2(source_reduction, mptot_filt); + PLEGMA_ScattCorrelator reductionsV3(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_2pt(source_reduction, list_mpf2_twopt); + PLEGMA_Propagator propTS_SS_packed; PLEGMA_Propagator propTS_SL_packed; @@ -1202,6 +1417,8 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); + //std::vector<> mm=list_mpi2ptot.to_string(); + corrTproton_protonpizero1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq21"); corrTproton_protonpizero2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq22"); @@ -1212,7 +1429,6 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, false, true, false )); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, false, false, true )); @@ -1225,15 +1441,95 @@ int main(int argc, char **argv) { outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - TIME(produceOutput(corrTproton_protonpizero1, outfilename, "T")); - TIME(produceOutput(corrTproton_protonpizero2, outfilename, "T")); - TIME(produceOutput(corrTproton_protonpizero3, outfilename, "T")); - TIME(produceOutput(corrTproton_protonpizero4, outfilename, "T")); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero4, outfilename, "T", parallel_sources, attract_lookup_table)); //creating factors PLEGMA_Vector stochastic_propagator_packed; + + PLEGMA_ScattCorrelator corrB3_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB4_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB5_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB6_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW5_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW6_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW8_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW13_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW14_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW15_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW16_2pt(source, filtered_sourcemomentumList_2pt); + + corrB3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); + corrB4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); + corrB5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B5"); + corrB6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B6"); + + corrW5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W5"); + corrW6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W6"); + corrW7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W7"); + corrW8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W8"); + + corrW13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W13"); + corrW14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W14"); + corrW15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); + corrW16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); + + for (int i_sample=0; i_sample stochastic_piece; + stochastic_piece.unload(); + stochastic_piece.copy(*stochastic_sources[i_sample], HOST); + stochastic_piece.load(); + + //V3 + TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed, true)); + + TIME(corrB3_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 3, true)); + TIME(corrB4_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 4, true)); + TIME(corrB5_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 5, true)); + TIME(corrB6_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 6, true)); + + stochastic_piece.apply_gamma5(); + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false));//checked + + TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); + + TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); + + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false));//checked + + TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); + + TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); + + + + stochastic_piece.unload(); + stochastic_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stochastic_piece.load(); + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked + + TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); + + TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked + + TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); + + TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); + + + } + for (int k=0; k= HGC_totalL[3]) @@ -1284,8 +1580,6 @@ int main(int argc, char **argv) { corrW16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); free(ssource); - PLEGMA_printf("SOURCE check SOURCE position[3] %d source[3] %d\n", sourcePositions[isource][3],source[3]); - PLEGMA_Propagator propTS_SS_packed_to_sink; @@ -1322,10 +1616,10 @@ int main(int argc, char **argv) { //V3 TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true)); - TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true)); - TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true)); - TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true)); - TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true)); + TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true, false, true)); + TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true, false, true)); + TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true, false, true)); + TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true, false, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1340,23 +1634,23 @@ int main(int argc, char **argv) { TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true)); + TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true, true)); - TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true)); + TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true)); - TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true)); + TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true, true)); + TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false));//checked - TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true)); - TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true)); + TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true, true)); + TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false));//checked - TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true)); - TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true)); + TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true, true)); + TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true, true)); }//loop over stochastic samples @@ -1377,6 +1671,26 @@ int main(int argc, char **argv) { TIME(produceOutput_3pt(corrW15, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); TIME(produceOutput_3pt(corrW16, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + if (k==0){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; + TIME(produceOutput_2pt_packed(corrB3_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB4_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB5_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB6_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; + TIME(produceOutput_2pt_packed(corrW5_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW6_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW7_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW8_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrW13_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW14_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW15_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW16_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + } + }//loop over source sink separations @@ -1473,15 +1787,45 @@ int main(int argc, char **argv) { TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT1, false, false, false )); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - TIME(produceOutput(corrTproton_neutronpiplus1, outfilename, "T")); - TIME(produceOutput(corrTproton_neutronpiplus2, outfilename, "T")); - TIME(produceOutput(corrTproton_neutronpiplus3, outfilename, "T")); - TIME(produceOutput(corrTproton_neutronpiplus4, outfilename, "T")); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4, outfilename, "T", parallel_sources, attract_lookup_table)); + PLEGMA_ScattCorrelator corrB9_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB10_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB11_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB12_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW17_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW18_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW19_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW20_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW21_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW22_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW23_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW24_2pt(source, filtered_sourcemomentumList_2pt); + + + corrB9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B9"); + corrB10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B10"); + corrB11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B11"); + corrB12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B12"); + + corrW17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W17"); + corrW18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W18"); + corrW19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W19"); + corrW20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W20"); + + corrW21_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W21"); + corrW22_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W22"); + corrW23_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W23"); + corrW24_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W24"); @@ -1559,6 +1903,46 @@ int main(int argc, char **argv) { for (int i_sample=0; i_sample stochastic_propagator_packed; + + if (k==0){ + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); + stochastic_propagator_packed.load(); + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true )); + + TIME( corrB9_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 9, true, false, false)); + TIME(corrB10_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 10, true, false, false)); + TIME(corrB11_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 11, true, false, false)); + TIME(corrB12_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 12, true, false, false)); + + + stochastic_propagator_packed.apply_gamma5(); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + + TIME(corrW22_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 22, true, false)); + TIME(corrW24_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 24, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false)); + + TIME(corrW21_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 21, true, false)); + TIME(corrW23_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 23, true, false)); + + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stochastic_propagator_packed.load(); + + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false)); + TIME(corrW17_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 17, true, false)); + TIME(corrW19_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 19, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false)); + TIME(corrW18_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 18, true, false)); + TIME(corrW20_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 20, true, false)); + + } for (int i_source_parallel=0; i_source_parallel temporary; temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); @@ -1568,6 +1952,7 @@ int main(int argc, char **argv) { } stochastic_propagator_packed.apply_gamma5(); + /* if (i_sample==0){ PLEGMA_Vector vectorAuxPrint; for(int isc = 0 ; isc < 12 ; isc++){ @@ -1580,18 +1965,18 @@ int main(int argc, char **argv) { } stochastic_propagator_packed.writeHDF5("corrB12_stochastic_propagator"); - } + } */ TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true )); - TIME( corrB9.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true)); - TIME(corrB10.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true)); - TIME(corrB11.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true)); - reductionsV3.writeHDF5("corrB12_V3_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); - reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->writeHDF5("corrB12_V4_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); + TIME( corrB9.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true, false, true)); + TIME(corrB10.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true, false, true)); + TIME(corrB11.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true, false, true)); + //reductionsV3.writeHDF5("corrB12_V3_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); + //reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->writeHDF5("corrB12_V4_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); - TIME(corrB12.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true)); + TIME(corrB12.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true, false, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1605,21 +1990,21 @@ int main(int argc, char **argv) { TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW17.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true)); - TIME(corrW19.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true)); + TIME(corrW17.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true, true)); + TIME(corrW19.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW18.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true)); - TIME(corrW20.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true)); + TIME(corrW18.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true, true)); + TIME(corrW20.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false)); - TIME(corrW22.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true)); - TIME(corrW24.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true)); + TIME(corrW22.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true, true)); + TIME(corrW24.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME(corrW21.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true)); - TIME(corrW23.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true)); + TIME(corrW21.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true, true)); + TIME(corrW23.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true, true)); } //loop over stochastic samples @@ -1640,6 +2025,26 @@ int main(int argc, char **argv) { TIME(produceOutput_3pt(corrW23, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); TIME(produceOutput_3pt(corrW24, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + if (k==0){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; + + TIME(produceOutput_2pt_packed(corrB9_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB10_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB11_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB12_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; + + TIME(produceOutput_2pt_packed(corrW17_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW18_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW19_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW20_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrW21_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW22_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW23_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW24_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + } @@ -1719,8 +2124,27 @@ int main(int argc, char **argv) { outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - TIME(produceOutput(corrTproton_protonpizero5, outfilename, "T")); - TIME(produceOutput(corrTproton_protonpizero6, outfilename, "T")); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero5, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero6, outfilename, "T", parallel_sources, attract_lookup_table)); + + PLEGMA_ScattCorrelator corrB7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB8_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW9_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW10_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW11_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW12_2pt(source, filtered_sourcemomentumList_2pt); + + corrB7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); + corrB8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); + + corrW9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W9"); + corrW10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W10"); + corrW11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W11"); + corrW12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W12"); + + + for (int k=0; k< tSinks.size(); ++k){ @@ -1773,6 +2197,30 @@ int main(int argc, char **argv) { for (int i_sample=0; i_sample stochastic_propagator_packed; + + if (k==0){ + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); + stochastic_propagator_packed.load(); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false)); + + TIME( corrW9_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 9, true)); + TIME(corrW11_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 11, true)); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false)); + + TIME(corrW10_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 10, true, false)); + TIME(corrW12_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 12, true, false)); + + stochastic_propagator_packed.apply_gamma5(); + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true)); + + TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); + TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); + + } for (int i_source_parallel=0; i_source_parallel temporary; temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); @@ -1783,10 +2231,10 @@ int main(int argc, char **argv) { stochastic_propagator_packed.apply_gamma5(); - TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SS_packed, true)); + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true)); - TIME(corrB7.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true)); - TIME(corrB8.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true)); + TIME(corrB7.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true, false, true)); + TIME(corrB8.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true, false, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1801,13 +2249,13 @@ int main(int argc, char **argv) { TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true)); - TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true)); + TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true, true)); + TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true, true)); TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); - TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true)); - TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true)); + TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true, true)); + TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true, true)); } //loop over stochastic samples @@ -1821,6 +2269,19 @@ int main(int argc, char **argv) { TIME(produceOutput_3pt(corrW11, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); TIME(produceOutput_3pt(corrW12, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + if (k==0){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; + TIME(produceOutput_2pt_packed(corrB7_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB8_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; + TIME(produceOutput_2pt_packed(corrW9_2pt , outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table));//because of V4 + TIME(produceOutput_2pt_packed(corrW10_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW11_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW12_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + } + } //loop over tSinks @@ -1847,9 +2308,9 @@ int main(int argc, char **argv) { //vectortmp1.dilutespin(vectorStoc_source_oet,0); //vectorSource_finite_mom.copy(vectortmp1); vectorSource_finite_mom.copy(vectorStoc_source_oet); - vectorSource_finite_mom.unload(); - vectorSource_finite_mom.writeHDF5("finite_mom_oet_source"); - vectorSource_finite_mom.load(); + //vectorSource_finite_mom.unload(); + //vectorSource_finite_mom.writeHDF5("finite_mom_oet_source"); + //vectorSource_finite_mom.load(); std::vector tmp_4Dmom= momentum_i2 ; tmp_4Dmom.push_back(0); @@ -1865,9 +2326,9 @@ int main(int argc, char **argv) { TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vectortmp1.absorb(vector2, source_local[3],true); PLEGMA_printf("Source local %d\n",source_local[3]); - vectortmp1.unload(); - vectortmp1.writeHDF5("source_for_up_fini_mom_oet_t"+std::to_string(source_local[3])); - vectortmp1.load(); + //vectortmp1.unload(); + //vectortmp1.writeHDF5("source_for_up_fini_mom_oet_t"+std::to_string(source_local[3])); + //vectortmp1.load(); } @@ -1882,13 +2343,20 @@ int main(int argc, char **argv) { //Rotate back immediately to the physical basis vectortmp1.rotateToPhysicalBasis(vectortmp2,+1); PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp1); stochastic_oet_prop_u_fini_mom_SL.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_u_fini_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } - stochastic_oet_prop_u_fini_mom_SL.unload(); - stochastic_oet_prop_u_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_u"); - stochastic_oet_prop_u_fini_mom_SL.load(); + //stochastic_oet_prop_u_fini_mom_SL.unload(); + //stochastic_oet_prop_u_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_u"); + //stochastic_oet_prop_u_fini_mom_SL.load(); //PLEGMA_Vector temporary1,temporary2; @@ -1958,6 +2426,12 @@ int main(int argc, char **argv) { vectorAuxF.copy(vectortmp1); stochastic_oet_prop_d_fini_mom_SL.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],max_source_sink_separations, i_source_parallel == 0 ? true : false); + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_d_fini_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + //PLEGMA_Vector temporary1,temporary2; //temporary1.copy(*stochastic_oet_prop_d_fini_mom_SL[spinindex],HOST); @@ -1977,9 +2451,9 @@ int main(int argc, char **argv) { }//end of finite momentum oet - stochastic_oet_prop_d_fini_mom_SL.unload(); - stochastic_oet_prop_d_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_d"); - stochastic_oet_prop_d_fini_mom_SL.load(); + //stochastic_oet_prop_d_fini_mom_SL.unload(); + //stochastic_oet_prop_d_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_d"); + //stochastic_oet_prop_d_fini_mom_SL.load(); @@ -1994,6 +2468,12 @@ int main(int argc, char **argv) { TIME(reductionsV3_diluted_D_UP.V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS); + st_oet_d_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_D_UP_2pt.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed, true)); + + } //for (int i=0; i< 4; ++i){ @@ -2007,6 +2487,110 @@ int main(int argc, char **argv) { TIME(reductionsV3_diluted_U_DN.V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); } + { + PLEGMA_Vector st_oet_u_fini; + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS); + //st_oet_u_fini.load(); + + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_DN_2pt.V3( st_oet_u_fini, glist_sink_meson, propDN_SS_packed, true)); + } + + + + PLEGMA_ScattCorrelator corrZ5_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ6_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ8_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ9_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ10_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ11_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ12_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ13_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ14_2pt(source, filtered_sourcemomentumList_2pt); + + corrZ5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); + corrZ6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); + + corrZ7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z7"); + corrZ8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z8"); + + corrZ9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z9"); + corrZ10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z10"); + + corrZ11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z11"); + corrZ12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); + + corrZ13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); + corrZ14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); + + corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); + corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); + corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); + corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); + + + TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); + TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); + + TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); + TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); + + TIME( corrZ9_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 9, false )); + TIME(corrZ10_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 10,false )); + + TIME(corrZ11_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 11, false )); + TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); + + TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); + TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); + + TIME(corrPPUP.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); + TIME(corrPPDN.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); + TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + + TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); + TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); + TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); + TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; + + TIME(produceOutput_2pt_packed(corrZ5_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ6_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ8_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ9_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ10_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ11_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ12_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_2pt"; + TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt")); + TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt")); + TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt")); + TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt")); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; + TIME( corrN0_packed.apply_phase()); + TIME( corrN0_packed.apply_sign("N")); + TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrN0_packed.writeHDF5(outfilename)); + + TIME( corrNP_packed.apply_phase() ); + TIME( corrNP_packed.apply_sign("N") ); + TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrNP_packed.writeHDF5(outfilename) ); + + for (int k=0; kwriteHDF5("corr_Z11_reductionsV2_diluted_STOCHU_DN_UP_"+std::to_string(tSinks[k])); - TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11 )); - TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13 )); + //reductionsV3_diluted_U_DN.writeHDF5("corr_Z11_reductionsV3_diluted_U_DN"); + //reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("corr_Z11_reductionsV2_diluted_STOCHU_DN_UP_"+std::to_string(tSinks[k])); + TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11, false, true )); + TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13, false, true )); - TIME(corrZ12.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 12 )); - TIME(corrZ14.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 14 )); + TIME(corrZ12.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 12, false, true )); + TIME(corrZ14.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 14, false, true )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z"; @@ -2089,6 +2673,17 @@ int main(int argc, char **argv) { }//loop over mpi2 + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; + TIME(corrP0UP.apply_sign("P")); + TIME(corrP0UP.writeHDF5( outfilename )); + TIME(corrP0DN.apply_sign("P")); + TIME(corrP0DN.writeHDF5( outfilename )); + TIME(corrPPUP.apply_sign("P")); + TIME(corrPPUP.writeHDF5( outfilename )); + TIME(corrPPDN.apply_sign("P")); + TIME(corrPPDN.writeHDF5( outfilename )); + + //for (int spinindex=0;spinindex<4;++spinindex){ // reductionsV3_diluted_U_DN.pop_back(); // reductionsV3_diluted_D_UP.pop_back(); @@ -2102,6 +2697,14 @@ int main(int argc, char **argv) { for(int i_samples=0; i_samples< n_stochastic_samples; ++i_samples) { + reductions_UU_V2_GAMMAF1D_U_2pt.pop_back(); + reductions_UU_V4_GAMMAF1U_D_2pt.pop_back(); + + reductions_UU_V3_GAMMAF2U_2pt.pop_back(); + reductions_DD_V3_GAMMAF2D_2pt.pop_back(); + + reductions_DD_V2_GAMMAF1U_U_2pt.pop_back(); + for (int k=0; k Date: Fri, 30 Dec 2022 11:36:46 +0100 Subject: [PATCH 043/168] Z diagram for 3pt now with gamma_f2 calculated --- lib/PLEGMA_ScattCorrelator.cu | 43 ++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 6158a707..30feb97c 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -518,6 +518,7 @@ void PLEGMA_ScattCorrelator::V3V2reduction( PLEGMA_ScattCorrelator } else { n_gammas_i2_f2=n_gammas_f2; } + PLEGMA_printf("n_gammas_i2_f2 %d\n",n_gammas_i2_f2); for (int g3=0 ; g3 < n_gammas_i2_f2 ; ++g3 ){//pf2 for (int alfa=0; alfa < N_SPINS; ++alfa ){ for (int beta=0; beta < N_SPINS; ++beta ){ @@ -2045,7 +2046,7 @@ void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorr //this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false);//checked FP break; default: - PLEGMA_error("This value of Z diagram index does not exists, please check your inputs in piNdiagrams.cpp"); + PLEGMA_error("This value of Z diagram index does not exists, please check your inputs in piNdiagrams.cpp %d\n", diagramm_index); }//switch (Diagram index) } @@ -2062,69 +2063,69 @@ void PLEGMA_ScattCorrelator::Z_diagrams_without_dilution(PLEGMA_ScattCorr Float factor[2]={-1.,0.};//-1 from eqs. (28),(31),(34),(37), .... switch (diagramm_index){ case 1: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor,false, threept); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, false, threept); //checked FP break; case 2: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, false, threept);//checked FP break; case 3: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, false, threept);//checked FP break; case 4: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, false, threept);//checked FP break; case 5: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, false, threept);//checked FP break; case 6: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, false, threept);//checked FP break; case 7: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, true, factor, false, false, threept);//checked FP break; case 8: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, true, factor, false, false, threept);//checked FP break; case 9: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true, threept); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true, false, threept); //checked FP break; case 10: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true, threept); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true, false, threept); //checked FP break; case 11: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false, threept); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false, false, threept); //checked FP break; case 12: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false,i_g_i2, true, factor, false, threept); //checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false,i_g_i2, true, factor, false, false, threept); //checked FP break; case 13: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false, threept); //checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false, false, threept); //checked FP break; case 14: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false, threept); //checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false, false, threept); //checked FP break; case 15: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true, threept);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, true, false, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, true); //checked FP break; case 16: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true, threept);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, false, factor, true, false, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, false, g, true); //checked FP break; case 17: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, true, i_g_i2, true, factor, false, false, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, true, g2, true, g, false);//checked FP break; case 18: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false, threept);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 1, false, i_g_i2, false, factor, false, false, threept);//checked FP //this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 1, false, g2, false, g, false);//checked FP break; case 19: - this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false, i_g_i2, true, factor, false, threept);//checked FP + this->V3V2reduction( srcV3, *srcV2[srcV2index], 2, false, i_g_i2, true, factor, false, false, threept);//checked FP //this->V3V2reduction( srcV3[lambda], srcV2[kappa], 2, false, g2, true, g, false); //checked FP break; case 20: - this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false, threept);//checked FP + this->V3V2reduction_matrix( srcV3, *srcV2[srcV2index], 0, false, i_g_i2, false, factor, false, false, threept);//checked FP //this->V3V2reduction_matrix( srcV3[lambda], srcV2[kappa], 0, false, g2, false, g, false);//checked FP break; default: From da2d1ec06872ede07ed398ca677c73c3b885a684 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 11 Jan 2023 08:27:08 +0100 Subject: [PATCH 044/168] wrapper functions for memcpy and memset in order to avoid tuning problems --- include/PLEGMA_global.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/PLEGMA_global.h b/include/PLEGMA_global.h index 74e883e0..7ee0d3e9 100644 --- a/include/PLEGMA_global.h +++ b/include/PLEGMA_global.h @@ -67,5 +67,11 @@ namespace plegma { #include +static inline void PLEGMA_memset(void *ptr, int value, size_t count){ + return qudaMemset(ptr,value,count); +} +static inline void PLEGMA_memcpy(void *dst, const void *src, size_t count,qudaMemcpyKind kind){ + return qudaMemcpy(dst,src,count,kind); +} } using namespace plegma; // TODO: This one shouldn't be here.. But helps avoiding missing namespace. From 6fc8708bda6f29c4e3f68a0ed717f54c3ceccaa4 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 11 Jan 2023 08:52:42 +0100 Subject: [PATCH 045/168] replacing qudaMemcpy and memset with the PLEGMA ones where needed --- lib/PLEGMA_Field.cu | 47 ++++++++++++++++++++++++++++++++++---------- lib/PLEGMA_Vector.cu | 34 ++++++++++++++++++++++++-------- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/lib/PLEGMA_Field.cu b/lib/PLEGMA_Field.cu index c83036f5..58424341 100644 --- a/lib/PLEGMA_Field.cu +++ b/lib/PLEGMA_Field.cu @@ -15,6 +15,7 @@ #include #include #include +#include using namespace plegma; #define DEVICE_MEMORY_REPORT @@ -865,16 +866,22 @@ void PLEGMA_Field::absorb(const PLEGMA_Field3D &field, int global_ int my_it = global_it - HGC_procPosition[3] * HGC_localL[3]; bool is_myIt = (my_it >= 0) && ( my_it < HGC_localL[3] ); - if(not is_myIt) return; - + size_t V4 = HGC_localVolume*2; size_t V3 = HGC_localVolume3D*2; + { + Float2 *tempquda=(Float2 *)device_malloc(V3 * sizeof(Float)); + PLEGMA_memcpy(tempquda,tempquda,V3 * sizeof(Float),qudaMemcpyDeviceToDevice); + device_free(tempquda); + } + if(not is_myIt) return; + Float *pointer_src = NULL; Float *pointer_dst = NULL; for(int i = 0; i < this->Field_length(); i++) { pointer_src = (field.D_elem() + i*V3); pointer_dst = (this->D_elem() + i*V4 + my_it*V3); - qudaMemcpy(pointer_dst, pointer_src, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); } checkQudaError(); } @@ -1007,7 +1014,7 @@ void PLEGMA_Field::absorbTimeslice(PLEGMA_Field &srcfield, int glo if(!srcfield.IsAllocDevice()) PLEGMA_error("This function needs allocation of input field on the device to work\n"); if(global_it >= HGC_totalL[3]) PLEGMA_error("The global time slice you provided exceed the temporal extent\n"); - if( this->field_name.compare(srcfield.Field_name()) != 0) PLEGMA_error("Fields types does not match\n"); + if( this->field_name.compare(srcfield.Field_name()) != 0) PLEGMA_error("Fields types does not match %s %s \n",this->field_name.c_str(),srcfield.Field_name().c_str()); //check dimensions @@ -1018,14 +1025,21 @@ void PLEGMA_Field::absorbTimeslice(PLEGMA_Field &srcfield, int glo Float *pointer_src = NULL; Float *pointer_dst = NULL; + { + Float2 *tempquda=(Float2 *)device_malloc(V3*2 * sizeof(Float)); + PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + device_free(tempquda); + } + for(int i = 0 ; i < this->field_length; i++){ - if( forcetozero ) + if( forcetozero ){ qudaMemset( this->d_elem + i*V4*2, 0, V4*2*sizeof(Float)); + } if(is_myIt){ pointer_dst = (this->d_elem + i*V4*2 + my_it*V3*2); pointer_src = (srcfield.D_elem() + i*V4*2 + my_it*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -1074,22 +1088,35 @@ void PLEGMA_Field3D::absorb(const PLEGMA_Field &field, int global_ size_t V4 = HGC_localVolume*2; Float *pointer_src = NULL; Float *pointer_dst = NULL; + + if (broadcast ==true){ + PLEGMA_memcpy(this->H_elem(), this->D_elem(), V3 * sizeof(Float), qudaMemcpyDeviceToHost); + PLEGMA_memcpy(this->D_elem(), this->H_elem(), V3 * sizeof(Float), qudaMemcpyHostToDevice); + } + { + Float2 *tmpquda=(Float2 *)device_malloc(V3 * sizeof(Float)); + PLEGMA_memset(tmpquda, 0, V3 * sizeof(Float)); + PLEGMA_memcpy(tmpquda, tmpquda, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); + device_free(tmpquda); + } + + for(int i = 0; i < this->Field_length(); i++) { pointer_dst = (this->D_elem() + i*V3); if(this->activeTimeSlice) { pointer_src = (field.D_elem() + i*V4 + my_it*V3); - qudaMemcpy(pointer_dst, pointer_src, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); } if (broadcast == true){ int time_rank=global_it/HGC_localL[3]; Float *temp=(Float *)malloc(sizeof(Float)*V3); - qudaMemcpy(temp, pointer_dst, V3* sizeof(Float), qudaMemcpyDeviceToHost); + PLEGMA_memcpy(temp, pointer_dst, V3* sizeof(Float), qudaMemcpyDeviceToHost); MPI_Bcast(temp, V3 , MPI_Type(), time_rank, HGC_timeComm); - qudaMemcpy(pointer_dst, temp, V3* sizeof(Float), qudaMemcpyHostToDevice); + PLEGMA_memcpy(pointer_dst, temp, V3* sizeof(Float), qudaMemcpyHostToDevice); free(temp); } if (broadcast == false && !(this->activeTimeSlice)){ - qudaMemset(pointer_dst, 0, V3 * sizeof(Float)); + PLEGMA_memset(pointer_dst, 0, V3 * sizeof(Float)); } } checkQudaError(); diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 46dbfd0c..228105af 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -12,7 +12,7 @@ #endif #include #include - +#include using namespace plegma; using namespace quda; @@ -132,13 +132,19 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator3D &prop, int global_i int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; + { + Float2* tempquda=(Float2*)device_malloc(V4*2*sizeof(Float)); + PLEGMA_memset(tempquda,0, V4*2*sizeof(Float)); + PLEGMA_memcpy(tempquda, tempquda,V3*2*sizeof(Float),qudaMemcpyDeviceToDevice); + device_free(tempquda); + } for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ - qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); + PLEGMA_memset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V3*2 + nu*N_COLS*N_COLS*V3*2 + c1*N_COLS*V3*2 + c2*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -178,16 +184,21 @@ void PLEGMA_Vector::absorb(PLEGMA_Vector3D &vec, int global_it, bo int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; + { + Float2 *tempquda=(Float2 *)device_malloc( V3*2 * sizeof(Float)); + PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + device_free(tempquda); + } for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ //qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); pointer_src = (vec.D_elem() + mu*N_COLS*V3*2 + c1*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } - comm_barrier(); + //comm_barrier(); checkQudaError(); } @@ -201,7 +212,7 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator &prop, int nu , int c for(int c1 = 0 ; c1 < N_COLS ; c1++){ pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2); pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2); - qudaMemcpy(pointer_dst, pointer_src, V4*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + qudaMemcpy(pointer_dst, pointer_src, V4*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } checkQudaError(); } @@ -542,16 +553,23 @@ namespace plegma{ int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; + { + Float2 *tmpdevice=(Float2*)device_malloc(V3*2 * sizeof(Float)); + PLEGMA_memset(tmpdevice, 0, V3*2 * sizeof(Float)); + PLEGMA_memcpy(tmpdevice, tmpdevice,V3*2 * sizeof(Float),qudaMemcpyDeviceToDevice); + device_free(tmpdevice); + } for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++) { + PLEGMA_printf("HERE IS THE PROBLEM %d %d %d %d %d\n",mu,c1,my_it,global_it,is_myIt); pointer_dst = (this->d_elem + mu*N_COLS*V3*2 + c1*V3*2); if(is_myIt){ pointer_src = (prop.D_elem() + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } else{ - qudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); + PLEGMA_memset(pointer_dst, 0, V3*2 * sizeof(Float)); } } From 9ed0967897f17643ff6f655d5fbe80bee93c0ee8 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 13 Jan 2023 09:36:24 +0100 Subject: [PATCH 046/168] correcting packing routines and include static bool variable to do the fake copy memset only once --- lib/PLEGMA_Propagator.cu | 37 +++++++++++++++++-- lib/PLEGMA_Vector.cu | 79 +++++++++++++++++++++++++++++++++------- 2 files changed, 98 insertions(+), 18 deletions(-) diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index 400f039d..f7cdfa69 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -58,13 +58,22 @@ void PLEGMA_Propagator::absorb(PLEGMA_Vector &vec, int global_it, int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; + static bool init_prop4D_vec4D = false; + + if (!init_prop4D_vec4D) { + Float2 *tempquda=(Float2 *)device_malloc(V3*2 * sizeof(Float)); + PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + device_free(tempquda); + init_prop4D_vec4D=true; + } + for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ qudaMemset(this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2 + my_it*V3*2); pointer_src = (vec.D_elem() + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -81,13 +90,22 @@ void PLEGMA_Propagator::absorb(PLEGMA_Vector3D &vec, int global_it int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; + static bool init_prop4D_vec3D = false; + + if (!init_prop4D_vec3D) { + Float2 *tempquda=(Float2 *)device_malloc(V3*2 * sizeof(Float)); + PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + device_free(tempquda); + init_prop4D_vec3D=true; + } + for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ qudaMemset(this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2 + my_it*V3*2); pointer_src = (vec.D_elem() + mu*N_COLS*V3*2 + c1*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } comm_barrier(); @@ -286,15 +304,26 @@ void PLEGMA_Propagator3D::absorb(PLEGMA_Vector &vec, int global_it int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; + + static bool init_prop3D_vec4D=false; + if (!init_prop3D_vec4D) { + Float2 *tempquda=(Float2 *)device_malloc(V3*2 * sizeof(Float)); + PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memset(tempquda, 0, V3*2 * sizeof(Float)); + + device_free(tempquda); + init_prop3D_vec4D=true; + } + for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ pointer_dst = (this->d_elem + mu*N_SPINS*N_COLS*N_COLS*V3*2 + nu*N_COLS*N_COLS*V3*2 + c1*N_COLS*V3*2 + c2*V3*2); if(is_myIt){ pointer_src = (vec.D_elem() + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } else - qudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); + PLEGMA_memset(pointer_dst, 0, V3*2 * sizeof(Float)); } checkQudaError(); } diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 228105af..aca2d39e 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -132,11 +132,16 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator3D &prop, int global_i int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; - { + static bool init_absorb_vec4D_prop3D = false; + + if (!init_absorb_vec4D_prop3D) { + Float2* tempquda=(Float2*)device_malloc(V4*2*sizeof(Float)); PLEGMA_memset(tempquda,0, V4*2*sizeof(Float)); PLEGMA_memcpy(tempquda, tempquda,V3*2*sizeof(Float),qudaMemcpyDeviceToDevice); device_free(tempquda); + init_absorb_vec4D_prop3D=true; + } for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ @@ -184,10 +189,17 @@ void PLEGMA_Vector::absorb(PLEGMA_Vector3D &vec, int global_it, bo int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; - { + + static bool init_vector4D_vector3D = false; + + if (!init_vector4D_vector3D) { + Float2 *tempquda=(Float2 *)device_malloc( V3*2 * sizeof(Float)); PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); device_free(tempquda); + + init_vector4D_vector3D=true; + } for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ @@ -313,10 +325,10 @@ void PLEGMA_Vector::pack_propagator_as_sink(PLEGMA_Vector &in, int stmp.copy(*this); } + vector1.absorb(in, sinktimeslice, true); for (int dt=0; dt::pointSource(const site& sourceposition, int spin, int this->zero_where(where); int my_src[N_DIMS]; size_t id=0; + static bool init_PointSource = false; + + if (!init_PointSource) { + Float * temphost=(Float*)malloc(sizeof(Float)); + Float2 *tempquda=(Float2 *)device_malloc(sizeof(Float)); + PLEGMA_memcpy(tempquda, temphost,sizeof(Float), + qudaMemcpyHostToDevice ); + free(temphost); + device_free(tempquda); + init_PointSource=true; + } + for(int i = N_DIMS-1; i >= 0; i--) { my_src[i] = (sourceposition[i] - HGC_procPosition[i] * HGC_localL[i]); @@ -375,14 +399,14 @@ void PLEGMA_Vector::pointSource(const site& sourceposition, int spin, int temp[0] = 1.0; if( where == BOTH ){ this->h_elem[((spin*N_COLS+color)*HGC_localVolume + id)*2] = 1.0; - qudaMemcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), + PLEGMA_memcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), qudaMemcpyHostToDevice ); } else if (where == HOST){ this->h_elem[((spin*N_COLS+color)*this->Total_length() + id)*2] = 1.0; } else if (where == DEVICE){ - qudaMemcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), + PLEGMA_memcpy((this->d_elem + ((spin*N_COLS+color)*this->Total_length() + id)*2), temp,sizeof(Float), qudaMemcpyHostToDevice ); } else{ @@ -513,12 +537,24 @@ namespace plegma{ int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; + static bool init_vector3D_prop4D = false; + + if (!init_vector3D_prop4D) { + + Float2* tempquda=(Float2*)device_malloc(V3*2 * sizeof(Float)); + PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memset(tempquda, 0, V3*2 * sizeof(Float)); + device_free(tempquda); + init_vector3D_prop4D=true; + + } + for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ pointer_dst = (this->d_elem + mu*N_COLS*V3*2 + c1*V3*2); if(is_myIt){ pointer_src = (prop.D_elem() + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2 + my_it*V3*2); - qudaMemcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } if (broadcast == true){ @@ -526,15 +562,15 @@ namespace plegma{ // printf("Time rank %d\n",time_rank); // fflush(stdout); Float *temp=(Float *)malloc(sizeof(Float)*V3*2); - qudaMemcpy(temp, pointer_dst, V3*2 * sizeof(Float), qudaMemcpyDeviceToHost); + PLEGMA_memcpy(temp, pointer_dst, V3*2 * sizeof(Float), qudaMemcpyDeviceToHost); MPI_Bcast(temp, V3*2 , MPI_Type(), time_rank, HGC_timeComm); // printf("Temp 0 %e\n",temp[0]); // fflush(stdout); - qudaMemcpy(pointer_dst, temp, V3*2 * sizeof(Float), qudaMemcpyHostToDevice); + PLEGMA_memcpy(pointer_dst, temp, V3*2 * sizeof(Float), qudaMemcpyHostToDevice); free(temp); } if (broadcast == false && is_myIt ==false){ - qudaMemset(pointer_dst, 0, V3*2 * sizeof(Float)); + PLEGMA_memset(pointer_dst, 0, V3*2 * sizeof(Float)); } } @@ -553,24 +589,39 @@ namespace plegma{ int V4 = HGC_localVolume; Float *pointer_src = NULL; Float *pointer_dst = NULL; - { + static bool init_vector3D_vector4D = false; + + if (!init_vector3D_vector4D) { Float2 *tmpdevice=(Float2*)device_malloc(V3*2 * sizeof(Float)); PLEGMA_memset(tmpdevice, 0, V3*2 * sizeof(Float)); PLEGMA_memcpy(tmpdevice, tmpdevice,V3*2 * sizeof(Float),qudaMemcpyDeviceToDevice); device_free(tmpdevice); + init_vector3D_vector4D=true; } for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++) { - PLEGMA_printf("HERE IS THE PROBLEM %d %d %d %d %d\n",mu,c1,my_it,global_it,is_myIt); pointer_dst = (this->d_elem + mu*N_COLS*V3*2 + c1*V3*2); if(is_myIt){ pointer_src = (prop.D_elem() + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } - else{ - PLEGMA_memset(pointer_dst, 0, V3*2 * sizeof(Float)); - } + if (broadcast == true){ + int time_rank=global_it/HGC_localL[3]; +// printf("Time rank %d\n",time_rank); +// fflush(stdout); + Float *temp=(Float *)malloc(sizeof(Float)*V3*2); + PLEGMA_memcpy(temp, pointer_dst, V3*2 * sizeof(Float), qudaMemcpyDeviceToHost); + MPI_Bcast(temp, V3*2 , MPI_Type(), time_rank, HGC_timeComm); +// printf("Temp 0 %e\n",temp[0]); +// fflush(stdout); + PLEGMA_memcpy(pointer_dst, temp, V3*2 * sizeof(Float), qudaMemcpyHostToDevice); + free(temp); + } + if (broadcast == false && is_myIt ==false){ + PLEGMA_memset(pointer_dst, 0, V3*2 * sizeof(Float)); + } + } checkQudaError(); From 101abea21413661a9d2d3177f3fa08e044838aa5 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 13 Jan 2023 10:06:12 +0100 Subject: [PATCH 047/168] correcting boundary Sign for 3pt function --- include/PLEGMA_ScattCorrelator.h | 2 +- lib/PLEGMA_ScattCorrelator.cu | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 6e062af8..f85b27d4 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -308,7 +308,7 @@ namespace plegma { void multiply_by_time_slice(std::shared_ptr&); void applyBoundaryConditions( bool antiperiodic, int n_coherent_source=1, int *attract_look_up_table=NULL ); - void applyBoundaryConditions_3pt( bool antiperiodic, int source_sink_separation,int max_source_sink_separation ); + void applyBoundaryConditions_3pt( bool antiperiodic, int n_coherent_source, int *attract_look_up_table, int source_sink_separation ); void apply_phase( ); diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 30feb97c..b5169d6a 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -3473,13 +3473,12 @@ void PLEGMA_ScattCorrelator::applyBoundaryConditions( bool antiperiodic, } template -void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiodic, int source_sink_separation,int max_source_sink_separation ) { +void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiodic, int n_coherent_source, int *attract_look_up_table, int source_sink_separation ) { if(!antiperiodic) return; std::size_t n_t = this->labels.find("t"); assert(n_t!=std::string::npos); - int parallel_sources=HGC_totalL[DIM_T]/max_source_sink_separation; int TIME = this->localT(); if (TIME==0) return; @@ -3487,17 +3486,13 @@ void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiod int out_dofs = ranges[0]*offsets[0]/TIME/in_dofs; int maxT = this->endT() - this->startT(); + if (n_coherent_source >1 && attract_look_up_table==NULL) PLEGMA_error("attract_look_up_table must be created before using this function\n"); + for( int t=0; t=maxT) ? (this->source[DIM_T]%HGC_localL[DIM_T]) + t - maxT : t; int t_global = HGC_procPosition[DIM_T] * HGC_localL[DIM_T] + t_local; - int actualSource; - for (int j=0; jsource[DIM_T]+j*max_source_sink_separation+HGC_totalL[DIM_T])%HGC_totalL[DIM_T]; - if (t_global>=((actualSource+max_source_sink_separation+HGC_totalL[DIM_T])%HGC_totalL[DIM_T])){ - break; - } - } - if (actualSource+source_sink_separation>HGC_totalL[DIM_T]){ + int source_num= n_coherent_source > 1 ? attract_look_up_table[t_global] : this->source[DIM_T]; + if( source_num + source_sink_separation > HGC_totalL[3] ){ for( int o_dofs=0; o_dofsH_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs) = -*(this->H_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs); @@ -3507,8 +3502,6 @@ void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiod } } - - template void PLEGMA_ScattCorrelator::apply_phase(){ std::size_t n_m = this->labels.find("m"); From deabb21cfe1e5be868fe722bdec1c862668a849d Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 13 Jan 2023 11:18:47 +0100 Subject: [PATCH 048/168] static variable added --- lib/PLEGMA_Field.cu | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/PLEGMA_Field.cu b/lib/PLEGMA_Field.cu index 58424341..5937f4ef 100644 --- a/lib/PLEGMA_Field.cu +++ b/lib/PLEGMA_Field.cu @@ -1025,10 +1025,13 @@ void PLEGMA_Field::absorbTimeslice(PLEGMA_Field &srcfield, int glo Float *pointer_src = NULL; Float *pointer_dst = NULL; - { + static bool init_absorbTimeslice = false; + + if (!init_absorbTimeslice) { Float2 *tempquda=(Float2 *)device_malloc(V3*2 * sizeof(Float)); PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); device_free(tempquda); + init_absorbTimeslice=true; } @@ -1089,15 +1092,20 @@ void PLEGMA_Field3D::absorb(const PLEGMA_Field &field, int global_ Float *pointer_src = NULL; Float *pointer_dst = NULL; - if (broadcast ==true){ - PLEGMA_memcpy(this->H_elem(), this->D_elem(), V3 * sizeof(Float), qudaMemcpyDeviceToHost); - PLEGMA_memcpy(this->D_elem(), this->H_elem(), V3 * sizeof(Float), qudaMemcpyHostToDevice); - } - { + static bool init_absorb_vec3D_vec4D = false; + if (!init_absorb_vec3D_vec4D) { + { + Float2 *tmpquda=(Float2 *)device_malloc(V3 * sizeof(Float)); + Float *tmphost=(Float*)malloc(sizeof(Float)*V3); + if (broadcast ==true){ + PLEGMA_memcpy(tmphost, tmpquda, V3 * sizeof(Float), qudaMemcpyDeviceToHost); + PLEGMA_memcpy(tmpquda, tmphost, V3 * sizeof(Float), qudaMemcpyHostToDevice); + } PLEGMA_memset(tmpquda, 0, V3 * sizeof(Float)); PLEGMA_memcpy(tmpquda, tmpquda, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); device_free(tmpquda); + free(tmphost); } From fc62bac5adf55b7f3af187f435a1dd87d0d366cc Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 13 Jan 2023 11:21:46 +0100 Subject: [PATCH 049/168] typo corrected --- lib/PLEGMA_Field.cu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PLEGMA_Field.cu b/lib/PLEGMA_Field.cu index 5937f4ef..e5070bc5 100644 --- a/lib/PLEGMA_Field.cu +++ b/lib/PLEGMA_Field.cu @@ -1093,7 +1093,7 @@ void PLEGMA_Field3D::absorb(const PLEGMA_Field &field, int global_ Float *pointer_dst = NULL; static bool init_absorb_vec3D_vec4D = false; - if (!init_absorb_vec3D_vec4D) { + if (!init_absorb_vec3D_vec4D) { Float2 *tmpquda=(Float2 *)device_malloc(V3 * sizeof(Float)); @@ -1106,6 +1106,7 @@ void PLEGMA_Field3D::absorb(const PLEGMA_Field &field, int global_ PLEGMA_memcpy(tmpquda, tmpquda, V3 * sizeof(Float), qudaMemcpyDeviceToDevice); device_free(tmpquda); free(tmphost); + init_absorb_vec3D_vec4D=true; } From 313851edd6b42cc084a5f82849858a43bd9ea53c Mon Sep 17 00:00:00 2001 From: Yan Li Date: Sun, 15 Jan 2023 19:11:14 +0100 Subject: [PATCH 050/168] Add ToolYan, testYan --- include/ToolYan.h | 50 ++++ lib/CMakeLists.txt | 1 + lib/ToolYan.cpp | 218 ++++++++++++++++ plegma/CMakeLists.txt | 59 ++--- plegma/testYan.cpp | 575 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 874 insertions(+), 29 deletions(-) create mode 100644 include/ToolYan.h create mode 100644 lib/ToolYan.cpp create mode 100644 plegma/testYan.cpp diff --git a/include/ToolYan.h b/include/ToolYan.h new file mode 100644 index 00000000..d494254c --- /dev/null +++ b/include/ToolYan.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include + +#include +#include +#include + + +enum FlavorYan {u,d}; + +// S=smear, L=local, B=both; left->in, right->out; Ex: SL => smear -> solve -> local (no smear); +enum SmearFlagYan {SS,SL,LS,LL,single2double,SB,LB}; + +class ToolYan +{ +private: +protected: + std::chrono::_V2::system_clock::time_point tStart; + std::chrono::_V2::system_clock::time_point tLast; + + plegma::PLEGMA_Gauge *gaugeP = NULL, *smearedGaugeP = NULL; + quda::QUDA_solver *solverP = NULL; + bool smearQ = false; // Global smearing flag + int nsmearGauss; + double alphaGauss; + +public: + ToolYan(); + ~ToolYan(); + + void printTime(std::string s = "Regular", bool preciseQ = true); + void testTimeCost(); + + void setupGauge(plegma::PLEGMA_Gauge &gauge) { assert(gaugeP == NULL); gaugeP = &gauge; }; + void setupSmearing(plegma::PLEGMA_Gauge &smearedGauge, int nsmearGauss, double alphaGauss) { assert(smearedGaugeP == NULL); smearedGaugeP = &smearedGauge; this->nsmearGauss=nsmearGauss; this->alphaGauss=alphaGauss; smearQ = true; }; + void setupSolver(quda::QUDA_solver &solver) { assert(solverP == NULL); solverP = &solver; }; + + // 1st: rotateToPhysicalBasis -> scale (for numerical purpose) -> solve + void solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f); + // 2rd: smear -> 1st + void solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s); + // 3nd: smear -> 1st + void solve(plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s); + + // out = outS when s != SB/LB + void setupPointPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s); + void setupSequentialPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s); +}; \ No newline at end of file diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ba3b9da5..e95c9805 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -25,6 +25,7 @@ set (PLEGMA_OBJS PLEGMA_BLAS.cu PLEGMA_Fmunu.cu PLEGMA_U1Gauge.cu + ToolYan.cpp ) if(PLEGMA_UDSC_BARYONS) LIST(APPEND PLEGMA_OBJS diff --git a/lib/ToolYan.cpp b/lib/ToolYan.cpp new file mode 100644 index 00000000..17ff3ca2 --- /dev/null +++ b/lib/ToolYan.cpp @@ -0,0 +1,218 @@ +#include + +ToolYan::ToolYan() +{ + tStart = tLast = std::chrono::high_resolution_clock::now(); + printTime("start"); +} +ToolYan::~ToolYan() +{ + printTime("end"); +} + +void ToolYan::printTime(std::string s, bool preciseQ) +{ + std::chrono::_V2::system_clock::time_point tNow = std::chrono::high_resolution_clock::now(); + std::chrono::duration tTotal = tNow - tStart; + std::chrono::duration tDura = tNow - tLast; + if (preciseQ) + PLEGMA_printf("[ToolYan: %s] Total time: %f; Duration: %f\n", s.c_str(), tTotal.count() / 1000, tDura.count() / 1000); + else + PLEGMA_printf("[ToolYan: %s] Total time: %d; Duration: %d\n", s.c_str(), int(tTotal.count() / 1000), int(tDura.count() / 1000)); + tLast = tNow; +} + +void ToolYan::testTimeCost() +{ + printTime("testTimeCost start"); + for (int i = 0; i <= 3; i++) + { + plegma::PLEGMA_Vector auxVector, auxVector1; + plegma::PLEGMA_Vector3D auxVector3D, auxVector3D1; + struct plegma::site source({0, 0, 0, 0}); + + auxVector.pointSource(source, 0, 0); + auxVector3D.pointSource(source, 0, 0, DEVICE); + + printTime(("test " + std::to_string(i + 1)).c_str()); + + solverP->solve(auxVector, auxVector); + printTime("bare solve"); + + auxVector1.rotateToPhysicalBasis(auxVector, +1); + printTime("rotate to physical basis"); + + if (smearQ) + { + auxVector1.gaussianSmearing(auxVector, *smearedGaugeP, this->nsmearGauss, this->alphaGauss); + printTime("smear"); + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(*smearedGaugeP, 0); + printTime("create gauge3D"); + auxVector3D1.gaussianSmearing(auxVector3D, smearedGauge3D, this->nsmearGauss, this->alphaGauss); + printTime("smear3D"); + } + } + printTime("testTimeCost end"); +} + +void ToolYan::solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f) +{ + FlavorYan f2 = (mu > 0 ? u : d); + double run_mu = (f == f2 ? mu : -mu); + plegma::PLEGMA_Vector auxVector; + + auxVector.rotateToPhysicalBasis(in, run_mu / std::abs(run_mu)); + double norm = auxVector.norm(); + auxVector.scale(1 / norm); + if (f != f2) + { + mu = run_mu; + solverP->UpdateSolver(); + } + solverP->solve(auxVector, auxVector); + auxVector.scale(norm); + out.rotateToPhysicalBasis(auxVector, run_mu / std::abs(run_mu)); +} + +void ToolYan::solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) +{ + assert(s < single2double); + + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve(out, auxVector, f); + return; + } + + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector3D auxVector3D; + + if (s == SL || s == SS) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(*smearedGaugeP, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, this->nsmearGauss, this->alphaGauss); + } + else + auxVector3D.copy(in); + + auxVector.absorb(auxVector3D, inTime); + solve(auxVector, auxVector, f); + + if (s == LS || s == SS) + { + out.gaussianSmearing(auxVector, *smearedGaugeP, this->nsmearGauss, this->alphaGauss); + } + else + out.copy(auxVector); +} + +void ToolYan::solve(plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) +{ + assert(single2double < s); + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve(outL, auxVector, f); + outS.copy(outL); + return; + } + + plegma::PLEGMA_Vector auxVector; + + if (s == SB) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + plegma::PLEGMA_Vector3D auxVector3D; + smearedGauge3D.absorb(*smearedGaugeP, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, this->nsmearGauss, this->alphaGauss); + auxVector.absorb(auxVector3D, inTime); + } + else + auxVector.absorb(in, inTime); + + solve(auxVector, auxVector, f); + + outS.gaussianSmearing(auxVector, *smearedGaugeP, this->nsmearGauss, this->alphaGauss); + outL.copy(auxVector); +} + +void ToolYan::setupPointPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s) +{ + if (s < single2double) + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3D; + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVector, auxVector3D, source[DIM_T], f, s); + auxVectorF.copy(auxVector); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorS, auxVectorL; + plegma::PLEGMA_Vector auxVectorSF, auxVectorLF; + plegma::PLEGMA_Vector3D auxVector3D; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVectorS, auxVectorL, auxVector3D, source[DIM_T], f, s); + auxVectorSF.copy(auxVectorS); + auxVectorLF.copy(auxVectorL); + outS.absorb(auxVectorSF, isc / 3, isc % 3); + outL.absorb(auxVectorLF, isc / 3, isc % 3); + } + } +} + +void ToolYan::setupSequentialPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) +{ + if (s < single2double) + { + plegma::PLEGMA_Vector auxVectorD; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorD, auxVector3DD, inTime, f, s); + auxVectorF.copy(auxVectorD); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; + plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + // auxVector3DF.apply_gamma_scatt(G_5); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); + auxVectorFS.copy(auxVectorDS); + auxVectorFL.copy(auxVectorDL); + outS.absorb(auxVectorFS, isc / 3, isc % 3); + outL.absorb(auxVectorFL, isc / 3, isc % 3); + } + } +} \ No newline at end of file diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index c2a9c252..137dc296 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -46,20 +46,20 @@ target_link_libraries(Calc_2pt ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt_wilson Calc_2pt_wilson.cpp) target_link_libraries(Calc_2pt_wilson ${PLEGMA_LIBS}) -cuda_add_executable(Tetraquark Tetraquark.cpp) -target_link_libraries(Tetraquark ${PLEGMA_LIBS}) +# cuda_add_executable(Tetraquark Tetraquark.cpp) +# target_link_libraries(Tetraquark ${PLEGMA_LIBS}) -cuda_add_executable(TetraquarkBCUD TetraquarkBCUD.cpp) -target_link_libraries(TetraquarkBCUD ${PLEGMA_LIBS}) +# cuda_add_executable(TetraquarkBCUD TetraquarkBCUD.cpp) +# target_link_libraries(TetraquarkBCUD ${PLEGMA_LIBS}) cuda_add_executable(TestFrame EXCLUDE_FROM_ALL TestFrame.cpp) target_link_libraries(TestFrame ${PLEGMA_LIBS}) -cuda_add_executable(StochasticTetraquark StochasticTetraquark.cpp) -target_link_libraries(StochasticTetraquark ${PLEGMA_LIBS}) +# cuda_add_executable(StochasticTetraquark StochasticTetraquark.cpp) +# target_link_libraries(StochasticTetraquark ${PLEGMA_LIBS}) -cuda_add_executable(StochasticTetraquarkBCUD StochasticTetraquarkBCUD.cpp) -target_link_libraries(StochasticTetraquarkBCUD ${PLEGMA_LIBS}) +# cuda_add_executable(StochasticTetraquarkBCUD StochasticTetraquarkBCUD.cpp) +# target_link_libraries(StochasticTetraquarkBCUD ${PLEGMA_LIBS}) cuda_add_executable(ComputeLightStochProp ComputeLightStochProp.cpp) target_link_libraries(ComputeLightStochProp ${PLEGMA_LIBS}) @@ -70,14 +70,14 @@ target_link_libraries(ComputeLightPointProp ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt_charmonium Calc_2pt_charmonium.cpp) target_link_libraries(Calc_2pt_charmonium ${PLEGMA_LIBS}) -cuda_add_executable(PDFs_nucleon PDFs_nucleon.cpp) -target_link_libraries(PDFs_nucleon ${PLEGMA_LIBS}) +# cuda_add_executable(PDFs_nucleon PDFs_nucleon.cpp) +# target_link_libraries(PDFs_nucleon ${PLEGMA_LIBS}) -cuda_add_executable(TMDPDFs_nucleon TMDPDFs_nucleon.cpp) -target_link_libraries(TMDPDFs_nucleon ${PLEGMA_LIBS}) +# cuda_add_executable(TMDPDFs_nucleon TMDPDFs_nucleon.cpp) +# target_link_libraries(TMDPDFs_nucleon ${PLEGMA_LIBS}) -cuda_add_executable(PDFs_qgq_nucleon PDFs_qgq_nucleon.cpp) -target_link_libraries(PDFs_qgq_nucleon ${PLEGMA_LIBS}) +# cuda_add_executable(PDFs_qgq_nucleon PDFs_qgq_nucleon.cpp) +# target_link_libraries(PDFs_qgq_nucleon ${PLEGMA_LIBS}) cuda_add_executable(nucleon_2pt_3pt nucleon_2pt_3pt.cpp) target_link_libraries(nucleon_2pt_3pt ${PLEGMA_LIBS}) @@ -103,9 +103,8 @@ target_link_libraries(Dilution ${PLEGMA_LIBS}) cuda_add_executable(testLinksSmearings EXCLUDE_FROM_ALL testLinksSmearings.cpp) target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) -cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) -target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) - +# cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) +# target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) @@ -128,11 +127,11 @@ target_link_libraries(LowModesCalc ${PLEGMA_LIBS}) cuda_add_executable(MG_tuner MG_tuner.cpp) target_link_libraries(MG_tuner ${PLEGMA_LIBS}) -cuda_add_executable(benchmark benchmark.cpp) -target_link_libraries(benchmark ${PLEGMA_LIBS}) +# cuda_add_executable(benchmark benchmark.cpp) +# target_link_libraries(benchmark ${PLEGMA_LIBS}) -cuda_add_executable(TMDWFs_mesons TMDWFs_mesons.cpp) -target_link_libraries(TMDWFs_mesons ${PLEGMA_LIBS}) +# cuda_add_executable(TMDWFs_mesons TMDWFs_mesons.cpp) +# target_link_libraries(TMDWFs_mesons ${PLEGMA_LIBS}) cuda_add_executable(quark_rms EXCLUDE_FROM_ALL quark_rms.cpp) target_link_libraries(quark_rms ${PLEGMA_LIBS}) @@ -149,17 +148,17 @@ target_link_libraries(Zfac ${PLEGMA_LIBS}) cuda_add_executable(ZfacStaple ZfacStaple.cpp) target_link_libraries(ZfacStaple ${PLEGMA_LIBS}) -cuda_add_executable(SoftFunction SoftFunction.cpp) -target_link_libraries(SoftFunction ${PLEGMA_LIBS}) +# cuda_add_executable(SoftFunction SoftFunction.cpp) +# target_link_libraries(SoftFunction ${PLEGMA_LIBS}) -cuda_add_executable(SoftFunctionWall SoftFunctionWall.cpp) -target_link_libraries(SoftFunctionWall ${PLEGMA_LIBS}) +# cuda_add_executable(SoftFunctionWall SoftFunctionWall.cpp) +# target_link_libraries(SoftFunctionWall ${PLEGMA_LIBS}) -cuda_add_executable(WallSourceNucleon WallSourceNucleon.cpp) -target_link_libraries(WallSourceNucleon ${PLEGMA_LIBS}) +# cuda_add_executable(WallSourceNucleon WallSourceNucleon.cpp) +# target_link_libraries(WallSourceNucleon ${PLEGMA_LIBS}) -cuda_add_executable(TMDPDFs_pion TMDPDFs_pion.cpp) -target_link_libraries(TMDPDFs_pion ${PLEGMA_LIBS}) +# cuda_add_executable(TMDPDFs_pion TMDPDFs_pion.cpp) +# target_link_libraries(TMDPDFs_pion ${PLEGMA_LIBS}) if (PLEGMA_SCATTERING_CONTRACTIONS) cuda_add_executable(testScattReductions EXCLUDE_FROM_ALL testScattReductions.cpp) @@ -176,6 +175,8 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(checking_Doet ${PLEGMA_LIBS}) cuda_add_executable(omegamass EXCLUDE_FROM_ALL omegamass.cpp) target_link_libraries(omegamass ${PLEGMA_LIBS}) + cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) + target_link_libraries(testYan ${PLEGMA_LIBS}) endif(PLEGMA_SCATTERING_CONTRACTIONS) diff --git a/plegma/testYan.cpp b/plegma/testYan.cpp new file mode 100644 index 00000000..4c6f9b64 --- /dev/null +++ b/plegma/testYan.cpp @@ -0,0 +1,575 @@ +#include + +/* + N=Nucleon; p=proton; n=neutron + P=pion; [pp]=pion+; [pm]=pion-; [p0]=pion0; [pu]=pion0u; [pd]=pion0d + J=current; [ju]; [jd] + i=initial; f=finial; c=current + 1=Nucleon; 2=pion +*/ + +extern int device; +static std::vector listOpt = {"verbosity", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", "load-gauge", "nsrc", "src-filename", "momlist-filename", "readStochSamples", "time-dilution", "nstochSamples", "confnumber", "contractionstoch", "contractionstd", "contractionoet"}; + +auto packVector = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) +{ + PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(in, timeSlice, true); + + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + out.absorb(auxVector3D, dt, false); + } +}; +auto packVectorD = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) +{ + PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(in, timeSlice, true); + + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + out.absorb(auxVector3D, dt, false); + } +}; +auto packPropogator = [](plegma::PLEGMA_Propagator &out, plegma::PLEGMA_Propagator &in, int timeSlice) +{ + PLEGMA_Vector auxVector; + for (int isc = 0; isc < 12; isc++) + { + auxVector.absorb(in, isc / 3, isc % 3); + packVector(auxVector, auxVector, timeSlice); + out.absorb(auxVector, isc / 3, isc % 3); + } +}; + +int main(int argc, char **argv) +{ + // ==== initialization + ToolYan tyan; + + initializeOptions(argc, argv, true, listOpt); + initializePLEGMA(); + + plegma::PLEGMA_Gauge gauge, smearedGauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.load(); + gauge.calculatePlaq(); + initGaugeQuda(gauge, true); + plaqQuda(); + + smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + smearedGauge.calculatePlaq(); + + updateOptions(LIGHT); + quda::QUDA_solver solver(mu); + + tyan.setupGauge(gauge); + tyan.setupSmearing(smearedGauge, nsmearGauss, alphaGauss); + tyan.setupSolver(solver); + // tyan.testTimeCost(); + + // initialization ==== + + // ==== general definitions + std::string savingPath = "tempData/"; + + struct plegma::site source({12, 14, 17, 9 + 12 * 3}); + int tSource = source[DIM_T]; + struct plegma::site sourceZero({0, 0, 0, tSource}); + + // old version + plegma::momList momList(3, pathListMomenta, {2}); + auto pi2List = momList.uniq_p(0); + auto pf1List = momList.uniq_p(1); + // pf2 + pf1 = 0 + auto pcList = momList.uniq_p(2); + plegma::momList pcMomList(1, {pcList}, {0}); + plegma::momList pf1MomList(1, {pf1List}, {0}); + + std::vector pi1List = {0, 0, 0}; + + std::vector GID = {ID}; + std::vector GN = {CG_5}; + std::vector Gpi = {G_5}; + std::vector Gc = {ID}; + // std::vector Gc_GAMMAS = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + // std::vector Gc = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; + // std::vector Gc_GAMMAS = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + + int time_fi = 6; + int time_i = source[DIM_T], time_f = (source[DIM_T] + time_fi) % HGC_totalL[3]; + + // general definitions ==== + + tyan.printTime("setupPointPropagator"); + + plegma::PLEGMA_Propagator propUSS, propUSL; + plegma::PLEGMA_Propagator propDSS, propDSL; + + tyan.setupPointPropagator(propUSS, propUSL, source, u, SB); + tyan.setupPointPropagator(propDSS, propDSL, source, d, SB); + + plegma::PLEGMA_Propagator propUSS_pack, propUSL_pack; + plegma::PLEGMA_Propagator propDSS_pack, propDSL_pack; + packPropogator(propUSS_pack, propUSS, time_f); + packPropogator(propUSL_pack, propUSL, time_f); + packPropogator(propDSS_pack, propDSS, time_f); + packPropogator(propDSL_pack, propDSL, time_f); + + propUSS.writeHDF5(savingPath + "propUSS"); + propUSS_pack.writeHDF5(savingPath + "propUSS_pack"); + + // propDSS_pack.writeHDF5(savingPath + "propDSS_pack"); + + // { + // if(mu<0) + // { + // mu=-mu; + // solver.UpdateSolver(); + // } + // plegma::PLEGMA_Vector auxVector, auxVector1; + // plegma::PLEGMA_Vector3D auxVector3D, auxVector3D1; + // plegma::PLEGMA_Gauge3D smearedGauge3D; + // smearedGauge3D.absorb(smearedGauge, 0); + + // auxVector3D.pointSource(source, 0, 0, DEVICE); + // auxVector3D1.gaussianSmearing(auxVector3D, smearedGauge3D, nsmearGauss, alphaGauss); + // auxVector.absorb(auxVector3D1, 0); + // auxVector.writeHDF5(savingPath+"pointSmear"); + + // auxVector1.rotateToPhysicalBasis(auxVector,+1); + // solver.solve(auxVector1,auxVector1); + // auxVector.rotateToPhysicalBasis(auxVector1,+1); + // auxVector1.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + // auxVector1.writeHDF5(savingPath+"aux_propU-SS"); + // } + + // { + // plegma::PLEGMA_Propagator propULS, propULL; + // tyan.setupPointPropagator(propULS, propULL, source, u, LB); + + // plegma::PLEGMA_Vector aux; + // aux.absorb(propUSS, 0, 0); + // aux.writeHDF5(savingPath + "propUSS-00"); + // aux.absorb(propULL, 0, 0); + // aux.writeHDF5(savingPath + "propULL-00"); + // aux.absorb(propUSL, 0, 0); + // aux.writeHDF5(savingPath + "propUSL-00"); + + // // N Diagram + // plegma::PLEGMA_ScattCorrelator T1Contraction(sourceZero, pf1List); + // plegma::PLEGMA_ScattCorrelator T2Contraction(sourceZero, pf1List); + // T1Contraction.T1(GN, GN, propDSS, propUSS, propDSS); + // // T1Contraction.writeHDF5(savingPath + "T1"); + // T2Contraction.T2(GN, GN, propDSS, propUSS, propDSS); + // // T2Contraction.writeHDF5(savingPath + "T2"); + + // plegma::PLEGMA_ScattCorrelator corr_NN(source, pf1MomList); + // corr_NN.initialize_diagram(GID, GID, GN, GN, "N0"); + // corr_NN.N_diagrams(T1Contraction, T2Contraction); + // corr_NN.writeHDF5(savingPath + "NN"); + // } + + tyan.printTime("setupSequentialPropagator"); + + PLEGMA_Propagator seqUSSDSS, seqUSLDSS; + PLEGMA_Propagator seqUSSDSS_pack, seqUSLDSS_pack; + tyan.setupSequentialPropagator(seqUSSDSS, seqUSLDSS, propDSS, time_i, G5, pi2List[0], +1, u, SB); + packPropogator(seqUSSDSS_pack, seqUSSDSS, time_f); + packPropogator(seqUSLDSS_pack, seqUSLDSS, time_f); + + tyan.printTime("stoc"); + + plegma::PLEGMA_Vector stocXi, stocG5Xi; + plegma::PLEGMA_Vector stocXi_pack, stocG5Xi_pack; + + plegma::PLEGMA_Vector stocPhiUTfSL, stocG5PhiUTfSL; + plegma::PLEGMA_Vector stocPhiDTfSL, stocG5PhiDTfSL; + + plegma::PLEGMA_Vector stocPhiUTiSL, stocG5PhiUTiSL; + plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS; + plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS_pack; + { + plegma::PLEGMA_Vector3D auxVector3D; + stocXi.randInit(1234); + stocXi.stochastic_Z(4); + stocG5Xi.copy(stocXi); + stocG5Xi.apply_gamma5(); + // + packVectorD(stocXi_pack, stocXi, time_f); + packVectorD(stocG5Xi_pack, stocG5Xi, time_f); + + stocXi.writeHDF5(savingPath + "stocXi"); + stocXi_pack.writeHDF5(savingPath + "stocXi_pack"); + tyan.printTime(std::to_string(HGC_totalL[3])); + + auxVector3D.absorb(stocXi, time_f); + tyan.solve(stocPhiUTfSL, auxVector3D, time_f, u, SL); + stocG5PhiUTfSL.copy(stocPhiUTfSL); + stocG5PhiUTfSL.apply_gamma5(); + // + auxVector3D.absorb(stocXi, time_f); + tyan.solve(stocPhiDTfSL, auxVector3D, time_f, d, SL); + stocG5PhiDTfSL.copy(stocPhiDTfSL); + stocG5PhiDTfSL.apply_gamma5(); + + auxVector3D.absorb(stocXi, time_i); + auxVector3D.mulMomentumPhases(pi2List[0], -1); + tyan.solve(stocPhiUTiSL, auxVector3D, time_i, u, SL); + stocG5PhiUTiSL.copy(stocPhiUTiSL); + stocG5PhiUTiSL.apply_gamma5(); + // + auxVector3D.absorb(stocXi, time_i); + // apply g5*g5=ID + // auxVector3D.mulMomentumPhases(pi2List[0],+1); + tyan.solve(stocPhiUG5Gi2TiSS, auxVector3D, time_i, u, SS); + packVectorD(stocPhiUG5Gi2TiSS_pack, stocPhiUG5Gi2TiSS, time_f); + } + + tyan.printTime("phiV3"); + + PLEGMA_Propagator phiV31; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, Gc, seqUSLDSS); + // auxV3.writeHDF5(savingPath + "temp1"); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + auxVector1.zero_where(BOTH); + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + // if (isc == 5) + // auxVector3D.writeHDF5(savingPath + "temp2"); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + // float *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + auxVector1.absorb(auxVector3D1, dt, false); + } + // if (isc == 5) + // auxVector1.writeHDF5(savingPath + "temp3"); + phiV31.absorb(auxVector1, isc / 3, isc % 3); + } + phiV31.writeHDF5(savingPath + "temp4"); + } + + PLEGMA_Propagator phiV32; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, Gc, propUSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV32.absorb(auxVector1, isc / 3, isc % 3); + } + } + + PLEGMA_Propagator phiV33; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, Gc, propDSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV33.absorb(auxVector1, isc / 3, isc % 3); + } + } + + PLEGMA_Propagator phiV34; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTiSL); + auxV3.V3(auxVector, Gc, propDSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocPhiUG5Gi2TiSS_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV34.absorb(auxVector1, isc / 3, isc % 3); + } + } + + tyan.printTime("cont"); + + auto outputfile = [&](plegma::PLEGMA_ScattCorrelator sc, std::string filename, bool sgn) + { + // momentum phase for pi1 + float phase = 2 * M_PI / (float)HGC_totalL[0] * pi1List[0] * source[0] + + 2 * M_PI / (float)HGC_totalL[1] * pi1List[1] * source[1] + + 2 * M_PI / (float)HGC_totalL[2] * pi1List[2] * source[2]; + float expPhase[2] = {cos(phase), sin(phase)}; + x_e_cx(sc.H_elem(), expPhase, sc.getTotalSize()); + + // additional sign coming from my Mathematica codes + float overall_sign[2] = {-1., 0.}; + if (sgn) + x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); + + if (time_f < time_i) + x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); + // sc.applyBoundaryConditions(true); + sc.writeHDF5(savingPath + filename); + }; + + float overall_sign[2] = {-1., 0.}; + // x_e_cx( cont.H_elem(), overall_sign, cont.getTotalSize()); + + plegma::PLEGMA_ScattCorrelator cont1(sourceZero, pf1List); + cont1.T1(GN, GN, propUSS_pack, propDSS_pack, phiV31); + outputfile(cont1, "cont1", true); // signs: Gf^t + + plegma::PLEGMA_ScattCorrelator cont2(sourceZero, pf1List); + cont2.T1(GN, GN, propUSS_pack, phiV31, propDSS_pack); + outputfile(cont2, "cont2", false); + + plegma::PLEGMA_ScattCorrelator cont3(sourceZero, pf1List); + cont3.T2(GN, GN, phiV31, propDSS_pack, propUSS_pack); + outputfile(cont3, "cont3", true); // signs: Gf^t + + plegma::PLEGMA_ScattCorrelator cont4(sourceZero, pf1List); + cont4.T1(GN, GN, phiV31, propUSS_pack, propDSS_pack); + outputfile(cont4, "cont4", true); // signs: Gfi1^t + + // + + plegma::PLEGMA_ScattCorrelator cont5(sourceZero, pf1List); + cont5.T2(GN, GN, seqUSSDSS_pack, phiV32, propDSS_pack); + outputfile(cont5, "cont5", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont6(sourceZero, pf1List); + cont6.T1(GN, GN, seqUSSDSS_pack, phiV32, propDSS_pack); + outputfile(cont6, "cont6", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont7(sourceZero, pf1List); + cont7.T1(GN, GN, phiV32, propDSS_pack, seqUSSDSS_pack); + outputfile(cont7, "cont7", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont8(sourceZero, pf1List); + cont8.T1(GN, GN, phiV32, seqUSSDSS_pack, propDSS_pack); + outputfile(cont8, "cont8", false); // signs: + + // + + plegma::PLEGMA_ScattCorrelator cont9(sourceZero, pf1List); + cont9.T1(GN, GN, propUSS_pack, phiV33, seqUSSDSS_pack); + outputfile(cont9, "cont9", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont10(sourceZero, pf1List); + cont10.T1(GN, GN, propUSS_pack, seqUSSDSS_pack, phiV33); + outputfile(cont10, "cont10", false); // signs: + + plegma::PLEGMA_ScattCorrelator cont11(sourceZero, pf1List); + cont11.T2(GN, GN, seqUSSDSS_pack, phiV33, propUSS_pack); + outputfile(cont11, "cont11", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont12(sourceZero, pf1List); + cont12.T1(GN, GN, seqUSSDSS_pack, propUSS_pack, phiV33); + outputfile(cont12, "cont12", true); // signs: Gfi1^t + + // + + plegma::PLEGMA_ScattCorrelator cont13(sourceZero, pf1List); + cont13.T1(GN, GN, propUSS_pack, propDSS_pack, phiV34); + outputfile(cont13, "cont13", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont14(sourceZero, pf1List); + cont14.T1(GN, GN, propUSS_pack, phiV34, propDSS_pack); + outputfile(cont14, "cont14", false); // signs: + + plegma::PLEGMA_ScattCorrelator cont15(sourceZero, pf1List); + cont15.T2(GN, GN, phiV34, propDSS_pack, propUSS_pack); + outputfile(cont15, "cont15", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont16(sourceZero, pf1List); + cont16.T1(GN, GN, phiV34, propUSS_pack, propDSS_pack); + outputfile(cont16, "cont16", true); // signs: Gfi1^t + + // for (int spin = 0; spin < 4; spin++) + // { + + // plegma::PLEGMA_Vector sd_stocXi,sd_aux; + // plegma::PLEGMA_Vector sd_stocPhiUTfSL, sd_stocG5PhiUTfSL; + // plegma::PLEGMA_Vector sd_stocPhiUG5Gi2TfSS; + // plegma::PLEGMA_Vector sd_stocPhiUG5Gi2TfSS_pack; + // { + // plegma::PLEGMA_Vector3D sd_auxVector3D; + // sd_aux.randInit(1234); + // sd_aux.stochastic_Z(4); + // sd_stocXi.diluteSpinDisplace(sd_aux,spin,0); + + // sd_auxVector3D.absorb(sd_stocXi, time_f); + // tyan.solve(sd_stocPhiUTfSL, sd_auxVector3D, time_f, u, SL); + // sd_stocG5PhiUTfSL.copy(sd_stocPhiUTfSL); + // sd_stocG5PhiUTfSL.apply_gamma5(); + + // sd_auxVector3D.absorb(sd_stocXi, time_f); + // // apply g5*g5=ID + // tyan.solve(sd_stocPhiUG5Gi2TfSS, sd_auxVector3D, time_f, u, SS); + // packVectorD(sd_stocPhiUG5Gi2TfSS_pack, sd_stocPhiUG5Gi2TfSS, time_f); + // } + + // PLEGMA_Propagator sd_phiV34; + // { + // plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); + // plegma::PLEGMA_Vector auxVector; + // auxVector.copy(sd_stocG5PhiUTfSL); + // auxV3.V3(auxVector, Gc, propDSL); + + // for (int isc = 0; isc < 12; isc++) + // { + // plegma::PLEGMA_Vector auxVector1; + // plegma::PLEGMA_Vector3D auxVector3DD; + // plegma::PLEGMA_Vector3D auxVector3D; + // auxVector3DD.absorb(sd_stocPhiUG5Gi2TfSS_pack, time_f); + // auxVector3D.copy(auxVector3DD); + // for (int dt = 0; dt < HGC_totalL[3]; dt++) + // { + // { + // plegma::PLEGMA_Vector3D auxVector3D1; + // auxVector3D1.copy(auxVector3D); + // float *aux = auxV3.Corr(dt, 0, 0); + // std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + // auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + // } + // } + // sd_phiV34.absorb(auxVector1, isc / 3, isc % 3); + // } + // } + + // plegma::PLEGMA_ScattCorrelator sd_cont13(sourceZero, pf1List); + // sd_cont13.T1(GN, GN, propUSS_pack, propDSS_pack, sd_phiV34); // signs: Gfi1^t + // x_e_cx(sd_cont13.H_elem(), overall_sign, sd_cont13.getTotalSize()); + // // sd_cont13.apply_phase(); + // sd_cont13.applyBoundaryConditions(true); + // sd_cont13.writeHDF5(savingPath + "cont13_" + std::to_string(spin)); + + // plegma::PLEGMA_ScattCorrelator sd_cont14(sourceZero, pf1List); + // sd_cont14.T1(GN, GN, propUSS_pack, sd_phiV34, propDSS_pack); // signs: + // // sd_cont14.apply_phase(); + // sd_cont14.applyBoundaryConditions(true); + // sd_cont14.writeHDF5(savingPath + "cont14_" + std::to_string(spin)); + + // plegma::PLEGMA_ScattCorrelator sd_cont15(sourceZero, pf1List); + // sd_cont15.T2(GN, GN, sd_phiV34, propDSS_pack, propUSS_pack); // signs: Gfi1^t + // x_e_cx(sd_cont15.H_elem(), overall_sign, sd_cont15.getTotalSize()); + // // sd_cont15.apply_phase(); + // sd_cont15.applyBoundaryConditions(true); + // sd_cont15.writeHDF5(savingPath + "cont15_" + std::to_string(spin)); + + // plegma::PLEGMA_ScattCorrelator sd_cont16(sourceZero, pf1List); + // sd_cont16.T1(GN, GN, sd_phiV34, propUSS_pack, propDSS_pack); // signs: Gfi1^t + // x_e_cx(sd_cont16.H_elem(), overall_sign, sd_cont16.getTotalSize()); + // // sd_cont16.apply_phase(); + // sd_cont16.applyBoundaryConditions(true); + // sd_cont16.writeHDF5(savingPath + "cont16_" + std::to_string(spin)); + // } + + // V reductions version + { // B12 + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_ScattCorrelator auxV4(sourceZero, pf1List); + auxVector.copy(stocG5Xi_pack); + auxVector.writeHDF5(savingPath + "t1"); + propUSS_pack.writeHDF5(savingPath + "t2"); + propUSS.writeHDF5(savingPath + "t3"); + // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); + auxV4.V4(auxVector, GN, propUSS_pack, propDSS_pack); // this and the above line won't produce the same V4, but the same cont3 + auxV4.writeHDF5(savingPath + "auxV4"); + + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, Gc, seqUSLDSS); + // auxVector.writeHDF5(savingPath + "auxVector"); + // seqUSLDSS.writeHDF5(savingPath + "seqUSLDSS"); + auxV3.writeHDF5(savingPath + "auxV3"); + + plegma::PLEGMA_ScattCorrelator cont3V(sourceZero, momList); + cont3V.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); + cont3V.B_diagrams(auxV3, auxV4, 0, 12, true); + cont3V.apply_sign("4pt"); + cont3V.applyBoundaryConditions(true); + cont3V.writeHDF5(savingPath + "cont3V"); + } + + { // Z11 + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, pf1List); + auxVector.copy(stocPhiUG5Gi2TiSS_pack); + auxV24.V2(auxVector, GN, propDSS_pack, propUSS_pack); + auxV24.writeHDF5(savingPath + "Z11auxV24"); + + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); + auxVector.copy(stocG5PhiUTiSL); + auxV3.V3(auxVector, Gc, propDSL); + auxV3.writeHDF5(savingPath + "Z11auxV3"); + + plegma::PLEGMA_ScattCorrelator contZ11(sourceZero, momList); + contZ11.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); + contZ11.Z_diagrams_without_dilution(auxV3, auxV24, 0, 11); + contZ11.apply_sign("4pt"); + contZ11.applyBoundaryConditions(true); + contZ11.writeHDF5(savingPath + "contZ11"); + } + + tyan.printTime("beforeFinalize"); + finalize(); + + return 0; +} From 307e9a58972adba7f72e54cd2f46f36dcd90ba5d Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 19 Jan 2023 09:30:35 +0100 Subject: [PATCH 051/168] recent changes in nucleon 3pt code --- plegma/nucleon_3pt_n_npi.cpp | 752 ++++++++++++++++++++--------------- 1 file changed, 437 insertions(+), 315 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 4b36277a..d10e7fb7 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -1,6 +1,6 @@ #include #include - +#include std::vector runtime; #define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ @@ -35,7 +35,7 @@ void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, int *attract_look_up_table){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table ); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); TIME(source.normalize_nstoch(n_stochastic_samples)); TIME(source.writeHDF5( outputFilename )); @@ -46,11 +46,12 @@ void produceOutput_3pt( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, int n_stochastic_samples, - int source_sink_separation, - int max_source_sink_separation){ + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions_3pt( true, source_sink_separation, max_source_sink_separation )); + TIME(source.applyBoundaryConditions_3pt( true, n_coherent_source, attract_look_up_table, source_sink_separation )); TIME(source.normalize_nstoch(n_stochastic_samples)); TIME(source.writeHDF5( outputFilename )); @@ -82,12 +83,13 @@ void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, void produceOutput_3pt( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, - int source_sink_separation, - int max_source_sink_separation + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation ){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions_3pt( true, source_sink_separation, max_source_sink_separation )); + TIME(source.applyBoundaryConditions_3pt( true,n_coherent_source, attract_look_up_table, source_sink_separation )); TIME(source.writeHDF5( outputFilename )); } @@ -123,7 +125,8 @@ int main(int argc, char **argv) { int n_stochastic_samples; int max_source_sink_separations; - + int dotwopoint; + setVerbosity(QUDA_DEBUG_VERBOSE); HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); HGC_options->set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); @@ -131,6 +134,8 @@ int main(int argc, char **argv) { HGC_options->set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); HGC_options->set("seed2", "Seed for intiialization of stochastic sources", verbosity, rand_seed2); + HGC_options->set("dotwopoint", "Doing also the twopoint functions", verbosity,dotwopoint); + //=========================================================================================================// initializePLEGMA(); @@ -154,6 +159,7 @@ int main(int argc, char **argv) { TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); PLEGMA_printf("Plaquette after smearing:\n"); smearedGauge.calculatePlaq(); + smearedGauge.writeHDF5("smearingGauge"); // Gauge for contractions contractGauge.copy(gauge); @@ -311,7 +317,9 @@ int main(int argc, char **argv) { for (int i=0; i(HOST)); - stochastic_propagator_2pt_SS.push_back(new PLEGMA_Vector(HOST)); + if (dotwopoint==1){ + stochastic_propagator_2pt_SS.push_back(new PLEGMA_Vector(HOST)); + } vectorSource_stochastic.stochastic_Z(nroots); vectorSource_stochastic.unload(); stochastic_sources[i]->copy(vectorSource_stochastic,HOST); @@ -331,50 +339,62 @@ int main(int argc, char **argv) { * ******************************************************/ - for (int i=0; i vectorInOut, vectorAuxD1,vectorAuxD2; - - vectorAuxD1.copy(*stochastic_sources[i], HOST); - vectorAuxD1.load(); - - //Step(3) Smearing all the time slice - TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - - //Step(4) We rotate the source to the physical basis - TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + if (dotwopoint==1){ + for (int i=0; i vectorInOut, vectorAuxD1,vectorAuxD2; + + vectorAuxD1.copy(*stochastic_sources[i], HOST); + vectorAuxD1.load(); + + //Step(3) Smearing all the time slice + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + //In vectorAuxD2 we store the results for the inversion + vectorAuxD2.scale(0.0); + + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(5) pick out a particular timeslice from the source + // + //PLEGMA_Vector3D vec3D; + //vec3D.absorb(vectorAuxD1, timeidx); + //vectorInOut.absorb(vec3D, timeidx); + //vectorInOut.copy(vectorAuxD1); + PLEGMA_printf("Start absorb\n"); + vectorInOut.absorbTimeslice(vectorAuxD1, timeidx); + PLEGMA_printf("Finish absorb\n"); + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + PLEGMA_printf("Finish solve\n"); + //Step(7) absorbing the particular timeslice to a 4d vector + //vec3D.absorb(vectorInOut, timeidx); + //vectorAuxD2.absorb(vec3D, timeidx, false); + vectorAuxD2.absorbTimeslice(vectorInOut, timeidx, false); + } - //In vectorAuxD2 we store the results for the inversion - vectorAuxD2.scale(0.0); + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); - PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); - for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - //Step(5) pick out a particular timeslice from the source - vectorInOut.absorbTimeslice(vectorAuxD1, timeidx); - //Step(6) Solve - TIME(solver.solve(vectorInOut, vectorInOut)); - //Step(7) absorbing the particular timeslice to a 4d vector - vectorAuxD2.absorbTimeslice(vectorInOut, timeidx, false); - } + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - //Step(6) We rotate back the propagator to the physical basis - TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + //Step(8) Save the propagator to the disk + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD2); + vectorAuxF.unload(); + vectorAuxF.writeLIME("globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber); + } - //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + //Step(9) Save the propagator to the host memory + vectorAuxD2.unload(); + stochastic_propagator_2pt_SS[i]->copy(vectorAuxD2,HOST); + vectorAuxD2.load(); - //Step(8) Save the propagator to the disk - { - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorAuxD2); - vectorAuxF.unload(); - vectorAuxF.writeLIME("globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber); } - - //Step(9) Save the propagator to the host memory - vectorAuxD2.unload(); - stochastic_propagator_2pt_SS[i]->copy(vectorAuxD2,HOST); - vectorAuxD2.load(); - } @@ -396,6 +416,7 @@ int main(int argc, char **argv) { PLEGMA_printf("PACKING check TIMESLICE %d\n",timeSlice); PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, timeSlice ); + PLEGMA_printf("absorb Gauge is done\n"); for(int i=0; i< n_stochastic_samples; ++i) { vectorSource_stochastic.copy( *stochastic_sources[i], HOST); vectorSource_stochastic.load(); @@ -403,8 +424,11 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; vectorInOut.copy(vectorSource_stochastic); + PLEGMA_printf("Absorb fermion is started\n"); vector1.absorb(vectorInOut,timeSlice); + PLEGMA_printf("Absorb fermion is finished\n"); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + PLEGMA_printf("absorb fermion start 4D <- 3D\n"); vectorInOut.absorb(vector2,timeSlice); } @@ -426,9 +450,9 @@ int main(int argc, char **argv) { //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); vectorAuxD1.unload(); - PLEGMA_printf("Save the stochastic source for sample %d\n",i); - std::string nstoch=std::to_string(i); - vectorAuxD1.writeHDF5("stochastic_propagators_UP"+nstoch+"_t"+std::to_string(timeSlice)); + //PLEGMA_printf("Save the stochastic source for sample %d\n",i); + //std::string nstoch=std::to_string(i); + //vectorAuxD1.writeHDF5("stochastic_propagators_UP"+nstoch+"_t"+std::to_string(timeSlice)); //writeHDF5(outfilename) stochastic_propags_UP_SL.push_back(new PLEGMA_Vector(HOST)); @@ -468,6 +492,7 @@ int main(int argc, char **argv) { vectorInOut.copy(vectorSource_stochastic); vector1.absorb(vectorInOut,timeSlice); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + PLEGMA_printf("Location 2\n"); vectorInOut.absorb(vector2,timeSlice); } @@ -548,9 +573,12 @@ int main(int argc, char **argv) { //double tmp=vector1.norm(); //PLEGMA_printf("Norm of source location %d is %e\n",source_location[3],tmp); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); - + PLEGMA_printf("Location 4\n"); vectorInOut.absorb(vector2,source_location[DIM_T]); } + //vectorInOut.unload(); + //vectorInOut.writeHDF5("testPointSourceSmeared"); + //vectorInOut.load(); // Inverting PLEGMA_printf("Going to invert %s for component %d\n", fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); @@ -599,6 +627,9 @@ int main(int argc, char **argv) { attract_lookup_table[(sourcePositions[isource][DIM_T]+max_source_sink_separations*i_source_parallel+sink)%HGC_totalL[3]]=(sourcePositions[isource][DIM_T]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; } } + for (int i=0; i propUP_SS; @@ -635,43 +666,46 @@ int main(int argc, char **argv) { TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); - //Computing T reductions+recombination - { - PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); + if (dotwopoint==1){ - } + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); - //Computing T reductions+recombination - { - PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); - } + } - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; - TIME( corrN0.apply_phase()); - TIME( corrN0.apply_sign("N")); - TIME( corrN0.applyBoundaryConditions( true )); - TIME( corrN0.writeHDF5(outfilename)); + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } - TIME( corrNP.apply_phase() ); - TIME( corrNP.apply_sign("N") ); - TIME( corrNP.applyBoundaryConditions( true ) ); - TIME( corrNP.writeHDF5(outfilename) ); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; + TIME( corrN0.apply_phase()); + TIME( corrN0.apply_sign("N")); + TIME( corrN0.applyBoundaryConditions( true )); + TIME( corrN0.writeHDF5(outfilename)); + + TIME( corrNP.apply_phase() ); + TIME( corrNP.apply_sign("N") ); + TIME( corrNP.applyBoundaryConditions( true ) ); + TIME( corrNP.writeHDF5(outfilename) ); + } { PLEGMA_printf("Save propagator for the up and dn quark\n"); @@ -684,6 +718,15 @@ int main(int argc, char **argv) { vectorAuxPrint.unload(); vectorAuxPrint.writeHDF5("propUPSS_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); } + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propUP_SL,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("propUPSL_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); + } + } propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -695,40 +738,47 @@ int main(int argc, char **argv) { } //parallel source position + PLEGMA_ScattCorrelator corrNP_packed(source, list_mpf1_twopt); TIME(corrNP_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); - { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrNP_packed.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); + if (dotwopoint==1){ + + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP_packed.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); - } + } + } PLEGMA_ScattCorrelator corrN0_packed(source, list_mpf1_twopt); TIME(corrN0_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); - { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrN0_packed.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); - } + if (dotwopoint==1){ + + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0_packed.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } -/* + } + /* { PLEGMA_printf("Save propagator for the up and dn quark\n"); PLEGMA_Vector vectorAuxPrint(BOTH); @@ -811,15 +861,16 @@ int main(int argc, char **argv) { for(int i=0; i< n_stochastic_samples; ++i) { - reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + if (dotwopoint==1){ + reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - + reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + } for (int k=0; k< tSinks.size(); ++k){ @@ -841,49 +892,80 @@ int main(int argc, char **argv) { } } + for (int i_sample=0; i_sample stochastic_source; stochastic_source.copy(*stochastic_sources[i_sample],HOST); stochastic_source.load(); + if (i_sample==0){ + stochastic_source.unload(); + stochastic_source.writeHDF5("stochastic_vector_source.h5"); + } for (int k=0; k< tSinks.size();++k){ int tsinkMtsource = tSinks[k]; if(tsinkMtsource >= HGC_totalL[3]) PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + PLEGMA_Propagator propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + + PLEGMA_printf("sasas\n"); + + for (int i_source_parallel=0; i_source_parallel stochastic_source_packed; - for (int i_source_parallel=0; i_source_parallel propUPpacked_to_sink; - PLEGMA_Propagator propDNpacked_to_sink; - for (int i_source_parallel=0; i_source_parallel temp; + temp.absorb(propUP_SS_packed, 0, 0); + temp.unload(); + temp.writeHDF5("up_packed_source"); + temp.load(); + temp.absorb(propUPpacked_to_sink, 0, 0); + temp.unload(); + temp.writeHDF5("up_packed_as_sink"); + temp.load(); + temp.absorb(propDNpacked_to_sink, 0, 0); + temp.unload(); + temp.writeHDF5("dn_packed_as_sink"); + temp.load(); } + TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); - if (k==0){ + if (k==0 && (dotwopoint==1)){ PLEGMA_Vector stoch_piece; stoch_piece.unload(); stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); @@ -1030,6 +1112,7 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + PLEGMA_printf("Location 6\n"); vectortmp1.absorb(vector2, source_local[3]); } @@ -1115,6 +1198,7 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + PLEGMA_printf("Location 999999\n"); vectortmp1.absorb(vector2, source_local[3]); } @@ -1262,12 +1346,12 @@ int main(int argc, char **argv) { } - TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + //TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("redV2_oet")); TIME(reductionsV2_diluted_STOCHD_UP_UP[k]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); TIME(reductionsV4_diluted_STOCHU_DN_UP[k]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); - if (k==0){ + if (k==0 && (dotwopoint==1)){ for (int i_source_parallel=0; i_source_parallel smearedGauge3D; smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vector2.mulMomentumPhases(momentum_i2,1); vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } @@ -1427,24 +1512,27 @@ int main(int argc, char **argv) { corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); - TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, false, true, false )); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); - TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + if (dotwopoint==1){ - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); + TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, false, false, true )); - TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, false, false, false )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, false, false, true)); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_protonpizero4, outfilename, "T", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero4, outfilename, "T", parallel_sources, attract_lookup_table)); + } //creating factors @@ -1481,54 +1569,57 @@ int main(int argc, char **argv) { corrW15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); corrW16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); - for (int i_sample=0; i_sample stochastic_piece; - stochastic_piece.unload(); - stochastic_piece.copy(*stochastic_sources[i_sample], HOST); - stochastic_piece.load(); + PLEGMA_Vector stochastic_piece; + stochastic_piece.unload(); + stochastic_piece.copy(*stochastic_sources[i_sample], HOST); + stochastic_piece.load(); - //V3 - TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed, true)); + //V3 + TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed, true)); - TIME(corrB3_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 3, true)); - TIME(corrB4_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 4, true)); - TIME(corrB5_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 5, true)); - TIME(corrB6_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 6, true)); + TIME(corrB3_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 3, true)); + TIME(corrB4_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 4, true)); + TIME(corrB5_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 5, true)); + TIME(corrB6_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 6, true)); - stochastic_piece.apply_gamma5(); - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false));//checked + stochastic_piece.apply_gamma5(); + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false));//checked - TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); + TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); - TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); + TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false));//checked + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false));//checked - TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); + TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); - TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); + TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); - stochastic_piece.unload(); - stochastic_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); - stochastic_piece.load(); - TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked + stochastic_piece.unload(); + stochastic_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stochastic_piece.load(); + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked - TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); + TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); - TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); + TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked - TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); + TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); - TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); + TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); + } //loop over sample - } + }//loop over doing twopoint for (int k=0; kwriteHDF5("reductionsV2"); + } TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true, false, true)); TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true, false, true)); TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true, false, true)); @@ -1655,23 +1749,23 @@ int main(int argc, char **argv) { }//loop over stochastic samples outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; - TIME(produceOutput_3pt(corrB3, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrB4, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrB5, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrB6, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB3, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrB4, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrB5, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrB6, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; - TIME(produceOutput_3pt(corrW5, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); - TIME(produceOutput_3pt(corrW6, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); - TIME(produceOutput_3pt(corrW7, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); - TIME(produceOutput_3pt(corrW8, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW5, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); + TIME(produceOutput_3pt(corrW6, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); + TIME(produceOutput_3pt(corrW7, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); + TIME(produceOutput_3pt(corrW8, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); - TIME(produceOutput_3pt(corrW13, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); - TIME(produceOutput_3pt(corrW14, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); - TIME(produceOutput_3pt(corrW15, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); - TIME(produceOutput_3pt(corrW16, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations)); + TIME(produceOutput_3pt(corrW13, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); + TIME(produceOutput_3pt(corrW14, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); + TIME(produceOutput_3pt(corrW15, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); + TIME(produceOutput_3pt(corrW16, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k])); - if (k==0){ + if (k==0 && (dotwopoint==1)){ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; TIME(produceOutput_2pt_packed(corrB3_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrB4_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); @@ -1726,8 +1820,9 @@ int main(int argc, char **argv) { vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vector2.mulMomentumPhases(momentum_i2,1); vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } @@ -1763,38 +1858,39 @@ int main(int argc, char **argv) { } + if (dotwopoint==1){ + PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus2(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus3(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus4(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_neutronpiplus2(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_neutronpiplus3(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_neutronpiplus4(source, list_mpi2ptot); + corrTproton_neutronpiplus1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); - corrTproton_neutronpiplus1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); + corrTproton_neutronpiplus2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq12"); - corrTproton_neutronpiplus2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq12"); + corrTproton_neutronpiplus3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq13"); - corrTproton_neutronpiplus3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq13"); + corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); - corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); + TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, false, true, false )); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); - TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, false, false, true )); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); - TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT1, false, false, false )); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); - TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true )); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true )); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - - TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4, outfilename, "T", parallel_sources, attract_lookup_table)); + } PLEGMA_ScattCorrelator corrB9_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrB10_2pt(source, filtered_sourcemomentumList_2pt); @@ -1904,7 +2000,7 @@ int main(int argc, char **argv) { for (int i_sample=0; i_sample stochastic_propagator_packed; - if (k==0){ + if (k==0 && (dotwopoint==1)){ stochastic_propagator_packed.unload(); stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); stochastic_propagator_packed.load(); @@ -2009,23 +2105,23 @@ int main(int argc, char **argv) { } //loop over stochastic samples outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; - TIME(produceOutput_3pt(corrB9, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrB10, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrB11, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrB12, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB9, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrB10, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrB11, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrB12, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; - TIME(produceOutput_3pt(corrW17, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrW18, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrW19, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrW20, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW17, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrW18, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrW19, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrW20, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); - TIME(produceOutput_3pt(corrW21, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrW22, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrW23, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrW24, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW21, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrW22, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrW23, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrW24, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); - if (k==0){ + if (k==0 && (dotwopoint==1)){ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; TIME(produceOutput_2pt_packed(corrB9_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); @@ -2076,8 +2172,9 @@ int main(int argc, char **argv) { vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vector2.mulMomentumPhases(momentum_i2,1); vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); } @@ -2109,23 +2206,26 @@ int main(int argc, char **argv) { } - PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); + if (dotwopoint==1){ + + PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); - corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); + corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); - corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); + corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); - TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, false )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, false )); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); - TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - TIME(produceOutput_2pt_packed(corrTproton_protonpizero5, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_protonpizero6, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero5, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero6, outfilename, "T", parallel_sources, attract_lookup_table)); + } PLEGMA_ScattCorrelator corrB7_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrB8_2pt(source, filtered_sourcemomentumList_2pt); @@ -2198,7 +2298,7 @@ int main(int argc, char **argv) { for (int i_sample=0; i_sample stochastic_propagator_packed; - if (k==0){ + if (k==0 && (dotwopoint==1)){ stochastic_propagator_packed.unload(); stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); stochastic_propagator_packed.load(); @@ -2260,16 +2360,16 @@ int main(int argc, char **argv) { } //loop over stochastic samples outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B"; - TIME(produceOutput_3pt(corrB7, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrB8, outfilename, "4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrB7, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrB8, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W"; - TIME(produceOutput_3pt(corrW9 , outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations ));//because of V4 - TIME(produceOutput_3pt(corrW10, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations ));//because of V4 - TIME(produceOutput_3pt(corrW11, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrW12, outfilename,"4pt", n_stochastic_samples, tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrW9 , outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] ));//because of V4 + TIME(produceOutput_3pt(corrW10, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] ));//because of V4 + TIME(produceOutput_3pt(corrW11, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrW12, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table, tSinks[k] )); - if (k==0){ + if (k==0 && (dotwopoint==1)){ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; TIME(produceOutput_2pt_packed(corrB7_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrB8_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); @@ -2324,8 +2424,9 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + //PLEGMA_printf("Location 15\n"); vectortmp1.absorb(vector2, source_local[3],true); - PLEGMA_printf("Source local %d\n",source_local[3]); + //PLEGMA_printf("Source local %d\n",source_local[3]); //vectortmp1.unload(); //vectortmp1.writeHDF5("source_for_up_fini_mom_oet_t"+std::to_string(source_local[3])); //vectortmp1.load(); @@ -2407,6 +2508,7 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + PLEGMA_printf("Location 10\n"); vectortmp1.absorb(vector2, source_local[3]); } @@ -2467,11 +2569,16 @@ int main(int argc, char **argv) { st_oet_d_fini.apply_gamma5(); TIME(reductionsV3_diluted_D_UP.V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); + //reductionsV3_diluted_D_UP.writeHDF5("reductionV3_oet"); - st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS); - st_oet_d_fini.apply_gamma5(); + if (dotwopoint==1){ - TIME(reductionsV3_diluted_D_UP_2pt.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed, true)); + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS); + st_oet_d_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_D_UP_2pt.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed, true)); + + } } @@ -2487,7 +2594,7 @@ int main(int argc, char **argv) { TIME(reductionsV3_diluted_U_DN.V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); } - { + if (dotwopoint==1){ PLEGMA_Vector st_oet_u_fini; st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS); //st_oet_u_fini.load(); @@ -2532,63 +2639,65 @@ int main(int argc, char **argv) { corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); + if (dotwopoint==1){ + TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); + TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); - TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); - TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); + TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); + TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); - TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); - TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); + TIME( corrZ9_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 9, false )); + TIME(corrZ10_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 10,false )); - TIME( corrZ9_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 9, false )); - TIME(corrZ10_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 10,false )); + TIME(corrZ11_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 11, false )); + TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); - TIME(corrZ11_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 11, false )); - TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); + TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); + TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); - TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); - TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); + TIME(corrPPUP.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); + TIME(corrPPDN.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); + TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); - TIME(corrPPUP.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); - TIME(corrPPDN.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); - TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); - TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); + TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); + TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); + TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); - TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); - TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; + TIME(produceOutput_2pt_packed(corrZ5_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ6_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ8_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ5_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ6_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ8_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ9_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ10_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ9_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ10_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ11_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ12_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ11_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ12_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_2pt"; + TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_2pt"; - TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt")); - TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt")); - TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt")); - TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt")); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; + TIME( corrN0_packed.apply_phase()); + TIME( corrN0_packed.apply_sign("N")); + TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrN0_packed.writeHDF5(outfilename)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; - TIME( corrN0_packed.apply_phase()); - TIME( corrN0_packed.apply_sign("N")); - TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); - TIME( corrN0_packed.writeHDF5(outfilename)); + TIME( corrNP_packed.apply_phase() ); + TIME( corrNP_packed.apply_sign("N") ); + TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrNP_packed.writeHDF5(outfilename) ); - TIME( corrNP_packed.apply_phase() ); - TIME( corrNP_packed.apply_sign("N") ); - TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); - TIME( corrNP_packed.writeHDF5(outfilename) ); + } @@ -2636,6 +2745,9 @@ int main(int argc, char **argv) { free(ssource); TIME(corrZ5.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 5, false, true )); + reductionsV3_diluted_D_UP.writeHDF5("corrZ5_V3"); + reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("corrZ5_V2"); + corrZ5.writeHDF5("corrZ5"); TIME(corrZ7.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 7, false, true )); TIME(corrZ6.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 6, false, true )); @@ -2655,33 +2767,37 @@ int main(int argc, char **argv) { outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z"; - TIME(produceOutput_3pt(corrZ5, outfilename, "4pt", tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrZ6, outfilename, "4pt", tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrZ7, outfilename, "4pt", tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrZ8, outfilename, "4pt", tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrZ5, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ6, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ7, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ8, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); - TIME(produceOutput_3pt(corrZ9, outfilename, "4pt", tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrZ10, outfilename,"4pt", tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrZ9, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ10, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); - TIME(produceOutput_3pt(corrZ11, outfilename,"4pt", tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrZ12, outfilename,"4pt", tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrZ13, outfilename,"4pt", tSinks[k], max_source_sink_separations )); - TIME(produceOutput_3pt(corrZ14, outfilename,"4pt", tSinks[k], max_source_sink_separations )); + TIME(produceOutput_3pt(corrZ11, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ12, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ13, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ14, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); }//end for loop source sink separations }//loop over mpi2 - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; - TIME(corrP0UP.apply_sign("P")); - TIME(corrP0UP.writeHDF5( outfilename )); - TIME(corrP0DN.apply_sign("P")); - TIME(corrP0DN.writeHDF5( outfilename )); - TIME(corrPPUP.apply_sign("P")); - TIME(corrPPUP.writeHDF5( outfilename )); - TIME(corrPPDN.apply_sign("P")); - TIME(corrPPDN.writeHDF5( outfilename )); + if (dotwopoint==1){ + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; + TIME(corrP0UP.apply_sign("P")); + TIME(corrP0UP.writeHDF5( outfilename )); + TIME(corrP0DN.apply_sign("P")); + TIME(corrP0DN.writeHDF5( outfilename )); + TIME(corrPPUP.apply_sign("P")); + TIME(corrPPUP.writeHDF5( outfilename )); + TIME(corrPPDN.apply_sign("P")); + TIME(corrPPDN.writeHDF5( outfilename )); + + } //for (int spinindex=0;spinindex<4;++spinindex){ @@ -2697,13 +2813,15 @@ int main(int argc, char **argv) { for(int i_samples=0; i_samples< n_stochastic_samples; ++i_samples) { - reductions_UU_V2_GAMMAF1D_U_2pt.pop_back(); - reductions_UU_V4_GAMMAF1U_D_2pt.pop_back(); + if (dotwopoint==1){ + reductions_UU_V2_GAMMAF1D_U_2pt.pop_back(); + reductions_UU_V4_GAMMAF1U_D_2pt.pop_back(); - reductions_UU_V3_GAMMAF2U_2pt.pop_back(); - reductions_DD_V3_GAMMAF2D_2pt.pop_back(); + reductions_UU_V3_GAMMAF2U_2pt.pop_back(); + reductions_DD_V3_GAMMAF2D_2pt.pop_back(); - reductions_DD_V2_GAMMAF1U_U_2pt.pop_back(); + reductions_DD_V2_GAMMAF1U_U_2pt.pop_back(); + } for (int k=0; k Date: Thu, 19 Jan 2023 16:21:44 +0100 Subject: [PATCH 052/168] removing verbose and unnecessary lines --- plegma/nucleon_3pt_n_npi.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index d10e7fb7..eb8eb3df 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -126,7 +126,7 @@ int main(int argc, char **argv) { int n_stochastic_samples; int max_source_sink_separations; int dotwopoint; - setVerbosity(QUDA_DEBUG_VERBOSE); + //setVerbosity(QUDA_DEBUG_VERBOSE); HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); HGC_options->set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); @@ -1405,8 +1405,6 @@ int main(int argc, char **argv) { momList filtered_sourcemomentumList_2pt = sourcemomentumList_twopt.extract(momentum_i2, 0); - int Nlist=filtered_sourcemomentumList.N_list(); - PLEGMA_ScattCorrelator reductionsV2(source_reduction, list_mpf1_threept); PLEGMA_ScattCorrelator reductionsV2_2pt(source_reduction, list_mpf1_twopt); From 67f1619dbc1fb2bfeb70e1bf768b576c25a00dba Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 19 Jan 2023 16:23:14 +0100 Subject: [PATCH 053/168] correcting default sign of P for the V4,V2 reduction --- include/PLEGMA_ScattCorrelator.h | 4 ++-- lib/PLEGMA_ScattCorrelator.cu | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index f85b27d4..6c7fd7d8 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -101,7 +101,7 @@ namespace plegma { * in most cases we do set this to false * **/ - void V2( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2,bool conj_v=false ); + void V2( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2,bool conj_v=true ); /** * * @brief performs V3 type reduction produces one spin and one color indices tensor from a fermion vector and a fermion propagator @@ -138,7 +138,7 @@ namespace plegma { * * **/ - void V4( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2, bool conj_v=false ); + void V4( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2, bool conj_v=true ); /** * * @brief performs V5 type reduction produces two spin and one color indices tensor from two fermion vectors diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index b5169d6a..b3960a7f 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -225,7 +225,7 @@ void PLEGMA_ScattCorrelator::V6_RED( PLEGMA_Vector &Phi1, PLEGMA_V } template -void PLEGMA_ScattCorrelator::V4( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2, bool conj_v) { +void PLEGMA_ScattCorrelator::V4( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2, bool conj_P) { int n_gammas= Gammas.size(); this->GList.clear(); @@ -244,14 +244,14 @@ void PLEGMA_ScattCorrelator::V4( PLEGMA_Vector &Phi, std::vectorsource[i]==0); - if(conj_v) + if(conj_P) V_reductions( V_4, *this, Phi, Gammas, S1, S2); else V_reductions( V_4, *this, Phi, Gammas, S1, S2); } template -void PLEGMA_ScattCorrelator::V2( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2, bool conj_v) { +void PLEGMA_ScattCorrelator::V2( PLEGMA_Vector &Phi, std::vector &Gammas, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2, bool conj_P) { int n_gammas= Gammas.size(); this->GList.clear(); @@ -270,7 +270,7 @@ void PLEGMA_ScattCorrelator::V2( PLEGMA_Vector &Phi, std::vectorsource[i]==0); - if(conj_v) + if(conj_P) V_reductions(V_2, *this, Phi, Gammas, S1, S2); else V_reductions(V_2, *this, Phi, Gammas, S1, S2); @@ -3492,7 +3492,9 @@ void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiod int t_local = (t>=maxT) ? (this->source[DIM_T]%HGC_localL[DIM_T]) + t - maxT : t; int t_global = HGC_procPosition[DIM_T] * HGC_localL[DIM_T] + t_local; int source_num= n_coherent_source > 1 ? attract_look_up_table[t_global] : this->source[DIM_T]; + PLEGMA_printf("t_global %d source num %d \n",t_global, source_num); if( source_num + source_sink_separation > HGC_totalL[3] ){ + PLEGMA_printf("we apply sign t_global %d\n",t_global); for( int o_dofs=0; o_dofsH_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs) = -*(this->H_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs); @@ -3514,6 +3516,7 @@ void PLEGMA_ScattCorrelator::apply_phase(){ #pragma omp parallel for for( int i_m=0; i_msource[0]+ 2*M_PI/(Float)HGC_totalL[1]* mom_list[i_m][1]*this->source[1]+ 2*M_PI/(Float)HGC_totalL[2]* mom_list[i_m][2]*this->source[2]; From 3277bb7d03f7c9465370c30408e5f9e5b4dd4969 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 10 Feb 2023 18:35:02 +0100 Subject: [PATCH 054/168] removing debug printf --- lib/PLEGMA_ScattCorrelator.cu | 12 +- lib/PLEGMA_Vector.cu | 3 +- plegma/nucleon_3pt_n_npi.cpp | 439 ++++++++++++---------------------- 3 files changed, 164 insertions(+), 290 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index b3960a7f..f5692003 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -518,7 +518,7 @@ void PLEGMA_ScattCorrelator::V3V2reduction( PLEGMA_ScattCorrelator } else { n_gammas_i2_f2=n_gammas_f2; } - PLEGMA_printf("n_gammas_i2_f2 %d\n",n_gammas_i2_f2); + //PLEGMA_printf("n_gammas_i2_f2 %d\n",n_gammas_i2_f2); for (int g3=0 ; g3 < n_gammas_i2_f2 ; ++g3 ){//pf2 for (int alfa=0; alfa < N_SPINS; ++alfa ){ for (int beta=0; beta < N_SPINS; ++beta ){ @@ -2611,13 +2611,13 @@ void PLEGMA_ScattCorrelator::M_diagrams( PLEGMA_ScattCorrelator &C auto map_minus = this->pList().index_map_minus(); //++++++++ PION-PION +++++++++ - +/* double normcheck; normcheck=Phi_0.norm(); PLEGMA_printf("Phi0 norm %e\n", normcheck); normcheck=Phi_1.norm(); PLEGMA_printf("Phi1 norm %e\n", normcheck); - +*/ //aux PLEGMA_SC for PhixGxPhi multiplications momList auxmlist(1, {moms_pf2,}, {0,}); PLEGMA_ScattCorrelator pipi_aux(this->getSource(), auxmlist); @@ -3492,9 +3492,9 @@ void PLEGMA_ScattCorrelator::applyBoundaryConditions_3pt( bool antiperiod int t_local = (t>=maxT) ? (this->source[DIM_T]%HGC_localL[DIM_T]) + t - maxT : t; int t_global = HGC_procPosition[DIM_T] * HGC_localL[DIM_T] + t_local; int source_num= n_coherent_source > 1 ? attract_look_up_table[t_global] : this->source[DIM_T]; - PLEGMA_printf("t_global %d source num %d \n",t_global, source_num); + //PLEGMA_printf("t_global %d source num %d \n",t_global, source_num); if( source_num + source_sink_separation > HGC_totalL[3] ){ - PLEGMA_printf("we apply sign t_global %d\n",t_global); + //PLEGMA_printf("we apply sign t_global %d\n",t_global); for( int o_dofs=0; o_dofsH_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs) = -*(this->H_elem() + o_dofs*TIME*in_dofs + t*in_dofs + i_dofs); @@ -3516,7 +3516,7 @@ void PLEGMA_ScattCorrelator::apply_phase(){ #pragma omp parallel for for( int i_m=0; i_msource[0]+ 2*M_PI/(Float)HGC_totalL[1]* mom_list[i_m][1]*this->source[1]+ 2*M_PI/(Float)HGC_totalL[2]* mom_list[i_m][2]*this->source[2]; diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index aca2d39e..548ebde7 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -28,7 +29,7 @@ template void PLEGMA_Vector::gaussianSmearing(PLEGMA_Vector &vecIn, PLEGMA_Gauge &gauge, int nsmearGauss, Float alphaGauss){ - + if(vecIn.IsAllocHost()) { vecIn.unload(); // backing up the vecIn } else { diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index eb8eb3df..97daea5d 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -126,6 +126,7 @@ int main(int argc, char **argv) { int n_stochastic_samples; int max_source_sink_separations; int dotwopoint; + int readStochSamples; //setVerbosity(QUDA_DEBUG_VERBOSE); HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); @@ -135,6 +136,8 @@ int main(int argc, char **argv) { HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); HGC_options->set("seed2", "Seed for intiialization of stochastic sources", verbosity, rand_seed2); HGC_options->set("dotwopoint", "Doing also the twopoint functions", verbosity,dotwopoint); + HGC_options->set("readStochSamples", "Flag for switching read/building stochastic propagators", verbosity, readStochSamples); + //=========================================================================================================// @@ -159,7 +162,6 @@ int main(int argc, char **argv) { TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); PLEGMA_printf("Plaquette after smearing:\n"); smearedGauge.calculatePlaq(); - smearedGauge.writeHDF5("smearingGauge"); // Gauge for contractions contractGauge.copy(gauge); @@ -320,17 +322,28 @@ int main(int argc, char **argv) { if (dotwopoint==1){ stochastic_propagator_2pt_SS.push_back(new PLEGMA_Vector(HOST)); } - vectorSource_stochastic.stochastic_Z(nroots); - vectorSource_stochastic.unload(); - stochastic_sources[i]->copy(vectorSource_stochastic,HOST); - - PLEGMA_printf("Save the stochastic source for sample %d\n",i); - std::string nstoch=std::to_string(i); - vectorSource_stochastic.writeHDF5("stochastic_source"+nstoch); - - vectorSource_stochastic.load(); - - + if (readStochSamples==0){ + vectorSource_stochastic.stochastic_Z(nroots); + vectorSource_stochastic.unload(); + stochastic_sources[i]->copy(vectorSource_stochastic,HOST); + vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); + //PLEGMA_printf("Save the stochastic source for sample %d\n",i); + //std::string nstoch=std::to_string(i); + //vectorSource_stochastic.writeHDF5("stochastic_source"+nstoch); + vectorSource_stochastic.load(); + } + else{ + std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read stochastic source from: %s\n",inputfilename.c_str()); + PLEGMA_Vector vectorRead(BOTH); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_sources[i]->copy(vectorRead,HOST); + inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_Vector vectorFloat(BOTH); + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorFloat.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_2pt_SS[i]->copy(vectorFloat,HOST); + } } /****************************************************** @@ -339,7 +352,7 @@ int main(int argc, char **argv) { * ******************************************************/ - if (dotwopoint==1){ + if ((dotwopoint==1) && (readStochSamples==0)){ for (int i=0; i vectorInOut, vectorAuxD1,vectorAuxD2; @@ -363,12 +376,9 @@ int main(int argc, char **argv) { //vec3D.absorb(vectorAuxD1, timeidx); //vectorInOut.absorb(vec3D, timeidx); //vectorInOut.copy(vectorAuxD1); - PLEGMA_printf("Start absorb\n"); vectorInOut.absorbTimeslice(vectorAuxD1, timeidx); - PLEGMA_printf("Finish absorb\n"); //Step(6) Solve TIME(solver.solve(vectorInOut, vectorInOut)); - PLEGMA_printf("Finish solve\n"); //Step(7) absorbing the particular timeslice to a 4d vector //vec3D.absorb(vectorInOut, timeidx); //vectorAuxD2.absorb(vec3D, timeidx, false); @@ -413,10 +423,8 @@ int main(int argc, char **argv) { for (int l=0; l smearedGauge3D; smearedGauge3D.absorb(smearedGauge, timeSlice ); - PLEGMA_printf("absorb Gauge is done\n"); for(int i=0; i< n_stochastic_samples; ++i) { vectorSource_stochastic.copy( *stochastic_sources[i], HOST); vectorSource_stochastic.load(); @@ -424,11 +432,8 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; vectorInOut.copy(vectorSource_stochastic); - PLEGMA_printf("Absorb fermion is started\n"); vector1.absorb(vectorInOut,timeSlice); - PLEGMA_printf("Absorb fermion is finished\n"); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - PLEGMA_printf("absorb fermion start 4D <- 3D\n"); vectorInOut.absorb(vector2,timeSlice); } @@ -492,7 +497,6 @@ int main(int argc, char **argv) { vectorInOut.copy(vectorSource_stochastic); vector1.absorb(vectorInOut,timeSlice); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - PLEGMA_printf("Location 2\n"); vectorInOut.absorb(vector2,timeSlice); } @@ -573,7 +577,6 @@ int main(int argc, char **argv) { //double tmp=vector1.norm(); //PLEGMA_printf("Norm of source location %d is %e\n",source_location[3],tmp); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); - PLEGMA_printf("Location 4\n"); vectorInOut.absorb(vector2,source_location[DIM_T]); } //vectorInOut.unload(); @@ -627,9 +630,6 @@ int main(int argc, char **argv) { attract_lookup_table[(sourcePositions[isource][DIM_T]+max_source_sink_separations*i_source_parallel+sink)%HGC_totalL[3]]=(sourcePositions[isource][DIM_T]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; } } - for (int i=0; i propUP_SS; @@ -658,8 +658,8 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrNP(source_local, list_mpf1_twopt); TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); - PLEGMA_ScattCorrelator corrN0(source_local, list_mpf1_twopt); - TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); +// PLEGMA_ScattCorrelator corrN0(source_local, list_mpf1_twopt); +// TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); // If twop_filename exists we hold the computation of the light props @@ -683,6 +683,7 @@ int main(int argc, char **argv) { } //Computing T reductions+recombination + /* { PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); @@ -693,13 +694,13 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); - } + }*/ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; - TIME( corrN0.apply_phase()); + /*TIME( corrN0.apply_phase()); TIME( corrN0.apply_sign("N")); TIME( corrN0.applyBoundaryConditions( true )); - TIME( corrN0.writeHDF5(outfilename)); + TIME( corrN0.writeHDF5(outfilename));*/ TIME( corrNP.apply_phase() ); TIME( corrNP.apply_sign("N") ); @@ -707,7 +708,7 @@ int main(int argc, char **argv) { TIME( corrNP.writeHDF5(outfilename) ); } - { + /*{ PLEGMA_printf("Save propagator for the up and dn quark\n"); PLEGMA_Vector vectorAuxPrint(BOTH); for(int isc = 0 ; isc < 12 ; isc++){ @@ -727,7 +728,7 @@ int main(int argc, char **argv) { vectorAuxPrint.writeHDF5("propUPSL_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); } - } + }*/ propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -840,13 +841,12 @@ int main(int argc, char **argv) { //phi goes to V2 reduction and xi goes to V3 reduction std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented - std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented - std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_UU_V3_GAMMAF2U;//implemented - std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented //Here the prefix DD means that reduction is based phi*g5 and xi*g5 @@ -854,22 +854,17 @@ int main(int argc, char **argv) { //phi goes to V3 reduction and xi goes to V2 reduction std::vector*> reductions_DD_V3_GAMMAF2D;//implemented - std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented + std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented - std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt;//implemented for(int i=0; i< n_stochastic_samples; ++i) { if (dotwopoint==1){ - reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - - reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - + reductions_DD_V2_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); } @@ -898,10 +893,10 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_source; stochastic_source.copy(*stochastic_sources[i_sample],HOST); stochastic_source.load(); - if (i_sample==0){ + /*if (i_sample==0){ stochastic_source.unload(); stochastic_source.writeHDF5("stochastic_vector_source.h5"); - } + }*/ for (int k=0; k< tSinks.size();++k){ @@ -912,8 +907,6 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUPpacked_to_sink; PLEGMA_Propagator propDNpacked_to_sink; - PLEGMA_printf("sasas\n"); - for (int i_source_parallel=0; i_source_parallel stochastic_source_packed; for (int i_source_parallel=0; i_source_parallel temp; - temp.absorb(propUP_SS_packed, 0, 0); - temp.unload(); - temp.writeHDF5("up_packed_source"); - temp.load(); - temp.absorb(propUPpacked_to_sink, 0, 0); - temp.unload(); - temp.writeHDF5("up_packed_as_sink"); - temp.load(); - temp.absorb(propDNpacked_to_sink, 0, 0); - temp.unload(); - temp.writeHDF5("dn_packed_as_sink"); - temp.load(); - } - - TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); if (k==0 && (dotwopoint==1)){ PLEGMA_Vector stoch_piece; stoch_piece.unload(); - stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stoch_piece.copy(*stochastic_sources[i_sample],HOST); stoch_piece.load(); - TIME(reductions_UU_V2_GAMMAF1D_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, false)); - - TIME(reductions_UU_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, false)); - - stoch_piece.apply_gamma5(); - TIME(reductions_DD_V3_GAMMAF2D_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); - - stoch_piece.unload(); - stoch_piece.copy(*stochastic_sources[i_sample], HOST); - stoch_piece.load(); + TIME(reductions_DD_V2_GAMMAF1U_D_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); - TIME(reductions_UU_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + TIME(reductions_DD_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); - stoch_piece.apply_gamma5(); - TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, false)); + stoch_piece.unload(); + stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); + stoch_piece.load(); + stoch_piece.apply_gamma5(); + stoch_piece.apply_gamma5(); + TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); } //B4,B6 //B10,B12 - TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, false)); + TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, true)); //W5,W6,W7,W8 //W9,W10,W11,W12,W17,W18,W19,W20 @@ -1062,13 +1027,13 @@ int main(int argc, char **argv) { //B7,B8 //B1,B2 - TIME(reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, true)); } //end of for source sink separations } //end of for stochastic samples vectorStoc_source_oet.stochastic_Z(nroots); - PLEGMA_printf("DONE stochastic factors\n"); + //PLEGMA_printf("DONE stochastic factors\n"); #if 1 @@ -1112,7 +1077,6 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - PLEGMA_printf("Location 6\n"); vectortmp1.absorb(vector2, source_local[3]); } @@ -1165,7 +1129,7 @@ int main(int argc, char **argv) { //stochastic_oet_prop_u_zero_mom_SS.load(); - PLEGMA_printf("DONE OET zero mom up\n"); + //PLEGMA_printf("DONE OET zero mom up\n"); //Doing for -mu for the DN propagator spin dilution oet if(mu>0) { @@ -1198,7 +1162,6 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - PLEGMA_printf("Location 999999\n"); vectortmp1.absorb(vector2, source_local[3]); } @@ -1247,7 +1210,7 @@ int main(int argc, char **argv) { //stochastic_oet_prop_d_zero_mom_SS.load(); - PLEGMA_printf("DONE OET zero mom dn\n"); + //PLEGMA_printf("DONE OET zero mom dn\n"); #endif /****************************************************** @@ -1346,10 +1309,10 @@ int main(int argc, char **argv) { } - TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); //TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("redV2_oet")); - TIME(reductionsV2_diluted_STOCHD_UP_UP[k]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, false)); - TIME(reductionsV4_diluted_STOCHU_DN_UP[k]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2_diluted_STOCHD_UP_UP[k]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, true)); + TIME(reductionsV4_diluted_STOCHU_DN_UP[k]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); if (k==0 && (dotwopoint==1)){ @@ -1365,9 +1328,9 @@ int main(int argc, char **argv) { st_oet_d_zeropacked_to_sink.pack_propagator_from_source_to_sink(stochastic_oet_prop_d_zero_mom_SS, sink_local[3], max_source_sink_separations, i_source_parallel==0 ? true : false); } - TIME(reductionsV2_diluted_STOCHU_DN_UP_2pt.V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, false)); - TIME(reductionsV2_diluted_STOCHD_UP_UP_2pt.V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, false)); - TIME(reductionsV4_diluted_STOCHU_DN_UP_2pt.V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, false)); + TIME(reductionsV2_diluted_STOCHU_DN_UP_2pt.V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); + TIME(reductionsV2_diluted_STOCHD_UP_UP_2pt.V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); + TIME(reductionsV4_diluted_STOCHU_DN_UP_2pt.V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); } @@ -1413,7 +1376,7 @@ int main(int argc, char **argv) { std::vector> mpi2_filt ; mpi2_filt.assign(mptot_filt.size(),momentum_i2); - PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); + //PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); PLEGMA_ScattCorrelator corrM( source, filtered_sourcemomentumList_2pt); @@ -1432,7 +1395,7 @@ int main(int argc, char **argv) { PLEGMA_Propagator propTS_SS_packed; PLEGMA_Propagator propTS_SL_packed; - +#if 0 for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS_SS; @@ -1585,14 +1548,14 @@ int main(int argc, char **argv) { TIME(corrB6_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 6, true)); stochastic_piece.apply_gamma5(); - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false));//checked + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true));//checked TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false));//checked + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true));//checked TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); @@ -1603,13 +1566,13 @@ int main(int argc, char **argv) { stochastic_piece.unload(); stochastic_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); stochastic_piece.load(); - TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false));//checked + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); @@ -1704,10 +1667,7 @@ int main(int argc, char **argv) { //V3 TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true)); - if (i_sample==0){ - reductionsV3.writeHDF5("reductionsV3"); - reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->writeHDF5("reductionsV2"); - } + TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true, false, true)); TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true, false, true)); TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true, false, true)); @@ -1724,23 +1684,23 @@ int main(int argc, char **argv) { - TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked + TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, true));//checked TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true, true)); TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true, true)); - TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false));//checked + TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, true));//checked TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true, true)); TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true, true)); - TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false));//checked + TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true));//checked TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true, true)); TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true, true)); - TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false));//checked + TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, true));//checked TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true, true)); TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true, true)); @@ -1786,7 +1746,7 @@ int main(int argc, char **argv) { }//loop over source sink separations - +#endif // ensuring mu positive if(mu<0) { mu*=-1.; @@ -1890,39 +1850,26 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4, outfilename, "T", parallel_sources, attract_lookup_table)); } - PLEGMA_ScattCorrelator corrB9_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrB10_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrB11_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrB12_2pt(source, filtered_sourcemomentumList_2pt); - - PLEGMA_ScattCorrelator corrW17_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW18_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW19_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW20_2pt(source, filtered_sourcemomentumList_2pt); - - PLEGMA_ScattCorrelator corrW21_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW22_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW23_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW24_2pt(source, filtered_sourcemomentumList_2pt); - + PLEGMA_ScattCorrelator corrB13_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB14_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB15_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB16_2pt(source, filtered_sourcemomentumList_2pt); - corrB9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B9"); - corrB10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B10"); - corrB11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B11"); - corrB12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B12"); - - corrW17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W17"); - corrW18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W18"); - corrW19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W19"); - corrW20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W20"); - - corrW21_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W21"); - corrW22_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W22"); - corrW23_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W23"); - corrW24_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W24"); + PLEGMA_ScattCorrelator corrW25_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW26_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW27_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW28_2pt(source, filtered_sourcemomentumList_2pt); + corrB13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12","B13"); + corrB14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B14"); + corrB15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B15"); + corrB16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B16"); + corrW25_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W25"); + corrW26_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W26"); + corrW27_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W27"); + corrW28_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W28"); for (int k=0; k< tSinks.size(); ++k){ @@ -1999,42 +1946,36 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_propagator_packed; if (k==0 && (dotwopoint==1)){ - stochastic_propagator_packed.unload(); - stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); - stochastic_propagator_packed.load(); +// stochastic_propagator_packed.unload(); +// stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); +// stochastic_propagator_packed.load(); + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stochastic_propagator_packed.load(); + stochastic_propagator_packed.apply_gamma5(); TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true )); - TIME( corrB9_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 9, true, false, false)); - TIME(corrB10_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 10, true, false, false)); - TIME(corrB11_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 11, true, false, false)); - TIME(corrB12_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 12, true, false, false)); - + TIME(corrB13_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V4_GAMMAF1U_D_2pt[i_sample], 0, 13, true, false, false)); + TIME(corrB14_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V4_GAMMAF1U_D_2pt[i_sample], 0, 14, true, false, false)); + TIME(corrB15_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt[i_sample], 0, 15, true, false, false)); + TIME(corrB16_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt[i_sample], 0, 16, true, false, false)); + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); + stochastic_propagator_packed.load(); stochastic_propagator_packed.apply_gamma5(); - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); - - TIME(corrW22_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 22, true, false)); - TIME(corrW24_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 24, true, false)); - - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true)); - TIME(corrW21_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 21, true, false)); - TIME(corrW23_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 23, true, false)); + TIME(corrW27_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 27, true, false)); + TIME(corrW28_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 28, true, false)); - stochastic_propagator_packed.unload(); - stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); - stochastic_propagator_packed.load(); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true)); + TIME(corrW25_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 25, true, false)); + TIME(corrW26_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 26, true, false)); - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false)); - TIME(corrW17_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 17, true, false)); - TIME(corrW19_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 19, true, false)); - - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, false)); - TIME(corrW18_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 18, true, false)); - TIME(corrW20_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 20, true, false)); } for (int i_source_parallel=0; i_source_parallel vectorAuxPrint; - for(int isc = 0 ; isc < 12 ; isc++){ - std::string spin=std::to_string(isc/3); - std::string col=std::to_string(isc%3); - - vectorAuxPrint.absorb(propTS_SL_packed,isc/3,isc%3); - vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("corrB12_propTS_SL_packed_"+spin+"_c"+col); - } - - stochastic_propagator_packed.writeHDF5("corrB12_stochastic_propagator"); - } */ TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true )); @@ -2067,9 +1994,6 @@ int main(int argc, char **argv) { TIME( corrB9.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 9, true, false, true)); TIME(corrB10.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 10, true, false, true)); TIME(corrB11.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 11, true, false, true)); - //reductionsV3.writeHDF5("corrB12_V3_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); - //reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->writeHDF5("corrB12_V4_source_"+std::to_string(i_sample)+"_tSinkMtSource_"+std::to_string(k)); - TIME(corrB12.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 12, true, false, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); @@ -2083,19 +2007,19 @@ int main(int argc, char **argv) { stochastic_source_packed.apply_gamma5(); - TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); + TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, true)); TIME(corrW17.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 17, true, true)); TIME(corrW19.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 19, true, true)); - TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, false)); + TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, true)); TIME(corrW18.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 18, true, true)); TIME(corrW20.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 20, true, true)); - TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, false)); + TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, true)); TIME(corrW22.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 22, true, true)); TIME(corrW24.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 24, true, true)); - TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true)); TIME(corrW21.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 21, true, true)); TIME(corrW23.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 23, true, true)); @@ -2122,29 +2046,25 @@ int main(int argc, char **argv) { if (k==0 && (dotwopoint==1)){ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; - TIME(produceOutput_2pt_packed(corrB9_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrB10_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrB11_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrB12_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB13_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB14_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB15_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrB16_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; - TIME(produceOutput_2pt_packed(corrW17_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW18_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW19_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW20_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW25_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW26_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW27_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW28_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW21_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW22_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW23_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW24_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); } } //loop over source sink separations - +#if 0 for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS_SS; @@ -2301,12 +2221,12 @@ int main(int argc, char **argv) { stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); stochastic_propagator_packed.load(); - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); TIME( corrW9_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 9, true)); TIME(corrW11_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 11, true)); - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, false)); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); TIME(corrW10_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 10, true, false)); TIME(corrW12_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 12, true, false)); @@ -2345,12 +2265,12 @@ int main(int argc, char **argv) { stochastic_source_packed.apply_gamma5(); - TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true)); TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true, true)); TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true, true)); - TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, false)); + TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true)); TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true, true)); TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true, true)); @@ -2382,7 +2302,7 @@ int main(int argc, char **argv) { } //loop over tSinks - +#endif { //Finite momentum oet PLEGMA_Vector vectortmp1; @@ -2422,7 +2342,6 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - //PLEGMA_printf("Location 15\n"); vectortmp1.absorb(vector2, source_local[3],true); //PLEGMA_printf("Source local %d\n",source_local[3]); //vectortmp1.unload(); @@ -2506,7 +2425,6 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - PLEGMA_printf("Location 10\n"); vectortmp1.absorb(vector2, source_local[3]); } @@ -2531,43 +2449,17 @@ int main(int argc, char **argv) { vectorAuxF.copy(vectortmp2); stochastic_oet_prop_d_fini_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - - - //PLEGMA_Vector temporary1,temporary2; - //temporary1.copy(*stochastic_oet_prop_d_fini_mom_SL[spinindex],HOST); - //temporary1.load(); - //temporary2.copy(vectortmp2); - //temporary1.pack_propagator_from_source_to_sink(temporary2,(source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],max_source_sink_separations, l == 0 ? true : false); - //temporary1.unload(); - //stochastic_oet_prop_d_fini_mom_SL[spinindex]->copy(temporary1,HOST); - //temporary1.load(); - - //vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); - //vectorSource_finite_mom.copy(vectortmp1); - - //} //end of spin dilution - } // end of parallel sources }//end of finite momentum oet - //stochastic_oet_prop_d_fini_mom_SL.unload(); - //stochastic_oet_prop_d_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_d"); - //stochastic_oet_prop_d_fini_mom_SL.load(); - - - - //for (int i=0; i< 4; ++i){ { PLEGMA_Vector st_oet_d_fini; st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SL); - // st_oet_d_fini.copy(*stochastic_oet_prop_d_fini_mom_SL[i],HOST); - // st_oet_d_fini.load(); st_oet_d_fini.apply_gamma5(); TIME(reductionsV3_diluted_D_UP.V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); - //reductionsV3_diluted_D_UP.writeHDF5("reductionV3_oet"); if (dotwopoint==1){ @@ -2585,7 +2477,6 @@ int main(int argc, char **argv) { { PLEGMA_Vector st_oet_u_fini; st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SL); - //st_oet_u_fini.load(); st_oet_u_fini.apply_gamma5(); @@ -2595,7 +2486,6 @@ int main(int argc, char **argv) { if (dotwopoint==1){ PLEGMA_Vector st_oet_u_fini; st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS); - //st_oet_u_fini.load(); st_oet_u_fini.apply_gamma5(); @@ -2604,9 +2494,9 @@ int main(int argc, char **argv) { - PLEGMA_ScattCorrelator corrZ5_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ6_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ15_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ16_2pt(source, filtered_sourcemomentumList_2pt); +/* PLEGMA_ScattCorrelator corrZ7_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ8_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ9_2pt(source, filtered_sourcemomentumList_2pt); @@ -2615,11 +2505,11 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrZ11_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ12_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ13_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ14_2pt(source, filtered_sourcemomentumList_2pt); - - corrZ5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); - corrZ6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); + PLEGMA_ScattCorrelator corrZ14_2pt(source, filtered_sourcemomentumList_2pt);*/ + corrZ15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); + corrZ16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); +/* corrZ7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z7"); corrZ8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z8"); @@ -2630,17 +2520,17 @@ int main(int argc, char **argv) { corrZ12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); corrZ13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); - corrZ14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); + corrZ14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14");*/ corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); - corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); - corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); +// corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); +// corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); if (dotwopoint==1){ - TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); - TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); - + TIME(corrZ15_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); + TIME(corrZ16_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); +/* TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); @@ -2651,23 +2541,23 @@ int main(int argc, char **argv) { TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); - TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); + TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false ));*/ TIME(corrPPUP.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); TIME(corrPPDN.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); - TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); - TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); +// TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); +// TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); + //TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); + //TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; - TIME(produceOutput_2pt_packed(corrZ5_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ6_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ15_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ16_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); +/* TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ8_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ9_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); @@ -2676,12 +2566,12 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrZ11_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ12_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table));*/ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_2pt"; TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; @@ -2743,9 +2633,6 @@ int main(int argc, char **argv) { free(ssource); TIME(corrZ5.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 5, false, true )); - reductionsV3_diluted_D_UP.writeHDF5("corrZ5_V3"); - reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("corrZ5_V2"); - corrZ5.writeHDF5("corrZ5"); TIME(corrZ7.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 7, false, true )); TIME(corrZ6.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 6, false, true )); @@ -2755,8 +2642,6 @@ int main(int argc, char **argv) { TIME(corrZ10.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 10,false, true )); - //reductionsV3_diluted_U_DN.writeHDF5("corr_Z11_reductionsV3_diluted_U_DN"); - //reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("corr_Z11_reductionsV2_diluted_STOCHU_DN_UP_"+std::to_string(tSinks[k])); TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11, false, true )); TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13, false, true )); @@ -2812,13 +2697,11 @@ int main(int argc, char **argv) { for(int i_samples=0; i_samples< n_stochastic_samples; ++i_samples) { if (dotwopoint==1){ - reductions_UU_V2_GAMMAF1D_U_2pt.pop_back(); - reductions_UU_V4_GAMMAF1U_D_2pt.pop_back(); + reductions_DD_V2_GAMMAF1U_D_2pt.pop_back(); + reductions_DD_V4_GAMMAF1U_D_2pt.pop_back(); - reductions_UU_V3_GAMMAF2U_2pt.pop_back(); - reductions_DD_V3_GAMMAF2D_2pt.pop_back(); + reductions_DD_V3_GAMMAF2U_2pt.pop_back(); - reductions_DD_V2_GAMMAF1U_U_2pt.pop_back(); } @@ -2851,16 +2734,6 @@ int main(int argc, char **argv) { stochastic_propags_DN_SL.pop_back(); } - //for(int i=0; i< 4; ++i) { - // stochastic_oet_prop_d_zero_mom_SS.pop_back(); - // stochastic_oet_prop_u_zero_mom_SS.pop_back(); - - // stochastic_oet_prop_d_fini_mom_SL.pop_back(); - // stochastic_oet_prop_u_fini_mom_SL.pop_back(); - - //} - - }//loop in finalize finalize(); return 0; From b47290b6c379f42844ccb1584be5829acd2c355f Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 10 Feb 2023 18:42:26 +0100 Subject: [PATCH 055/168] moving writiing out N0 outside pi2 loop, thanks Yan --- plegma/nucleon_3pt_n_npi.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 97daea5d..de974d74 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -2574,22 +2574,10 @@ int main(int argc, char **argv) { // TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; - TIME( corrN0_packed.apply_phase()); - TIME( corrN0_packed.apply_sign("N")); - TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); - TIME( corrN0_packed.writeHDF5(outfilename)); - - TIME( corrNP_packed.apply_phase() ); - TIME( corrNP_packed.apply_sign("N") ); - TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); - TIME( corrNP_packed.writeHDF5(outfilename) ); } - - for (int k=0; k corrZ5(source, filtered_sourcemomentumList); @@ -2670,6 +2658,20 @@ int main(int argc, char **argv) { if (dotwopoint==1){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; + TIME( corrN0_packed.apply_phase()); + TIME( corrN0_packed.apply_sign("N")); + TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrN0_packed.writeHDF5(outfilename)); + + TIME( corrNP_packed.apply_phase() ); + TIME( corrNP_packed.apply_sign("N") ); + TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrNP_packed.writeHDF5(outfilename) ); + + + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; TIME(corrP0UP.apply_sign("P")); TIME(corrP0UP.writeHDF5( outfilename )); From 521fcf1c67f12a4a48cb2f1b3bebabbf90f9e3b8 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 10 Feb 2023 19:08:00 +0100 Subject: [PATCH 056/168] correct name fOR M diagrams --- plegma/nucleon_3pt_n_npi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index de974d74..9f8c19d4 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -2568,7 +2568,7 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table));*/ - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_2pt"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_correct_2pt"; TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); // TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); // TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); From 34edaa1d69af309037e727c42c83b383b4858c3d Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 20 Feb 2023 08:47:35 +0100 Subject: [PATCH 057/168] remove debug absorb function no longer needed --- include/PLEGMA_Vector.h | 4 ---- lib/PLEGMA_Vector.cu | 34 ---------------------------------- 2 files changed, 38 deletions(-) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index 81933ceb..ceb13e21 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -102,10 +102,6 @@ namespace plegma { void pack_propagator_as_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize); - - void absorb(PLEGMA_Vector3D &vec, int global_it, bool broadcast=false); - - }; template void copyToQUDA(quda::ColorSpinorField *cudaVector, Float* delem, bool isEv = false); // delem is a device pointer diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 548ebde7..2ef07ca4 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -180,40 +180,6 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator &prop, int global_it, checkQudaError(); } -//vec4D <- vec3D (it) -template -void PLEGMA_Vector::absorb(PLEGMA_Vector3D &vec, int global_it, bool broadcast){ - if(global_it >= HGC_totalL[3]) PLEGMA_error("The global time slice you provided exceed the temporal extent\n"); - int my_it = global_it - HGC_procPosition[3] * HGC_localL[3]; - bool is_myIt = (my_it >= 0) && ( my_it < HGC_localL[3] ); - int V3 = HGC_localVolume/HGC_localL[3]; - int V4 = HGC_localVolume; - Float *pointer_src = NULL; - Float *pointer_dst = NULL; - - static bool init_vector4D_vector3D = false; - - if (!init_vector4D_vector3D) { - - Float2 *tempquda=(Float2 *)device_malloc( V3*2 * sizeof(Float)); - PLEGMA_memcpy(tempquda, tempquda, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); - device_free(tempquda); - - init_vector4D_vector3D=true; - - } - for(int mu = 0 ; mu < N_SPINS ; mu++) - for(int c1 = 0 ; c1 < N_COLS ; c1++){ - //qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); - if(is_myIt){ - pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); - pointer_src = (vec.D_elem() + mu*N_COLS*V3*2 + c1*V3*2); - PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); - } - } - //comm_barrier(); - checkQudaError(); -} // vec4D <- prop4D template From ee01a81056544557a133730911b1e03c8ef08785 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Mon, 27 Mar 2023 11:23:34 +0200 Subject: [PATCH 058/168] remove assertion for name_of_diagram & ToolYan --- include/ToolYan.h | 50 -------- lib/PLEGMA_ScattCorrelator.cu | 2 +- lib/ToolYan.cpp | 218 ---------------------------------- 3 files changed, 1 insertion(+), 269 deletions(-) delete mode 100644 include/ToolYan.h delete mode 100644 lib/ToolYan.cpp diff --git a/include/ToolYan.h b/include/ToolYan.h deleted file mode 100644 index d494254c..00000000 --- a/include/ToolYan.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include - - -enum FlavorYan {u,d}; - -// S=smear, L=local, B=both; left->in, right->out; Ex: SL => smear -> solve -> local (no smear); -enum SmearFlagYan {SS,SL,LS,LL,single2double,SB,LB}; - -class ToolYan -{ -private: -protected: - std::chrono::_V2::system_clock::time_point tStart; - std::chrono::_V2::system_clock::time_point tLast; - - plegma::PLEGMA_Gauge *gaugeP = NULL, *smearedGaugeP = NULL; - quda::QUDA_solver *solverP = NULL; - bool smearQ = false; // Global smearing flag - int nsmearGauss; - double alphaGauss; - -public: - ToolYan(); - ~ToolYan(); - - void printTime(std::string s = "Regular", bool preciseQ = true); - void testTimeCost(); - - void setupGauge(plegma::PLEGMA_Gauge &gauge) { assert(gaugeP == NULL); gaugeP = &gauge; }; - void setupSmearing(plegma::PLEGMA_Gauge &smearedGauge, int nsmearGauss, double alphaGauss) { assert(smearedGaugeP == NULL); smearedGaugeP = &smearedGauge; this->nsmearGauss=nsmearGauss; this->alphaGauss=alphaGauss; smearQ = true; }; - void setupSolver(quda::QUDA_solver &solver) { assert(solverP == NULL); solverP = &solver; }; - - // 1st: rotateToPhysicalBasis -> scale (for numerical purpose) -> solve - void solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f); - // 2rd: smear -> 1st - void solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s); - // 3nd: smear -> 1st - void solve(plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s); - - // out = outS when s != SB/LB - void setupPointPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s); - void setupSequentialPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s); -}; \ No newline at end of file diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index f5692003..99824b3e 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1056,7 +1056,7 @@ void PLEGMA_ScattCorrelator::initialize_diagram( std::vector void PLEGMA_ScattCorrelator::initialize_diagram( std::vector &G_i2, std::vector &G_f2, std::string name_of_diagram){ - assert(( name_of_diagram=="P") || (name_of_diagram=="P0DN") || (name_of_diagram=="P0UP") || (name_of_diagram=="PPDN") || (name_of_diagram=="PPUP" ) ); + // assert(( name_of_diagram=="P") || (name_of_diagram=="P0DN") || (name_of_diagram=="P0UP") || (name_of_diagram=="PPDN") || (name_of_diagram=="PPUP" ) ); //Gamma list this->GList.clear(); diff --git a/lib/ToolYan.cpp b/lib/ToolYan.cpp deleted file mode 100644 index 17ff3ca2..00000000 --- a/lib/ToolYan.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include - -ToolYan::ToolYan() -{ - tStart = tLast = std::chrono::high_resolution_clock::now(); - printTime("start"); -} -ToolYan::~ToolYan() -{ - printTime("end"); -} - -void ToolYan::printTime(std::string s, bool preciseQ) -{ - std::chrono::_V2::system_clock::time_point tNow = std::chrono::high_resolution_clock::now(); - std::chrono::duration tTotal = tNow - tStart; - std::chrono::duration tDura = tNow - tLast; - if (preciseQ) - PLEGMA_printf("[ToolYan: %s] Total time: %f; Duration: %f\n", s.c_str(), tTotal.count() / 1000, tDura.count() / 1000); - else - PLEGMA_printf("[ToolYan: %s] Total time: %d; Duration: %d\n", s.c_str(), int(tTotal.count() / 1000), int(tDura.count() / 1000)); - tLast = tNow; -} - -void ToolYan::testTimeCost() -{ - printTime("testTimeCost start"); - for (int i = 0; i <= 3; i++) - { - plegma::PLEGMA_Vector auxVector, auxVector1; - plegma::PLEGMA_Vector3D auxVector3D, auxVector3D1; - struct plegma::site source({0, 0, 0, 0}); - - auxVector.pointSource(source, 0, 0); - auxVector3D.pointSource(source, 0, 0, DEVICE); - - printTime(("test " + std::to_string(i + 1)).c_str()); - - solverP->solve(auxVector, auxVector); - printTime("bare solve"); - - auxVector1.rotateToPhysicalBasis(auxVector, +1); - printTime("rotate to physical basis"); - - if (smearQ) - { - auxVector1.gaussianSmearing(auxVector, *smearedGaugeP, this->nsmearGauss, this->alphaGauss); - printTime("smear"); - plegma::PLEGMA_Gauge3D smearedGauge3D; - smearedGauge3D.absorb(*smearedGaugeP, 0); - printTime("create gauge3D"); - auxVector3D1.gaussianSmearing(auxVector3D, smearedGauge3D, this->nsmearGauss, this->alphaGauss); - printTime("smear3D"); - } - } - printTime("testTimeCost end"); -} - -void ToolYan::solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f) -{ - FlavorYan f2 = (mu > 0 ? u : d); - double run_mu = (f == f2 ? mu : -mu); - plegma::PLEGMA_Vector auxVector; - - auxVector.rotateToPhysicalBasis(in, run_mu / std::abs(run_mu)); - double norm = auxVector.norm(); - auxVector.scale(1 / norm); - if (f != f2) - { - mu = run_mu; - solverP->UpdateSolver(); - } - solverP->solve(auxVector, auxVector); - auxVector.scale(norm); - out.rotateToPhysicalBasis(auxVector, run_mu / std::abs(run_mu)); -} - -void ToolYan::solve(plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) -{ - assert(s < single2double); - - if (!smearQ) - { - plegma::PLEGMA_Vector auxVector; - auxVector.absorb(in, inTime); - solve(out, auxVector, f); - return; - } - - plegma::PLEGMA_Vector auxVector; - plegma::PLEGMA_Vector3D auxVector3D; - - if (s == SL || s == SS) - { - plegma::PLEGMA_Gauge3D smearedGauge3D; - smearedGauge3D.absorb(*smearedGaugeP, inTime); - auxVector3D.gaussianSmearing(in, smearedGauge3D, this->nsmearGauss, this->alphaGauss); - } - else - auxVector3D.copy(in); - - auxVector.absorb(auxVector3D, inTime); - solve(auxVector, auxVector, f); - - if (s == LS || s == SS) - { - out.gaussianSmearing(auxVector, *smearedGaugeP, this->nsmearGauss, this->alphaGauss); - } - else - out.copy(auxVector); -} - -void ToolYan::solve(plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) -{ - assert(single2double < s); - if (!smearQ) - { - plegma::PLEGMA_Vector auxVector; - auxVector.absorb(in, inTime); - solve(outL, auxVector, f); - outS.copy(outL); - return; - } - - plegma::PLEGMA_Vector auxVector; - - if (s == SB) - { - plegma::PLEGMA_Gauge3D smearedGauge3D; - plegma::PLEGMA_Vector3D auxVector3D; - smearedGauge3D.absorb(*smearedGaugeP, inTime); - auxVector3D.gaussianSmearing(in, smearedGauge3D, this->nsmearGauss, this->alphaGauss); - auxVector.absorb(auxVector3D, inTime); - } - else - auxVector.absorb(in, inTime); - - solve(auxVector, auxVector, f); - - outS.gaussianSmearing(auxVector, *smearedGaugeP, this->nsmearGauss, this->alphaGauss); - outL.copy(auxVector); -} - -void ToolYan::setupPointPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s) -{ - if (s < single2double) - { - plegma::PLEGMA_Vector auxVector; - plegma::PLEGMA_Vector auxVectorF; - plegma::PLEGMA_Vector3D auxVector3D; - for (int isc = 0; isc < 12; isc++) - { - auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); - solve(auxVector, auxVector3D, source[DIM_T], f, s); - auxVectorF.copy(auxVector); - outS.absorb(auxVectorF, isc / 3, isc % 3); - } - } - else - { - plegma::PLEGMA_Vector auxVectorS, auxVectorL; - plegma::PLEGMA_Vector auxVectorSF, auxVectorLF; - plegma::PLEGMA_Vector3D auxVector3D; - - for (int isc = 0; isc < 12; isc++) - { - auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); - solve(auxVectorS, auxVectorL, auxVector3D, source[DIM_T], f, s); - auxVectorSF.copy(auxVectorS); - auxVectorLF.copy(auxVectorL); - outS.absorb(auxVectorSF, isc / 3, isc % 3); - outL.absorb(auxVectorLF, isc / 3, isc % 3); - } - } -} - -void ToolYan::setupSequentialPropagator(plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) -{ - if (s < single2double) - { - plegma::PLEGMA_Vector auxVectorD; - plegma::PLEGMA_Vector auxVectorF; - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3DF; - - for (int isc = 0; isc < 12; isc++) - { - auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); - auxVector3DF.apply_gamma(Gamma); - auxVector3DF.mulMomentumPhases(mom, momSign); - auxVector3DD.copy(auxVector3DF); - solve(auxVectorD, auxVector3DD, inTime, f, s); - auxVectorF.copy(auxVectorD); - outS.absorb(auxVectorF, isc / 3, isc % 3); - } - } - else - { - plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; - plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3DF; - - for (int isc = 0; isc < 12; isc++) - { - auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); - // auxVector3DF.apply_gamma_scatt(G_5); - auxVector3DF.apply_gamma(Gamma); - auxVector3DF.mulMomentumPhases(mom, momSign); - auxVector3DD.copy(auxVector3DF); - solve(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); - auxVectorFS.copy(auxVectorDS); - auxVectorFL.copy(auxVectorDL); - outS.absorb(auxVectorFS, isc / 3, isc % 3); - outL.absorb(auxVectorFL, isc / 3, isc % 3); - } - } -} \ No newline at end of file From 6eae74d408c23669b63cf055797fd5d908579bb3 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Mon, 27 Mar 2023 11:55:38 +0200 Subject: [PATCH 059/168] include more cases for apply_g5 --- utils/PLEGMA_scatt_utils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/PLEGMA_scatt_utils.cpp b/utils/PLEGMA_scatt_utils.cpp index 19312fc9..ce824d64 100644 --- a/utils/PLEGMA_scatt_utils.cpp +++ b/utils/PLEGMA_scatt_utils.cpp @@ -158,6 +158,18 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) case(G_4): return G_5_G_4; break; + case(G_5_G_1): + return G_1; + break; + case(G_5_G_2): + return G_2; + break; + case(G_5_G_3): + return G_3; + break; + case(G_5_G_4): + return G_4; + break; case(G_5): return ID; break; From 34e92e4bdb94ea9d425eb94b22625361d768cc98 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Thu, 30 Mar 2023 08:10:30 +0200 Subject: [PATCH 060/168] add pi0Insertion --- plegma/pi0Insertion.cpp | 349 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 plegma/pi0Insertion.cpp diff --git a/plegma/pi0Insertion.cpp b/plegma/pi0Insertion.cpp new file mode 100644 index 00000000..add02e73 --- /dev/null +++ b/plegma/pi0Insertion.cpp @@ -0,0 +1,349 @@ +#include +#include +std::vector runtime; +#define TIME(fnc) \ + runtime.push_back(MPI_Wtime()); \ + fnc; \ + PLEGMA_printf("TIME for " #fnc " %f sec\n", MPI_Wtime() - runtime.back()); \ + runtime.pop_back() + +extern int device; +static std::vector listOpt = {"verbosity", "load-gauge", "nsrc", "src-filename", "seed1", "confnumber", "outdiagramPrefix", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; + +int main(int argc, char **argv) +{ + /****************************************************** + * + * Initialiazation + * + ******************************************************/ + initializeOptions(argc, argv, true, listOpt); + + int seed_oet; + int confnumber_int; + std::string outdiagramPrefix = ""; + + HGC_options->set("seed_oet", "Seed for initialization of stochastic sources for the oet", verbosity, seed_oet); + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + + initializePLEGMA(); + + { + plegma::PLEGMA_Gauge gauge, smearedGauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.load(); + gauge.calculatePlaq(); + initGaugeQuda(gauge, true); + plaqQuda(); + + smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + smearedGauge.calculatePlaq(); + + updateOptions(LIGHT); + quda::QUDA_solver solver(mu); + +#if 1 // Utilities + +#if 1 // general + bool smearQ = true; + + enum FlavorYan + { + u, + d + }; + enum SmearFlagYan + { + SS, + SL, + LS, + LL, + single2double, + SB, + LB + }; +#endif + +#if 1 // solve + auto solve0 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f) + { + FlavorYan f2 = (mu > 0 ? u : d); + double run_mu = (f == f2 ? mu : -mu); + plegma::PLEGMA_Vector auxVector; + + auxVector.rotateToPhysicalBasis(in, run_mu / std::abs(run_mu)); + double norm = auxVector.norm(); + auxVector.scale(1 / norm); + if (f != f2) + { + mu = run_mu; + solver.UpdateSolver(); + } + solver.solve(auxVector, auxVector); + auxVector.scale(norm); + out.rotateToPhysicalBasis(auxVector, run_mu / std::abs(run_mu)); + }; + auto solve1 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); + + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(out, auxVector, f); + return; + } + + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector3D auxVector3D; + + if (s == SL || s == SS) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + } + else + auxVector3D.copy(in); + + auxVector.absorb(auxVector3D, inTime); + solve0(auxVector, auxVector, f); + + if (s == LS || s == SS) + { + out.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + } + else + out.copy(auxVector); + }; + auto solve2 = [&](plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(single2double < s); + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(outL, auxVector, f); + outS.copy(outL); + return; + } + + plegma::PLEGMA_Vector auxVector; + + if (s == SB) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + plegma::PLEGMA_Vector3D auxVector3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + auxVector.absorb(auxVector3D, inTime); + } + else + auxVector.absorb(in, inTime); + + solve0(auxVector, auxVector, f); + + outS.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + outL.copy(auxVector); + }; +#endif + +#if 0 // setupPointPropagator + auto setupPointPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s) + { + if (s < single2double) + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3D; + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVector, auxVector3D, source[DIM_T], f, s); + auxVectorF.copy(auxVector); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorS, auxVectorL; + plegma::PLEGMA_Vector auxVectorSF, auxVectorLF; + plegma::PLEGMA_Vector3D auxVector3D; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVectorS, auxVectorL, auxVector3D, source[DIM_T], f, s); + auxVectorSF.copy(auxVectorS); + auxVectorLF.copy(auxVectorL); + outS.absorb(auxVectorSF, isc / 3, isc % 3); + outL.absorb(auxVectorLF, isc / 3, isc % 3); + } + } + }; +#endif + +#if 0 // setupSequentialPropagator + auto ToolYan::setupSequentialPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + if (s < single2double) + { + plegma::PLEGMA_Vector auxVectorD; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorD, auxVector3DD, inTime, f, s); + auxVectorF.copy(auxVectorD); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; + plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + // auxVector3DF.apply_gamma_scatt(G_5); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); + auxVectorFS.copy(auxVectorDS); + auxVectorFL.copy(auxVectorDL); + outS.absorb(auxVectorFS, isc / 3, isc % 3); + outL.absorb(auxVectorFL, isc / 3, isc % 3); + } + } + }; +#endif + +#endif + + /****************************************************** + * + * General input + * + ******************************************************/ + // Get the confnumber for latfile + char *ssource; + asprintf(&ssource, "%04d", confnumber_int); + std::string confnumber = ssource; + free(ssource); + + std::vector gscatts_ID = {ID}; + std::vector gscatts_N = {CG_5}; + std::vector gscatts_pi = {G_5}; + std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; + std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + plegma::momList momList_3pt(4, pathListMomenta_threept, {1, 2, 3}); // pi2, pf1, pf2, pc + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList_3pt.size()); + if (momList_3pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects_pi2 = momList_3pt.uniq_p(0); + auto momVects_pc = momList_3pt.uniq_p(3); + plegma::momList momList_pc(1, {momVects_pc}, {0}); + + /****************************************************** + * + * Main + * + ******************************************************/ + for (int isource = 0; isource < numSourcePositions; ++isource) + { + plegma::site &source = sourcePositions[isource]; + PLEGMA_printf(("TestYan: source=" + std::to_string(source[0]) + "_" + std::to_string(source[1]) + "_" + std::to_string(source[2]) + "_" + std::to_string(source[3])).c_str()); + assert(source[0] == source[1] == source[2] == 0 && 0 <= source[3] < HGC_totalL[3]); + + plegma::PLEGMA_Vector stocXi; + { + stocXi.randInit(seed_oet); + stocXi.stochastic_Z(4); + } + int time_i = source[3]; + + plegma::PLEGMA_Vector stocPhiU_ti_SL, stocPhiD_ti_SL; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(stocXi, time_i); + solve1(stocPhiU_ti_SL, auxVector3D, time_i, u, SL); + solve1(stocPhiD_ti_SL, auxVector3D, time_i, d, SL); + + // Here we do u and d separately for saving mu-changing time + // This the u part + for (int i_pi2 = 0; i_pi2 < momVects_pi2.size(); ++i_pi2) + { + auto &mom_pi2 = momVects_pi2[i_pi2]; + std::string str_pi2 = "pi2=" + std::to_string(mom_pi2[0]) + "_" + std::to_string(mom_pi2[1]) + "_" + std::to_string(mom_pi2[2]); + PLEGMA_printf(("TestYan: pi2=" + str_pi2).c_str()); + + plegma::PLEGMA_Vector stocPhiD_ti_mpi2_SL; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(stocXi, time_i); + auxVector3D.mulMomentumPhases(mom_pi2, -1); + solve1(stocPhiD_ti_mpi2_SL, auxVector3D, time_i, d, SL); + + plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); + pi0Insertion.initialize_diagram(gscatts_pi, gscatts_c, str_pi2 + "/up"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiU_ti_SL); + aux_pi2.copy(stocPhiD_ti_mpi2_SL); + pi0Insertion.P_diagrams(aux, aux_pi2, -1); + } + + asprintf(&ssource, "st%03d", time_i); + std::string sourcepositiontext = (std::string) "_" + ssource; + free(ssource); + std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_pi0Isert"; + + pi0Insertion.writeHDF5(outfilename); + } + // This is the d part + for (int i_pi2 = 0; i_pi2 < momVects_pi2.size(); ++i_pi2) + { + auto &mom_pi2 = momVects_pi2[i_pi2]; + std::string str_pi2 = "pi2=" + std::to_string(mom_pi2[0]) + "_" + std::to_string(mom_pi2[1]) + "_" + std::to_string(mom_pi2[2]); + PLEGMA_printf(("TestYan: pi2=" + str_pi2).c_str()); + + plegma::PLEGMA_Vector stocPhiU_ti_mpi2_SL; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(stocXi, time_i); + auxVector3D.mulMomentumPhases(mom_pi2, -1); + solve1(stocPhiU_ti_mpi2_SL, auxVector3D, time_i, u, SL); + + plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); + pi0Insertion.initialize_diagram(gscatts_pi, gscatts_c, str_pi2 + "/dn"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiD_ti_SL); + aux_pi2.copy(stocPhiU_ti_mpi2_SL); + pi0Insertion.P_diagrams(aux, aux_pi2, -1); + } + + asprintf(&ssource, "st%03d", time_i); + std::string sourcepositiontext = (std::string) "_" + ssource; + free(ssource); + std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_pi0Isert"; + + pi0Insertion.writeHDF5(outfilename); + } + } + } + + finalize(); + return 0; +} From abf6486144cab215785f8f460895a42117069224 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Thu, 13 Apr 2023 12:07:41 +0200 Subject: [PATCH 061/168] pi0 loop --- include/PLEGMA_ScattCorrelator.h | 1 + lib/PLEGMA_ScattCorrelator.cu | 22 +- plegma/QuarkLoops_pi0_insertion.cpp | 309 ++++++++++++++++++++++++++++ 3 files changed, 331 insertions(+), 1 deletion(-) create mode 100644 plegma/QuarkLoops_pi0_insertion.cpp diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 6c7fd7d8..e793a0c6 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -291,6 +291,7 @@ namespace plegma { void T_diagrams_piNsink(PLEGMA_ScattCorrelator &srcV2, PLEGMA_ScattCorrelator &srcV3,int diagram_index, bool accum=false); + void Loop_diagrams( PLEGMA_Vector &Phi_0, PLEGMA_Vector &Phi_1, bool accum=false); void Loop_diagrams( PLEGMA_Vector* &Phi_0, PLEGMA_Vector* &Phi_1, int i_pi2,bool dn=false, bool accum=false); void P_diagrams( std::vector*> &Phi_0, std::vector*> &Phi_1, int i_pi2, bool accum=false ); diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 99824b3e..567bfd17 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1003,7 +1003,7 @@ void PLEGMA_ScattCorrelator::V5V6reduction_matrix(PLEGMA_ScattCorrelator< template void PLEGMA_ScattCorrelator::initialize_diagram( std::vector &G_f2, std::string name_of_diagram){ - assert( name_of_diagram=="L" ); + // assert( name_of_diagram=="L" ); //Gamma list this->GList.clear(); @@ -2451,6 +2451,26 @@ void PLEGMA_ScattCorrelator::P_diagrams( PLEGMA_Vector &Phi_0, PLE } +/* +This method calculates the quark loops without oet (The oet version can be done with P_diagrams). +It can be used for both smeared loops (pi0 case) or local loops (insertion case). +Formally, it calculates <\bar{q} \Gamma q>=-Tr[Q \Gamma]=-Tr[Q \xi\xi^\dag \Gamma]=-\xi^\dag \Gamma Q \xi := - Phi_1 \Gamma Phi_0. +So Phi_0 should be the stochastic propagator, and Phi_1 the stoc source. +By gamma5-Hermiticity, even before gauge average, the u-quark loop is complex conjugate to\ + either the d-quark loop (when g5 Gamma^\dag g5 = Gamma)\ + or the negative d-quark loop (when g5 Gamma^\dag g5 = -Gamma). +Complex conjugate: 1, g5, gugv +Negative complex conjugate: gu, g5gu +*/ +template +void PLEGMA_ScattCorrelator::Loop_diagrams( PLEGMA_Vector &Phi_0, PLEGMA_Vector &Phi_1, bool accum) +{ + clear_output(!accum); + + PLEGMA_ScattCorrelator auxPhiPhi(this->source, pList(), this->getTotalT()); + auxPhiPhi.PhiPhi(Phi_0, GList[0], Phi_1); + x_pe_sy(this->H_elem(), (Float) -1., auxPhiPhi.H_elem(), this->getTotalSize()); +} //here pi2 is looped outside in the building of the stocastic propagator. NB for moms_red I expect that pi2 is the same! diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp new file mode 100644 index 00000000..30e006a1 --- /dev/null +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -0,0 +1,309 @@ +#include +#include +std::vector runtime; +#define TIME(fnc) \ + runtime.push_back(MPI_Wtime()); \ + fnc; \ + PLEGMA_printf("TIME for " #fnc " %f sec\n", MPI_Wtime() - runtime.back()); \ + runtime.pop_back() + +extern int device; +static std::vector listOpt = {"verbosity", "load-gauge", "momlisttwopt-filename", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; + +int main(int argc, char **argv) +{ + /****************************************************** + * + * Initialiazation + * + ******************************************************/ + initializeOptions(argc, argv, true, listOpt); + + int confnumber_int; + std::string outdiagramPrefix; + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + + std::string caseToDo, readStocPath; + int readStoc, seed_stoc, num_stoc; + HGC_options->set("caseToDo", "pi0 or insertion", verbosity, caseToDo); + HGC_options->set("readStocPath", "Path for stoc", verbosity, readStocPath); + HGC_options->set("readStoc", "Set 1 to read stoc from NJNpi_N0P+", verbosity, readStoc); + HGC_options->set("seed_stoc", "Seed for stoc", verbosity, seed_stoc); + HGC_options->set("num_stoc", "Num of stoc", verbosity, num_stoc); + + initializePLEGMA(); + + { + plegma::PLEGMA_Gauge gauge, smearedGauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.load(); + gauge.calculatePlaq(); + initGaugeQuda(gauge, true); + plaqQuda(); + + smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + smearedGauge.calculatePlaq(); + + updateOptions(LIGHT); + quda::QUDA_solver solver(mu); + +#if 1 // Utilities + +#if 1 // general + bool smearQ = true; + + enum FlavorYan + { + u, + d + }; + enum SmearFlagYan + { + SS, + SL, + LS, + LL, + single2double, + SB, + LB + }; +#endif + +#if 1 // solve + auto solve0 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f) + { + FlavorYan f2 = (mu > 0 ? u : d); + double run_mu = (f == f2 ? mu : -mu); + plegma::PLEGMA_Vector auxVector; + + auxVector.rotateToPhysicalBasis(in, run_mu / std::abs(run_mu)); + double norm = auxVector.norm(); + auxVector.scale(1 / norm); + if (f != f2) + { + mu = run_mu; + solver.UpdateSolver(); + } + solver.solve(auxVector, auxVector); + auxVector.scale(norm); + out.rotateToPhysicalBasis(auxVector, run_mu / std::abs(run_mu)); + }; + auto solve1 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); + + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(out, auxVector, f); + return; + } + + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector3D auxVector3D; + + if (s == SL || s == SS) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + } + else + auxVector3D.copy(in); + + auxVector.absorb(auxVector3D, inTime); + solve0(auxVector, auxVector, f); + + if (s == LS || s == SS) + { + out.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + } + else + out.copy(auxVector); + }; + auto solve2 = [&](plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(single2double < s); + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(outL, auxVector, f); + outS.copy(outL); + return; + } + + plegma::PLEGMA_Vector auxVector; + + if (s == SB) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + plegma::PLEGMA_Vector3D auxVector3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + auxVector.absorb(auxVector3D, inTime); + } + else + auxVector.absorb(in, inTime); + + solve0(auxVector, auxVector, f); + + outS.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + outL.copy(auxVector); + }; +#endif + +#if 0 // setupPointPropagator + auto setupPointPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s) + { + if (s < single2double) + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3D; + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVector, auxVector3D, source[DIM_T], f, s); + auxVectorF.copy(auxVector); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorS, auxVectorL; + plegma::PLEGMA_Vector auxVectorSF, auxVectorLF; + plegma::PLEGMA_Vector3D auxVector3D; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVectorS, auxVectorL, auxVector3D, source[DIM_T], f, s); + auxVectorSF.copy(auxVectorS); + auxVectorLF.copy(auxVectorL); + outS.absorb(auxVectorSF, isc / 3, isc % 3); + outL.absorb(auxVectorLF, isc / 3, isc % 3); + } + } + }; +#endif + +#if 0 // setupSequentialPropagator + auto ToolYan::setupSequentialPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + if (s < single2double) + { + plegma::PLEGMA_Vector auxVectorD; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorD, auxVector3DD, inTime, f, s); + auxVectorF.copy(auxVectorD); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; + plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + // auxVector3DF.apply_gamma_scatt(G_5); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); + auxVectorFS.copy(auxVectorDS); + auxVectorFL.copy(auxVectorDL); + outS.absorb(auxVectorFS, isc / 3, isc % 3); + outL.absorb(auxVectorFL, isc / 3, isc % 3); + } + } + }; +#endif + +#endif + + /****************************************************** + * + * General input + * + ******************************************************/ + // Get the confnumber for latfile + char *ssource; + asprintf(&ssource, "%04d", confnumber_int); + std::string confnumber = ssource; + free(ssource); + + std::vector gscatts_ID = {ID}; + std::vector gscatts_N = {CG_5}; + std::vector gscatts_pi = {G_5}; + std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; + std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_twopt.c_str()); + plegma::momList momList2pt(3, pathListMomenta_twopt, {1, 2}); // pi2, pf1, pf2 + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList2pt.size()); + if (momList2pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects2pt_pi2 = momList2pt.uniq_p(0); + plegma::momList momList2pt_pi2(1, {momVects2pt_pi2}, {0}); + + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + plegma::momList momList3pt(4, pathListMomenta_threept, {1, 2, 3}); // pi2, pf1, pf2, pc + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList3pt.size()); + if (momList3pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects3pt_pi2 = momList3pt.uniq_p(0); + auto momVects3pt_pc = momList3pt.uniq_p(3); + plegma::momList momList3pt_pc(1, {momVects3pt_pc}, {0}); + + /****************************************************** + * + * Main + * + ******************************************************/ + if (caseToDo == "pi0" && readStoc == 1) + { + struct plegma::site src({0, 0, 0, 0}); + plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); + pi0Loop.initialize_diagram(gscatts_pi, "stocRead1_" + std::to_string(num_stoc) + "/dn"); + + plegma::PLEGMA_Vector stocSrc, stocProp; + plegma::PLEGMA_Vector stocSrcD, stocPropD; + for (int i = 0; i < num_stoc; i++) + { + std::string inputfilename = readStocPath + "globalTfulltimedilution_source_nstoch" + std::to_string(i) + "_" + confnumber; + PLEGMA_printf("Read stochastic source from: %s\n", inputfilename.c_str()); + stocSrcD.readFile(inputfilename, LIME_FORMAT); + inputfilename = readStocPath + "globalTfulltimedilution_propagator_nstoch" + std::to_string(i) + "_" + confnumber; + PLEGMA_printf("Read stochastic propagator from: %s\n", inputfilename.c_str()); + stocProp.readFile(inputfilename, LIME_FORMAT); + + stocSrc.copy(stocSrcD); + // stocProp.copy(stocPropD); + pi0Loop.Loop_diagrams(stocProp, stocSrc, num_stoc == 0 ? false : true); + } + + pi0Loop.normalize_nstoch(1. / num_stoc); + std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + pi0Loop.writeHDF5(outfilename); + } + } + + finalize(); + return 0; +} From 2c553a6da4a7084ddf26ff9db5cdc86936fc9f6c Mon Sep 17 00:00:00 2001 From: Yan Li Date: Thu, 13 Apr 2023 14:25:13 +0200 Subject: [PATCH 062/168] pi0Loop update --- plegma/QuarkLoops_pi0_insertion.cpp | 87 +++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 22 deletions(-) diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index 30e006a1..cdd17001 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -276,31 +276,74 @@ int main(int argc, char **argv) * Main * ******************************************************/ - if (caseToDo == "pi0" && readStoc == 1) + if (caseToDo == "pi0") { - struct plegma::site src({0, 0, 0, 0}); - plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); - pi0Loop.initialize_diagram(gscatts_pi, "stocRead1_" + std::to_string(num_stoc) + "/dn"); - - plegma::PLEGMA_Vector stocSrc, stocProp; - plegma::PLEGMA_Vector stocSrcD, stocPropD; - for (int i = 0; i < num_stoc; i++) + if (readStoc == 0) { - std::string inputfilename = readStocPath + "globalTfulltimedilution_source_nstoch" + std::to_string(i) + "_" + confnumber; - PLEGMA_printf("Read stochastic source from: %s\n", inputfilename.c_str()); - stocSrcD.readFile(inputfilename, LIME_FORMAT); - inputfilename = readStocPath + "globalTfulltimedilution_propagator_nstoch" + std::to_string(i) + "_" + confnumber; - PLEGMA_printf("Read stochastic propagator from: %s\n", inputfilename.c_str()); - stocProp.readFile(inputfilename, LIME_FORMAT); - - stocSrc.copy(stocSrcD); - // stocProp.copy(stocPropD); - pi0Loop.Loop_diagrams(stocProp, stocSrc, num_stoc == 0 ? false : true); + struct plegma::site src({0, 0, 0, 0}); + plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); + pi0Loop.initialize_diagram(gscatts_pi, "stoc" + std::to_string(seed_stoc) + "_" + std::to_string(num_stoc) + "/up"); + + plegma::PLEGMA_Vector stocSrcUnsmeared; + stocSrcUnsmeared.randInit(seed_stoc); + for (int i = 0; i < num_stoc; i++) + { + plegma::PLEGMA_Vector stocSrc, stocProp; + plegma::PLEGMA_Vector stocPropSmeared; + + stocSrcUnsmeared.stochastic_Z(4); + plegma::PLEGMA_Vector stocSrcSmeared; + stocSrcSmeared.gaussianSmearing(stocSrcUnsmeared, smearedGauge, nsmearGauss, alphaGauss); + for (int tc = 0; tc < HGC_totalL[3]; tc++) + { + plegma::PLEGMA_Vector aux, stocPropUnsmeared; + plegma::PLEGMA_Vector3D aux3D, aux3D2; + aux.absorbTimeslice(stocSrcSmeared, tc, true); + solve0(stocPropUnsmeared, aux, u); + aux3D.absorb(stocPropUnsmeared, tc); + + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, tc); + aux3D2.gaussianSmearing(aux3D, smearedGauge3D, nsmearGauss, alphaGauss); + + stocPropSmeared.absorb(aux3D2, tc, tc == 0 ? true : false); + } + stocSrc.copy(stocSrcUnsmeared); // Note: smearing a prop Q gives SQS, with stoc, it's SQS\xi \xi^\dag, so no smearing is needed for the src. + stocProp.copy(stocPropSmeared); + pi0Loop.Loop_diagrams(stocProp, stocSrc, i == 0 ? false : true); + } + pi0Loop.normalize_nstoch(num_stoc); + std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + pi0Loop.writeHDF5(outfilename); } - - pi0Loop.normalize_nstoch(1. / num_stoc); - std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; - pi0Loop.writeHDF5(outfilename); + else if (readStoc == 1) + { + struct plegma::site src({0, 0, 0, 0}); + plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); + pi0Loop.initialize_diagram(gscatts_pi, "stocRead1_" + std::to_string(num_stoc) + "/dn"); + + plegma::PLEGMA_Vector stocSrc, stocProp; + plegma::PLEGMA_Vector stocSrcD, stocPropD; + for (int i = 0; i < num_stoc; i++) + { + std::string inputfilename = readStocPath + "globalTfulltimedilution_source_nstoch" + std::to_string(i) + "_" + confnumber; + PLEGMA_printf("Read stochastic source from: %s\n", inputfilename.c_str()); + stocSrcD.readFile(inputfilename, LIME_FORMAT); + inputfilename = readStocPath + "globalTfulltimedilution_propagator_nstoch" + std::to_string(i) + "_" + confnumber; + PLEGMA_printf("Read stochastic propagator from: %s\n", inputfilename.c_str()); + stocProp.readFile(inputfilename, LIME_FORMAT); + + stocSrc.copy(stocSrcD); + pi0Loop.Loop_diagrams(stocProp, stocSrc, i == 0 ? false : true); + } + pi0Loop.normalize_nstoch(num_stoc); + std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + pi0Loop.writeHDF5(outfilename); + } + } + else + { + PLEGMA_printf("%s not supported", caseToDo.c_str()); } } From fe470b67bc46bc8dc1d460dab483d2c930ae41fa Mon Sep 17 00:00:00 2001 From: Yan Li Date: Tue, 18 Apr 2023 08:44:13 +0200 Subject: [PATCH 063/168] insertionLoop --- lib/PLEGMA_ScattCorrelator.cu | 8 +++-- plegma/QuarkLoops_pi0_insertion.cpp | 51 +++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 567bfd17..c016d8f1 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2456,9 +2456,11 @@ This method calculates the quark loops without oet (The oet version can be done It can be used for both smeared loops (pi0 case) or local loops (insertion case). Formally, it calculates <\bar{q} \Gamma q>=-Tr[Q \Gamma]=-Tr[Q \xi\xi^\dag \Gamma]=-\xi^\dag \Gamma Q \xi := - Phi_1 \Gamma Phi_0. So Phi_0 should be the stochastic propagator, and Phi_1 the stoc source. -By gamma5-Hermiticity, even before gauge average, the u-quark loop is complex conjugate to\ - either the d-quark loop (when g5 Gamma^\dag g5 = Gamma)\ - or the negative d-quark loop (when g5 Gamma^\dag g5 = -Gamma). +By gamma5-Hermiticity, even before gauge average, the u-quark loop is complex conjugate to + either the d-quark loop (when g5 Gamma^\dag g5 = Gamma) + or the negative d-quark loop (when g5 Gamma^\dag g5 = -Gamma) + in position space, or in momentum space with momentum flipped: \vec{p} -> -\vec{p} + Complex conjugate: 1, g5, gugv Negative complex conjugate: gu, g5gu */ diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index cdd17001..c900aae8 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -1,3 +1,22 @@ +/* +Here we compute quark loops, including smeared (for pi0) and local (for insertion), + with or without one-end-trick (oet not supported yet). + +The output data structure is like: +sx00sy00sz00st00/stoc(seed_stoc)_(num_stoc))/[up or dn] dim=[N_time,N_mom,N_gamma,2 for real and imag] + +Only one of up and dn will be done for each run. up and dn are either conjugate or + negative-conjugate to each other (with momentum flipped) + +Each run should start with a random seed, and end up with either creating a new data file + or appending an existed data file with a group name indicating the random seed and number + of stochastic sources used. +It is recommended to backup data files before a new run that increases the statistics + in case of the possibility that the new run destroys the existed data file. +*/ + + + #include #include std::vector runtime; @@ -305,7 +324,7 @@ int main(int argc, char **argv) plegma::PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, tc); aux3D2.gaussianSmearing(aux3D, smearedGauge3D, nsmearGauss, alphaGauss); - + stocPropSmeared.absorb(aux3D2, tc, tc == 0 ? true : false); } stocSrc.copy(stocSrcUnsmeared); // Note: smearing a prop Q gives SQS, with stoc, it's SQS\xi \xi^\dag, so no smearing is needed for the src. @@ -320,7 +339,7 @@ int main(int argc, char **argv) { struct plegma::site src({0, 0, 0, 0}); plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); - pi0Loop.initialize_diagram(gscatts_pi, "stocRead1_" + std::to_string(num_stoc) + "/dn"); + pi0Loop.initialize_diagram(gscatts_pi, "stocRead1_" + std::to_string(num_stoc) + "/up"); plegma::PLEGMA_Vector stocSrc, stocProp; plegma::PLEGMA_Vector stocSrcD, stocPropD; @@ -341,6 +360,34 @@ int main(int argc, char **argv) pi0Loop.writeHDF5(outfilename); } } + else if (caseToDo == "insertion") + { + struct plegma::site src({0, 0, 0, 0}); + plegma::PLEGMA_ScattCorrelator insertLoop(src, momList3pt_pc); + insertLoop.initialize_diagram(gscatts_c, "stoc" + std::to_string(seed_stoc) + "_" + std::to_string(num_stoc) + "/up"); + + plegma::PLEGMA_Vector stocSrcUnsmeared, stocPropUnsmeared; + stocSrcUnsmeared.randInit(seed_stoc); + for (int i = 0; i < num_stoc; i++) + { + plegma::PLEGMA_Vector stocSrc, stocProp; + + stocSrcUnsmeared.stochastic_Z(4); + for (int tc = 0; tc < HGC_totalL[3]; tc++) + { + plegma::PLEGMA_Vector aux, aux2; + aux.absorbTimeslice(stocSrcUnsmeared, tc, true); + solve0(aux2, aux, u); + stocPropUnsmeared.absorbTimeslice(aux2, tc, tc == 0 ? true : false); + } + stocSrc.copy(stocSrcUnsmeared); + stocProp.copy(stocPropUnsmeared); + insertLoop.Loop_diagrams(stocProp, stocSrc, i == 0 ? false : true); + } + insertLoop.normalize_nstoch(num_stoc); + std::string outfilename = outdiagramPrefix + confnumber + "_insertLoop"; + insertLoop.writeHDF5(outfilename); + } else { PLEGMA_printf("%s not supported", caseToDo.c_str()); From 230c470a5960b782aebaa31c3f69ffbd77871ca0 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Tue, 25 Apr 2023 19:24:45 +0200 Subject: [PATCH 064/168] loops with samples saved --- plegma/QuarkLoops_pi0_insertion.cpp | 100 ++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 4 deletions(-) diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index c900aae8..2a175a29 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -15,8 +15,6 @@ It is recommended to backup data files before a new run that increases the stati in case of the possibility that the new run destroys the existed data file. */ - - #include #include std::vector runtime; @@ -295,7 +293,73 @@ int main(int argc, char **argv) * Main * ******************************************************/ - if (caseToDo == "pi0") + if (caseToDo == "pi0-saveSample") + { + if (readStoc == 0) + { + struct plegma::site src({0, 0, 0, 0}); + plegma::PLEGMA_Vector stocSrcUnsmeared; + stocSrcUnsmeared.randInit(seed_stoc); + for (int i = 0; i < num_stoc; i++) + { + plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); + pi0Loop.initialize_diagram(gscatts_pi, "stoc" + std::to_string(seed_stoc) + "id" + std::to_string(i) + "_1" + "/up"); + + plegma::PLEGMA_Vector stocSrc, stocProp; + plegma::PLEGMA_Vector stocPropSmeared; + + stocSrcUnsmeared.stochastic_Z(4); + plegma::PLEGMA_Vector stocSrcSmeared; + stocSrcSmeared.gaussianSmearing(stocSrcUnsmeared, smearedGauge, nsmearGauss, alphaGauss); + for (int tc = 0; tc < HGC_totalL[3]; tc++) + { + plegma::PLEGMA_Vector aux, stocPropUnsmeared; + plegma::PLEGMA_Vector3D aux3D, aux3D2; + aux.absorbTimeslice(stocSrcSmeared, tc, true); + solve0(stocPropUnsmeared, aux, u); + aux3D.absorb(stocPropUnsmeared, tc); + + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, tc); + aux3D2.gaussianSmearing(aux3D, smearedGauge3D, nsmearGauss, alphaGauss); + + stocPropSmeared.absorb(aux3D2, tc, tc == 0 ? true : false); + } + stocSrc.copy(stocSrcUnsmeared); // Note: smearing a prop Q gives SQS, with stoc, it's SQS\xi \xi^\dag, so no smearing is needed for the src. + stocProp.copy(stocPropSmeared); + pi0Loop.Loop_diagrams(stocProp, stocSrc, false); + + std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + pi0Loop.writeHDF5(outfilename); + } + } + else if (readStoc == 1) + { + struct plegma::site src({0, 0, 0, 0}); + for (int i = 0; i < num_stoc; i++) + { + plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); + pi0Loop.initialize_diagram(gscatts_pi, "stocRead1id" + std::to_string(i) + "_1" + "/up"); + + plegma::PLEGMA_Vector stocSrc, stocProp; + plegma::PLEGMA_Vector stocSrcD, stocPropD; + + std::string inputfilename = readStocPath + "globalTfulltimedilution_source_nstoch" + std::to_string(i) + "_" + confnumber; + PLEGMA_printf("Read stochastic source from: %s\n", inputfilename.c_str()); + stocSrcD.readFile(inputfilename, LIME_FORMAT); + inputfilename = readStocPath + "globalTfulltimedilution_propagator_nstoch" + std::to_string(i) + "_" + confnumber; + PLEGMA_printf("Read stochastic propagator from: %s\n", inputfilename.c_str()); + stocProp.readFile(inputfilename, LIME_FORMAT); + + stocSrc.copy(stocSrcD); + pi0Loop.Loop_diagrams(stocProp, stocSrc, false); + + std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + pi0Loop.writeHDF5(outfilename); + } + } + } + else if (caseToDo == "pi0-saveAverage") { if (readStoc == 0) { @@ -360,7 +424,35 @@ int main(int argc, char **argv) pi0Loop.writeHDF5(outfilename); } } - else if (caseToDo == "insertion") + else if (caseToDo == "insertion-saveSample") + { + struct plegma::site src({0, 0, 0, 0}); + plegma::PLEGMA_Vector stocSrcUnsmeared, stocPropUnsmeared; + stocSrcUnsmeared.randInit(seed_stoc); + for (int i = 0; i < num_stoc; i++) + { + plegma::PLEGMA_ScattCorrelator insertLoop(src, momList3pt_pc); + insertLoop.initialize_diagram(gscatts_c, "stoc" + std::to_string(seed_stoc) + "id" + std::to_string(i) + "_" + std::to_string(num_stoc) + "/up"); + + plegma::PLEGMA_Vector stocSrc, stocProp; + + stocSrcUnsmeared.stochastic_Z(4); + for (int tc = 0; tc < HGC_totalL[3]; tc++) + { + plegma::PLEGMA_Vector aux, aux2; + aux.absorbTimeslice(stocSrcUnsmeared, tc, true); + solve0(aux2, aux, u); + stocPropUnsmeared.absorbTimeslice(aux2, tc, tc == 0 ? true : false); + } + stocSrc.copy(stocSrcUnsmeared); + stocProp.copy(stocPropUnsmeared); + insertLoop.Loop_diagrams(stocProp, stocSrc, false); + + std::string outfilename = outdiagramPrefix + confnumber + "_insertLoop"; + insertLoop.writeHDF5(outfilename); + } + } + else if (caseToDo == "insertion-saveAverage") { struct plegma::site src({0, 0, 0, 0}); plegma::PLEGMA_ScattCorrelator insertLoop(src, momList3pt_pc); From 95af29e7f6e2c0fc3e7b9d06d17c007e23e34b9c Mon Sep 17 00:00:00 2001 From: Jacopo Tarello Date: Mon, 1 May 2023 09:57:03 +0200 Subject: [PATCH 065/168] Change in the absorb function; defined a direction of the staple in the kernel; 2 codes for the computation of TMDPDFs, one of them optimized (new) --- lib/PLEGMA_Vector.cu | 4 +- lib/kernels/PLEGMA_threep_staple.cu | 4 +- plegma/CMakeLists.txt | 45 +- plegma/TMDPDFs_mesons_Juwels.cpp | 865 +++++++++++++++++++++++++ plegma/new_TMDPDFs_mesons_Juwels.cpp | 936 +++++++++++++++++++++++++++ 5 files changed, 1809 insertions(+), 45 deletions(-) create mode 100644 plegma/TMDPDFs_mesons_Juwels.cpp create mode 100644 plegma/new_TMDPDFs_mesons_Juwels.cpp diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 548ebde7..7085cdd1 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -204,14 +204,14 @@ void PLEGMA_Vector::absorb(PLEGMA_Vector3D &vec, int global_it, bo } for(int mu = 0 ; mu < N_SPINS ; mu++) for(int c1 = 0 ; c1 < N_COLS ; c1++){ - //qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); + qudaMemset(this->d_elem + mu*N_COLS*V4*2 + c1*V4*2, 0, V4*2*sizeof(Float)); if(is_myIt){ pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2 + my_it*V3*2); pointer_src = (vec.D_elem() + mu*N_COLS*V3*2 + c1*V3*2); PLEGMA_memcpy(pointer_dst, pointer_src, V3*2 * sizeof(Float), qudaMemcpyDeviceToDevice); } } - //comm_barrier(); + comm_barrier(); checkQudaError(); } diff --git a/lib/kernels/PLEGMA_threep_staple.cu b/lib/kernels/PLEGMA_threep_staple.cu index 923f27ef..4892e595 100644 --- a/lib/kernels/PLEGMA_threep_staple.cu +++ b/lib/kernels/PLEGMA_threep_staple.cu @@ -38,8 +38,8 @@ __global__ void threep_staple_device(Float2* block2, su3Tx.get(su3,vid); bool notZfac=(mu<0) && (nu<0) && (c1<0) && (c2<0); - if(notZfac) partial_trace_mul_Prop_G_Prop(R,prop1,prop2,su3); - else open_mul_Prop_G_Prop(R,prop1,prop2,su3,mu,nu,c1,c2); + if(notZfac) partial_trace_mul_Prop_G_Prop(R,prop1,prop2,su3); + else open_mul_Prop_G_Prop(R,prop1,prop2,su3,mu,nu,c1,c2); for(int iop = 0; iop < listGammas.size; iop++){ int opId=listGammas.array[iop]; diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index c2a9c252..79927a93 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -46,21 +46,9 @@ target_link_libraries(Calc_2pt ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt_wilson Calc_2pt_wilson.cpp) target_link_libraries(Calc_2pt_wilson ${PLEGMA_LIBS}) -cuda_add_executable(Tetraquark Tetraquark.cpp) -target_link_libraries(Tetraquark ${PLEGMA_LIBS}) - -cuda_add_executable(TetraquarkBCUD TetraquarkBCUD.cpp) -target_link_libraries(TetraquarkBCUD ${PLEGMA_LIBS}) - cuda_add_executable(TestFrame EXCLUDE_FROM_ALL TestFrame.cpp) target_link_libraries(TestFrame ${PLEGMA_LIBS}) -cuda_add_executable(StochasticTetraquark StochasticTetraquark.cpp) -target_link_libraries(StochasticTetraquark ${PLEGMA_LIBS}) - -cuda_add_executable(StochasticTetraquarkBCUD StochasticTetraquarkBCUD.cpp) -target_link_libraries(StochasticTetraquarkBCUD ${PLEGMA_LIBS}) - cuda_add_executable(ComputeLightStochProp ComputeLightStochProp.cpp) target_link_libraries(ComputeLightStochProp ${PLEGMA_LIBS}) @@ -70,15 +58,6 @@ target_link_libraries(ComputeLightPointProp ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt_charmonium Calc_2pt_charmonium.cpp) target_link_libraries(Calc_2pt_charmonium ${PLEGMA_LIBS}) -cuda_add_executable(PDFs_nucleon PDFs_nucleon.cpp) -target_link_libraries(PDFs_nucleon ${PLEGMA_LIBS}) - -cuda_add_executable(TMDPDFs_nucleon TMDPDFs_nucleon.cpp) -target_link_libraries(TMDPDFs_nucleon ${PLEGMA_LIBS}) - -cuda_add_executable(PDFs_qgq_nucleon PDFs_qgq_nucleon.cpp) -target_link_libraries(PDFs_qgq_nucleon ${PLEGMA_LIBS}) - cuda_add_executable(nucleon_2pt_3pt nucleon_2pt_3pt.cpp) target_link_libraries(nucleon_2pt_3pt ${PLEGMA_LIBS}) @@ -103,10 +82,6 @@ target_link_libraries(Dilution ${PLEGMA_LIBS}) cuda_add_executable(testLinksSmearings EXCLUDE_FROM_ALL testLinksSmearings.cpp) target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) -cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) -target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) - - cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) @@ -128,12 +103,6 @@ target_link_libraries(LowModesCalc ${PLEGMA_LIBS}) cuda_add_executable(MG_tuner MG_tuner.cpp) target_link_libraries(MG_tuner ${PLEGMA_LIBS}) -cuda_add_executable(benchmark benchmark.cpp) -target_link_libraries(benchmark ${PLEGMA_LIBS}) - -cuda_add_executable(TMDWFs_mesons TMDWFs_mesons.cpp) -target_link_libraries(TMDWFs_mesons ${PLEGMA_LIBS}) - cuda_add_executable(quark_rms EXCLUDE_FROM_ALL quark_rms.cpp) target_link_libraries(quark_rms ${PLEGMA_LIBS}) @@ -149,17 +118,11 @@ target_link_libraries(Zfac ${PLEGMA_LIBS}) cuda_add_executable(ZfacStaple ZfacStaple.cpp) target_link_libraries(ZfacStaple ${PLEGMA_LIBS}) -cuda_add_executable(SoftFunction SoftFunction.cpp) -target_link_libraries(SoftFunction ${PLEGMA_LIBS}) - -cuda_add_executable(SoftFunctionWall SoftFunctionWall.cpp) -target_link_libraries(SoftFunctionWall ${PLEGMA_LIBS}) - -cuda_add_executable(WallSourceNucleon WallSourceNucleon.cpp) -target_link_libraries(WallSourceNucleon ${PLEGMA_LIBS}) +cuda_add_executable(TMDPDFs_mesons_Juwels TMDPDFs_mesons_Juwels.cpp) +target_link_libraries(TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) -cuda_add_executable(TMDPDFs_pion TMDPDFs_pion.cpp) -target_link_libraries(TMDPDFs_pion ${PLEGMA_LIBS}) +cuda_add_executable(new_TMDPDFs_mesons_Juwels new_TMDPDFs_mesons_Juwels.cpp) +target_link_libraries(new_TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) if (PLEGMA_SCATTERING_CONTRACTIONS) cuda_add_executable(testScattReductions EXCLUDE_FROM_ALL testScattReductions.cpp) diff --git a/plegma/TMDPDFs_mesons_Juwels.cpp b/plegma/TMDPDFs_mesons_Juwels.cpp new file mode 100644 index 00000000..951c0155 --- /dev/null +++ b/plegma/TMDPDFs_mesons_Juwels.cpp @@ -0,0 +1,865 @@ +#include +#include + +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +using namespace plegma; +using namespace quda; + +int main(int argc, char **argv) +{ + + static std::vector listOpt = {"verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", + "nsrc", "src-filename", "maxQsq", "twop-filename","threep-filename", "corr-file-format", + "corr-space", "tSinks","xiMomSm","gammas"}; + + initializeOptions(argc, argv, true, listOpt); + + if(mu<0){ + mu *= -1.0; + } + + double mu_ud = mu; + + double mu_s; + HGC_options->set("mu-s", "mu for strange quark", verbosity, mu_s); + + int L_LEN = 0; + HGC_options->set("l-len", "length of l", verbosity, L_LEN); + + int L_DIR = 2; + HGC_options->set("l-dir", "direction of l", verbosity, L_DIR); + + int B_LEN = 0; + HGC_options->set("b-len", "length of b", verbosity, B_LEN); + + int Z_LEN = 0; + HGC_options->set("z-len", "length of z", verbosity, Z_LEN); + + int nStout; + HGC_options->set("n_stout", "n parameter stout smearing", verbosity, nStout); + + double rhoStout; + HGC_options->set("rho_stout", "Rho parameter stout smearing", verbosity, rhoStout); + + bool calc3pt = true; + HGC_options->set("calc3pt", "If true then the 3pt function is computed", verbosity, calc3pt); + + std::string conf; + HGC_options->set("conf", "configuration", verbosity, conf); + + std::string twop_filename_1; + HGC_options->set("twop-filename-1", "2p filename for kaon +", verbosity, twop_filename_1); + + std::string threep_filename_1; + HGC_options->set("threep-filename-1", "3p filename for kaon +", verbosity, threep_filename_1); + + std::vector sinkMom(4); + HGC_options->set("sinkMom", "momentum at the sink", verbosity, sinkMom); + + initializePLEGMA(); + + int B_DIR1, B_DIR2; + switch(L_DIR) { + case 0: + B_DIR1 = 1; + B_DIR2 = 2; + break; + case 1: + B_DIR1 = 0; + B_DIR2 = 2; + break; + case 2: + B_DIR1 = 0; + B_DIR2 = 1; + break; + default: + PLEGMA_error("The direction of the WIlson line has to be smaller than 3"); + } + + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true, QUDA_WILSON_LINKS); + plaqQuda(); + + // Smearing + PLEGMA_Gauge smearedGauge; + PLEGMA_Gauge smearedGaugeMn; + smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + smearedGaugeMn.copy(smearedGauge); + + //Momentum smearing: put the momentum phase to smeared gauge field + std::complex momSmScale[N_DIMS]; + std::complex momSmScaleMn[N_DIMS]; + std::complex I(0,1); + for(int i = 0 ; i < N_DIMS; i++){ + momSmScale[i] = std::exp(-(xiMomSm*2.*PI*sinkMom[i]/HGC_totalL[i])*I); + momSmScaleMn[i] = std::exp(+(xiMomSm*2.*PI*sinkMom[i]/HGC_totalL[i])*I); + } + smearedGauge.scaleDirWise(momSmScale); + smearedGaugeMn.scaleDirWise(momSmScaleMn); + + // Extracting the spacial sink momentum from the sink 4-momentum + std::vector sinkMom_3D(3); + std::copy(sinkMom.begin(),sinkMom.begin()+3,sinkMom_3D.begin()); + + // ensuring mu positive + if(mu<0) mu*=-1.; + updateOptions(LIGHT); + TIME(QUDA_solver *solver = new QUDA_solver(mu)); + + PLEGMA_Vector vectorIn; + PLEGMA_Vector vectorOut; + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxD21; + PLEGMA_Vector vectorAuxF; + + PLEGMA_Propagator *propUP_smearplus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propUP_smearminus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propST_smearplus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propST_smearminus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_pionUPplusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_pionUPminusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonUPplusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonUPminusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonSTplusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonSTminusmom = new PLEGMA_Propagator(BOTH); + + PLEGMA_Propagator *propF_UPsmearplus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_UPsmearminus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearplus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearminus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_UPsmearplus_2 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_UPsmearminus_2 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearplus_2 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearminus_2 = new PLEGMA_Propagator(BOTH); + + PLEGMA_Propagator *propIn = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propExchange = nullptr; + + PLEGMA_Propagator3D propUP3D_smearplus; + PLEGMA_Propagator3D propUP3D_smearminus; + PLEGMA_Propagator3D propST3D_smearplus; + PLEGMA_Propagator3D propST3D_smearminus; + + PLEGMA_Gauge gaugeWL; + gaugeWL.copy(gauge); + gaugeWL.stoutSmearing(gaugeWL,nStout,rhoStout,3); + + PLEGMA_Su3field su3; + PLEGMA_Su3field *su3_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_2_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_2_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_3_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_3_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_4_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_4_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_2_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_3_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_2_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_3_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_4_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_4_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_temp = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_temp1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_temp2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_in = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_exchange = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field tmp(BOTH); + + for(int isource=0;isource& prop_SL, double run_mu, WHICHFLAVOR fl,PLEGMA_Gauge& smeared_Gauge, int nsmear) { + // ensuring mu value + if(mu != run_mu) { + //updateOptions(fl); + mu = run_mu; + solver->UpdateSolver(); + } + + PLEGMA_Vector vectorIn1; + PLEGMA_Vector vectorOut1; + PLEGMA_Vector vectorAuxD1; + PLEGMA_Vector vectorAuxF1; + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxD1.pointSource(sourcePositions[isource], isc/3, isc%3, DEVICE); + vectorIn1.gaussianSmearing(vectorAuxD1, smeared_Gauge, nsmear, alphaGauss); + PLEGMA_printf("Going to invert for component %d\n", isc); + solver->solve(vectorOut1, vectorIn1); + vectorAuxF1.copy(vectorOut1); + prop_SL.absorb(vectorAuxF1, isc/3, isc%3); + } + }; + + TIME(computePropagator(*propUP_smearplus, mu_ud, LIGHT, smearedGauge ,nsmearGauss)); + TIME(computePropagator(*propUP_smearminus , mu_ud, LIGHT, smearedGaugeMn ,nsmearGauss)); + TIME(computePropagator(*propST_smearplus, mu_s, STRANGE, smearedGauge ,nsmearGauss)); + TIME(computePropagator(*propST_smearminus , mu_s, STRANGE, smearedGaugeMn ,nsmearGauss)); + + for(int ts=0;ts corrThrpWL(corr_space, sourcePositions[isource], 0, tSinks[ts]+1); + + int signPer = (tSinks[ts] + sourcePositions[isource][3]) >= HGC_totalL[3] ? -1 : +1; + int global_fixSinkTime = (tSinks[ts] + sourcePositions[isource][3])%HGC_totalL[3]; + int my_fixSinkTime = global_fixSinkTime - HGC_procPosition[3] * HGC_localL[3]; + bool is_myST = (my_fixSinkTime >= 0) && ( my_fixSinkTime < HGC_localL[3] ); + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propUP_smearplus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGauge , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propUP3D_smearplus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propUP_smearminus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGaugeMn , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propUP3D_smearminus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propST_smearplus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGauge , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propST3D_smearplus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propST_smearminus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGaugeMn , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propST3D_smearminus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + if(calc3pt){ + + propUP_smearplus->unload(); + propUP_smearminus->unload(); + propST_smearplus->unload(); + propST_smearminus->unload(); + + auto computeSequentialPropagator = [&](PLEGMA_Propagator& seqPropOUT,PLEGMA_Propagator3D& prop1, double run_mu, WHICHFLAVOR fl, + PLEGMA_Gauge& smeared_Gauge, int nsmear, int sign_mom) { + + PLEGMA_Vector3D vectorAux3D; + PLEGMA_Vector vectorAuxF3; + PLEGMA_Vector vectorAuxD3; + PLEGMA_Vector vectorIn3; + PLEGMA_Vector vectorOut3; + + for(int nu = 0 ; nu < 4 ; nu++) + for(int c2 = 0 ; c2 < 3 ; c2++){ + vectorAux3D.absorb(prop1,nu,c2); + vectorAux3D.mulMomentumPhases(sinkMom,sign_mom); //put momentum at the sink + std::complex Isingle(0,1); + float phase = 2.*PI*(((float) sinkMom[0] * sourcePositions[isource][0])/HGC_totalL[0] + + ((float)sinkMom[1] * sourcePositions[isource][1])/HGC_totalL[1] + + ((float)sinkMom[2] * sourcePositions[isource][2])/HGC_totalL[2]); + vectorAux3D.cscale(std::exp(-sign_mom*phase*Isingle)); // put momentum from the point source + vectorAux3D.apply_gamma(G5); + vectorAuxF3.absorb(vectorAux3D, global_fixSinkTime); + vectorAuxD3.copy(vectorAuxF3); + vectorIn3.gaussianSmearing(vectorAuxD3,smeared_Gauge, nsmear, alphaGauss); + // check if we need to normalize the seqsource for mix precision solver + if(mu!=run_mu) { + //updateOptions(fl); + mu=run_mu; + solver->UpdateSolver(); + } + double norm = vectorIn3.norm(); + vectorIn3.cscale(1/norm); + solver->solve(vectorOut3, vectorIn3); + vectorOut3.cscale(norm); + vectorAuxF3.copy(vectorOut3); + seqPropOUT.absorb(vectorAuxF3, nu, c2); + + } + seqPropOUT.apply_gamma(G5); + seqPropOUT.conjugate(); + + }; + + TIME(computeSequentialPropagator(*seqProp_pionUPplusmom, propUP3D_smearminus, -mu_ud, LIGHT, smearedGauge, nsmearGauss, +1)); + TIME(computeSequentialPropagator(*seqProp_pionUPminusmom, propUP3D_smearplus, -mu_ud, LIGHT, smearedGaugeMn, nsmearGauss, -1)); + TIME(computeSequentialPropagator(*seqProp_kaonUPplusmom, propST3D_smearminus, -mu_ud, LIGHT, smearedGauge, nsmearGauss, +1)); + TIME(computeSequentialPropagator(*seqProp_kaonUPminusmom, propST3D_smearplus, -mu_ud, LIGHT, smearedGaugeMn, nsmearGauss, -1)); + TIME(computeSequentialPropagator(*seqProp_kaonSTplusmom, propUP3D_smearminus, mu_s, STRANGE, smearedGauge, nsmearGauss, +1)); + TIME(computeSequentialPropagator(*seqProp_kaonSTminusmom, propUP3D_smearplus, mu_s, STRANGE, smearedGaugeMn, nsmearGauss, -1)); + + propF_UPsmearplus_1->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_1->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_1->copy(*propST_smearplus,BOTH); + propF_STsmearminus_1->copy(*propST_smearminus,BOTH); + propF_UPsmearplus_2->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_2->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_2->copy(*propST_smearplus,BOTH); + propF_STsmearminus_2->copy(*propST_smearminus,BOTH); + + WL_1->setUnit( (std::vector) {0,4,8}); + WL_2_1->setUnit( (std::vector) {0,4,8}); + WL_3_1->setUnit( (std::vector) {0,4,8}); + WL_4_1->setUnit( (std::vector) {0,4,8}); + WL_2_2->setUnit( (std::vector) {0,4,8}); + WL_3_2->setUnit( (std::vector) {0,4,8}); + WL_4_2->setUnit( (std::vector) {0,4,8}); + + //absorb the gauge directions for building the 4 branches + su3_1->absorbDir_device(gaugeWL, L_DIR); + su3_2_1->absorbDir_device(gaugeWL, B_DIR1); + su3_2_2->absorbDir_device(gaugeWL, B_DIR2); + su3_3_1->absorbDir_device(gaugeWL, L_DIR); + su3_3_2->absorbDir_device(gaugeWL, L_DIR); + su3_4_1->absorbDir_device(gaugeWL, L_DIR); + su3_4_2->absorbDir_device(gaugeWL, L_DIR); + + size_t bval, zval; + bool WL2_rev = true; + int WL2_dir = 0; + bool WL4_rev = true; + int WL4_dir = 1; + + for(int l = 0; l <= L_LEN; l++) {//loop over values of L, building "1" and "3" + + if(l != 0) { + + WL_1->wilsonLineUpdate(*su3_1, tmp, 4 + L_DIR); + WL_3_1->wilsonLineUpdate(*su3_3_1, tmp, 4 + L_DIR, true); + WL_3_2->wilsonLineUpdate(*su3_3_2, tmp, 4 + L_DIR, true); + + su3_exchange = su3_in; su3_in = su3_2_1; su3_2_1 = su3_exchange; + su3_2_1->shift(*su3_in, 4 + L_DIR); + + su3_exchange = su3_in; su3_in = su3_2_2; su3_2_2 = su3_exchange; + su3_2_2->shift(*su3_in, 4 + L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_1; WL_2_1 = su3_exchange; + WL_2_1->shift(*su3_in, 4 + L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_2; WL_2_2 = su3_exchange; + WL_2_2->shift(*su3_in, 4 + L_DIR); + + } + + if(WL2_rev) { + WL2_rev = false; + WL2_dir = 1; + }else { + WL2_rev = true; + WL2_dir = 0; + } + + for(int b = 0; b <= B_LEN; b++) {//loop over values of B, building "2" + + if(b != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + WL_2_1->wilsonLineUpdate(*su3_2_1, tmp, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + WL_2_2->wilsonLineUpdate(*su3_2_2, tmp, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_3_1; su3_3_1 = su3_exchange; + su3_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_3_2; su3_3_2 = su3_exchange; + su3_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_4_1; su3_4_1 = su3_exchange; + su3_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_4_2; su3_4_2 = su3_exchange; + su3_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_3_1; WL_3_1 = su3_exchange; + WL_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_3_2; WL_3_2 = su3_exchange; + WL_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_4_1; WL_4_1 = su3_exchange; + WL_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_4_2; WL_4_2 = su3_exchange; + WL_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + } + + WL_temp->UxU(*WL_1, *WL_2_1); + WL_temp1->UxU(*WL_temp, *WL_3_1); + + WL_temp->UxU(*WL_1, *WL_2_2); + WL_temp2->UxU(*WL_temp, *WL_3_2); + + if(WL4_rev) { + WL4_rev = false; + WL4_dir = 0; + }else { + WL4_rev = true; + WL4_dir = 1; + } + + for(int z = 0; z <= Z_LEN; z++) {//loop over values of Z, building "4" + + if(z != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_1->wilsonLineUpdate(*su3_4_1, tmp, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_2->wilsonLineUpdate(*su3_4_2, tmp, 4*WL4_dir + L_DIR); + + } + + WL1->UxU(*WL_temp1, *WL_4_1); + WL2->UxU(*WL_temp2, *WL_4_2); + + if(WL2_rev) bval = B_LEN - b; + else bval = b; + + if(WL4_rev) zval = Z_LEN - z; + else zval = z; + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPplusmom, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPplusmom, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPminusmom, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPminusmom, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPplusmom, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPplusmom, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPminusmom, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPminusmom, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTplusmom, *propF_STsmearplus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTplusmom, *propF_STsmearplus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTminusmom, *propF_STsmearminus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTminusmom, *propF_STsmearminus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + }//loop over values of Z, building "4" + }//loop over values of B, building "2" + }//loop over values of L, building "1" and "3" + + propF_UPsmearplus_1->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_1->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_1->copy(*propST_smearplus,BOTH); + propF_STsmearminus_1->copy(*propST_smearminus,BOTH); + propF_UPsmearplus_2->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_2->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_2->copy(*propST_smearplus,BOTH); + propF_STsmearminus_2->copy(*propST_smearminus,BOTH); + + //now repeat the same thing only going in negative boost direction for the staple + //set the 4 branches as unit + WL_1->setUnit( (std::vector) {0,4,8}); + WL_2_1->setUnit( (std::vector) {0,4,8}); + WL_3_1->setUnit( (std::vector) {0,4,8}); + WL_4_1->setUnit( (std::vector) {0,4,8}); + WL_2_2->setUnit( (std::vector) {0,4,8}); + WL_3_2->setUnit( (std::vector) {0,4,8}); + WL_4_2->setUnit( (std::vector) {0,4,8}); + + //absorb the gauge directions for building the 4 branches + su3_1->absorbDir_device(gaugeWL, L_DIR); + su3_2_1->absorbDir_device(gaugeWL, B_DIR1); + su3_2_2->absorbDir_device(gaugeWL, B_DIR2); + su3_3_1->absorbDir_device(gaugeWL, L_DIR); + su3_3_2->absorbDir_device(gaugeWL, L_DIR); + su3_4_1->absorbDir_device(gaugeWL, L_DIR); + su3_4_2->absorbDir_device(gaugeWL, L_DIR); + + WL2_rev = true; + WL2_dir = 0; + WL4_rev = true; + WL4_dir = 0; + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4 + L_DIR); + + WL_4_1->wilsonLineUpdate(*su3_4_1, tmp, 4 + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4 + L_DIR); + + WL_4_2->wilsonLineUpdate(*su3_4_2, tmp, 4 + L_DIR); + + for(int l = 0; l <= L_LEN; l++) {//loop over values of L, building "1" and "3" + + if(l != 0) { + + WL_1->wilsonLineUpdate(*su3_1, tmp, L_DIR); + WL_3_1->wilsonLineUpdate(*su3_3_1, tmp, L_DIR, true); + WL_3_2->wilsonLineUpdate(*su3_3_2, tmp, L_DIR, true); + + su3_exchange = su3_in; su3_in = su3_2_1; su3_2_1 = su3_exchange; + su3_2_1->shift(*su3_in, L_DIR); + + su3_exchange = su3_in; su3_in = su3_2_2; su3_2_2 = su3_exchange; + su3_2_2->shift(*su3_in, L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_1; WL_2_1 = su3_exchange; + WL_2_1->shift(*su3_in, L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_2; WL_2_2 = su3_exchange; + WL_2_2->shift(*su3_in, L_DIR); + + } + + if(WL2_rev) { + WL2_rev = false; + WL2_dir = 1; + }else { + WL2_rev = true; + WL2_dir = 0; + } + + for(int b = 0; b <= B_LEN; b++) {//loop over values of B, building "2" + + if(b != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + WL_2_1->wilsonLineUpdate(*su3_2_1, tmp, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + WL_2_2->wilsonLineUpdate(*su3_2_2, tmp, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_3_1; su3_3_1 = su3_exchange; + su3_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_3_2; su3_3_2 = su3_exchange; + su3_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_4_1; su3_4_1 = su3_exchange; + su3_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_4_2; su3_4_2 = su3_exchange; + su3_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_3_1; WL_3_1 = su3_exchange; + WL_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_3_2; WL_3_2 = su3_exchange; + WL_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_4_1; WL_4_1 = su3_exchange; + WL_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_4_2; WL_4_2 = su3_exchange; + WL_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + } + + WL_temp->UxU(*WL_1, *WL_2_1); + WL_temp1->UxU(*WL_temp, *WL_3_1); + + WL_temp->UxU(*WL_1, *WL_2_2); + WL_temp2->UxU(*WL_temp, *WL_3_2); + + if(WL4_rev) { + WL4_rev = false; + WL4_dir = 1; + }else { + WL4_rev = true; + WL4_dir = 0; + } + + for(int z = 0; z <= Z_LEN-1; z++) {//loop over values of Z, building "4" + + if(z != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_1->wilsonLineUpdate(*su3_4_1, tmp, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_2->wilsonLineUpdate(*su3_4_2, tmp, 4*WL4_dir + L_DIR); + + } + + WL1->UxU(*WL_temp1, *WL_4_1); + WL2->UxU(*WL_temp2, *WL_4_2); + + if(WL2_rev) bval = B_LEN - b; + else bval = b; + + if(WL4_rev) zval = Z_LEN - z; + else zval = 1 + z; + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPplusmom, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPplusmom, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPminusmom, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_pionUPminusmom, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPplusmom, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPplusmom, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPminusmom, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonUPminusmom, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTplusmom, *propF_STsmearplus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTplusmom, *propF_STsmearplus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTminusmom, *propF_STsmearminus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(*seqProp_kaonSTminusmom, *propF_STsmearminus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + }//loop over values of Z, building "4" + }//loop over values of B, building "2" + }//loop over values of L, building "1" and "3" + } + } + + propUP_smearplus->load(); + propUP_smearminus->load(); + propST_smearplus->load(); + propST_smearminus->load(); + + for(int nu = 0 ; nu < 4 ; nu++) + for(int c2 = 0 ; c2 < 3 ; c2++){ + vectorAuxF.absorb(*propUP_smearplus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propUP_smearplus->absorb(vectorAuxF, nu, c2); + + vectorAuxF.absorb(*propUP_smearminus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGaugeMn, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propUP_smearminus->absorb(vectorAuxF, nu, c2); + + vectorAuxF.absorb(*propST_smearplus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propST_smearplus->absorb(vectorAuxF, nu, c2); + + vectorAuxF.absorb(*propST_smearminus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGaugeMn, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propST_smearminus->absorb(vectorAuxF, nu, c2); + + } + + propUP_smearplus->rotateToPhysicalBase_device(+1); + propUP_smearminus->rotateToPhysicalBase_device(+1); + propST_smearplus->rotateToPhysicalBase_device(+1); + propST_smearminus->rotateToPhysicalBase_device(+1); + propUP_smearplus->applyBoundaries_device(sourcePositions[isource][3]); + propUP_smearminus->applyBoundaries_device(sourcePositions[isource][3]); + propST_smearplus->applyBoundaries_device(sourcePositions[isource][3]); + propST_smearminus->applyBoundaries_device(sourcePositions[isource][3]); + + PLEGMA_Correlator corr(corr_space, sourcePositions[isource]); + corr.setFixMomVec(sinkMom_3D); + + TIME(corr.contractMesonsNew(*propUP_smearplus, *propUP_smearminus)); + corr.writeFile((twop_filename+conf).c_str(), corr_file_format); + + TIME(corr.contractMesonsNew(*propUP_smearplus, *propST_smearminus)); + corr.writeFile((twop_filename_1+conf).c_str(), corr_file_format); + + } + + delete propUP_smearplus; + delete propUP_smearminus; + delete propST_smearplus; + delete propST_smearminus; + delete propIn; + + delete seqProp_pionUPplusmom; + delete seqProp_pionUPminusmom; + delete seqProp_kaonUPplusmom; + delete seqProp_kaonUPminusmom; + delete seqProp_kaonSTplusmom; + delete seqProp_kaonSTminusmom; + + delete su3_1; + delete su3_2_1; + delete su3_2_2; + delete su3_3_1; + delete su3_3_2; + delete su3_4_1; + delete su3_4_2; + delete WL_1; + delete WL_2_1; + delete WL_3_1; + delete WL_2_2; + delete WL_3_2; + delete WL_4_1; + delete WL_4_2; + delete WL_temp; + delete WL_temp1; + delete WL_temp2; + delete su3_in; + delete WL1; + delete WL2; + + delete solver; + + finalize(); + return 0; +} diff --git a/plegma/new_TMDPDFs_mesons_Juwels.cpp b/plegma/new_TMDPDFs_mesons_Juwels.cpp new file mode 100644 index 00000000..f556143d --- /dev/null +++ b/plegma/new_TMDPDFs_mesons_Juwels.cpp @@ -0,0 +1,936 @@ +#include +#include + +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +using namespace plegma; +using namespace quda; + +int main(int argc, char **argv) +{ + + static std::vector listOpt = {"verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", + "nsrc", "src-filename", "maxQsq", "twop-filename","threep-filename", "corr-file-format", + "corr-space", "tSinks","xiMomSm","gammas"}; + + initializeOptions(argc, argv, true, listOpt); + + if(mu<0){ + mu *= -1.0; + } + + double mu_ud = mu; + + double mu_s; + HGC_options->set("mu-s", "mu for strange quark", verbosity, mu_s); + + int L_LEN = 0; + HGC_options->set("l-len", "length of l", verbosity, L_LEN); + + int L_DIR = 2; + HGC_options->set("l-dir", "direction of l", verbosity, L_DIR); + + int B_LEN = 0; + HGC_options->set("b-len", "length of b", verbosity, B_LEN); + + int Z_LEN = 0; + HGC_options->set("z-len", "length of z", verbosity, Z_LEN); + + int nStout; + HGC_options->set("n_stout", "n parameter stout smearing", verbosity, nStout); + + double rhoStout; + HGC_options->set("rho_stout", "Rho parameter stout smearing", verbosity, rhoStout); + + bool calc3pt = true; + HGC_options->set("calc3pt", "If true then the 3pt function is computed", verbosity, calc3pt); + + std::string conf; + HGC_options->set("conf", "configuration", verbosity, conf); + + std::string twop_filename_1; + HGC_options->set("twop-filename-1", "2p filename for kaon +", verbosity, twop_filename_1); + + std::string threep_filename_1; + HGC_options->set("threep-filename-1", "3p filename for kaon +", verbosity, threep_filename_1); + + std::vector sinkMom(4); + HGC_options->set("sinkMom", "momentum at the sink", verbosity, sinkMom); + + initializePLEGMA(); + + int B_DIR1, B_DIR2; + switch(L_DIR) { + case 0: + B_DIR1 = 1; + B_DIR2 = 2; + break; + case 1: + B_DIR1 = 0; + B_DIR2 = 2; + break; + case 2: + B_DIR1 = 0; + B_DIR2 = 1; + break; + default: + PLEGMA_error("The direction of the WIlson line has to be smaller than 3"); + } + + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true, QUDA_WILSON_LINKS); + plaqQuda(); + + // Smearing + PLEGMA_Gauge smearedGauge; + PLEGMA_Gauge smearedGaugeMn; + smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + smearedGaugeMn.copy(smearedGauge); + + //Momentum smearing: put the momentum phase to smeared gauge field + std::complex momSmScale[N_DIMS]; + std::complex momSmScaleMn[N_DIMS]; + std::complex I(0,1); + for(int i = 0 ; i < N_DIMS; i++){ + momSmScale[i] = std::exp(-(xiMomSm*2.*PI*sinkMom[i]/HGC_totalL[i])*I); + momSmScaleMn[i] = std::exp(+(xiMomSm*2.*PI*sinkMom[i]/HGC_totalL[i])*I); + } + smearedGauge.scaleDirWise(momSmScale); + smearedGaugeMn.scaleDirWise(momSmScaleMn); + + // Extracting the spacial sink momentum from the sink 4-momentum + std::vector sinkMom_3D(3); + std::copy(sinkMom.begin(),sinkMom.begin()+3,sinkMom_3D.begin()); + + // ensuring mu positive + if(mu<0) mu*=-1.; + updateOptions(LIGHT); + TIME(QUDA_solver *solver = new QUDA_solver(mu)); + + PLEGMA_Vector vectorIn; + PLEGMA_Vector vectorOut; + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxD21; + PLEGMA_Vector vectorAuxF; + + PLEGMA_Propagator *propUP_smearplus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propUP_smearminus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propST_smearplus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propST_smearminus = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_pionUPplusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_pionUPminusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonUPplusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonUPminusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonSTplusmom = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *seqProp_kaonSTminusmom = new PLEGMA_Propagator(BOTH); + + PLEGMA_Propagator *propF_UPsmearplus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_UPsmearminus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearplus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearminus_1 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_UPsmearplus_2 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_UPsmearminus_2 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearplus_2 = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propF_STsmearminus_2 = new PLEGMA_Propagator(BOTH); + + PLEGMA_Propagator *propIn = new PLEGMA_Propagator(BOTH); + PLEGMA_Propagator *propExchange = nullptr; + + PLEGMA_Propagator3D propUP3D_smearplus; + PLEGMA_Propagator3D propUP3D_smearminus; + PLEGMA_Propagator3D propST3D_smearplus; + PLEGMA_Propagator3D propST3D_smearminus; + + std::vector*> sequential_propagators; + + for(int i=0; i< 6*tSinks.size(); ++i) { + sequential_propagators.push_back(new PLEGMA_Propagator(HOST)); + } + + PLEGMA_Gauge gaugeWL; + gaugeWL.copy(gauge); + gaugeWL.stoutSmearing(gaugeWL,nStout,rhoStout,3); + + PLEGMA_Su3field su3; + PLEGMA_Su3field *su3_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_2_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_2_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_3_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_3_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_4_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_4_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_2_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_3_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_2_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_3_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_4_1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_4_2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_temp = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_temp1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL_temp2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_in = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL1 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *WL2 = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field *su3_exchange = new PLEGMA_Su3field(BOTH); + PLEGMA_Su3field tmp(BOTH); + + for(int isource=0;isource& prop_SL, double run_mu, WHICHFLAVOR fl,PLEGMA_Gauge& smeared_Gauge, int nsmear) { + // ensuring mu value + if(mu != run_mu) { + //updateOptions(fl); + mu = run_mu; + solver->UpdateSolver(); + } + + PLEGMA_Vector vectorIn1; + PLEGMA_Vector vectorOut1; + PLEGMA_Vector vectorAuxD1; + PLEGMA_Vector vectorAuxF1; + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxD1.pointSource(sourcePositions[isource], isc/3, isc%3, DEVICE); + vectorIn1.gaussianSmearing(vectorAuxD1, smeared_Gauge, nsmear, alphaGauss); + PLEGMA_printf("Going to invert for component %d\n", isc); + solver->solve(vectorOut1, vectorIn1); + vectorAuxF1.copy(vectorOut1); + prop_SL.absorb(vectorAuxF1, isc/3, isc%3); + } + }; + + TIME(computePropagator(*propUP_smearplus, mu_ud, LIGHT, smearedGauge ,nsmearGauss)); + TIME(computePropagator(*propUP_smearminus , mu_ud, LIGHT, smearedGaugeMn ,nsmearGauss)); + TIME(computePropagator(*propST_smearplus, mu_s, STRANGE, smearedGauge ,nsmearGauss)); + TIME(computePropagator(*propST_smearminus , mu_s, STRANGE, smearedGaugeMn ,nsmearGauss)); + + for(int ts=0;ts= HGC_totalL[3] ? -1 : +1; + int global_fixSinkTime = (tSinks[ts] + sourcePositions[isource][3])%HGC_totalL[3]; + int my_fixSinkTime = global_fixSinkTime - HGC_procPosition[3] * HGC_localL[3]; + bool is_myST = (my_fixSinkTime >= 0) && ( my_fixSinkTime < HGC_localL[3] ); + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propUP_smearplus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGauge , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propUP3D_smearplus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propUP_smearminus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGaugeMn , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propUP3D_smearminus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propST_smearplus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGauge , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propST3D_smearplus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + for(int isc = 0 ; isc < 12 ; isc++){ + vectorAuxF.absorb(*propST_smearminus,isc/3,isc%3); + vectorAuxD21.copy(vectorAuxF); + vectorAuxD.gaussianSmearing(vectorAuxD21, smearedGaugeMn , nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorAuxD); + propST3D_smearminus.absorb(vectorAuxF,global_fixSinkTime, isc/3, isc%3); + } + + if(calc3pt){ + + propUP_smearplus->unload(); + propUP_smearminus->unload(); + propST_smearplus->unload(); + propST_smearminus->unload(); + + auto computeSequentialPropagator = [&](PLEGMA_Propagator& seqPropOUT,PLEGMA_Propagator3D& prop1, double run_mu, WHICHFLAVOR fl, + PLEGMA_Gauge& smeared_Gauge, int nsmear, int sign_mom) { + + PLEGMA_Vector3D vectorAux3D; + PLEGMA_Vector vectorAuxF3; + PLEGMA_Vector vectorAuxD3; + PLEGMA_Vector vectorIn3; + PLEGMA_Vector vectorOut3; + + for(int nu = 0 ; nu < 4 ; nu++) + for(int c2 = 0 ; c2 < 3 ; c2++){ + vectorAux3D.absorb(prop1,nu,c2); + vectorAux3D.mulMomentumPhases(sinkMom,sign_mom); //put momentum at the sink + std::complex Isingle(0,1); + float phase = 2.*PI*(((float) sinkMom[0] * sourcePositions[isource][0])/HGC_totalL[0] + + ((float)sinkMom[1] * sourcePositions[isource][1])/HGC_totalL[1] + + ((float)sinkMom[2] * sourcePositions[isource][2])/HGC_totalL[2]); + vectorAux3D.cscale(std::exp(-sign_mom*phase*Isingle)); // put momentum from the point source + vectorAux3D.apply_gamma(G5); + vectorAuxF3.absorb(vectorAux3D, global_fixSinkTime); + vectorAuxD3.copy(vectorAuxF3); + vectorIn3.gaussianSmearing(vectorAuxD3,smeared_Gauge, nsmear, alphaGauss); + // check if we need to normalize the seqsource for mix precision solver + if(mu!=run_mu) { + //updateOptions(fl); + mu=run_mu; + solver->UpdateSolver(); + } + double norm = vectorIn3.norm(); + vectorIn3.cscale(1/norm); + solver->solve(vectorOut3, vectorIn3); + vectorOut3.cscale(norm); + vectorAuxF3.copy(vectorOut3); + seqPropOUT.absorb(vectorAuxF3, nu, c2); + + } + seqPropOUT.apply_gamma(G5); + seqPropOUT.conjugate(); + + }; + + TIME(computeSequentialPropagator(*seqProp_pionUPplusmom, propUP3D_smearminus, -mu_ud, LIGHT, smearedGauge, nsmearGauss, +1)); + TIME(computeSequentialPropagator(*seqProp_pionUPminusmom, propUP3D_smearplus, -mu_ud, LIGHT, smearedGaugeMn, nsmearGauss, -1)); + TIME(computeSequentialPropagator(*seqProp_kaonUPplusmom, propST3D_smearminus, -mu_ud, LIGHT, smearedGauge, nsmearGauss, +1)); + TIME(computeSequentialPropagator(*seqProp_kaonUPminusmom, propST3D_smearplus, -mu_ud, LIGHT, smearedGaugeMn, nsmearGauss, -1)); + TIME(computeSequentialPropagator(*seqProp_kaonSTplusmom, propUP3D_smearminus, mu_s, STRANGE, smearedGauge, nsmearGauss, +1)); + TIME(computeSequentialPropagator(*seqProp_kaonSTminusmom, propUP3D_smearplus, mu_s, STRANGE, smearedGaugeMn, nsmearGauss, -1)); + + sequential_propagators[(6*ts)+0]->copy(*seqProp_pionUPplusmom,HOST); + sequential_propagators[(6*ts)+1]->copy(*seqProp_pionUPminusmom,HOST); + sequential_propagators[(6*ts)+2]->copy(*seqProp_kaonUPplusmom,HOST); + sequential_propagators[(6*ts)+3]->copy(*seqProp_kaonUPminusmom,HOST); + sequential_propagators[(6*ts)+4]->copy(*seqProp_kaonSTplusmom,HOST); + sequential_propagators[(6*ts)+5]->copy(*seqProp_kaonSTminusmom,HOST); + + } + } + + PLEGMA_printf("DONE PROPAGATORS \n"); + + propF_UPsmearplus_1->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_1->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_1->copy(*propST_smearplus,BOTH); + propF_STsmearminus_1->copy(*propST_smearminus,BOTH); + propF_UPsmearplus_2->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_2->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_2->copy(*propST_smearplus,BOTH); + propF_STsmearminus_2->copy(*propST_smearminus,BOTH); + + WL_1->setUnit( (std::vector) {0,4,8}); + WL_2_1->setUnit( (std::vector) {0,4,8}); + WL_3_1->setUnit( (std::vector) {0,4,8}); + WL_4_1->setUnit( (std::vector) {0,4,8}); + WL_2_2->setUnit( (std::vector) {0,4,8}); + WL_3_2->setUnit( (std::vector) {0,4,8}); + WL_4_2->setUnit( (std::vector) {0,4,8}); + + //absorb the gauge directions for building the 4 branches + su3_1->absorbDir_device(gaugeWL, L_DIR); + su3_2_1->absorbDir_device(gaugeWL, B_DIR1); + su3_2_2->absorbDir_device(gaugeWL, B_DIR2); + su3_3_1->absorbDir_device(gaugeWL, L_DIR); + su3_3_2->absorbDir_device(gaugeWL, L_DIR); + su3_4_1->absorbDir_device(gaugeWL, L_DIR); + su3_4_2->absorbDir_device(gaugeWL, L_DIR); + + size_t bval, zval; + bool WL2_rev = true; + int WL2_dir = 0; + bool WL4_rev = true; + int WL4_dir = 1; + + for(int l = 0; l <= L_LEN; l++) {//loop over values of L, building "1" and "3" + + if(l != 0) { + + WL_1->wilsonLineUpdate(*su3_1, tmp, 4 + L_DIR); + WL_3_1->wilsonLineUpdate(*su3_3_1, tmp, 4 + L_DIR, true); + WL_3_2->wilsonLineUpdate(*su3_3_2, tmp, 4 + L_DIR, true); + + su3_exchange = su3_in; su3_in = su3_2_1; su3_2_1 = su3_exchange; + su3_2_1->shift(*su3_in, 4 + L_DIR); + + su3_exchange = su3_in; su3_in = su3_2_2; su3_2_2 = su3_exchange; + su3_2_2->shift(*su3_in, 4 + L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_1; WL_2_1 = su3_exchange; + WL_2_1->shift(*su3_in, 4 + L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_2; WL_2_2 = su3_exchange; + WL_2_2->shift(*su3_in, 4 + L_DIR); + + } + + if(WL2_rev) { + WL2_rev = false; + WL2_dir = 1; + }else { + WL2_rev = true; + WL2_dir = 0; + } + + for(int b = 0; b <= B_LEN; b++) {//loop over values of B, building "2" + + if(b != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + WL_2_1->wilsonLineUpdate(*su3_2_1, tmp, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + WL_2_2->wilsonLineUpdate(*su3_2_2, tmp, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_3_1; su3_3_1 = su3_exchange; + su3_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_3_2; su3_3_2 = su3_exchange; + su3_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_4_1; su3_4_1 = su3_exchange; + su3_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_4_2; su3_4_2 = su3_exchange; + su3_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_3_1; WL_3_1 = su3_exchange; + WL_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_3_2; WL_3_2 = su3_exchange; + WL_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_4_1; WL_4_1 = su3_exchange; + WL_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_4_2; WL_4_2 = su3_exchange; + WL_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + } + + WL_temp->UxU(*WL_1, *WL_2_1); + WL_temp1->UxU(*WL_temp, *WL_3_1); + + WL_temp->UxU(*WL_1, *WL_2_2); + WL_temp2->UxU(*WL_temp, *WL_3_2); + + if(WL4_rev) { + WL4_rev = false; + WL4_dir = 0; + }else { + WL4_rev = true; + WL4_dir = 1; + } + + for(int z = 0; z <= Z_LEN; z++) {//loop over values of Z, building "4" + + if(z != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_1->wilsonLineUpdate(*su3_4_1, tmp, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_2->wilsonLineUpdate(*su3_4_2, tmp, 4*WL4_dir + L_DIR); + + } + + WL1->UxU(*WL_temp1, *WL_4_1); + WL2->UxU(*WL_temp2, *WL_4_2); + + if(WL2_rev) bval = B_LEN - b; + else bval = b; + + if(WL4_rev) zval = Z_LEN - z; + else zval = z; + + for(int ts=0;ts corrThrpWL(corr_space, sourcePositions[isource], 0, tSinks[ts]+1); + + PLEGMA_Propagator sequential_propagator_0; + PLEGMA_Propagator sequential_propagator_1; + PLEGMA_Propagator sequential_propagator_2; + PLEGMA_Propagator sequential_propagator_3; + PLEGMA_Propagator sequential_propagator_4; + PLEGMA_Propagator sequential_propagator_5; + + sequential_propagator_0.copy(*sequential_propagators[0+(ts*6)],HOST); + sequential_propagator_1.copy(*sequential_propagators[1+(ts*6)],HOST); + sequential_propagator_2.copy(*sequential_propagators[2+(ts*6)],HOST); + sequential_propagator_3.copy(*sequential_propagators[3+(ts*6)],HOST); + sequential_propagator_4.copy(*sequential_propagators[4+(ts*6)],HOST); + sequential_propagator_5.copy(*sequential_propagators[5+(ts*6)],HOST); + + sequential_propagator_0.load(); + sequential_propagator_1.load(); + sequential_propagator_2.load(); + sequential_propagator_3.load(); + sequential_propagator_4.load(); + sequential_propagator_5.load(); + + PLEGMA_printf("GET HERE \n"); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_0, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_0, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_1, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_1, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_2, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_2, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_3, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_3, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_4, *propF_STsmearplus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_4, *propF_STsmearplus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_5, *propF_STsmearminus_1, *WL1, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL.contractNucleonThrp_staple(sequential_propagator_5, *propF_STsmearminus_2, *WL2, +1, gammas, false, bval, -l, -zval)); + corrThrpWL.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + } + }//loop over values of Z, building "4" + }//loop over values of B, building "2" + }//loop over values of L, building "1" and "3" + + propF_UPsmearplus_1->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_1->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_1->copy(*propST_smearplus,BOTH); + propF_STsmearminus_1->copy(*propST_smearminus,BOTH); + propF_UPsmearplus_2->copy(*propUP_smearplus,BOTH); + propF_UPsmearminus_2->copy(*propUP_smearminus,BOTH); + propF_STsmearplus_2->copy(*propST_smearplus,BOTH); + propF_STsmearminus_2->copy(*propST_smearminus,BOTH); + + //now repeat the same thing only going in negative boost direction for the staple + //set the 4 branches as unit + WL_1->setUnit( (std::vector) {0,4,8}); + WL_2_1->setUnit( (std::vector) {0,4,8}); + WL_3_1->setUnit( (std::vector) {0,4,8}); + WL_4_1->setUnit( (std::vector) {0,4,8}); + WL_2_2->setUnit( (std::vector) {0,4,8}); + WL_3_2->setUnit( (std::vector) {0,4,8}); + WL_4_2->setUnit( (std::vector) {0,4,8}); + + //absorb the gauge directions for building the 4 branches + su3_1->absorbDir_device(gaugeWL, L_DIR); + su3_2_1->absorbDir_device(gaugeWL, B_DIR1); + su3_2_2->absorbDir_device(gaugeWL, B_DIR2); + su3_3_1->absorbDir_device(gaugeWL, L_DIR); + su3_3_2->absorbDir_device(gaugeWL, L_DIR); + su3_4_1->absorbDir_device(gaugeWL, L_DIR); + su3_4_2->absorbDir_device(gaugeWL, L_DIR); + + WL2_rev = true; + WL2_dir = 0; + WL4_rev = true; + WL4_dir = 0; + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4 + L_DIR); + + WL_4_1->wilsonLineUpdate(*su3_4_1, tmp, 4 + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4 + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4 + L_DIR); + + WL_4_2->wilsonLineUpdate(*su3_4_2, tmp, 4 + L_DIR); + + for(int l = 0; l <= L_LEN; l++) {//loop over values of L, building "1" and "3" + + if(l != 0) { + + WL_1->wilsonLineUpdate(*su3_1, tmp, L_DIR); + WL_3_1->wilsonLineUpdate(*su3_3_1, tmp, L_DIR, true); + WL_3_2->wilsonLineUpdate(*su3_3_2, tmp, L_DIR, true); + + su3_exchange = su3_in; su3_in = su3_2_1; su3_2_1 = su3_exchange; + su3_2_1->shift(*su3_in, L_DIR); + + su3_exchange = su3_in; su3_in = su3_2_2; su3_2_2 = su3_exchange; + su3_2_2->shift(*su3_in, L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_1; WL_2_1 = su3_exchange; + WL_2_1->shift(*su3_in, L_DIR); + + su3_exchange = su3_in; su3_in = WL_2_2; WL_2_2 = su3_exchange; + WL_2_2->shift(*su3_in, L_DIR); + + } + + if(WL2_rev) { + WL2_rev = false; + WL2_dir = 1; + }else { + WL2_rev = true; + WL2_dir = 0; + } + + for(int b = 0; b <= B_LEN; b++) {//loop over values of B, building "2" + + if(b != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL2_dir + B_DIR1); + + WL_2_1->wilsonLineUpdate(*su3_2_1, tmp, 4*WL2_dir + B_DIR1); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL2_dir + B_DIR2); + + WL_2_2->wilsonLineUpdate(*su3_2_2, tmp, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_3_1; su3_3_1 = su3_exchange; + su3_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_3_2; su3_3_2 = su3_exchange; + su3_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = su3_4_1; su3_4_1 = su3_exchange; + su3_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = su3_4_2; su3_4_2 = su3_exchange; + su3_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_3_1; WL_3_1 = su3_exchange; + WL_3_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_3_2; WL_3_2 = su3_exchange; + WL_3_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + su3_exchange = su3_in; su3_in = WL_4_1; WL_4_1 = su3_exchange; + WL_4_1->shift(*su3_in, 4*WL2_dir + B_DIR1); + + su3_exchange = su3_in; su3_in = WL_4_2; WL_4_2 = su3_exchange; + WL_4_2->shift(*su3_in, 4*WL2_dir + B_DIR2); + + } + + WL_temp->UxU(*WL_1, *WL_2_1); + WL_temp1->UxU(*WL_temp, *WL_3_1); + + WL_temp->UxU(*WL_1, *WL_2_2); + WL_temp2->UxU(*WL_temp, *WL_3_2); + + if(WL4_rev) { + WL4_rev = false; + WL4_dir = 1; + }else { + WL4_rev = true; + WL4_dir = 0; + } + + for(int z = 0; z <= Z_LEN-1; z++) {//loop over values of Z, building "4" + + if(z != 0) { + + propExchange = propIn; propIn = propF_UPsmearplus_1; propF_UPsmearplus_1 = propExchange; + propF_UPsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_1; propF_UPsmearminus_1 = propExchange; + propF_UPsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_1; propF_STsmearplus_1 = propExchange; + propF_STsmearplus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_1; propF_STsmearminus_1 = propExchange; + propF_STsmearminus_1->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_1->wilsonLineUpdate(*su3_4_1, tmp, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearplus_2; propF_UPsmearplus_2 = propExchange; + propF_UPsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_UPsmearminus_2; propF_UPsmearminus_2 = propExchange; + propF_UPsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearplus_2; propF_STsmearplus_2 = propExchange; + propF_STsmearplus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + propExchange = propIn; propIn = propF_STsmearminus_2; propF_STsmearminus_2 = propExchange; + propF_STsmearminus_2->shift(*propIn, 4*WL4_dir + L_DIR); + + WL_4_2->wilsonLineUpdate(*su3_4_2, tmp, 4*WL4_dir + L_DIR); + + } + + WL1->UxU(*WL_temp1, *WL_4_1); + WL2->UxU(*WL_temp2, *WL_4_2); + + if(WL2_rev) bval = B_LEN - b; + else bval = b; + + if(WL4_rev) zval = Z_LEN - z; + else zval = 1 + z; + + for(int ts=0;ts corrThrpWL_1(corr_space, sourcePositions[isource], 0, tSinks[ts]+1); + + PLEGMA_Propagator sequential_propagator_0_1; + PLEGMA_Propagator sequential_propagator_1_1; + PLEGMA_Propagator sequential_propagator_2_1; + PLEGMA_Propagator sequential_propagator_3_1; + PLEGMA_Propagator sequential_propagator_4_1; + PLEGMA_Propagator sequential_propagator_5_1; + + sequential_propagator_0_1.copy(*sequential_propagators[0+(ts*6)],HOST); + sequential_propagator_1_1.copy(*sequential_propagators[1+(ts*6)],HOST); + sequential_propagator_2_1.copy(*sequential_propagators[2+(ts*6)],HOST); + sequential_propagator_3_1.copy(*sequential_propagators[3+(ts*6)],HOST); + sequential_propagator_4_1.copy(*sequential_propagators[4+(ts*6)],HOST); + sequential_propagator_5_1.copy(*sequential_propagators[5+(ts*6)],HOST); + + sequential_propagator_0_1.load(); + sequential_propagator_1_1.load(); + sequential_propagator_2_1.load(); + sequential_propagator_3_1.load(); + sequential_propagator_4_1.load(); + sequential_propagator_5_1.load(); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_0_1, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_0_1, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_1_1, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_1_1, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename+"_ts"+std::to_string(tSinks[ts])+"_pionUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_2_1, *propF_UPsmearplus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_2_1, *propF_UPsmearplus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_3_1, *propF_UPsmearminus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_3_1, *propF_UPsmearminus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonUP_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_4_1, *propF_STsmearplus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_4_1, *propF_STsmearplus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_plusmom_B_DIR2_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_5_1, *propF_STsmearminus_1, *WL1, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR1_"+conf).c_str(), corr_file_format); + + TIME(corrThrpWL_1.contractNucleonThrp_staple(sequential_propagator_5_1, *propF_STsmearminus_2, *WL2, +1, gammas, false, bval, l, zval)); + corrThrpWL_1.writeFile((threep_filename_1+"_ts"+std::to_string(tSinks[ts])+"_kaonST_minusmom_B_DIR2_"+conf).c_str(), corr_file_format); + } + }//loop over values of Z, building "4" + }//loop over values of B, building "2" + }//loop over values of L, building "1" and "3" + + propUP_smearplus->load(); + propUP_smearminus->load(); + propST_smearplus->load(); + propST_smearminus->load(); + + for(int nu = 0 ; nu < 4 ; nu++) + for(int c2 = 0 ; c2 < 3 ; c2++){ + vectorAuxF.absorb(*propUP_smearplus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propUP_smearplus->absorb(vectorAuxF, nu, c2); + + vectorAuxF.absorb(*propUP_smearminus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGaugeMn, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propUP_smearminus->absorb(vectorAuxF, nu, c2); + + vectorAuxF.absorb(*propST_smearplus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propST_smearplus->absorb(vectorAuxF, nu, c2); + + vectorAuxF.absorb(*propST_smearminus, nu, c2); + vectorAuxD.copy(vectorAuxF); + vectorOut.gaussianSmearing(vectorAuxD, smearedGaugeMn, nsmearGauss, alphaGauss); + vectorAuxF.copy(vectorOut); + propST_smearminus->absorb(vectorAuxF, nu, c2); + + } + + propUP_smearplus->rotateToPhysicalBase_device(+1); + propUP_smearminus->rotateToPhysicalBase_device(+1); + propST_smearplus->rotateToPhysicalBase_device(+1); + propST_smearminus->rotateToPhysicalBase_device(+1); + propUP_smearplus->applyBoundaries_device(sourcePositions[isource][3]); + propUP_smearminus->applyBoundaries_device(sourcePositions[isource][3]); + propST_smearplus->applyBoundaries_device(sourcePositions[isource][3]); + propST_smearminus->applyBoundaries_device(sourcePositions[isource][3]); + + PLEGMA_Correlator corr(corr_space, sourcePositions[isource]); + corr.setFixMomVec(sinkMom_3D); + + TIME(corr.contractMesonsNew(*propUP_smearplus, *propUP_smearminus)); + corr.writeFile((twop_filename+conf).c_str(), corr_file_format); + + TIME(corr.contractMesonsNew(*propUP_smearplus, *propST_smearminus)); + corr.writeFile((twop_filename_1+conf).c_str(), corr_file_format); + + } + + for(int i=0; i< 6*tSinks.size(); ++i) { + sequential_propagators.pop_back(); + } + + + delete propUP_smearplus; + delete propUP_smearminus; + delete propST_smearplus; + delete propST_smearminus; + delete propIn; + + delete seqProp_pionUPplusmom; + delete seqProp_pionUPminusmom; + delete seqProp_kaonUPplusmom; + delete seqProp_kaonUPminusmom; + delete seqProp_kaonSTplusmom; + delete seqProp_kaonSTminusmom; + + delete su3_1; + delete su3_2_1; + delete su3_2_2; + delete su3_3_1; + delete su3_3_2; + delete su3_4_1; + delete su3_4_2; + delete WL_1; + delete WL_2_1; + delete WL_3_1; + delete WL_2_2; + delete WL_3_2; + delete WL_4_1; + delete WL_4_2; + delete WL_temp; + delete WL_temp1; + delete WL_temp2; + delete su3_in; + delete WL1; + delete WL2; + + delete solver; + + finalize(); + return 0; +} From 405bc664dc82a13ba84c914de40ec3e5399e1458 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 5 May 2023 16:48:26 +0200 Subject: [PATCH 066/168] convert D1ff diagrams to triangle diagrams --- include/PLEGMA_ScattCorrelator.h | 4 +++- lib/PLEGMA.cu | 4 ++-- lib/PLEGMA_ScattCorrelator.cu | 28 +++++++++++++++------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 6c7fd7d8..77e030d3 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -278,7 +278,9 @@ namespace plegma { void M_diagrams( PLEGMA_ScattCorrelator &CorrNucleon, PLEGMA_ScattCorrelator &CorrPion, Float *data, bool accum=false ); - void LT_diagrams( PLEGMA_ScattCorrelator &T1reduction, PLEGMA_ScattCorrelator &T2reduction, PLEGMA_ScattCorrelator &Loop, bool accum=false ); +// void LT_diagrams( PLEGMA_ScattCorrelator &T1reduction, PLEGMA_ScattCorrelator &T2reduction, PLEGMA_ScattCorrelator &Loop, bool accum=false ); + void LT_diagrams( PLEGMA_ScattCorrelator &T1reduction, PLEGMA_ScattCorrelator &T2reduction, bool accum=false ); + void D1ii_diagrams(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, Float * loopcontribution, const int ig_i2, const int diagram_index, bool accum=false); diff --git a/lib/PLEGMA.cu b/lib/PLEGMA.cu index 7616882f..964ac658 100644 --- a/lib/PLEGMA.cu +++ b/lib/PLEGMA.cu @@ -16,6 +16,7 @@ using namespace quda; //extern Topology *default_topo; std::vector HDF5::open_files; Communicator &get_current_communicator(); + //Communicator default_t; //extern Topology *default_topo; @@ -26,8 +27,7 @@ void plegma::PLEGMA_init(int localL[4], int nProcs[4], int verbosity){ #define ADD_TO_GLOBAL #include -#undef ADD_TO_GLOBAL - +#undef ADD_TO_GLOBAL if(HGC_init_PLEGMA_flag == false){ for(int i = 0 ; i < N_DIMS ; i++) HGC_localL[i] = localL[i]; diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index f5692003..c23b9550 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1580,8 +1580,9 @@ void PLEGMA_ScattCorrelator::D1ii_diagrams(PLEGMA_ScattCorrelator //only difference between them is the type of loop(pipi_aux): UP and //DN in the former respectively in the latter - float signofFactor=-1.; - Float factor[2]={signofFactor*loopcontribution[0],signofFactor*loopcontribution[1]};//-1 from eqs. (20),(23), .... +// float signofFactor=-1.; +// Float factor[2]={signofFactor*loopcontribution[0],signofFactor*loopcontribution[1]};//-1 from eqs. (20),(23), .... + Float factor[2]={-1,0};//signofFactor*loopcontribution[0],signofFactor*loopcontribution[1]};//-1 from eqs. (20),(23), .... switch( diagram_index ){ case 1: @@ -2907,13 +2908,13 @@ void PLEGMA_ScattCorrelator::T_diagrams_piNsink( PLEGMA_ScattCorrelator -void PLEGMA_ScattCorrelator::LT_diagrams( PLEGMA_ScattCorrelator &T1, PLEGMA_ScattCorrelator &T2, PLEGMA_ScattCorrelator &Loop, bool accum){ +void PLEGMA_ScattCorrelator::LT_diagrams( PLEGMA_ScattCorrelator &T1, PLEGMA_ScattCorrelator &T2, bool accum){ //checks between T1 T2 if(!T1.check_reduction(T_1)) PLEGMA_error("srcT1 seems not to have T1like shape\n"); if(!T2.check_reduction(T_2)) PLEGMA_error("srcT2 seems not to have T2like shape\n"); - if( T1.getMomList()!=T2.getMomList() || T1.getMomList()!=this->pList().pi(1) ) + if( T1.getMomList()!=T2.getMomList() ) // || T1.getMomList()!=this->pList().pi(1) ) PLEGMA_error("T1,T2 have not the the same mom list of N\n"); assert( Nmoms()==this->pList().pi(0).size() ); @@ -2937,9 +2938,9 @@ void PLEGMA_ScattCorrelator::LT_diagrams( PLEGMA_ScattCorrelator & #pragma omp parallel for for(int i_m=0; i_m::LT_diagrams( PLEGMA_ScattCorrelator & Float temp[N_SPINS*N_SPINS*2]; for( int gi1=0; gi1::absorbGammai2Gammaf2momentumf2(PLEGMA_ScattC template void PLEGMA_ScattCorrelator::absorbSourceSinkSpinMom(PLEGMA_ScattCorrelator &srcCorr, int alpha, int beta, int pf1, bool forcetozero){ - std::vector> moms_pinsertion_red = this->pList().uniq_p(2); //list of pf1 momenta needed here + std::vector> moms_pinsertion_red = this->pList().uniq_p(3); //list of pf1 momenta needed here std::vector> moms_pinsertion = srcCorr.pList().uniq_p(0); //list of pf1 in Nucleons PLEGMA_SC std::vector i_pinsertions = srcCorr.pList().u_posix( 0, moms_pinsertion_red); //list of positions of moms_pf1_red momenta in moms_pf1 array @@ -3659,7 +3661,7 @@ void PLEGMA_ScattCorrelator::absorbSourceSinkSpinMom(PLEGMA_ScattCorrelat if (i_mom_f1!=pf1){ continue; } - int i_pc = i_pinsertions[imap[i_m][2]]; //position of pf1 in moms_pf1 (tempNN) + int i_pc = i_pinsertions[imap[i_m][3]]; //position of pc in mom list (tempNN) for(int t=0; t < TIME; ++t){ for (int g1=0 ; g1 < n_gammas_i1 ; ++g1 ){//pi From 8b552bb2d2a336d1a3025a0fa446278fbb56bf7b Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 5 May 2023 16:51:34 +0200 Subject: [PATCH 067/168] including diagrams for the extended GEVP proton pi zero and neutron pi plus --- plegma/nucleon_3pt_n_npi.cpp | 589 ++++++++++++++++++++++++++++++----- 1 file changed, 518 insertions(+), 71 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 9f8c19d4..a9fd22e7 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -143,7 +143,30 @@ int main(int argc, char **argv) { //=========================================================================================================// initializePLEGMA(); - + /* + FILE *fid; + LimeWriter *limewriter = (LimeWriter*)NULL; + //if(unloadFromDev) unload(); + if(comm_rank() == 0){ + fid=fopen("stochastic_source0.lime","a"); + if(fid==NULL) PLEGMA_error("Error opening file for writing: stochastic_source0.lime\n"); + else printf("Opening was fine\n"); + limewriter = limeCreateWriter(fid); + if(limewriter==(LimeWriter*)NULL) PLEGMA_error("Could not create limeWriter"); + std::string xlf_message = getDateAndTime(); // More xlf-info can be added + write_lime_header(limewriter,"xlf-info",xlf_message,1,1); + std::ostringstream oss; + oss << lime_version_header() << "" << "PLEGMA_Vector" << "\n" << "" << 32 << "\n"; + oss << "" << 12 << "\n"; + std::vector xyzt = {"x","y","z","t"}; + for(int i = 0 ; i < N_DIMS; i++) oss << "" << HGC_totalL[i] << "\n"; + oss << ""; + write_lime_header(limewriter,"ildg-format",oss.str(),1,0); + } +// write_binary_to_lime(filename,fid,limewriter,h_elem,field_length); + limeDestroyWriter(limewriter); + + exit(1);*/ { PLEGMA_Gauge smearedGauge(BOTH); @@ -315,7 +338,7 @@ int main(int argc, char **argv) { *Step 1: Producing the stochastic sources * ******************************************************/ - +#if 1 for (int i=0; i(HOST)); @@ -323,14 +346,48 @@ int main(int argc, char **argv) { stochastic_propagator_2pt_SS.push_back(new PLEGMA_Vector(HOST)); } if (readStochSamples==0){ - vectorSource_stochastic.stochastic_Z(nroots); + + vectorSource_stochastic.stochastic_Z(nroots); vectorSource_stochastic.unload(); - stochastic_sources[i]->copy(vectorSource_stochastic,HOST); vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); + vectorSource_stochastic.load(); + + + +/* PLEGMA_Vector vectorRead(BOTH); + vectorRead.readFile("stochastic_source.0000.00000_plegma_conventions.lime",LIME_FORMAT); + vectorRead.load(); + vectorRead.rotate_uk_ch_g5g4(); + vectorRead.apply_gamma(G2); + vectorRead.unload(); + + stochastic_sources[i]->copy(vectorRead,HOST);*/ + vectorSource_stochastic.unload(); + stochastic_sources[i]->copy(vectorSource_stochastic,HOST); + vectorSource_stochastic.load(); + + + +/* + vectorRead.copy(vectorSource_stochastic); + vectorSource_stochastic.unload(); + vectorRead.rotate_uk_ch_g5g4(); + vectorRead.apply_gamma(G2); + vectorRead.unload(); + vectorRead.writeLIME("globalTfulltimedilution_source_nstoch_qlua"+std::to_string(i)+"_"+confnumber); +*/ + + //PLEGMA_Vector vectorRead(BOTH); + //vectorRead.readFile("stochastic_source0.lime",LIME_FORMAT); + //vectorRead.load(); + //stochastic_sources[i]->copy(vectorRead,HOST); +//tochastic_sources[i]->copy(vectorSource_stochastic,HOST); + +// vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); //PLEGMA_printf("Save the stochastic source for sample %d\n",i); //std::string nstoch=std::to_string(i); //vectorSource_stochastic.writeHDF5("stochastic_source"+nstoch); - vectorSource_stochastic.load(); +// vectorSource_stochastic.load(); } else{ std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; @@ -346,6 +403,7 @@ int main(int argc, char **argv) { } } + /****************************************************** * *Step 2: Producing the stochastic propagators @@ -407,8 +465,9 @@ int main(int argc, char **argv) { } } +#endif - +#if 1 if(mu<0) { mu = -mu; @@ -536,6 +595,8 @@ int main(int argc, char **argv) { } } +#endif + /****************************************************** * @@ -543,7 +604,6 @@ int main(int argc, char **argv) { * ******************************************************/ - for(int isource = startSource; isource < numSourcePositions; isource++){ @@ -559,6 +619,7 @@ int main(int argc, char **argv) { free(ssource); +#if 1 auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, double run_mu, WHICHFLAVOR fl, int nSmear, site &source_location, bool finalize) { PLEGMA_Gauge3D smearedGauge3D; @@ -841,12 +902,17 @@ int main(int argc, char **argv) { //phi goes to V2 reduction and xi goes to V3 reduction std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented + std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt; std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_UU_V3_GAMMAF2U;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented //Here the prefix DD means that reduction is based phi*g5 and xi*g5 @@ -855,6 +921,7 @@ int main(int argc, char **argv) { std::vector*> reductions_DD_V3_GAMMAF2D;//implemented std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented + std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented @@ -862,9 +929,17 @@ int main(int argc, char **argv) { for(int i=0; i< n_stochastic_samples; ++i) { if (dotwopoint==1){ reductions_DD_V2_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_DD_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + + reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + } @@ -940,7 +1015,12 @@ int main(int argc, char **argv) { stoch_piece.unload(); stoch_piece.copy(*stochastic_sources[i_sample],HOST); stoch_piece.load(); + + TIME(reductions_UU_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + stoch_piece.apply_gamma5(); + TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); + TIME(reductions_DD_V2_GAMMAF1U_D_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); TIME(reductions_DD_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); @@ -949,10 +1029,18 @@ int main(int argc, char **argv) { stoch_piece.unload(); stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); stoch_piece.load(); + + TIME(reductions_UU_V2_GAMMAF1D_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); + + TIME(reductions_UU_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + + stoch_piece.apply_gamma5(); - stoch_piece.apply_gamma5(); - TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); + TIME(reductions_DD_V3_GAMMAF2D_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); + + TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + } @@ -1031,11 +1119,90 @@ int main(int argc, char **argv) { } //end of for source sink separations } //end of for stochastic samples - + + auto &momentum_i2 = mpi2_twopt[0]; + //List of momenta corresponding to a fix value of p_i2 + momList filtered_sourcemomentumList_2pt_single = sourcemomentumList_twopt.extract(momentum_i2, 0); + + PLEGMA_ScattCorrelator corrD1ii1(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii2(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii3(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii4(source, filtered_sourcemomentumList_2pt_single); + + PLEGMA_ScattCorrelator corrD1ii9(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii10(source, filtered_sourcemomentumList_2pt_single); + + PLEGMA_ScattCorrelator corrD1ii13(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii14(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii15(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii16(source, filtered_sourcemomentumList_2pt_single); + + + corrD1ii1.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii1"); + corrD1ii2.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii2"); + corrD1ii3.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii3"); + corrD1ii4.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii4"); + + corrD1ii9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii9"); + corrD1ii10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii10"); + + corrD1ii13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii13"); + corrD1ii14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii14"); + corrD1ii15.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii15"); + corrD1ii16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii16"); + + + + for (int i=0; i tmm(BOTH); + tmm.copy(*stochastic_sources[0],HOST); + tmm.load(); + vectorStoc_source_oet.copy(tmm); + }*/ + + //PLEGMA_printf("DONE stochastic factors\n"); +#endif #if 1 /****************************************************** * @@ -1213,6 +1380,8 @@ int main(int argc, char **argv) { //PLEGMA_printf("DONE OET zero mom dn\n"); #endif + +#if 1 /****************************************************** * * Step 4: Computing the zero momentum oet factors @@ -1229,6 +1398,8 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN(source_reduction, list_mpc); PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt(source_reduction, list_mpf2_twopt); + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt(source_reduction, list_mpf2_twopt); PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt(source_reduction, list_mpf2_twopt); @@ -1238,7 +1409,12 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHU_DN_UP_2pt(source_reduction, list_mpf1_twopt); PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_UP_2pt(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHD_UP_DN_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_DN_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt(source_reduction, list_mpf1_twopt); @@ -1328,7 +1504,12 @@ int main(int argc, char **argv) { st_oet_d_zeropacked_to_sink.pack_propagator_from_source_to_sink(stochastic_oet_prop_d_zero_mom_SS, sink_local[3], max_source_sink_separations, i_source_parallel==0 ? true : false); } + TIME(reductionsV2_diluted_STOCHU_DN_DN_2pt.V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDN_SS_packed, propDN_SS_packed, true)); TIME(reductionsV2_diluted_STOCHU_DN_UP_2pt.V2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); + + TIME(reductionsV4_diluted_STOCHD_UP_DN_2pt.V4( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + TIME(reductionsV2_diluted_STOCHD_UP_DN_2pt.V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + TIME(reductionsV2_diluted_STOCHD_UP_UP_2pt.V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); TIME(reductionsV4_diluted_STOCHU_DN_UP_2pt.V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); @@ -1336,6 +1517,8 @@ int main(int argc, char **argv) { } +#endif + //P diagram PLEGMA_ScattCorrelator corrP0UP(source, list_mpi2_twopt); PLEGMA_ScattCorrelator corrP0DN(source, list_mpi2_twopt); @@ -1357,7 +1540,6 @@ int main(int argc, char **argv) { * ******************************************************/ - //We first have a loop over all unique the source meson momentum p_i2 for (int i_mpi2=0; i_mpi2 reductionsV2(source_reduction, list_mpf1_threept); - PLEGMA_ScattCorrelator reductionsV2_2pt(source_reduction, list_mpf1_twopt); - - std::vector> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); std::vector> mpi2_filt ; @@ -1379,6 +1556,13 @@ int main(int argc, char **argv) { //PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); +#if 1 + + PLEGMA_ScattCorrelator reductionsV2(source_reduction, list_mpf1_threept); + PLEGMA_ScattCorrelator reductionsV2_2pt(source_reduction, list_mpf1_twopt); + + + PLEGMA_ScattCorrelator corrM( source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrD1if12(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrD1if34(source, filtered_sourcemomentumList_2pt); @@ -1395,7 +1579,7 @@ int main(int argc, char **argv) { PLEGMA_Propagator propTS_SS_packed; PLEGMA_Propagator propTS_SL_packed; -#if 0 +#if 1 for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS_SS; @@ -1457,7 +1641,6 @@ int main(int argc, char **argv) { } - PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); @@ -1475,19 +1658,32 @@ int main(int argc, char **argv) { if (dotwopoint==1){ - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); - TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + PLEGMA_ScattCorrelator corrD1ff1389(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1ff24710(source, filtered_sourcemomentumList_2pt); + + + corrD1ff24710.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); + corrD1ff1389.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); - TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + + TIME(corrD1ff24710.LT_diagrams( reductionsT1, reductionsT2 )); + TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, false, false, true)); - - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, 0, false, true, true)); + TIME(corrD1ff1389.LT_diagrams( reductionsT1, reductionsT2 )); + TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); @@ -1505,6 +1701,12 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrB5_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrB6_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB17_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB18_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB19_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB20_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW5_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW6_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW7_2pt(source, filtered_sourcemomentumList_2pt); @@ -1515,11 +1717,23 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrW15_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW16_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW29_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW30_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW31_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW32_2pt(source, filtered_sourcemomentumList_2pt); + + corrB3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); corrB4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); corrB5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B5"); corrB6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B6"); + corrB17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B17"); + corrB18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B18"); + corrB19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B19"); + corrB20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B20"); + + corrW5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W5"); corrW6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W6"); corrW7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W7"); @@ -1530,6 +1744,13 @@ int main(int argc, char **argv) { corrW15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); corrW16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); + corrW29_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W29"); + corrW30_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W30"); + corrW31_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); + corrW32_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); + + + if (dotwopoint==1){ for (int i_sample=0; i_sample propTS_SL; - //we first implemenet UU pizero UP if(mu<0) { mu*=-1.; solver.UpdateSolver(); @@ -1817,6 +2069,16 @@ int main(int argc, char **argv) { if (dotwopoint==1){ + + + PLEGMA_ScattCorrelator corrD1ff13141718(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1ff15161920(source, filtered_sourcemomentumList_2pt); + + + corrD1ff13141718.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff13-14-17-18"); + corrD1ff15161920.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff15-16-19-20"); + + PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus2(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus3(source, list_mpi2ptot); @@ -1831,41 +2093,79 @@ int main(int argc, char **argv) { corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); - TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, false, true, false )); + TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, 0, false, true, false )); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); - TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT2, 0, false, false, false )); + + TIME(corrD1ff13141718.LT_diagrams( reductionsT1, reductionsT2 )); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); - TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT1, false, false, false )); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, 0, false, false, true )); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, false, false, true )); + TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, 0, false, false, true )); + + TIME(corrD1ff15161920.LT_diagrams( reductionsT1, reductionsT2 )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + TIME(produceOutput_2pt_packed(corrD1ff13141718, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrD1ff15161920, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4, outfilename, "T", parallel_sources, attract_lookup_table)); } + PLEGMA_ScattCorrelator corrB9_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB10_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB11_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB12_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrB13_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrB14_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrB15_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrB16_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW17_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW18_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW19_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW20_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW21_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW22_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW23_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW24_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW25_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW26_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW27_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW28_2pt(source, filtered_sourcemomentumList_2pt); + corrB9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12","B9"); + corrB10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B10"); + corrB11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B11"); + corrB12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B12"); corrB13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12","B13"); corrB14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B14"); corrB15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B15"); corrB16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B16"); + corrW17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W17"); + corrW18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W18"); + corrW19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W19"); + corrW20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W20"); + + corrW21_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W21"); + corrW22_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W22"); + corrW23_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W23"); + corrW24_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W24"); + + corrW25_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W25"); corrW26_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W26"); corrW27_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W27"); @@ -1952,6 +2252,18 @@ int main(int argc, char **argv) { stochastic_propagator_packed.unload(); stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); stochastic_propagator_packed.load(); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true)); + + TIME(corrW17_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 17, true, false)); + TIME(corrW19_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 19, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true)); + + TIME(corrW18_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 18, true, false)); + TIME(corrW20_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 20, true, false)); + + stochastic_propagator_packed.apply_gamma5(); TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true )); @@ -1964,6 +2276,15 @@ int main(int argc, char **argv) { stochastic_propagator_packed.unload(); stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); stochastic_propagator_packed.load(); + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true )); + + TIME(corrB9_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 9, true, false, false)); + TIME(corrB10_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 10, true, false, false)); + TIME(corrB11_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 11, true, false, false)); + TIME(corrB12_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 12, true, false, false)); + + stochastic_propagator_packed.apply_gamma5(); TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true)); @@ -1971,11 +2292,22 @@ int main(int argc, char **argv) { TIME(corrW27_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 27, true, false)); TIME(corrW28_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 28, true, false)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); + + TIME(corrW21_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 21, true, false)); + TIME(corrW23_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 23, true, false)); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true)); TIME(corrW25_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 25, true, false)); TIME(corrW26_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 26, true, false)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); + + TIME(corrW22_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 22, true, false)); + TIME(corrW24_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 24, true, false)); + } for (int i_source_parallel=0; i_source_parallel propTS_SS; @@ -2105,7 +2452,7 @@ int main(int argc, char **argv) { //Computing sequential propagators UD T_fii with insertion //glist_insertion[0]=gamma_5 and momentum momentum_i2 - PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); + PLEGMA_printf("Going to invert DN for sequential propagator DN for component %d\n", isc); //performing the inversion TIME(solver.solve(vectorAuxD, vectorAuxD)); //performing rotation to physical base @@ -2129,6 +2476,11 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrD1ff56(source, filtered_sourcemomentumList_2pt); + + + corrD1ff56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff56"); + corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); @@ -2136,9 +2488,13 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, false )); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(corrD1ff56.LT_diagrams( reductionsT1, reductionsT2 )); + TIME(produceOutput_2pt_packed( corrD1ff56, outfilename, "T", parallel_sources, attract_lookup_table)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; TIME(produceOutput_2pt_packed(corrTproton_protonpizero5, outfilename, "T", parallel_sources, attract_lookup_table)); @@ -2153,6 +2509,12 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrW11_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW12_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW33_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW34_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW35_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW36_2pt(source, filtered_sourcemomentumList_2pt); + + corrB7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); corrB8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); @@ -2161,6 +2523,12 @@ int main(int argc, char **argv) { corrW11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W11"); corrW12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W12"); + corrW33_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W33"); + corrW34_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W34"); + corrW35_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); + corrW36_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); + + @@ -2238,6 +2606,17 @@ int main(int argc, char **argv) { TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + + TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); + TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + + TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); + TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); + + } for (int i_source_parallel=0; i_source_parallel temporary; @@ -2298,10 +2677,17 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrW11_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrW12_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW33_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table));//because of V4 + TIME(produceOutput_2pt_packed(corrW34_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW35_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW36_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + } } //loop over tSinks +#endif #endif { //Finite momentum oet @@ -2452,7 +2838,7 @@ int main(int argc, char **argv) { } // end of parallel sources }//end of finite momentum oet - +#if 1 { PLEGMA_Vector st_oet_d_fini; st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SL); @@ -2462,17 +2848,27 @@ int main(int argc, char **argv) { TIME(reductionsV3_diluted_D_UP.V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); if (dotwopoint==1){ + PLEGMA_Vector st_oet_u_fini; + + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS); + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_UP_2pt.V3( st_oet_u_fini, glist_sink_meson, propUP_SS_packed, true)); - st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS); + PLEGMA_Vector st_oet_d_fini; + + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS); st_oet_d_fini.apply_gamma5(); - TIME(reductionsV3_diluted_D_UP_2pt.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed, true)); + TIME(reductionsV3_diluted_D_UP_2pt.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed, true)); + } } - +#endif +#if 1 //for (int i=0; i< 4; ++i){ { PLEGMA_Vector st_oet_u_fini; @@ -2482,7 +2878,7 @@ int main(int argc, char **argv) { TIME(reductionsV3_diluted_U_DN.V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); } - +#if 1 if (dotwopoint==1){ PLEGMA_Vector st_oet_u_fini; st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS); @@ -2491,12 +2887,12 @@ int main(int argc, char **argv) { TIME(reductionsV3_diluted_U_DN_2pt.V3( st_oet_u_fini, glist_sink_meson, propDN_SS_packed, true)); } +#endif - - PLEGMA_ScattCorrelator corrZ15_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ16_2pt(source, filtered_sourcemomentumList_2pt); -/* PLEGMA_ScattCorrelator corrZ7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ5_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ6_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ7_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ8_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ9_2pt(source, filtered_sourcemomentumList_2pt); @@ -2505,11 +2901,20 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrZ11_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ12_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ13_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ14_2pt(source, filtered_sourcemomentumList_2pt);*/ + PLEGMA_ScattCorrelator corrZ14_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ15_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ16_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ17_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ18_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ19_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ20_2pt(source, filtered_sourcemomentumList_2pt); + + + corrZ5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); + corrZ6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); - corrZ15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); - corrZ16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); -/* corrZ7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z7"); corrZ8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z8"); @@ -2520,17 +2925,27 @@ int main(int argc, char **argv) { corrZ12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); corrZ13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); - corrZ14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14");*/ + corrZ14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); + + corrZ15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z15"); + corrZ16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z16"); + + corrZ17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z17"); + corrZ18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z18"); + corrZ19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z19"); + corrZ20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z20"); + corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); -// corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); -// corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); + corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); + corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); if (dotwopoint==1){ - TIME(corrZ15_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); - TIME(corrZ16_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); -/* + + TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); + TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); + TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); @@ -2541,23 +2956,36 @@ int main(int argc, char **argv) { TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); - TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false ));*/ + TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); + + TIME(corrZ15_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 15, false )); + TIME(corrZ16_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 16, false )); + + TIME(corrZ17_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 17, false )); + TIME(corrZ18_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 18, false )); + + TIME(corrZ19_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 19, false )); + TIME(corrZ20_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 20, false )); + +#endif TIME(corrPPUP.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); TIME(corrPPDN.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); -// TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); -// TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); + TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); +#if 1 TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - //TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - //TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); + TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); + TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; - TIME(produceOutput_2pt_packed(corrZ15_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ16_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); -/* TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ5_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ6_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ8_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ9_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); @@ -2566,18 +2994,27 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrZ11_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ12_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table));*/ + TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ15_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ16_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ17_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ18_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ19_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ20_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_correct_2pt"; TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); -// TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); -// TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); } +#endif - +#if 1 for (int k=0; k corrZ5(source, filtered_sourcemomentumList); @@ -2653,11 +3090,13 @@ int main(int argc, char **argv) { }//end for loop source sink separations +#endif }//loop over mpi2 if (dotwopoint==1){ +#if 1 outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; TIME( corrN0_packed.apply_phase()); TIME( corrN0_packed.apply_sign("N")); @@ -2670,7 +3109,7 @@ int main(int argc, char **argv) { TIME( corrNP_packed.writeHDF5(outfilename) ); - +#endif outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; TIME(corrP0UP.apply_sign("P")); @@ -2688,7 +3127,7 @@ int main(int argc, char **argv) { //for (int spinindex=0;spinindex<4;++spinindex){ // reductionsV3_diluted_U_DN.pop_back(); // reductionsV3_diluted_D_UP.pop_back(); - +#if 1 for (int k=0; k Date: Fri, 5 May 2023 16:54:22 +0200 Subject: [PATCH 068/168] adding Yan stuff the CMakeLists --- plegma/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index c2a9c252..d20ec74c 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -106,6 +106,11 @@ target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) +cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) +target_link_libraries(testYan ${PLEGMA_LIBS}) + +cuda_add_executable(pi0Insertion EXCLUDE_FROM_ALL pi0Insertion.cpp) +target_link_libraries(pi0Insertion ${PLEGMA_LIBS}) cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) From 329c084d899fae8c06a923ec4b3079b11e326493 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 5 May 2023 16:54:51 +0200 Subject: [PATCH 069/168] convert ot etmc basis --- lib/PLEGMA_Vector.cu | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 2ef07ca4..7e172be4 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -123,6 +123,12 @@ void PLEGMA_Vector::rotate_uk_ch_g5g4(){ rotate_uk_ch_g5g4_k(toField2(*this)); } +template +void PLEGMA_Vector::rotate_uk_ch_etmc(){ + rotate_uk_ch_etmc_k(toField2(*this)); +} + + // vec4D <- Prop3D template void PLEGMA_Vector::absorb(PLEGMA_Propagator3D &prop, int global_it, int nu , int c2){ From 411d49905f32c4d4420c897430cd1e04d6e9137f Mon Sep 17 00:00:00 2001 From: Yan Li Date: Sat, 6 May 2023 06:31:28 +0200 Subject: [PATCH 070/168] CMakeLists --- lib/CMakeLists.txt | 1 - plegma/CMakeLists.txt | 49 +++++++++---------------------------------- 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index e95c9805..ba3b9da5 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -25,7 +25,6 @@ set (PLEGMA_OBJS PLEGMA_BLAS.cu PLEGMA_Fmunu.cu PLEGMA_U1Gauge.cu - ToolYan.cpp ) if(PLEGMA_UDSC_BARYONS) LIST(APPEND PLEGMA_OBJS diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 137dc296..13747a9d 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -46,21 +46,9 @@ target_link_libraries(Calc_2pt ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt_wilson Calc_2pt_wilson.cpp) target_link_libraries(Calc_2pt_wilson ${PLEGMA_LIBS}) -# cuda_add_executable(Tetraquark Tetraquark.cpp) -# target_link_libraries(Tetraquark ${PLEGMA_LIBS}) - -# cuda_add_executable(TetraquarkBCUD TetraquarkBCUD.cpp) -# target_link_libraries(TetraquarkBCUD ${PLEGMA_LIBS}) - cuda_add_executable(TestFrame EXCLUDE_FROM_ALL TestFrame.cpp) target_link_libraries(TestFrame ${PLEGMA_LIBS}) -# cuda_add_executable(StochasticTetraquark StochasticTetraquark.cpp) -# target_link_libraries(StochasticTetraquark ${PLEGMA_LIBS}) - -# cuda_add_executable(StochasticTetraquarkBCUD StochasticTetraquarkBCUD.cpp) -# target_link_libraries(StochasticTetraquarkBCUD ${PLEGMA_LIBS}) - cuda_add_executable(ComputeLightStochProp ComputeLightStochProp.cpp) target_link_libraries(ComputeLightStochProp ${PLEGMA_LIBS}) @@ -70,15 +58,6 @@ target_link_libraries(ComputeLightPointProp ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt_charmonium Calc_2pt_charmonium.cpp) target_link_libraries(Calc_2pt_charmonium ${PLEGMA_LIBS}) -# cuda_add_executable(PDFs_nucleon PDFs_nucleon.cpp) -# target_link_libraries(PDFs_nucleon ${PLEGMA_LIBS}) - -# cuda_add_executable(TMDPDFs_nucleon TMDPDFs_nucleon.cpp) -# target_link_libraries(TMDPDFs_nucleon ${PLEGMA_LIBS}) - -# cuda_add_executable(PDFs_qgq_nucleon PDFs_qgq_nucleon.cpp) -# target_link_libraries(PDFs_qgq_nucleon ${PLEGMA_LIBS}) - cuda_add_executable(nucleon_2pt_3pt nucleon_2pt_3pt.cpp) target_link_libraries(nucleon_2pt_3pt ${PLEGMA_LIBS}) @@ -103,8 +82,8 @@ target_link_libraries(Dilution ${PLEGMA_LIBS}) cuda_add_executable(testLinksSmearings EXCLUDE_FROM_ALL testLinksSmearings.cpp) target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) -# cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) -# target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) +cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) +target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) @@ -127,12 +106,6 @@ target_link_libraries(LowModesCalc ${PLEGMA_LIBS}) cuda_add_executable(MG_tuner MG_tuner.cpp) target_link_libraries(MG_tuner ${PLEGMA_LIBS}) -# cuda_add_executable(benchmark benchmark.cpp) -# target_link_libraries(benchmark ${PLEGMA_LIBS}) - -# cuda_add_executable(TMDWFs_mesons TMDWFs_mesons.cpp) -# target_link_libraries(TMDWFs_mesons ${PLEGMA_LIBS}) - cuda_add_executable(quark_rms EXCLUDE_FROM_ALL quark_rms.cpp) target_link_libraries(quark_rms ${PLEGMA_LIBS}) @@ -148,17 +121,11 @@ target_link_libraries(Zfac ${PLEGMA_LIBS}) cuda_add_executable(ZfacStaple ZfacStaple.cpp) target_link_libraries(ZfacStaple ${PLEGMA_LIBS}) -# cuda_add_executable(SoftFunction SoftFunction.cpp) -# target_link_libraries(SoftFunction ${PLEGMA_LIBS}) - -# cuda_add_executable(SoftFunctionWall SoftFunctionWall.cpp) -# target_link_libraries(SoftFunctionWall ${PLEGMA_LIBS}) - -# cuda_add_executable(WallSourceNucleon WallSourceNucleon.cpp) -# target_link_libraries(WallSourceNucleon ${PLEGMA_LIBS}) +cuda_add_executable(TMDPDFs_mesons_Juwels TMDPDFs_mesons_Juwels.cpp) +target_link_libraries(TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) -# cuda_add_executable(TMDPDFs_pion TMDPDFs_pion.cpp) -# target_link_libraries(TMDPDFs_pion ${PLEGMA_LIBS}) +cuda_add_executable(new_TMDPDFs_mesons_Juwels new_TMDPDFs_mesons_Juwels.cpp) +target_link_libraries(new_TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) if (PLEGMA_SCATTERING_CONTRACTIONS) cuda_add_executable(testScattReductions EXCLUDE_FROM_ALL testScattReductions.cpp) @@ -175,6 +142,10 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(checking_Doet ${PLEGMA_LIBS}) cuda_add_executable(omegamass EXCLUDE_FROM_ALL omegamass.cpp) target_link_libraries(omegamass ${PLEGMA_LIBS}) + cuda_add_executable(pi0Insertion EXCLUDE_FROM_ALL pi0Insertion.cpp) + target_link_libraries(pi0Insertion ${PLEGMA_LIBS}) + cuda_add_executable(QuarkLoops_pi0_insertion EXCLUDE_FROM_ALL QuarkLoops_pi0_insertion.cpp) + target_link_libraries(QuarkLoops_pi0_insertion ${PLEGMA_LIBS}) cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) target_link_libraries(testYan ${PLEGMA_LIBS}) endif(PLEGMA_SCATTERING_CONTRACTIONS) From 99def48e78445befdc70585d14ac06639a82c619 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sat, 6 May 2023 10:18:53 +0200 Subject: [PATCH 071/168] correcting compilation error --- lib/kernels/PLEGMA_vector_utils.cuh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/kernels/PLEGMA_vector_utils.cuh b/lib/kernels/PLEGMA_vector_utils.cuh index 1bd35f0b..afc2164c 100644 --- a/lib/kernels/PLEGMA_vector_utils.cuh +++ b/lib/kernels/PLEGMA_vector_utils.cuh @@ -18,6 +18,18 @@ static __global__ void rotate_uk_ch_g5g4_kernel(vector2 vec){ vec.set(Sout,sid); } +template +static __global__ void rotate_uk_ch_etmc_kernel(vector2 vec){ + int sid = blockIdx.x*blockDim.x + threadIdx.x; + Float2 Sin[N_SPINS][N_COLS]; + Float2 Sout[N_SPINS][N_COLS]; + if (sid >= vec.volume()) return; + vec.get(Sin,sid); + U_uk_ch_etmc(Sout,Sin); + vec.set(Sout,sid); +} + + template void rotate_uk_ch_g5g4_k(vector2 vec){ dim3 blockDim( THREADS_PER_BLOCK , 1, 1); @@ -26,6 +38,14 @@ void rotate_uk_ch_g5g4_k(vector2 vec){ } +template +void rotate_uk_ch_etmc_k(vector2 vec){ + dim3 blockDim( THREADS_PER_BLOCK , 1, 1); + dim3 gridDim( (vec.volume() + blockDim.x -1)/blockDim.x , 1 , 1); + rotate_uk_ch_etmc_kernel<<>>(vec); +} + + template static __global__ void apply_gamma_vector_kernel(vector2 vec, GAMMAS r){ int sid = blockIdx.x*blockDim.x + threadIdx.x; From c7287bc83f99f02f2d30e5afcaa42f6a6aad626c Mon Sep 17 00:00:00 2001 From: Yan Li Date: Sat, 6 May 2023 11:37:19 +0200 Subject: [PATCH 072/168] CMakeLists --- plegma/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 13747a9d..e5578091 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -82,8 +82,8 @@ target_link_libraries(Dilution ${PLEGMA_LIBS}) cuda_add_executable(testLinksSmearings EXCLUDE_FROM_ALL testLinksSmearings.cpp) target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) -cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) -target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) +# cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) +# target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) From 606b9f3088f87c4bc79efa3fe1b4240675f9d885 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sat, 6 May 2023 13:58:22 +0200 Subject: [PATCH 073/168] adding etmc basis change function --- include/PLEGMA_Vector.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index ceb13e21..aea2c177 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -93,6 +93,7 @@ namespace plegma { @brief Performs the similarity transformation of gamma matrices from tmLQCD to QUDA-UKQCD and vice versa **/ void rotate_uk_ch_g5g4(); + void rotate_uk_ch_etmc(); void covD(PLEGMA_Vector &vecIn, PLEGMA_Gauge &gauge, int dirOr); void mulGV(PLEGMA_Vector &vecIn, PLEGMA_Su3field &u); void pack_fermion_to_sink(std::vector*> &stochastic_vector, int sinktime); From 0ea0dab8bfc86474ed631894bb9039d3255ee29a Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sat, 6 May 2023 15:54:28 +0200 Subject: [PATCH 074/168] correcting for compilation error --- lib/kernels/PLEGMA_kernel_utils.cuh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/kernels/PLEGMA_kernel_utils.cuh b/lib/kernels/PLEGMA_kernel_utils.cuh index d26d2eee..eee39549 100644 --- a/lib/kernels/PLEGMA_kernel_utils.cuh +++ b/lib/kernels/PLEGMA_kernel_utils.cuh @@ -165,6 +165,21 @@ namespace plegma { vout[3][c1] = nrm * (vin[3][c1] + vin[1][c1]); } } + + + template + __inline__ __device__ void U_uk_ch_etmc(Float2 vout[N_SPINS][N_COLS], Float2vin[N_SPINS][N_COLS]){ + Float nrm=1./sqrt(2.); +#pragma unroll + for(int c1 = 0; c1 < N_COLS; c1++){ + vout[0][c1] = nrm * (vin[0][c1] + vin[2][c1]); + vout[1][c1] = nrm * (vin[1][c1] + vin[3][c1]); + vout[2][c1] = nrm * (vin[0][c1] - vin[2][c1]); + vout[3][c1] = nrm * (vin[1][c1] - vin[3][c1]); + } + } + + template __inline__ __device__ void gammaProp(Float2 pout[N_SPINS][N_SPINS][N_COLS][N_COLS], From be31cf5be61fec9e952f44d79793cc9255ffefb8 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sun, 7 May 2023 13:50:23 +0200 Subject: [PATCH 075/168] the d1ff diagrams can be combined from the T reductions either by taking the sum or the difference --- include/PLEGMA_ScattCorrelator.h | 2 +- lib/PLEGMA_ScattCorrelator.cu | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 77e030d3..4a3d46d7 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -279,7 +279,7 @@ namespace plegma { void M_diagrams( PLEGMA_ScattCorrelator &CorrNucleon, PLEGMA_ScattCorrelator &CorrPion, Float *data, bool accum=false ); // void LT_diagrams( PLEGMA_ScattCorrelator &T1reduction, PLEGMA_ScattCorrelator &T2reduction, PLEGMA_ScattCorrelator &Loop, bool accum=false ); - void LT_diagrams( PLEGMA_ScattCorrelator &T1reduction, PLEGMA_ScattCorrelator &T2reduction, bool accum=false ); + void LT_diagrams( PLEGMA_ScattCorrelator &T1reduction, PLEGMA_ScattCorrelator &T2reduction,int sign, bool accum=false ); void D1ii_diagrams(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, Float * loopcontribution, const int ig_i2, const int diagram_index, bool accum=false); diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index c23b9550..5dab7c3e 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -2908,7 +2908,7 @@ void PLEGMA_ScattCorrelator::T_diagrams_piNsink( PLEGMA_ScattCorrelator -void PLEGMA_ScattCorrelator::LT_diagrams( PLEGMA_ScattCorrelator &T1, PLEGMA_ScattCorrelator &T2, bool accum){ +void PLEGMA_ScattCorrelator::LT_diagrams( PLEGMA_ScattCorrelator &T1, PLEGMA_ScattCorrelator &T2, int sign, bool accum){ //checks between T1 T2 if(!T1.check_reduction(T_1)) PLEGMA_error("srcT1 seems not to have T1like shape\n"); @@ -2956,7 +2956,7 @@ void PLEGMA_ScattCorrelator::LT_diagrams( PLEGMA_ScattCorrelator & // loop_contribution[1]= loop_pointer[1]; for(int spin=0; spin Date: Sun, 7 May 2023 15:21:35 +0200 Subject: [PATCH 076/168] correcting compilation error --- plegma/nucleon_3pt_n_npi.cpp | 393 +++++++---------------------------- 1 file changed, 71 insertions(+), 322 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index a9fd22e7..12749bc6 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -255,8 +255,6 @@ int main(int argc, char **argv) { momList list_mpf2_twopt(1,{mpf2_twopt,},{0,}); - - int parallel_sources=HGC_totalL[3]/max_source_sink_separations; std::vector lookuptable_UP; std::vector lookuptable_DN; @@ -271,8 +269,6 @@ int main(int argc, char **argv) { attract_lookup_table=(int *)malloc(sizeof(int)*HGC_totalL[3]); - - PLEGMA_Vector vectorSource_stochastic; vectorSource_stochastic.randInit(rand_seed1); @@ -298,13 +294,6 @@ int main(int argc, char **argv) { std::vector*> stochastic_propags_DN_SL; - //std::vector*> stochastic_oet_prop_u_zero_mom_SS; - - //std::vector*> stochastic_oet_prop_d_zero_mom_SS; - - //std::vector*> stochastic_oet_prop_u_fini_mom_SL; - - //std::vector*> stochastic_oet_prop_d_fini_mom_SL; PLEGMA_Vector stochastic_oet_prop_u_zero_mom_SS; PLEGMA_Vector stochastic_oet_prop_d_zero_mom_SS; @@ -318,21 +307,6 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SS; - - //for(int i=0; i< 4; ++i) { - - //stochastic_oet_prop_u_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); - //stochastic_oet_prop_d_zero_mom_SS.push_back(new PLEGMA_Vector(HOST)); - - //stochastic_oet_prop_u_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); - //stochastic_oet_prop_d_fini_mom_SL.push_back(new PLEGMA_Vector(HOST)); - - - //} - - - - /****************************************************** * *Step 1: Producing the stochastic sources @@ -350,44 +324,17 @@ int main(int argc, char **argv) { vectorSource_stochastic.stochastic_Z(nroots); vectorSource_stochastic.unload(); vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); - vectorSource_stochastic.load(); - - - -/* PLEGMA_Vector vectorRead(BOTH); +#if 0 + PLEGMA_Vector vectorRead(BOTH); vectorRead.readFile("stochastic_source.0000.00000_plegma_conventions.lime",LIME_FORMAT); vectorRead.load(); vectorRead.rotate_uk_ch_g5g4(); vectorRead.apply_gamma(G2); vectorRead.unload(); - - stochastic_sources[i]->copy(vectorRead,HOST);*/ - vectorSource_stochastic.unload(); + stochastic_sources[i]->copy(vectorRead,HOST); +#endif stochastic_sources[i]->copy(vectorSource_stochastic,HOST); vectorSource_stochastic.load(); - - - -/* - vectorRead.copy(vectorSource_stochastic); - vectorSource_stochastic.unload(); - vectorRead.rotate_uk_ch_g5g4(); - vectorRead.apply_gamma(G2); - vectorRead.unload(); - vectorRead.writeLIME("globalTfulltimedilution_source_nstoch_qlua"+std::to_string(i)+"_"+confnumber); -*/ - - //PLEGMA_Vector vectorRead(BOTH); - //vectorRead.readFile("stochastic_source0.lime",LIME_FORMAT); - //vectorRead.load(); - //stochastic_sources[i]->copy(vectorRead,HOST); -//tochastic_sources[i]->copy(vectorSource_stochastic,HOST); - -// vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); - //PLEGMA_printf("Save the stochastic source for sample %d\n",i); - //std::string nstoch=std::to_string(i); - //vectorSource_stochastic.writeHDF5("stochastic_source"+nstoch); -// vectorSource_stochastic.load(); } else{ std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; @@ -588,7 +535,6 @@ int main(int argc, char **argv) { vectorAuxD1.load(); } - //lookuptable[(source[3]+tSinks[k]+l*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]=isource*tSinks.size()*parallel_sources+k*parallel_sources+l; lookuptable_DN[timeSlice]=(countindex-1)/n_stochastic_samples; } } @@ -635,14 +581,9 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; vector1.pointSource(source_location, isc/3, isc%3, DEVICE); - //double tmp=vector1.norm(); - //PLEGMA_printf("Norm of source location %d is %e\n",source_location[3],tmp); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); vectorInOut.absorb(vector2,source_location[DIM_T]); } - //vectorInOut.unload(); - //vectorInOut.writeHDF5("testPointSourceSmeared"); - //vectorInOut.load(); // Inverting PLEGMA_printf("Going to invert %s for component %d\n", fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); @@ -719,8 +660,8 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrNP(source_local, list_mpf1_twopt); TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); -// PLEGMA_ScattCorrelator corrN0(source_local, list_mpf1_twopt); -// TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + PLEGMA_ScattCorrelator corrN0(source_local, list_mpf1_twopt); + TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); // If twop_filename exists we hold the computation of the light props @@ -740,11 +681,10 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); - } //Computing T reductions+recombination - /* + { PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); @@ -755,13 +695,13 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); - }*/ + } outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; - /*TIME( corrN0.apply_phase()); + TIME( corrN0.apply_phase()); TIME( corrN0.apply_sign("N")); TIME( corrN0.applyBoundaryConditions( true )); - TIME( corrN0.writeHDF5(outfilename));*/ + TIME( corrN0.writeHDF5(outfilename)); TIME( corrNP.apply_phase() ); TIME( corrNP.apply_sign("N") ); @@ -780,21 +720,10 @@ int main(int argc, char **argv) { vectorAuxPrint.unload(); vectorAuxPrint.writeHDF5("propUPSS_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); } - for(int isc = 0 ; isc < 12 ; isc++){ - std::string spin=std::to_string(isc/3); - std::string col=std::to_string(isc%3); - - vectorAuxPrint.absorb(propUP_SL,isc/3,isc%3); - vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("propUPSL_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); - } - }*/ propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); -// stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(j+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, j == 0 ? true : false); - propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -840,45 +769,6 @@ int main(int argc, char **argv) { } - /* - { - PLEGMA_printf("Save propagator for the up and dn quark\n"); - PLEGMA_Vector vectorAuxPrint(BOTH); - for(int isc = 0 ; isc < 12 ; isc++){ - std::string spin=std::to_string(isc/3); - std::string col=std::to_string(isc%3); - - vectorAuxPrint.absorb(propUP_SL_packed,isc/3,isc%3); - vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("propUPSL_packed_s"+spin+"_c"+col); - } - for(int isc = 0 ; isc < 12 ; isc++){ - std::string spin=std::to_string(isc/3); - std::string col=std::to_string(isc%3); - - vectorAuxPrint.absorb(propUP_SS_packed,isc/3,isc%3); - vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("propUPSS_packed_s"+spin+"_c"+col); - } - for(int isc = 0 ; isc < 12 ; isc++){ - std::string spin=std::to_string(isc/3); - std::string col=std::to_string(isc%3); - - vectorAuxPrint.absorb(propDN_SL_packed,isc/3,isc%3); - vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("propDNSL_packed_s"+spin+"_c"+col); - } - for(int isc = 0 ; isc < 12 ; isc++){ - std::string spin=std::to_string(isc/3); - std::string col=std::to_string(isc%3); - - vectorAuxPrint.absorb(propDN_SS_packed,isc/3,isc%3); - vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("propDNSS_packed_s"+spin+"_c"+col); - } - } - */ - /****************************************************** * * Step 4: Computing the factors from the point to all @@ -900,30 +790,36 @@ int main(int argc, char **argv) { //Here the prefix UU means that reduction is based phi and xi, without the gamma_5 //We replace U(x_f2,x_f1) with phi(x_f2) xi^dagger(x_f1) //phi goes to V2 reduction and xi goes to V3 reduction + + + //Here the prefix DD means that reduction is based phi*g5 and xi*g5 + //We replace D(x_f2,x_f1) with xi(x_f2)*gamma_5* phi^dagger(x_f1) *gamma_5 + //phi goes to V3 reduction and xi goes to V2 reduction + + //For the proton pizero x neutron piplus + std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented - std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented - - std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented - std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt; std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented - std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_UU_V3_GAMMAF2U;//implemented std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented - - //Here the prefix DD means that reduction is based phi*g5 and xi*g5 - //We replace D(x_f2,x_f1) with xi(x_f2)*gamma_5* phi^dagger(x_f1) *gamma_5 - //phi goes to V3 reduction and xi goes to V2 reduction - std::vector*> reductions_DD_V3_GAMMAF2D;//implemented - std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt; + + std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented + + + for(int i=0; i< n_stochastic_samples; ++i) { @@ -931,6 +827,8 @@ int main(int argc, char **argv) { reductions_DD_V2_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_DD_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); @@ -938,8 +836,6 @@ int main(int argc, char **argv) { reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - } @@ -968,11 +864,6 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_source; stochastic_source.copy(*stochastic_sources[i_sample],HOST); stochastic_source.load(); - /*if (i_sample==0){ - stochastic_source.unload(); - stochastic_source.writeHDF5("stochastic_vector_source.h5"); - }*/ - for (int k=0; k< tSinks.size();++k){ int tsinkMtsource = tSinks[k]; @@ -1010,6 +901,10 @@ int main(int argc, char **argv) { TIME(reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); + //B4,B6 + //B10,B12 + TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, true)); + if (k==0 && (dotwopoint==1)){ PLEGMA_Vector stoch_piece; stoch_piece.unload(); @@ -1045,10 +940,6 @@ int main(int argc, char **argv) { } - //B4,B6 - //B10,B12 - TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, true)); - //W5,W6,W7,W8 //W9,W10,W11,W12,W17,W18,W19,W20 PLEGMA_Vector stochastic_propagator_packed; @@ -1096,15 +987,10 @@ int main(int argc, char **argv) { temporary.unload(); temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[sink_local[3]]*n_stochastic_samples+i_sample],HOST); temporary.load(); - //temporary.writeHDF5("source_for_packing_j"+std::to_string(i_source_parallel)+"_stoch"+std::to_string(i_sample)); - //temporary.load(); stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } - //stochastic_propagator_packed.unload(); - //stochastic_propagator_packed.writeHDF5("stochastic_up_packed_SL_ns"+std::to_string(i_sample)); - //stochastic_propagator_packed.load(); stochastic_propagator_packed.apply_gamma5(); @@ -1124,14 +1010,18 @@ int main(int argc, char **argv) { //List of momenta corresponding to a fix value of p_i2 momList filtered_sourcemomentumList_2pt_single = sourcemomentumList_twopt.extract(momentum_i2, 0); + //proton pizero x proton pizero + //udu ubaru (x_f) dbarubarubar PLEGMA_ScattCorrelator corrD1ii1(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii2(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii3(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii4(source, filtered_sourcemomentumList_2pt_single); + //udu dbard (x_f) dbarubarubar PLEGMA_ScattCorrelator corrD1ii9(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii10(source, filtered_sourcemomentumList_2pt_single); + //dud dbaru (x_f) dbarubarubar PLEGMA_ScattCorrelator corrD1ii13(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii14(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii15(source, filtered_sourcemomentumList_2pt_single); @@ -1240,28 +1130,16 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1, vector2; - vector1.absorb(vectorStoc_source_oet, source_local[3]); + vector1.absorb(vectorStoc_source_oet, source_local[DIM_T]); PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vectortmp1.absorb(vector2, source_local[3]); + vectortmp1.absorb(vector2, source_local[DIM_T]); } - //Dilution - //vectortmp2.dilutespin(vectortmp1,0); - - //Save the smeared,transformed and diluted source for non-zero momentum oet. - //vectorSave_diluted.copy(vectortmp2); - - //for (int spinindex=0; spinindex<4; ++spinindex){ - //Transforming to physical base for the UP quark - //vectortmp1.unload(); - //vectortmp1.writeHDF5("source_for_up_zero_mom_oet_t"+std::to_string(source_local[3])); - //vectortmp1.load(); vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); - //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); //Doing the zero momentum stochastic propagator with spin dilution //Doing the inversion TIME(solver.solve(vectortmp2, vectortmp2)); @@ -1269,25 +1147,12 @@ int main(int argc, char **argv) { vectortmp1.rotateToPhysicalBasis(vectortmp2,+1); //Gaussian smearing of the propagator TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); - //PLEGMA_Vector temporary1,temporary2; - //temporary1.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); - //temporary1.load(); - //temporary2.copy(vectortmp2); //temporary1.pack_propagator_from_source_to_sink(temporary2, maxinsertion_local[3], max_source_sink_separations, l == 0 ? true : false); PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectortmp2); stochastic_oet_prop_u_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - //temporary1.unload(); - //stochastic_oet_prop_u_zero_mom_SS[spinindex]->copy(temporary1,HOST); - // temporary1.load(); - - //temporary1.writeLIME(outfile_V+confnumber+"propagator_up"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); - - //vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); - //vectorSave_diluted.copy(vectortmp1); - //} //end of loop in spin indices } //end of loop on parallel sources @@ -1298,7 +1163,7 @@ int main(int argc, char **argv) { //PLEGMA_printf("DONE OET zero mom up\n"); - //Doing for -mu for the DN propagator spin dilution oet + //Doing for -mu for the DN propagator spin dilution oet if(mu>0) { mu*=-1.; solver.UpdateSolver(); @@ -1332,16 +1197,6 @@ int main(int argc, char **argv) { vectortmp1.absorb(vector2, source_local[3]); } - //Dilution - //vectortmp2.dilutespin(vectortmp1,0); - - //Save the smeared,transformed and diluted source for non-zero momentum oet. - //vectorSave_diluted.copy(vectortmp2); - - - //for (int spinindex=0; spinindex<4; ++spinindex){ - //Transforming to physical base for the DN quark - //vectortmp2.rotateToPhysicalBasis(vectorSave_diluted,-1); vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); //Doing the zero momentum stochastic propagator with spin dilution @@ -1351,31 +1206,13 @@ int main(int argc, char **argv) { vectortmp1.rotateToPhysicalBasis(vectortmp2,-1); //Gaussian smearing of the propagator TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); - //PLEGMA_Vector temporary1,temporary2; - //temporary1.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); - //temporary1.load(); - //temporary2.copy(vectortmp2); - //PLEGMA_printf("PACKING stochastic oet dn %d\n",maxinsertion_local[3]); - - //temporary1.pack_propagator_from_source_to_sink(temporary2, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectortmp2); stochastic_oet_prop_d_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); - //temporary1.unload(); - //stochastic_oet_prop_d_zero_mom_SS[spinindex]->copy(temporary1,HOST); - //vectortmp2.writeLIME(outfile_V+confnumber+"propagator_dn"+sourcepositiontext+"mompi2_0_0_0_s"+std::to_string(spinindex)); - // temporary1.load(); - //vectortmp1.diluteSpinDisplace(vectorSave_diluted,(spinindex+1)%4,spinindex); - //vectorSave_diluted.copy(vectortmp1); - //}//end of loop on spin indices } //end of loop on parallel sources }//end of do_stochastic_oet - //stochastic_oet_prop_d_zero_mom_SS.unload(); - //stochastic_oet_prop_d_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_d"); - //stochastic_oet_prop_d_zero_mom_SS.load(); - //PLEGMA_printf("DONE OET zero mom dn\n"); @@ -1390,18 +1227,14 @@ int main(int argc, char **argv) { * ******************************************************/ - // std::vector*> reductionsV3_diluted_U_DN; - // std::vector*> reductionsV3_diluted_D_UP; - // std::vector*> reductionsV4_diluted_STOCHU_DN_UP; - // std::vector*> reductionsV2_diluted_STOCHU_DN_UP; - // std::vector*> reductionsV2_diluted_STOCHD_UP_UP; PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt(source_reduction, list_mpf2_twopt); + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt(source_reduction, list_mpf2_twopt); PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt(source_reduction, list_mpf2_twopt); - PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt(source_reduction, list_mpf2_twopt); - PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt(source_reduction, list_mpf2_twopt); std::vector*> reductionsV4_diluted_STOCHU_DN_UP; std::vector*> reductionsV2_diluted_STOCHU_DN_UP; @@ -1416,20 +1249,6 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt(source_reduction, list_mpf1_twopt); PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt(source_reduction, list_mpf1_twopt); - - - // for (int spinindex=0;spinindex<4;++spinindex){ - // try - // { - // reductionsV3_diluted_U_DN.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); - // reductionsV3_diluted_D_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); - // - // } - // catch(std::bad_alloc&){ - // PLEGMA_printf("Memory allocation fails to store V3 factors oet"); - // exit(1); - // } - for (int k=0; k propUPpacked_to_sink; @@ -1460,19 +1278,11 @@ int main(int argc, char **argv) { propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); } - //for (int spinindex=0;spinindex<4;++spinindex){ - //PLEGMA_Vector st_oet_u_zero; - //PLEGMA_Vector st_oet_d_zero; - - //st_oet_u_zero.copy(*stochastic_oet_prop_u_zero_mom_SS[spinindex],HOST); - //st_oet_u_zero.load(); - //st_oet_d_zero.copy(*stochastic_oet_prop_d_zero_mom_SS[spinindex],HOST); - //st_oet_d_zero.load(); - PLEGMA_Vector st_oet_u_zeropacked_to_sink; - PLEGMA_Vector st_oet_d_zeropacked_to_sink; + PLEGMA_Vector st_oet_u_zeropacked_to_sink; + PLEGMA_Vector st_oet_d_zeropacked_to_sink; - for (int i_source_parallel=0; i_source_parallelV2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); - //TIME(reductionsV2_diluted_STOCHU_DN_UP[k]->writeHDF5("redV2_oet")); TIME(reductionsV2_diluted_STOCHD_UP_UP[k]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, true)); TIME(reductionsV4_diluted_STOCHU_DN_UP[k]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); if (k==0 && (dotwopoint==1)){ - for (int i_source_parallel=0; i_source_parallel reductionsV2(source_reduction, list_mpf1_threept); PLEGMA_ScattCorrelator reductionsV2_2pt(source_reduction, list_mpf1_twopt); - - PLEGMA_ScattCorrelator corrM( source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrD1if12(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrD1if34(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrD1if56(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator reductionsT1(source_reduction, mptot_filt); PLEGMA_ScattCorrelator reductionsT2(source_reduction, mptot_filt); - PLEGMA_ScattCorrelator reductionsV3(source_reduction, list_mpc); PLEGMA_ScattCorrelator reductionsV3_2pt(source_reduction, list_mpf2_twopt); - PLEGMA_Propagator propTS_SS_packed; PLEGMA_Propagator propTS_SL_packed; #if 1 + //First we do the UP - UP case sequential inversion for the proton pizero for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ PLEGMA_Propagator propTS_SS; @@ -1673,8 +1466,8 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); - TIME(corrD1ff24710.LT_diagrams( reductionsT1, reductionsT2 )); - TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(corrD1ff24710.LT_diagrams( reductionsT1, reductionsT2, 1 )); + TIME(produceOutput_2pt_packed( corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); @@ -1682,7 +1475,7 @@ int main(int argc, char **argv) { TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, 0, false, true, true)); - TIME(corrD1ff1389.LT_diagrams( reductionsT1, reductionsT2 )); + TIME(corrD1ff1389.LT_diagrams( reductionsT1, reductionsT2, 1 )); TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); @@ -1796,7 +1589,6 @@ int main(int argc, char **argv) { - stochastic_piece.unload(); stochastic_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); stochastic_piece.load(); @@ -2000,6 +1792,7 @@ int main(int argc, char **argv) { }//loop over source sink separations #endif + //We perform next U-D sequential to handle the piplus neutron case // ensuring mu positive if(mu<0) { mu*=-1.; @@ -2011,7 +1804,6 @@ int main(int argc, char **argv) { PLEGMA_Propagator propTS_SS; PLEGMA_Propagator propTS_SL; - if(mu<0) { mu*=-1.; solver.UpdateSolver(); @@ -2095,18 +1887,20 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, 0, false, true, false )); - TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); - TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT2, 0, false, false, false )); - - TIME(corrD1ff13141718.LT_diagrams( reductionsT1, reductionsT2 )); - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, 0, false, false, true )); + + TIME(corrD1ff13141718.LT_diagrams( reductionsT1, reductionsT2, 1 )); + + + TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT2, 0, false, false, false )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, 0, false, false, true )); - TIME(corrD1ff15161920.LT_diagrams( reductionsT1, reductionsT2 )); + TIME(corrD1ff15161920.LT_diagrams( reductionsT2, reductionsT1, -1 )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; @@ -2410,7 +2204,7 @@ int main(int argc, char **argv) { } //loop over source sink separations - +//Here we perform the last sequential the DN DN case #if 1 for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ @@ -2486,15 +2280,14 @@ int main(int argc, char **argv) { corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); - TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, false )); + TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, true )); TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); - TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, false, true )); + TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, true, true )); - TIME(corrD1ff56.LT_diagrams( reductionsT1, reductionsT2 )); + TIME(corrD1ff56.LT_diagrams( reductionsT1, reductionsT2, 1 )); TIME(produceOutput_2pt_packed( corrD1ff56, outfilename, "T", parallel_sources, attract_lookup_table)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; TIME(produceOutput_2pt_packed(corrTproton_protonpizero5, outfilename, "T", parallel_sources, attract_lookup_table)); @@ -2709,12 +2502,7 @@ int main(int argc, char **argv) { //Multiplying by the appropriate momentum phase - //vectortmp1.dilutespin(vectorStoc_source_oet,0); - //vectorSource_finite_mom.copy(vectortmp1); vectorSource_finite_mom.copy(vectorStoc_source_oet); - //vectorSource_finite_mom.unload(); - //vectorSource_finite_mom.writeHDF5("finite_mom_oet_source"); - //vectorSource_finite_mom.load(); std::vector tmp_4Dmom= momentum_i2 ; tmp_4Dmom.push_back(0); @@ -2729,16 +2517,11 @@ int main(int argc, char **argv) { smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); vectortmp1.absorb(vector2, source_local[3],true); - //PLEGMA_printf("Source local %d\n",source_local[3]); - //vectortmp1.unload(); - //vectortmp1.writeHDF5("source_for_up_fini_mom_oet_t"+std::to_string(source_local[3])); - //vectortmp1.load(); } - //for (int spinindex=0; spinindex<4; ++spinindex){ - //Transforming to physical base for the UP quark + //Transforming to physical base for the UP quark vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); //Doing the inversion @@ -2758,28 +2541,6 @@ int main(int argc, char **argv) { } - //stochastic_oet_prop_u_fini_mom_SL.unload(); - //stochastic_oet_prop_u_fini_mom_SL.writeHDF5("finite_momentum_oet_unsmeared_u"); - //stochastic_oet_prop_u_fini_mom_SL.load(); - - - //PLEGMA_Vector temporary1,temporary2; - //temporary1.copy(*stochastic_oet_prop_u_fini_mom_SL[spinindex],HOST); - //temporary1.load(); - //temporary2.copy(vectortmp2); - //temporary1.pack_propagator_from_source_to_sink(temporary2,(source[3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, l == 0 ? true : false); - //temporary1.unload(); - //stochastic_oet_prop_u_fini_mom_SL[spinindex]->copy(temporary1,HOST); - //temporary1.load(); - - - - //vectortmp1.diluteSpinDisplace(vectorSource_finite_mom,(spinindex+1)%4,spinindex); - //vectorSource_finite_mom.copy(vectortmp1); - - //} //end of spin dilution - - //} // end of parallel sources //Doing for +mu for the DN propagator spin dilution oet if(mu>0) { @@ -2792,12 +2553,6 @@ int main(int argc, char **argv) { site source_local = sourcePositions[isource]; source_local[3]=(source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; vectortmp1.zero_device(); - //int sink_local=(sourcePositions[isource][3]+(l+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - - //Multiplying by the appropriate momentum phase - - //vectortmp1.dilutespin(vectorStoc_source_oet,0); - //vectorSource_finite_mom.copy(vectortmp1); vectorSource_finite_mom.copy(vectorStoc_source_oet); std::vector tmp_4Dmom= momentum_i2 ; @@ -2815,9 +2570,6 @@ int main(int argc, char **argv) { } - - //for (int spinindex=0; spinindex<4; ++spinindex){ - //Transforming to physical base for the UP quark vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); @@ -3124,9 +2876,6 @@ int main(int argc, char **argv) { } - //for (int spinindex=0;spinindex<4;++spinindex){ - // reductionsV3_diluted_U_DN.pop_back(); - // reductionsV3_diluted_D_UP.pop_back(); #if 1 for (int k=0; k Date: Wed, 17 May 2023 10:42:47 +0200 Subject: [PATCH 077/168] include sigma aka f0(500) --- plegma/QuarkLoops_pi0_insertion.cpp | 57 +++++++++++++++++-------- plegma/pi0Insertion.cpp | 64 ++++++++++++++++++++++++----- 2 files changed, 94 insertions(+), 27 deletions(-) diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index 2a175a29..c94052e2 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -13,6 +13,8 @@ Each run should start with a random seed, and end up with either creating a new of stochastic sources used. It is recommended to backup data files before a new run that increases the statistics in case of the possibility that the new run destroys the existed data file. + +Here the f_0(500)/sigma resonance (ubaru+dbard) is also supported. */ #include @@ -41,9 +43,10 @@ int main(int argc, char **argv) HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); - std::string caseToDo, readStocPath; + std::string caseToDo, whichMeson, readStocPath; int readStoc, seed_stoc, num_stoc; - HGC_options->set("caseToDo", "pi0 or insertion", verbosity, caseToDo); + HGC_options->set("caseToDo", "meson or insertion - saveSample or saveAverage", verbosity, caseToDo); + HGC_options->set("whichMeson", "pi0 or sigma", verbosity, whichMeson); HGC_options->set("readStocPath", "Path for stoc", verbosity, readStocPath); HGC_options->set("readStoc", "Set 1 to read stoc from NJNpi_N0P+", verbosity, readStoc); HGC_options->set("seed_stoc", "Seed for stoc", verbosity, seed_stoc); @@ -266,11 +269,33 @@ int main(int argc, char **argv) free(ssource); std::vector gscatts_ID = {ID}; - std::vector gscatts_N = {CG_5}; - std::vector gscatts_pi = {G_5}; std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + std::vector gscatts_meson = {}; + std::string filenameEnd = ""; + if (caseToDo == "meson-saveSample" || caseToDo == "meson-saveAverage") + { + if (whichMeson == "pi0") + { + gscatts_meson.push_back(G_5); + filenameEnd = "pi0Loop"; + } + else if (whichMeson == "sigma") + { + gscatts_meson.push_back(ID); + filenameEnd = "sigmaLoop"; + } + else + { + PLEGMA_error("whichMeson = %s not supported", whichMeson); + } + } + else + { + filenameEnd = "insertLoop"; + } + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_twopt.c_str()); plegma::momList momList2pt(3, pathListMomenta_twopt, {1, 2}); // pi2, pf1, pf2 PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList2pt.size()); @@ -293,7 +318,7 @@ int main(int argc, char **argv) * Main * ******************************************************/ - if (caseToDo == "pi0-saveSample") + if (caseToDo == "meson-saveSample") { if (readStoc == 0) { @@ -303,7 +328,7 @@ int main(int argc, char **argv) for (int i = 0; i < num_stoc; i++) { plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); - pi0Loop.initialize_diagram(gscatts_pi, "stoc" + std::to_string(seed_stoc) + "id" + std::to_string(i) + "_1" + "/up"); + pi0Loop.initialize_diagram(gscatts_meson, "stoc" + std::to_string(seed_stoc) + "id" + std::to_string(i) + "_1" + "/up"); plegma::PLEGMA_Vector stocSrc, stocProp; plegma::PLEGMA_Vector stocPropSmeared; @@ -329,7 +354,7 @@ int main(int argc, char **argv) stocProp.copy(stocPropSmeared); pi0Loop.Loop_diagrams(stocProp, stocSrc, false); - std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenameEnd; pi0Loop.writeHDF5(outfilename); } } @@ -339,7 +364,7 @@ int main(int argc, char **argv) for (int i = 0; i < num_stoc; i++) { plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); - pi0Loop.initialize_diagram(gscatts_pi, "stocRead1id" + std::to_string(i) + "_1" + "/up"); + pi0Loop.initialize_diagram(gscatts_meson, "stocRead1id" + std::to_string(i) + "_1" + "/up"); plegma::PLEGMA_Vector stocSrc, stocProp; plegma::PLEGMA_Vector stocSrcD, stocPropD; @@ -354,18 +379,18 @@ int main(int argc, char **argv) stocSrc.copy(stocSrcD); pi0Loop.Loop_diagrams(stocProp, stocSrc, false); - std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenameEnd; pi0Loop.writeHDF5(outfilename); } } } - else if (caseToDo == "pi0-saveAverage") + else if (caseToDo == "meson-saveAverage") { if (readStoc == 0) { struct plegma::site src({0, 0, 0, 0}); plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); - pi0Loop.initialize_diagram(gscatts_pi, "stoc" + std::to_string(seed_stoc) + "_" + std::to_string(num_stoc) + "/up"); + pi0Loop.initialize_diagram(gscatts_meson, "stoc" + std::to_string(seed_stoc) + "_" + std::to_string(num_stoc) + "/up"); plegma::PLEGMA_Vector stocSrcUnsmeared; stocSrcUnsmeared.randInit(seed_stoc); @@ -396,14 +421,14 @@ int main(int argc, char **argv) pi0Loop.Loop_diagrams(stocProp, stocSrc, i == 0 ? false : true); } pi0Loop.normalize_nstoch(num_stoc); - std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenameEnd; pi0Loop.writeHDF5(outfilename); } else if (readStoc == 1) { struct plegma::site src({0, 0, 0, 0}); plegma::PLEGMA_ScattCorrelator pi0Loop(src, momList2pt_pi2); - pi0Loop.initialize_diagram(gscatts_pi, "stocRead1_" + std::to_string(num_stoc) + "/up"); + pi0Loop.initialize_diagram(gscatts_meson, "stocRead1_" + std::to_string(num_stoc) + "/up"); plegma::PLEGMA_Vector stocSrc, stocProp; plegma::PLEGMA_Vector stocSrcD, stocPropD; @@ -420,7 +445,7 @@ int main(int argc, char **argv) pi0Loop.Loop_diagrams(stocProp, stocSrc, i == 0 ? false : true); } pi0Loop.normalize_nstoch(num_stoc); - std::string outfilename = outdiagramPrefix + confnumber + "_pi0Loop"; + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenameEnd; pi0Loop.writeHDF5(outfilename); } } @@ -448,7 +473,7 @@ int main(int argc, char **argv) stocProp.copy(stocPropUnsmeared); insertLoop.Loop_diagrams(stocProp, stocSrc, false); - std::string outfilename = outdiagramPrefix + confnumber + "_insertLoop"; + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenameEnd; insertLoop.writeHDF5(outfilename); } } @@ -477,7 +502,7 @@ int main(int argc, char **argv) insertLoop.Loop_diagrams(stocProp, stocSrc, i == 0 ? false : true); } insertLoop.normalize_nstoch(num_stoc); - std::string outfilename = outdiagramPrefix + confnumber + "_insertLoop"; + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenameEnd; insertLoop.writeHDF5(outfilename); } else diff --git a/plegma/pi0Insertion.cpp b/plegma/pi0Insertion.cpp index add02e73..2813c4d0 100644 --- a/plegma/pi0Insertion.cpp +++ b/plegma/pi0Insertion.cpp @@ -1,3 +1,18 @@ +/* +Here we compute the pi0 contracted with insertion. +Both 'up' and 'dn' part will be done seperately, through they're +supposely to be (anti)-conjugate to their momentum-flipped partner. + +The conj sign for pion isn't implemented here. +To multiply it with the N-diagram, and construct the M-like NJNpi diagram, +we need (up -/+ dn)*i/sqrt(2) for (u+d)/(u-d) insertion, where i/sqrt(2) comes from +(-1) for adj-sign of pion and (-i)/sqrt(2) for prefactor of source pion. +Note u+d insertion corresponds to up-dn construction. + +Here the f_0(500)/sigma resonance (ubaru+dbard) is also supported. +Just u+d should correspond to up+dn this case. +*/ + #include #include std::vector runtime; @@ -19,13 +34,13 @@ int main(int argc, char **argv) ******************************************************/ initializeOptions(argc, argv, true, listOpt); - int seed_oet; - int confnumber_int; - std::string outdiagramPrefix = ""; + int seed_oet, confnumber_int; + std::string outdiagramPrefix, whichMeson; HGC_options->set("seed_oet", "Seed for initialization of stochastic sources for the oet", verbosity, seed_oet); HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + HGC_options->set("whichMeson", "pi0 or sigma", verbosity, whichMeson); initializePLEGMA(); @@ -244,11 +259,26 @@ int main(int argc, char **argv) free(ssource); std::vector gscatts_ID = {ID}; - std::vector gscatts_N = {CG_5}; - std::vector gscatts_pi = {G_5}; std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + std::vector gscatts_meson = {}; + std::string filenamePost = ""; + if (whichMeson == "pi0") + { + gscatts_meson.push_back(G_5); + filenamePost = "pi0Insert"; + } + else if (whichMeson == "sigma") + { + gscatts_meson.push_back(ID); + filenamePost = "sigmaInsert"; + } + else + { + PLEGMA_error("whichMeson = %s not supported", whichMeson); + } + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); plegma::momList momList_3pt(4, pathListMomenta_threept, {1, 2, 3}); // pi2, pf1, pf2, pc PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList_3pt.size()); @@ -292,12 +322,18 @@ int main(int argc, char **argv) plegma::PLEGMA_Vector stocPhiD_ti_mpi2_SL; plegma::PLEGMA_Vector3D auxVector3D; - auxVector3D.absorb(stocXi, time_i); + { + plegma::PLEGMA_Vector aux; + aux.copy(stocXi); + aux.apply_gamma5(); + aux.apply_gamma_scatt(gscatts_meson[0]); + auxVector3D.absorb(aux, time_i); + } auxVector3D.mulMomentumPhases(mom_pi2, -1); solve1(stocPhiD_ti_mpi2_SL, auxVector3D, time_i, d, SL); plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); - pi0Insertion.initialize_diagram(gscatts_pi, gscatts_c, str_pi2 + "/up"); + pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/up"); { plegma::PLEGMA_Vector aux, aux_pi2; aux.copy(stocPhiU_ti_SL); @@ -308,7 +344,7 @@ int main(int argc, char **argv) asprintf(&ssource, "st%03d", time_i); std::string sourcepositiontext = (std::string) "_" + ssource; free(ssource); - std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_pi0Isert"; + std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_" + filenamePost; pi0Insertion.writeHDF5(outfilename); } @@ -321,12 +357,18 @@ int main(int argc, char **argv) plegma::PLEGMA_Vector stocPhiU_ti_mpi2_SL; plegma::PLEGMA_Vector3D auxVector3D; - auxVector3D.absorb(stocXi, time_i); + { + plegma::PLEGMA_Vector aux; + aux.copy(stocXi); + aux.apply_gamma5(); + aux.apply_gamma_scatt(gscatts_meson[0]); + auxVector3D.absorb(aux, time_i); + } auxVector3D.mulMomentumPhases(mom_pi2, -1); solve1(stocPhiU_ti_mpi2_SL, auxVector3D, time_i, u, SL); plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); - pi0Insertion.initialize_diagram(gscatts_pi, gscatts_c, str_pi2 + "/dn"); + pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/dn"); { plegma::PLEGMA_Vector aux, aux_pi2; aux.copy(stocPhiD_ti_SL); @@ -337,7 +379,7 @@ int main(int argc, char **argv) asprintf(&ssource, "st%03d", time_i); std::string sourcepositiontext = (std::string) "_" + ssource; free(ssource); - std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_pi0Isert"; + std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_" + filenamePost; pi0Insertion.writeHDF5(outfilename); } From 41271bb3c5589031bc66ea490cdf8ca338075033 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 31 May 2023 08:54:27 +0200 Subject: [PATCH 078/168] saving W29-32 diagrams and correcting D1ff --- plegma/nucleon_3pt_n_npi.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 12749bc6..0862204c 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -1458,7 +1458,6 @@ int main(int argc, char **argv) { corrD1ff24710.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); corrD1ff1389.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); @@ -1467,17 +1466,23 @@ int main(int argc, char **argv) { TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); TIME(corrD1ff24710.LT_diagrams( reductionsT1, reductionsT2, 1 )); - TIME(produceOutput_2pt_packed( corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); - TIME(reductionsT1.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT1, 0, false, true, true)); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT2, 0, false, true, true)); TIME(corrD1ff1389.LT_diagrams( reductionsT1, reductionsT2, 1 )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; + + TIME(produceOutput_2pt_packed( corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); @@ -1786,6 +1791,13 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrW15_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrW16_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW29_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW30_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW31_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW32_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + + } @@ -1902,11 +1914,13 @@ int main(int argc, char **argv) { TIME(corrD1ff15161920.LT_diagrams( reductionsT2, reductionsT1, -1 )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; TIME(produceOutput_2pt_packed(corrD1ff13141718, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrD1ff15161920, outfilename, "T", parallel_sources, attract_lookup_table)); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3, outfilename, "T", parallel_sources, attract_lookup_table)); @@ -2286,6 +2300,9 @@ int main(int argc, char **argv) { TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, true, true )); TIME(corrD1ff56.LT_diagrams( reductionsT1, reductionsT2, 1 )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; + TIME(produceOutput_2pt_packed( corrD1ff56, outfilename, "T", parallel_sources, attract_lookup_table)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; From b41d5bdc002f9c58d9089f01066b3cfc608d4a65 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Tue, 6 Jun 2023 19:35:47 +0200 Subject: [PATCH 079/168] comment for mom convention of loops --- plegma/QuarkLoops_pi0_insertion.cpp | 2 + plegma/testYan.cpp | 866 +++++++++++----------------- 2 files changed, 331 insertions(+), 537 deletions(-) diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index c94052e2..e531b730 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -5,6 +5,8 @@ Here we compute quark loops, including smeared (for pi0) and local (for insertio The output data structure is like: sx00sy00sz00st00/stoc(seed_stoc)_(num_stoc))/[up or dn] dim=[N_time,N_mom,N_gamma,2 for real and imag] +The momenta are multiplied as sink momenta, i.e., with the Fourier phase exp(-i p x). + Only one of up and dn will be done for each run. up and dn are either conjugate or negative-conjugate to each other (with momentum flipped) diff --git a/plegma/testYan.cpp b/plegma/testYan.cpp index 4c6f9b64..1d5f8a09 100644 --- a/plegma/testYan.cpp +++ b/plegma/testYan.cpp @@ -1,575 +1,367 @@ -#include - -/* - N=Nucleon; p=proton; n=neutron - P=pion; [pp]=pion+; [pm]=pion-; [p0]=pion0; [pu]=pion0u; [pd]=pion0d - J=current; [ju]; [jd] - i=initial; f=finial; c=current - 1=Nucleon; 2=pion -*/ +#include +#include +std::vector runtime; +#define TIME(fnc) \ + runtime.push_back(MPI_Wtime()); \ + fnc; \ + PLEGMA_printf("TIME for " #fnc " %f sec\n", MPI_Wtime() - runtime.back()); \ + runtime.pop_back() extern int device; -static std::vector listOpt = {"verbosity", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", "load-gauge", "nsrc", "src-filename", "momlist-filename", "readStochSamples", "time-dilution", "nstochSamples", "confnumber", "contractionstoch", "contractionstd", "contractionoet"}; - -auto packVector = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) -{ - PLEGMA_Vector3D auxVector3D; - auxVector3D.absorb(in, timeSlice, true); +static std::vector listOpt = {"verbosity", "load-gauge", "momlisttwopt-filename", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; - for (int dt = 0; dt < HGC_totalL[3]; dt++) - { - out.absorb(auxVector3D, dt, false); - } -}; -auto packVectorD = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) +int main(int argc, char **argv) { - PLEGMA_Vector3D auxVector3D; - auxVector3D.absorb(in, timeSlice, true); + /****************************************************** + * + * Initialiazation + * + ******************************************************/ + initializeOptions(argc, argv, true, listOpt); - for (int dt = 0; dt < HGC_totalL[3]; dt++) - { - out.absorb(auxVector3D, dt, false); - } -}; -auto packPropogator = [](plegma::PLEGMA_Propagator &out, plegma::PLEGMA_Propagator &in, int timeSlice) -{ - PLEGMA_Vector auxVector; - for (int isc = 0; isc < 12; isc++) - { - auxVector.absorb(in, isc / 3, isc % 3); - packVector(auxVector, auxVector, timeSlice); - out.absorb(auxVector, isc / 3, isc % 3); - } -}; + int confnumber_int; + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); -int main(int argc, char **argv) -{ - // ==== initialization - ToolYan tyan; + int seed_stoc; + HGC_options->set("seed_stoc", "Seed for stoc", verbosity, seed_stoc); - initializeOptions(argc, argv, true, listOpt); initializePLEGMA(); - plegma::PLEGMA_Gauge gauge, smearedGauge; - gauge.readFile(latfile, LIME_FORMAT); - gauge.load(); - gauge.calculatePlaq(); - initGaugeQuda(gauge, true); - plaqQuda(); - - smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); - smearedGauge.calculatePlaq(); - - updateOptions(LIGHT); - quda::QUDA_solver solver(mu); - - tyan.setupGauge(gauge); - tyan.setupSmearing(smearedGauge, nsmearGauss, alphaGauss); - tyan.setupSolver(solver); - // tyan.testTimeCost(); - - // initialization ==== - - // ==== general definitions - std::string savingPath = "tempData/"; - - struct plegma::site source({12, 14, 17, 9 + 12 * 3}); - int tSource = source[DIM_T]; - struct plegma::site sourceZero({0, 0, 0, tSource}); - - // old version - plegma::momList momList(3, pathListMomenta, {2}); - auto pi2List = momList.uniq_p(0); - auto pf1List = momList.uniq_p(1); - // pf2 + pf1 = 0 - auto pcList = momList.uniq_p(2); - plegma::momList pcMomList(1, {pcList}, {0}); - plegma::momList pf1MomList(1, {pf1List}, {0}); - - std::vector pi1List = {0, 0, 0}; - - std::vector GID = {ID}; - std::vector GN = {CG_5}; - std::vector Gpi = {G_5}; - std::vector Gc = {ID}; - // std::vector Gc_GAMMAS = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; - // std::vector Gc = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; - // std::vector Gc_GAMMAS = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; - - int time_fi = 6; - int time_i = source[DIM_T], time_f = (source[DIM_T] + time_fi) % HGC_totalL[3]; - - // general definitions ==== - - tyan.printTime("setupPointPropagator"); - - plegma::PLEGMA_Propagator propUSS, propUSL; - plegma::PLEGMA_Propagator propDSS, propDSL; - - tyan.setupPointPropagator(propUSS, propUSL, source, u, SB); - tyan.setupPointPropagator(propDSS, propDSL, source, d, SB); - - plegma::PLEGMA_Propagator propUSS_pack, propUSL_pack; - plegma::PLEGMA_Propagator propDSS_pack, propDSL_pack; - packPropogator(propUSS_pack, propUSS, time_f); - packPropogator(propUSL_pack, propUSL, time_f); - packPropogator(propDSS_pack, propDSS, time_f); - packPropogator(propDSL_pack, propDSL, time_f); - - propUSS.writeHDF5(savingPath + "propUSS"); - propUSS_pack.writeHDF5(savingPath + "propUSS_pack"); - - // propDSS_pack.writeHDF5(savingPath + "propDSS_pack"); - - // { - // if(mu<0) - // { - // mu=-mu; - // solver.UpdateSolver(); - // } - // plegma::PLEGMA_Vector auxVector, auxVector1; - // plegma::PLEGMA_Vector3D auxVector3D, auxVector3D1; - // plegma::PLEGMA_Gauge3D smearedGauge3D; - // smearedGauge3D.absorb(smearedGauge, 0); - - // auxVector3D.pointSource(source, 0, 0, DEVICE); - // auxVector3D1.gaussianSmearing(auxVector3D, smearedGauge3D, nsmearGauss, alphaGauss); - // auxVector.absorb(auxVector3D1, 0); - // auxVector.writeHDF5(savingPath+"pointSmear"); - - // auxVector1.rotateToPhysicalBasis(auxVector,+1); - // solver.solve(auxVector1,auxVector1); - // auxVector.rotateToPhysicalBasis(auxVector1,+1); - // auxVector1.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); - // auxVector1.writeHDF5(savingPath+"aux_propU-SS"); - // } - - // { - // plegma::PLEGMA_Propagator propULS, propULL; - // tyan.setupPointPropagator(propULS, propULL, source, u, LB); - - // plegma::PLEGMA_Vector aux; - // aux.absorb(propUSS, 0, 0); - // aux.writeHDF5(savingPath + "propUSS-00"); - // aux.absorb(propULL, 0, 0); - // aux.writeHDF5(savingPath + "propULL-00"); - // aux.absorb(propUSL, 0, 0); - // aux.writeHDF5(savingPath + "propUSL-00"); - - // // N Diagram - // plegma::PLEGMA_ScattCorrelator T1Contraction(sourceZero, pf1List); - // plegma::PLEGMA_ScattCorrelator T2Contraction(sourceZero, pf1List); - // T1Contraction.T1(GN, GN, propDSS, propUSS, propDSS); - // // T1Contraction.writeHDF5(savingPath + "T1"); - // T2Contraction.T2(GN, GN, propDSS, propUSS, propDSS); - // // T2Contraction.writeHDF5(savingPath + "T2"); - - // plegma::PLEGMA_ScattCorrelator corr_NN(source, pf1MomList); - // corr_NN.initialize_diagram(GID, GID, GN, GN, "N0"); - // corr_NN.N_diagrams(T1Contraction, T2Contraction); - // corr_NN.writeHDF5(savingPath + "NN"); - // } - - tyan.printTime("setupSequentialPropagator"); - - PLEGMA_Propagator seqUSSDSS, seqUSLDSS; - PLEGMA_Propagator seqUSSDSS_pack, seqUSLDSS_pack; - tyan.setupSequentialPropagator(seqUSSDSS, seqUSLDSS, propDSS, time_i, G5, pi2List[0], +1, u, SB); - packPropogator(seqUSSDSS_pack, seqUSSDSS, time_f); - packPropogator(seqUSLDSS_pack, seqUSLDSS, time_f); - - tyan.printTime("stoc"); - - plegma::PLEGMA_Vector stocXi, stocG5Xi; - plegma::PLEGMA_Vector stocXi_pack, stocG5Xi_pack; - - plegma::PLEGMA_Vector stocPhiUTfSL, stocG5PhiUTfSL; - plegma::PLEGMA_Vector stocPhiDTfSL, stocG5PhiDTfSL; - - plegma::PLEGMA_Vector stocPhiUTiSL, stocG5PhiUTiSL; - plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS; - plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS_pack; { - plegma::PLEGMA_Vector3D auxVector3D; - stocXi.randInit(1234); - stocXi.stochastic_Z(4); - stocG5Xi.copy(stocXi); - stocG5Xi.apply_gamma5(); - // - packVectorD(stocXi_pack, stocXi, time_f); - packVectorD(stocG5Xi_pack, stocG5Xi, time_f); - - stocXi.writeHDF5(savingPath + "stocXi"); - stocXi_pack.writeHDF5(savingPath + "stocXi_pack"); - tyan.printTime(std::to_string(HGC_totalL[3])); - - auxVector3D.absorb(stocXi, time_f); - tyan.solve(stocPhiUTfSL, auxVector3D, time_f, u, SL); - stocG5PhiUTfSL.copy(stocPhiUTfSL); - stocG5PhiUTfSL.apply_gamma5(); - // - auxVector3D.absorb(stocXi, time_f); - tyan.solve(stocPhiDTfSL, auxVector3D, time_f, d, SL); - stocG5PhiDTfSL.copy(stocPhiDTfSL); - stocG5PhiDTfSL.apply_gamma5(); - - auxVector3D.absorb(stocXi, time_i); - auxVector3D.mulMomentumPhases(pi2List[0], -1); - tyan.solve(stocPhiUTiSL, auxVector3D, time_i, u, SL); - stocG5PhiUTiSL.copy(stocPhiUTiSL); - stocG5PhiUTiSL.apply_gamma5(); - // - auxVector3D.absorb(stocXi, time_i); - // apply g5*g5=ID - // auxVector3D.mulMomentumPhases(pi2List[0],+1); - tyan.solve(stocPhiUG5Gi2TiSS, auxVector3D, time_i, u, SS); - packVectorD(stocPhiUG5Gi2TiSS_pack, stocPhiUG5Gi2TiSS, time_f); - } + plegma::PLEGMA_Gauge gauge, smearedGauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.load(); + gauge.calculatePlaq(); + initGaugeQuda(gauge, true); + plaqQuda(); - tyan.printTime("phiV3"); + smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + smearedGauge.calculatePlaq(); - PLEGMA_Propagator phiV31; - { - plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); - plegma::PLEGMA_Vector auxVector; - auxVector.copy(stocG5PhiDTfSL); - auxV3.V3(auxVector, Gc, seqUSLDSS); - // auxV3.writeHDF5(savingPath + "temp1"); + updateOptions(LIGHT); + quda::QUDA_solver solver(mu); + +#if 1 // Utilities - for (int isc = 0; isc < 12; isc++) +#if 1 // general + bool smearQ = true; + + enum FlavorYan + { + u, + d + }; + enum SmearFlagYan + { + SS, + SL, + LS, + LL, + single2double, + SB, + LB + }; +#endif + +#if 1 // solve + auto solve0 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f) { - plegma::PLEGMA_Vector auxVector1; - auxVector1.zero_where(BOTH); - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3D; - auxVector3DD.absorb(stocG5Xi_pack, time_f, true); - auxVector3D.copy(auxVector3DD); - // if (isc == 5) - // auxVector3D.writeHDF5(savingPath + "temp2"); - for (int dt = 0; dt < HGC_totalL[3]; dt++) + FlavorYan f2 = (mu > 0 ? u : d); + double run_mu = (f == f2 ? mu : -mu); + plegma::PLEGMA_Vector auxVector; + + auxVector.rotateToPhysicalBasis(in, run_mu / std::abs(run_mu)); + double norm = auxVector.norm(); + auxVector.scale(1 / norm); + if (f != f2) { - plegma::PLEGMA_Vector3D auxVector3D1; - auxVector3D1.copy(auxVector3D); - // float *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); - float *aux = auxV3.Corr(dt, 0, 0); - std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); - auxVector3D1.cscale(auxC); - // auxVector1.absorb(auxVector3D1, dt, false); - auxVector1.absorb(auxVector3D1, dt, false); + mu = run_mu; + solver.UpdateSolver(); } - // if (isc == 5) - // auxVector1.writeHDF5(savingPath + "temp3"); - phiV31.absorb(auxVector1, isc / 3, isc % 3); - } - phiV31.writeHDF5(savingPath + "temp4"); - } + solver.solve(auxVector, auxVector); + auxVector.scale(norm); + out.rotateToPhysicalBasis(auxVector, run_mu / std::abs(run_mu)); + }; + auto solve1 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); - PLEGMA_Propagator phiV32; - { - plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); - plegma::PLEGMA_Vector auxVector; - auxVector.copy(stocG5PhiDTfSL); - auxV3.V3(auxVector, Gc, propUSL); + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(out, auxVector, f); + return; + } - for (int isc = 0; isc < 12; isc++) - { - plegma::PLEGMA_Vector auxVector1; - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3D; - auxVector3DD.absorb(stocG5Xi_pack, time_f, true); - auxVector3D.copy(auxVector3DD); - for (int dt = 0; dt < HGC_totalL[3]; dt++) + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector3D auxVector3D; + + if (s == SL || s == SS) { - plegma::PLEGMA_Vector3D auxVector3D1; - auxVector3D1.copy(auxVector3D); - float *aux = auxV3.Corr(dt, 0, 0); - std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); - auxVector3D1.cscale(auxC); - auxVector1.absorb(auxVector3D1, dt, false); + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); } - phiV32.absorb(auxVector1, isc / 3, isc % 3); - } - } + else + auxVector3D.copy(in); - PLEGMA_Propagator phiV33; - { - plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); - plegma::PLEGMA_Vector auxVector; - auxVector.copy(stocG5PhiUTfSL); - auxV3.V3(auxVector, Gc, propDSL); + auxVector.absorb(auxVector3D, inTime); + solve0(auxVector, auxVector, f); - for (int isc = 0; isc < 12; isc++) + if (s == LS || s == SS) + { + out.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + } + else + out.copy(auxVector); + }; + auto solve2 = [&](plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) { - plegma::PLEGMA_Vector auxVector1; - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3D; - auxVector3DD.absorb(stocG5Xi_pack, time_f, true); - auxVector3D.copy(auxVector3DD); - for (int dt = 0; dt < HGC_totalL[3]; dt++) + assert(single2double < s); + if (!smearQ) { - plegma::PLEGMA_Vector3D auxVector3D1; - auxVector3D1.copy(auxVector3D); - float *aux = auxV3.Corr(dt, 0, 0); - std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); - auxVector3D1.cscale(auxC); - auxVector1.absorb(auxVector3D1, dt, false); + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(outL, auxVector, f); + outS.copy(outL); + return; } - phiV33.absorb(auxVector1, isc / 3, isc % 3); - } - } - PLEGMA_Propagator phiV34; - { - plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); - plegma::PLEGMA_Vector auxVector; - auxVector.copy(stocG5PhiUTiSL); - auxV3.V3(auxVector, Gc, propDSL); + plegma::PLEGMA_Vector auxVector; + + if (s == SB) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + plegma::PLEGMA_Vector3D auxVector3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + auxVector.absorb(auxVector3D, inTime); + } + else + auxVector.absorb(in, inTime); + + solve0(auxVector, auxVector, f); - for (int isc = 0; isc < 12; isc++) + outS.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + outL.copy(auxVector); + }; +#endif + +#if 1 // setupPointPropagator + auto setupPointPropagator1 = [&](plegma::PLEGMA_Propagator &out, plegma::site &source, FlavorYan f, SmearFlagYan s) { - plegma::PLEGMA_Vector auxVector1; - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3D; - auxVector3DD.absorb(stocPhiUG5Gi2TiSS_pack, time_f, true); - auxVector3D.copy(auxVector3DD); - for (int dt = 0; dt < HGC_totalL[3]; dt++) + assert(s < single2double); + + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3D; + for (int isc = 0; isc < 12; isc++) { - plegma::PLEGMA_Vector3D auxVector3D1; - auxVector3D1.copy(auxVector3D); - float *aux = auxV3.Corr(dt, 0, 0); - std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); - auxVector3D1.cscale(auxC); - auxVector1.absorb(auxVector3D1, dt, false); + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve1(auxVector, auxVector3D, source[DIM_T], f, s); + auxVectorF.copy(auxVector); + out.absorb(auxVectorF, isc / 3, isc % 3); } - phiV34.absorb(auxVector1, isc / 3, isc % 3); - } - } + }; + auto setupPointPropagator2 = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s) + { + assert(single2double < s); + plegma::PLEGMA_Vector auxVectorS, auxVectorL; + plegma::PLEGMA_Vector auxVectorSF, auxVectorLF; + plegma::PLEGMA_Vector3D auxVector3D; - tyan.printTime("cont"); + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve2(auxVectorS, auxVectorL, auxVector3D, source[DIM_T], f, s); + auxVectorSF.copy(auxVectorS); + auxVectorLF.copy(auxVectorL); + outS.absorb(auxVectorSF, isc / 3, isc % 3); + outL.absorb(auxVectorLF, isc / 3, isc % 3); + } + }; +#endif + +#if 0 // setupSequentialPropagator + auto ToolYan::setupSequentialPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + if (s < single2double) + { + plegma::PLEGMA_Vector auxVectorD; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorD, auxVector3DD, inTime, f, s); + auxVectorF.copy(auxVectorD); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; + plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + // auxVector3DF.apply_gamma_scatt(G_5); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); + auxVectorFS.copy(auxVectorDS); + auxVectorFL.copy(auxVectorDL); + outS.absorb(auxVectorFS, isc / 3, isc % 3); + outL.absorb(auxVectorFL, isc / 3, isc % 3); + } + } + }; +#endif + +#endif + + /****************************************************** + * + * General input + * + ******************************************************/ + // Get the confnumber for latfile + char *ssource; + asprintf(&ssource, "%04d", confnumber_int); + std::string confnumber = ssource; + free(ssource); + + std::vector gscatts_ID = {ID}; + std::vector gscatts_N = {CG_5}; + std::vector gscatts_pi = {G_5}; + std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; + std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + + std::vector gscatts_meson = {}; + std::string filenameEnd = ""; + + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_twopt.c_str()); + plegma::momList momList2pt(3, pathListMomenta_twopt, {1, 2}); // pi2, pf1, pf2 + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList2pt.size()); + if (momList2pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects2pt_pi2 = momList2pt.uniq_p(0); + plegma::momList momList2pt_pi2(1, {momVects2pt_pi2}, {0}); + + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + plegma::momList momList3pt(4, pathListMomenta_threept, {1, 2, 3}); // pi2, pf1, pf2, pc + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList3pt.size()); + if (momList3pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects3pt_pi2 = momList3pt.uniq_p(0); + auto momVects3pt_pc = momList3pt.uniq_p(3); + plegma::momList momList3pt_pc(1, {momVects3pt_pc}, {0}); + + /****************************************************** + * + * Main + * + ******************************************************/ + + struct plegma::site source({1, 2, 3, 4}); + struct plegma::site source_reduction({0, 0, 0, 4}); + + plegma::PLEGMA_Propagator propU, propD; + setupPointPropagator1(propU, source, u, LL); + setupPointPropagator1(propD, source, d, LL); + + std::vector glist_source_nucleon = {CG_5}; + std::vector glist_sink_nucleon = {CG_5}; + + std::vector glist_source_meson = {G_5}; + std::vector glist_sink_meson = {G_5}; + + std::vector glist_source_nucleon_unpaired = {ID}; + std::vector glist_sink_nucleon_unpaired = {ID}; + + momList sourcemomentumList_threept(4, pathListMomenta_threept, {1, 2, 3}); + + momList sourcemomentumList_twopt(3, pathListMomenta_twopt, {1, 2}); + + std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); + momList list_mpi2_threept(1, {mpi2_threept}, {0}); + for (int i_mpi2 = 0; i_mpi2 < mpi2_threept.size(); ++i_mpi2) + { - auto outputfile = [&](plegma::PLEGMA_ScattCorrelator sc, std::string filename, bool sgn) - { - // momentum phase for pi1 - float phase = 2 * M_PI / (float)HGC_totalL[0] * pi1List[0] * source[0] + - 2 * M_PI / (float)HGC_totalL[1] * pi1List[1] * source[1] + - 2 * M_PI / (float)HGC_totalL[2] * pi1List[2] * source[2]; - float expPhase[2] = {cos(phase), sin(phase)}; - x_e_cx(sc.H_elem(), expPhase, sc.getTotalSize()); - - // additional sign coming from my Mathematica codes - float overall_sign[2] = {-1., 0.}; - if (sgn) - x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); - - if (time_f < time_i) - x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); - // sc.applyBoundaryConditions(true); - sc.writeHDF5(savingPath + filename); - }; - - float overall_sign[2] = {-1., 0.}; - // x_e_cx( cont.H_elem(), overall_sign, cont.getTotalSize()); - - plegma::PLEGMA_ScattCorrelator cont1(sourceZero, pf1List); - cont1.T1(GN, GN, propUSS_pack, propDSS_pack, phiV31); - outputfile(cont1, "cont1", true); // signs: Gf^t - - plegma::PLEGMA_ScattCorrelator cont2(sourceZero, pf1List); - cont2.T1(GN, GN, propUSS_pack, phiV31, propDSS_pack); - outputfile(cont2, "cont2", false); - - plegma::PLEGMA_ScattCorrelator cont3(sourceZero, pf1List); - cont3.T2(GN, GN, phiV31, propDSS_pack, propUSS_pack); - outputfile(cont3, "cont3", true); // signs: Gf^t - - plegma::PLEGMA_ScattCorrelator cont4(sourceZero, pf1List); - cont4.T1(GN, GN, phiV31, propUSS_pack, propDSS_pack); - outputfile(cont4, "cont4", true); // signs: Gfi1^t - - // - - plegma::PLEGMA_ScattCorrelator cont5(sourceZero, pf1List); - cont5.T2(GN, GN, seqUSSDSS_pack, phiV32, propDSS_pack); - outputfile(cont5, "cont5", true); // signs: Gfi1^t - - plegma::PLEGMA_ScattCorrelator cont6(sourceZero, pf1List); - cont6.T1(GN, GN, seqUSSDSS_pack, phiV32, propDSS_pack); - outputfile(cont6, "cont6", true); // signs: Gfi1^t - - plegma::PLEGMA_ScattCorrelator cont7(sourceZero, pf1List); - cont7.T1(GN, GN, phiV32, propDSS_pack, seqUSSDSS_pack); - outputfile(cont7, "cont7", true); // signs: Gfi1^t - - plegma::PLEGMA_ScattCorrelator cont8(sourceZero, pf1List); - cont8.T1(GN, GN, phiV32, seqUSSDSS_pack, propDSS_pack); - outputfile(cont8, "cont8", false); // signs: - - // - - plegma::PLEGMA_ScattCorrelator cont9(sourceZero, pf1List); - cont9.T1(GN, GN, propUSS_pack, phiV33, seqUSSDSS_pack); - outputfile(cont9, "cont9", true); // signs: Gfi1^t - - plegma::PLEGMA_ScattCorrelator cont10(sourceZero, pf1List); - cont10.T1(GN, GN, propUSS_pack, seqUSSDSS_pack, phiV33); - outputfile(cont10, "cont10", false); // signs: - - plegma::PLEGMA_ScattCorrelator cont11(sourceZero, pf1List); - cont11.T2(GN, GN, seqUSSDSS_pack, phiV33, propUSS_pack); - outputfile(cont11, "cont11", true); // signs: Gfi1^t - - plegma::PLEGMA_ScattCorrelator cont12(sourceZero, pf1List); - cont12.T1(GN, GN, seqUSSDSS_pack, propUSS_pack, phiV33); - outputfile(cont12, "cont12", true); // signs: Gfi1^t - - // - - plegma::PLEGMA_ScattCorrelator cont13(sourceZero, pf1List); - cont13.T1(GN, GN, propUSS_pack, propDSS_pack, phiV34); - outputfile(cont13, "cont13", true); // signs: Gfi1^t - - plegma::PLEGMA_ScattCorrelator cont14(sourceZero, pf1List); - cont14.T1(GN, GN, propUSS_pack, phiV34, propDSS_pack); - outputfile(cont14, "cont14", false); // signs: - - plegma::PLEGMA_ScattCorrelator cont15(sourceZero, pf1List); - cont15.T2(GN, GN, phiV34, propDSS_pack, propUSS_pack); - outputfile(cont15, "cont15", true); // signs: Gfi1^t - - plegma::PLEGMA_ScattCorrelator cont16(sourceZero, pf1List); - cont16.T1(GN, GN, phiV34, propUSS_pack, propDSS_pack); - outputfile(cont16, "cont16", true); // signs: Gfi1^t - - // for (int spin = 0; spin < 4; spin++) - // { - - // plegma::PLEGMA_Vector sd_stocXi,sd_aux; - // plegma::PLEGMA_Vector sd_stocPhiUTfSL, sd_stocG5PhiUTfSL; - // plegma::PLEGMA_Vector sd_stocPhiUG5Gi2TfSS; - // plegma::PLEGMA_Vector sd_stocPhiUG5Gi2TfSS_pack; - // { - // plegma::PLEGMA_Vector3D sd_auxVector3D; - // sd_aux.randInit(1234); - // sd_aux.stochastic_Z(4); - // sd_stocXi.diluteSpinDisplace(sd_aux,spin,0); - - // sd_auxVector3D.absorb(sd_stocXi, time_f); - // tyan.solve(sd_stocPhiUTfSL, sd_auxVector3D, time_f, u, SL); - // sd_stocG5PhiUTfSL.copy(sd_stocPhiUTfSL); - // sd_stocG5PhiUTfSL.apply_gamma5(); - - // sd_auxVector3D.absorb(sd_stocXi, time_f); - // // apply g5*g5=ID - // tyan.solve(sd_stocPhiUG5Gi2TfSS, sd_auxVector3D, time_f, u, SS); - // packVectorD(sd_stocPhiUG5Gi2TfSS_pack, sd_stocPhiUG5Gi2TfSS, time_f); - // } - - // PLEGMA_Propagator sd_phiV34; - // { - // plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); - // plegma::PLEGMA_Vector auxVector; - // auxVector.copy(sd_stocG5PhiUTfSL); - // auxV3.V3(auxVector, Gc, propDSL); - - // for (int isc = 0; isc < 12; isc++) - // { - // plegma::PLEGMA_Vector auxVector1; - // plegma::PLEGMA_Vector3D auxVector3DD; - // plegma::PLEGMA_Vector3D auxVector3D; - // auxVector3DD.absorb(sd_stocPhiUG5Gi2TfSS_pack, time_f); - // auxVector3D.copy(auxVector3DD); - // for (int dt = 0; dt < HGC_totalL[3]; dt++) - // { - // { - // plegma::PLEGMA_Vector3D auxVector3D1; - // auxVector3D1.copy(auxVector3D); - // float *aux = auxV3.Corr(dt, 0, 0); - // std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); - // auxVector3D1.cscale(auxC); - // auxVector1.absorb(auxVector3D1, dt, false); - // } - // } - // sd_phiV34.absorb(auxVector1, isc / 3, isc % 3); - // } - // } - - // plegma::PLEGMA_ScattCorrelator sd_cont13(sourceZero, pf1List); - // sd_cont13.T1(GN, GN, propUSS_pack, propDSS_pack, sd_phiV34); // signs: Gfi1^t - // x_e_cx(sd_cont13.H_elem(), overall_sign, sd_cont13.getTotalSize()); - // // sd_cont13.apply_phase(); - // sd_cont13.applyBoundaryConditions(true); - // sd_cont13.writeHDF5(savingPath + "cont13_" + std::to_string(spin)); - - // plegma::PLEGMA_ScattCorrelator sd_cont14(sourceZero, pf1List); - // sd_cont14.T1(GN, GN, propUSS_pack, sd_phiV34, propDSS_pack); // signs: - // // sd_cont14.apply_phase(); - // sd_cont14.applyBoundaryConditions(true); - // sd_cont14.writeHDF5(savingPath + "cont14_" + std::to_string(spin)); - - // plegma::PLEGMA_ScattCorrelator sd_cont15(sourceZero, pf1List); - // sd_cont15.T2(GN, GN, sd_phiV34, propDSS_pack, propUSS_pack); // signs: Gfi1^t - // x_e_cx(sd_cont15.H_elem(), overall_sign, sd_cont15.getTotalSize()); - // // sd_cont15.apply_phase(); - // sd_cont15.applyBoundaryConditions(true); - // sd_cont15.writeHDF5(savingPath + "cont15_" + std::to_string(spin)); - - // plegma::PLEGMA_ScattCorrelator sd_cont16(sourceZero, pf1List); - // sd_cont16.T1(GN, GN, sd_phiV34, propUSS_pack, propDSS_pack); // signs: Gfi1^t - // x_e_cx(sd_cont16.H_elem(), overall_sign, sd_cont16.getTotalSize()); - // // sd_cont16.apply_phase(); - // sd_cont16.applyBoundaryConditions(true); - // sd_cont16.writeHDF5(savingPath + "cont16_" + std::to_string(spin)); - // } - - // V reductions version - { // B12 - plegma::PLEGMA_Vector auxVector; - plegma::PLEGMA_ScattCorrelator auxV4(sourceZero, pf1List); - auxVector.copy(stocG5Xi_pack); - auxVector.writeHDF5(savingPath + "t1"); - propUSS_pack.writeHDF5(savingPath + "t2"); - propUSS.writeHDF5(savingPath + "t3"); - // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); - auxV4.V4(auxVector, GN, propUSS_pack, propDSS_pack); // this and the above line won't produce the same V4, but the same cont3 - auxV4.writeHDF5(savingPath + "auxV4"); - - plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); - auxVector.copy(stocG5PhiDTfSL); - auxV3.V3(auxVector, Gc, seqUSLDSS); - // auxVector.writeHDF5(savingPath + "auxVector"); - // seqUSLDSS.writeHDF5(savingPath + "seqUSLDSS"); - auxV3.writeHDF5(savingPath + "auxV3"); - - plegma::PLEGMA_ScattCorrelator cont3V(sourceZero, momList); - cont3V.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); - cont3V.B_diagrams(auxV3, auxV4, 0, 12, true); - cont3V.apply_sign("4pt"); - cont3V.applyBoundaryConditions(true); - cont3V.writeHDF5(savingPath + "cont3V"); - } + auto &momentum_i2 = mpi2_threept[i_mpi2]; + // List of momenta corresponding to a fix value of p_i2 + momList filtered_sourcemomentumList = sourcemomentumList_threept.extract(momentum_i2, 0); + + momList filtered_sourcemomentumList_2pt = sourcemomentumList_twopt.extract(momentum_i2, 0); + + std::vector> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); + + std::vector> mpi2_filt; + mpi2_filt.assign(mptot_filt.size(), momentum_i2); + // PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); + momList list_mpi2ptot(2, {mpi2_filt, mptot_filt}, {1}); - { // Z11 - plegma::PLEGMA_Vector auxVector; - plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, pf1List); - auxVector.copy(stocPhiUG5Gi2TiSS_pack); - auxV24.V2(auxVector, GN, propDSS_pack, propUSS_pack); - auxV24.writeHDF5(savingPath + "Z11auxV24"); - - plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, pcMomList); - auxVector.copy(stocG5PhiUTiSL); - auxV3.V3(auxVector, Gc, propDSL); - auxV3.writeHDF5(savingPath + "Z11auxV3"); - - plegma::PLEGMA_ScattCorrelator contZ11(sourceZero, momList); - contZ11.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); - contZ11.Z_diagrams_without_dilution(auxV3, auxV24, 0, 11); - contZ11.apply_sign("4pt"); - contZ11.applyBoundaryConditions(true); - contZ11.writeHDF5(savingPath + "contZ11"); + PLEGMA_ScattCorrelator reductionsT1(source_reduction, mptot_filt); + PLEGMA_ScattCorrelator reductionsT2(source_reduction, mptot_filt); + + PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); + // PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); + // PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); + + corrTproton_protonpizero1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq21"); + + corrTproton_protonpizero2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq22"); + + // corrTproton_protonpizero3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq23"); + + // corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq24"); + + // PLEGMA_ScattCorrelator corrD1ff1389(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1ff24710(source, filtered_sourcemomentumList_2pt); + + corrD1ff24710.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); + // corrD1ff1389.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); + + TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, propU, propD, propU)); + TIME(corrTproton_protonpizero1.convertTreductiontoDiagram(reductionsT1, 0, false, true, true)); + + TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, propU, propD, propU)); + TIME(corrTproton_protonpizero2.convertTreductiontoDiagram(reductionsT2, 0, false, true, true)); + + TIME(corrD1ff24710.LT_diagrams(reductionsT1, reductionsT2, 1)); + corrD1ff24710.writeHDF5("test_D"); + // TIME(produceOutput_2pt_packed(corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); + + // TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + // TIME(corrTproton_protonpizero3.convertTreductiontoDiagram(reductionsT1, 0, false, true, true)); + + // TIME(reductionsT1.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + // TIME(corrTproton_protonpizero4.convertTreductiontoDiagram(reductionsT1, 0, false, true, true)); + + // TIME(corrD1ff1389.LT_diagrams(reductionsT1, reductionsT2, 1)); + // TIME(produceOutput_2pt_packed(corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); + + // TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); + // TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); + // TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); + // TIME(produceOutput_2pt_packed(corrTproton_protonpizero4, outfilename, "T", parallel_sources, attract_lookup_table)); + + corrTproton_protonpizero1.writeHDF5("test_T"); + corrTproton_protonpizero2.writeHDF5("test_T"); + } } - tyan.printTime("beforeFinalize"); finalize(); - return 0; } From 2afbf23c4d6c20e4b94231ceb5a030a6fc63b7ae Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 14 Jun 2023 09:11:01 +0200 Subject: [PATCH 080/168] correcting Di11 10 diagram --- lib/PLEGMA_ScattCorrelator.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 5dab7c3e..5e9be803 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1601,7 +1601,7 @@ void PLEGMA_ScattCorrelator::D1ii_diagrams(PLEGMA_ScattCorrelator this->V3V2reduction( srcV3, srcV2, 2, true, ig_i2, false, factor, true);//checked FP break; case 10: - this->V3V2reduction_matrix( srcV3, srcV2, 0, false, ig_i2, false, factor, true);//checked FP + this->V3V2reduction( srcV3, srcV2, 0, false, ig_i2, false, factor, true);//checked FP break; case 13: this->V3V2reduction( srcV3, srcV2, 2, false, ig_i2, true, factor, false);//checked FP From e7be94891ab5af427b30a36369f8d89d7bfda124 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 14 Jun 2023 09:13:36 +0200 Subject: [PATCH 081/168] correcting W21-24 diagrams --- plegma/nucleon_3pt_n_npi.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 0862204c..ac4474d7 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -2102,8 +2102,8 @@ int main(int argc, char **argv) { TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); - TIME(corrW21_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 21, true, false)); - TIME(corrW23_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 23, true, false)); + TIME(corrW21_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 21, true, false)); + TIME(corrW23_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 23, true, false)); TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true)); @@ -2113,8 +2113,8 @@ int main(int argc, char **argv) { TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); - TIME(corrW22_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 22, true, false)); - TIME(corrW24_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 24, true, false)); + TIME(corrW22_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 22, true, false)); + TIME(corrW24_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 24, true, false)); } From d3ba4fc5029b911efc1c82381f5604deb3bac421 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 15 Jun 2023 08:51:42 +0200 Subject: [PATCH 082/168] correcting W33-36 --- plegma/nucleon_3pt_n_npi.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index ac4474d7..ca4a8340 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -2416,6 +2416,10 @@ int main(int argc, char **argv) { TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); From 0ee6e2ee014383b26c3d22ad8c036ec6534a91a3 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 16 Jun 2023 20:16:22 +0200 Subject: [PATCH 083/168] correcting sign problem in Tseq 2526, correcting momentum problem in D1ii, correcting stochastic piece for W33-36 --- plegma/nucleon_3pt_n_npi.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index ca4a8340..acf67fc2 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -1006,7 +1006,8 @@ int main(int argc, char **argv) { } //end of for source sink separations } //end of for stochastic samples - auto &momentum_i2 = mpi2_twopt[0]; +// auto &momentum_i2 = {0,0,0};//mpi2_twopt[0]; + std::vector momentum_i2= {0,0,0}; //List of momenta corresponding to a fix value of p_i2 momList filtered_sourcemomentumList_2pt_single = sourcemomentumList_twopt.extract(momentum_i2, 0); @@ -2294,10 +2295,10 @@ int main(int argc, char **argv) { corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); - TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, false, true, true )); + TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); - TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, false, true, true )); + TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); TIME(corrD1ff56.LT_diagrams( reductionsT1, reductionsT2, 1 )); @@ -2420,6 +2421,8 @@ int main(int argc, char **argv) { stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); + stochastic_propagator_packed.apply_gamma5(); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); From 16fc010f8056a4da29f824958ee60f0e1430f4a9 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sun, 18 Jun 2023 22:07:38 +0200 Subject: [PATCH 084/168] correcting D1ii and W diagrams --- plegma/CMakeLists.txt | 2 + plegma/nucleon_3pt_n_npi_wd1ii.cpp | 1392 ++++++++++++++++++++++++++++ 2 files changed, 1394 insertions(+) create mode 100644 plegma/nucleon_3pt_n_npi_wd1ii.cpp diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 5c75578c..e9209e12 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -142,6 +142,8 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(nucleon_delta_test ${PLEGMA_LIBS}) cuda_add_executable(nucleon_3pt_n_npi EXCLUDE_FROM_ALL nucleon_3pt_n_npi.cpp) target_link_libraries(nucleon_3pt_n_npi ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi_wd1ii EXCLUDE_FROM_ALL nucleon_3pt_n_npi_wd1ii.cpp) + target_link_libraries(nucleon_3pt_n_npi_wd1ii ${PLEGMA_LIBS}) cuda_add_executable(piNdiagrams_oet piNdiagrams_oet.cpp) target_link_libraries(piNdiagrams_oet ${PLEGMA_LIBS}) cuda_add_executable(checking_Doet checking_Doet.cpp) diff --git a/plegma/nucleon_3pt_n_npi_wd1ii.cpp b/plegma/nucleon_3pt_n_npi_wd1ii.cpp new file mode 100644 index 00000000..ae0b8f20 --- /dev/null +++ b/plegma/nucleon_3pt_n_npi_wd1ii.cpp @@ -0,0 +1,1392 @@ +#include +#include +#include +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) saveTuneCache(false); TIME(fnc) + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename","momlisttwopt-filename","momlistthreept-filename", + "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space", "tSinks","Projs", "threep-filename","confnumber", "nstochSamples"}; + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *attract_look_up_table){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + + +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions_3pt( true, n_coherent_source, attract_look_up_table, source_sink_separation )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.writeHDF5( outputFilename )); +} + +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *attract_look_up_table + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); + TIME(source.writeHDF5( outputFilename )); +} + + +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions_3pt( true,n_coherent_source, attract_look_up_table, source_sink_separation )); + TIME(source.writeHDF5( outputFilename )); +} + + +int main(int argc, char **argv) { + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + std::vector mu_s; + std::vector mu_c; + int rand_seed1=1234; + int rand_seed2=5678; + int confnumber_int; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i glist_source_nucleon={CG_5}; + std::vector glist_sink_nucleon={CG_5}; + + std::vector glist_source_meson={G_5}; + std::vector glist_sink_meson={G_5}; + + std::vector glist_source_nucleon_unpaired={ID}; + std::vector glist_sink_nucleon_unpaired={ID}; + std::vector glist_insertion = {ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4};//,S12,S13,S23,S41,S42,S43}; + + int n_stochastic_samples; + int max_source_sink_separations; + int dotwopoint; + int readStochSamples; + //setVerbosity(QUDA_DEBUG_VERBOSE); + + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + HGC_options->set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); + HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + HGC_options->set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + HGC_options->set("seed2", "Seed for intiialization of stochastic sources", verbosity, rand_seed2); + HGC_options->set("dotwopoint", "Doing also the twopoint functions", verbosity,dotwopoint); + HGC_options->set("readStochSamples", "Flag for switching read/building stochastic propagators", verbosity, readStochSamples); + + + + //=========================================================================================================// + initializePLEGMA(); + + /* + FILE *fid; + LimeWriter *limewriter = (LimeWriter*)NULL; + //if(unloadFromDev) unload(); + if(comm_rank() == 0){ + fid=fopen("stochastic_source0.lime","a"); + if(fid==NULL) PLEGMA_error("Error opening file for writing: stochastic_source0.lime\n"); + else printf("Opening was fine\n"); + limewriter = limeCreateWriter(fid); + if(limewriter==(LimeWriter*)NULL) PLEGMA_error("Could not create limeWriter"); + std::string xlf_message = getDateAndTime(); // More xlf-info can be added + write_lime_header(limewriter,"xlf-info",xlf_message,1,1); + std::ostringstream oss; + oss << lime_version_header() << "" << "PLEGMA_Vector" << "\n" << "" << 32 << "\n"; + oss << "" << 12 << "\n"; + std::vector xyzt = {"x","y","z","t"}; + for(int i = 0 ; i < N_DIMS; i++) oss << "" << HGC_totalL[i] << "\n"; + oss << ""; + write_lime_header(limewriter,"ildg-format",oss.str(),1,0); + } +// write_binary_to_lime(filename,fid,limewriter,h_elem,field_length); + limeDestroyWriter(limewriter); + + exit(1);*/ + + { + PLEGMA_Gauge smearedGauge(BOTH); + PLEGMA_Gauge contractGauge(BOTH); + { + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + // Gauge for contractions + contractGauge.copy(gauge); + // apply boundary conditions since is needed for the covariant derivative + applyBoundaryConditions(contractGauge,true); + } + + updateOptions(LIGHT); + TIME(QUDA_solver solver(mu)); + + std::string given_twop_filename = twop_filename; + std::string given_threep_filename = threep_filename; + + //Get the confnumber for latfile + char *ssource; + asprintf(&ssource,"%04d", confnumber_int); + std::string confnumber= ssource; + free(ssource); + + + //Reading the momentum lists + //PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + //momList sourcemomentumList_threept(4,pathListMomenta_threept,{1,2,3}); + //PLEGMA_printf("N momenta in sourcemomentumList: %d\n",sourcemomentumList_threept.size()); + //We have four types of momenta in the list here + //The first three entries are the pi2 pion source momentum + //The second three entries are the pf1 nucleon sink momentum + //The third three entries are the pf2 pion sink momentum (it is assumed that pf2 is the same as -pf1) + //The fourth three entries are the pc momentum at the insertion + //pf1 + pf2 = 0, momentum at the sink is zero , the the pion momentum + //at sink follows from the nucleon momentum + //In addition the following momentum conversations are imposed + //pi1 + pi2 = pc so the momentum phase factor is calculated as pc-pi2 + //We define the list of momenta such that the total momentum should be the [2] \ + //column, the pc, and of coarse it is understand that this refers to the source only. + //At the sink we have always zero momentum + + momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); + //For the twopoint functions we have also three momentum + //first is pi2 + //second is pf1 + //third is pf2 + //and in this case the total momentum is defined as the sum of pf1 and pf2 + //to get pi1 we have to subtract pi2 from the total momentum + + + if(sourcemomentumList_twopt.empty()) + PLEGMA_error("twopt momentumList empty"); + //if(sourcemomentumList_threept.empty()) + // PLEGMA_error("threept momentumList empty"); + + std::vector> mpi2_twopt = sourcemomentumList_twopt.uniq_p(0); + momList list_mpi2_twopt(1,{mpi2_twopt,},{0,}); + + //std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); + //momList list_mpi2_threept(1,{mpi2_threept,},{0,}); + + //std::vector> mpf1_threept = sourcemomentumList_threept.uniq_p(1); + //momList list_mpf1_threept(1,{mpf1_threept,},{0,}); + + std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); + momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); + + //std::vector> mpc = sourcemomentumList_threept.uniq_p(3); + //momList list_mpc(1,{mpc,},{0,}); + + std::vector> mpf2_twopt = sourcemomentumList_twopt.uniq_p(2); + momList list_mpf2_twopt(1,{mpf2_twopt,},{0,}); + + + int parallel_sources=HGC_totalL[3]/max_source_sink_separations; + std::vector lookuptable_UP; + std::vector lookuptable_DN; + + + for (int i=0; i vectorSource_stochastic; + vectorSource_stochastic.randInit(rand_seed1); + + + //Computing with ubaru insertion + //Step (1) produce the stochastic sample + //Step (2) produce the stochastic propagators + //Step (3) produce standard point to all propagators + //Step (4) produce factors with point to all + //Step (5) produce sequential through the source with momenta pi2 + //Step (6) produce factors with the sequential + //Step (7) doing the recombination + //Step (8) doing the one end trick calculation for the Z diagrams + + std::vector*> stochastic_sources; + + std::vector*> stochastic_propagator_2pt_SS; + + + /****************************************************** + * + *Step 1: Producing the stochastic sources + * + ******************************************************/ +#if 1 + for (int i=0; i(HOST)); + if (dotwopoint==1){ + stochastic_propagator_2pt_SS.push_back(new PLEGMA_Vector(HOST)); + } + if (readStochSamples==0){ + + vectorSource_stochastic.stochastic_Z(nroots); + vectorSource_stochastic.unload(); + vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); +#if 0 + PLEGMA_Vector vectorRead(BOTH); + vectorRead.readFile("stochastic_source.0000.00000_plegma_conventions.lime",LIME_FORMAT); + vectorRead.load(); + vectorRead.rotate_uk_ch_g5g4(); + vectorRead.apply_gamma(G2); + vectorRead.unload(); + stochastic_sources[i]->copy(vectorRead,HOST); +#endif + stochastic_sources[i]->copy(vectorSource_stochastic,HOST); + vectorSource_stochastic.load(); + } + else{ + std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read stochastic source from: %s\n",inputfilename.c_str()); + PLEGMA_Vector vectorRead(BOTH); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_sources[i]->copy(vectorRead,HOST); + inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_Vector vectorFloat(BOTH); + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorFloat.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_2pt_SS[i]->copy(vectorFloat,HOST); + } + } + + + /****************************************************** + * + *Step 2: Producing the stochastic propagators + * + ******************************************************/ + + if ((dotwopoint==1) && (readStochSamples==0)){ + for (int i=0; i vectorInOut, vectorAuxD1,vectorAuxD2; + + vectorAuxD1.copy(*stochastic_sources[i], HOST); + vectorAuxD1.load(); + + //Step(3) Smearing all the time slice + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + //In vectorAuxD2 we store the results for the inversion + vectorAuxD2.scale(0.0); + + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(5) pick out a particular timeslice from the source + // + //PLEGMA_Vector3D vec3D; + //vec3D.absorb(vectorAuxD1, timeidx); + //vectorInOut.absorb(vec3D, timeidx); + //vectorInOut.copy(vectorAuxD1); + vectorInOut.absorbTimeslice(vectorAuxD1, timeidx); + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + //Step(7) absorbing the particular timeslice to a 4d vector + //vec3D.absorb(vectorInOut, timeidx); + //vectorAuxD2.absorb(vec3D, timeidx, false); + vectorAuxD2.absorbTimeslice(vectorInOut, timeidx, false); + } + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(8) Save the propagator to the disk + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD2); + vectorAuxF.unload(); + vectorAuxF.writeLIME("globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber); + } + + //Step(9) Save the propagator to the host memory + vectorAuxD2.unload(); + stochastic_propagator_2pt_SS[i]->copy(vectorAuxD2,HOST); + vectorAuxD2.load(); + + } + } + +#endif + +#if 1 + /* + if(mu<0) + { + mu = -mu; + solver.UpdateSolver(); + } + + int countindex=0; + for (int isource=0; isource smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, timeSlice ); + for(int i=0; i< n_stochastic_samples; ++i) { + vectorSource_stochastic.copy( *stochastic_sources[i], HOST); + vectorSource_stochastic.load(); + PLEGMA_Vector vectorInOut, vectorAuxD1; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vectorInOut.copy(vectorSource_stochastic); + vector1.absorb(vectorInOut,timeSlice); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorInOut.absorb(vector2,timeSlice); + } + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); + + //Step(5) pick out a particular timeslice from the source + vectorInOut.absorbTimeslice(vectorAuxD1, timeSlice); + + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); + + //Step(7) Smearing all the time slice in the propagator + //We do not perform smearing for stochastic propagator + //because it always ends at the insertion + //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorAuxD1.unload(); + //PLEGMA_printf("Save the stochastic source for sample %d\n",i); + //std::string nstoch=std::to_string(i); + //vectorAuxD1.writeHDF5("stochastic_propagators_UP"+nstoch+"_t"+std::to_string(timeSlice)); + + //writeHDF5(outfilename) + stochastic_propags_UP_SL.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_UP_SL[countindex]->copy(vectorAuxD1, HOST); + countindex++; + //(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + vectorAuxD1.load(); + + } + lookuptable_UP[timeSlice]=(countindex-1)/n_stochastic_samples; + } + } + } + } + + if(mu>0) + { + mu = -mu; + solver.UpdateSolver(); + } + + + countindex=0; + for (int isource=0; isource smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, timeSlice ); + for(int i=0; i< n_stochastic_samples; ++i) { + vectorSource_stochastic.copy( *stochastic_sources[i], HOST); + vectorSource_stochastic.load(); + PLEGMA_Vector vectorInOut,vectorAuxD1; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vectorInOut.copy(vectorSource_stochastic); + vector1.absorb(vectorInOut,timeSlice); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorInOut.absorb(vector2,timeSlice); + } + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); + + //Step(5) pick out a particular timeslice from the source + vectorInOut.absorbTimeslice(vectorAuxD1, timeSlice); + + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); + + //Step(7) Smearing all the time slice in the propagator + //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //vectorAuxD1.unload(); + //PLEGMA_printf("Save the stochastic source for sample %d\n",i); + //std::string nstoch=std::to_string(i); + //vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch+"_t"+std::to_string(timeSlice)); + + vectorAuxD1.unload(); + stochastic_propags_DN_SL.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_DN_SL[countindex]->copy(vectorAuxD1, HOST); + countindex++; + + //stochastic_propags_DN_SL[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + vectorAuxD1.load(); + + } + lookuptable_DN[timeSlice]=(countindex-1)/n_stochastic_samples; + } + } + } + } +*/ +#endif + + + /****************************************************** + * + * Step 3: Computing the point to all propagators + * + ******************************************************/ + + for(int isource = startSource; isource < numSourcePositions; isource++){ + + + site source = sourcePositions[isource]; + + site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); + //updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); + + asprintf(&ssource,"sx%02dsy%02dsz%02dst%03d", sourcePositions[isource][0], sourcePositions[isource][1], sourcePositions[isource][2], sourcePositions[isource][3]); + std::string sourcepositiontext= (std::string)"_" + ssource; + free(ssource); + + +#if 1 + auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, + double run_mu, WHICHFLAVOR fl, int nSmear, site &source_location, bool finalize) { + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_location[DIM_T]); + // ensuring mu value + if(mu != run_mu) { + updateOptions(fl); + mu = run_mu; + solver.UpdateSolver(); + } + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorInOut; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source_location, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut.absorb(vector2,source_location[DIM_T]); + } + // Inverting + PLEGMA_printf("Going to invert %s for component %d\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + TIME(solver.solve(vectorInOut, vectorInOut)); + + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + + if(prop_SL.getAllocation() != NONE) { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorInOut); + prop_SL.absorb(vectorAuxF, isc/3, isc%3); + } + { // Smearing the solution + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop_SS.absorb(vectorAuxF, isc/3, isc%3); + } + } + if(finalize) { + prop_SS.rotateToPhysicalBase_device(run_mu/abs(run_mu)); + prop_SS.applyBoundaries_device(source[DIM_T]); + } + }; + + PLEGMA_Propagator propUP_SS_packed; + PLEGMA_Propagator propDN_SS_packed; + +// PLEGMA_Propagator propUP_SL_packed; +// PLEGMA_Propagator propDN_SL_packed; + + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + for (int sink=0; sink propUP_SS; + PLEGMA_Propagator propDN_SS; + + PLEGMA_Propagator propUP_SL(NONE); + PLEGMA_Propagator propDN_SL(NONE); + + //site source_local = sourcePositions[isource]; + //source_local[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site source_local; + source_local[0] = sourcePositions[isource][0]; + source_local[1] = sourcePositions[isource][1]; + source_local[2] = sourcePositions[isource][2]; + source_local[3] = (sourcePositions[isource][DIM_T]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site source_localPtSinkMtSource; + source_localPtSinkMtSource[0] = sourcePositions[isource][0]; + source_localPtSinkMtSource[1] = sourcePositions[isource][1]; + source_localPtSinkMtSource[2] = sourcePositions[isource][2]; + source_localPtSinkMtSource[3] = (sourcePositions[isource][DIM_T]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + source_local_reduction[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + + // If twop_filename exists we hold the computation of the light props + TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); + TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); + + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +// propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +// propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + } //parallel source position + + /****************************************************** + * + * Step 4: Computing the factors from the point to all + * and + * stochastic pieces + * + ******************************************************/ + + + //We implement the UD part first + //The neutron piplus at the source + + //We can compute V2 contractions for B and V3 contraction for W first + //without having to compute it for all the iterations in the loop + //over the sequential momentum + //Provided we have the same pf1,pf2 pairs for all pi2 sequential momentum + //For the saved V2 and V3 reductions we have to use all possible unique pf1 and pf2 + + //Here the prefix UU means that reduction is based phi and xi, without the gamma_5 + //We replace U(x_f2,x_f1) with phi(x_f2) xi^dagger(x_f1) + //phi goes to V2 reduction and xi goes to V3 reduction + + + //Here the prefix DD means that reduction is based phi*g5 and xi*g5 + //We replace D(x_f2,x_f1) with xi(x_f2)*gamma_5* phi^dagger(x_f1) *gamma_5 + //phi goes to V3 reduction and xi goes to V2 reduction + + //For the proton pizero x neutron piplus + + +// std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented + std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented + +// std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented + +// std::vector*> reductions_UU_V3_GAMMAF2U;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented + +// std::vector*> reductions_DD_V3_GAMMAF2D;//implemented + std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented + +// std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt; + + std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented + + + + + + for(int i=0; i< n_stochastic_samples; ++i) { + if (dotwopoint==1){ + reductions_DD_V2_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + + reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + + } + +/* + for (int k=0; k< tSinks.size(); ++k){ + try + { + reductions_DD_V2_GAMMAF1U_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_UU_V2_GAMMAF1D_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + reductions_UU_V4_GAMMAF1U_D.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + reductions_UU_V3_GAMMAF2U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + reductions_DD_V3_GAMMAF2D.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors"); + exit(1); + } + } + */ + } + + + for (int i_sample=0; i_sample stochastic_source; + stochastic_source.copy(*stochastic_sources[i_sample],HOST); + stochastic_source.load(); + + for (int k=0; k< tSinks.size();++k){ + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + PLEGMA_Propagator propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + + for (int i_source_parallel=0; i_source_parallel stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallelV2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); + + //B4,B6 + //B10,B12 + // TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, true)); + + if (k==0 && (dotwopoint==1)){ + PLEGMA_Vector stoch_piece; + stoch_piece.unload(); + stoch_piece.copy(*stochastic_sources[i_sample],HOST); + stoch_piece.load(); + + TIME(reductions_UU_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + + stoch_piece.apply_gamma5(); + TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); + + TIME(reductions_DD_V2_GAMMAF1U_D_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + + TIME(reductions_DD_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + + + stoch_piece.unload(); + stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); + stoch_piece.load(); + + TIME(reductions_UU_V2_GAMMAF1D_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); + + TIME(reductions_UU_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + + + stoch_piece.apply_gamma5(); + + TIME(reductions_DD_V3_GAMMAF2D_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); + + TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + + + } + } //end of for source sink separations + } //end of for stochastic samples + +// auto &momentum_i2 = {0,0,0};//mpi2_twopt[0]; + std::vector momentum_i2= {0,0,0}; + //List of momenta corresponding to a fix value of p_i2 + momList filtered_sourcemomentumList_2pt_single = sourcemomentumList_twopt.extract(momentum_i2, 0); + + //proton pizero x proton pizero + //udu ubaru (x_f) dbarubarubar + PLEGMA_ScattCorrelator corrD1ii1(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii2(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii3(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii4(source, filtered_sourcemomentumList_2pt_single); + + //udu dbard (x_f) dbarubarubar + PLEGMA_ScattCorrelator corrD1ii9(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii10(source, filtered_sourcemomentumList_2pt_single); + + //dud dbaru (x_f) dbarubarubar + PLEGMA_ScattCorrelator corrD1ii13(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii14(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii15(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii16(source, filtered_sourcemomentumList_2pt_single); + + + corrD1ii1.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii1"); + corrD1ii2.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii2"); + corrD1ii3.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii3"); + corrD1ii4.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii4"); + + corrD1ii9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii9"); + corrD1ii10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii10"); + + corrD1ii13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii13"); + corrD1ii14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii14"); + corrD1ii15.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii15"); + corrD1ii16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii16"); + + + + for (int i=0; i> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); + + std::vector> mpi2_filt ; + mpi2_filt.assign(mptot_filt.size(),momentum_i2); + //PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); + momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); + +#if 1 + + PLEGMA_ScattCorrelator reductionsV2_2pt(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV3_2pt(source_reduction, list_mpf2_twopt); + + PLEGMA_Propagator propTS_SS_packed; +#if 1 + //First we do the UP - UP case sequential inversion for the proton pizero + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + + PLEGMA_Propagator propTS_SS; + + + //we first implemenet UU + //Ensure mu is positive + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propUP_SS_packed, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + } + + vectorAuxD2.absorbTimeslice(vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); + + //Perform multiplication with glist_insertion[0] + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); + + //Computing sequential propagators UD T_fii with insertion + //glist_insertion[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert UP for sequential propagator UP for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,+1); + //performing smearing + vectorAuxF.copy(vectorAuxD2); + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); + + } + + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + } + + //creating factors + + PLEGMA_Vector stochastic_propagator_packed; + + PLEGMA_ScattCorrelator corrW29_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW30_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW31_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW32_2pt(source, filtered_sourcemomentumList_2pt); + + + corrW29_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W29"); + corrW30_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W30"); + corrW31_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); + corrW32_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); + + + + + for (int i_sample=0; i_sample stochastic_piece; + stochastic_piece.unload(); + stochastic_piece.copy(*stochastic_sources[i_sample], HOST); + stochastic_piece.load(); + + stochastic_piece.apply_gamma5(); + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, false));//checked + + TIME(corrW31_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 31, true, false)); + TIME(corrW32_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 32, true, false)); + + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, false));//checked + + TIME(corrW29_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 29, true, false)); + TIME(corrW30_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 30, true, false)); + + } //loop over sample + + + + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; + + TIME(produceOutput_2pt_packed(corrW29_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW30_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW31_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW32_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + +#endif + //We perform next U-D sequential to handle the piplus neutron case + // ensuring mu positive + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + propTS_SS_packed.zero_where(BOTH); + + + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + + PLEGMA_Propagator propTS_SS; + + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propDN_SS_packed, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + } + + vectorAuxD2.absorbTimeslice(vectorAuxD, (sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); + + //Perform multiplication with glist_insertion[0] + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); + + //Computing sequential propagators UD T_fii with insertion + //glist_insertion[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert UP for sequential propagator DN for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,+1); + + //performing smearing + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); + + } + + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + } + + + PLEGMA_ScattCorrelator corrW17_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW18_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW19_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW20_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW21_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW22_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW23_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW24_2pt(source, filtered_sourcemomentumList_2pt); + + + corrW17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W17"); + corrW18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W18"); + corrW19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W19"); + corrW20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W20"); + + corrW21_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W21"); + corrW22_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W22"); + corrW23_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W23"); + corrW24_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W24"); + + + for (int i_sample=0; i_sample stochastic_propagator_packed; + +// stochastic_propagator_packed.unload(); +// stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); +// stochastic_propagator_packed.load(); + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stochastic_propagator_packed.load(); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true)); + + TIME(corrW17_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 17, true, false)); + TIME(corrW19_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 19, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true)); + + TIME(corrW18_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 18, true, false)); + TIME(corrW20_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 20, true, false)); + + + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); + stochastic_propagator_packed.load(); + + stochastic_propagator_packed.apply_gamma5(); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); + + TIME(corrW21_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 21, true, false)); + TIME(corrW23_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 23, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); + + TIME(corrW22_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 22, true, false)); + TIME(corrW24_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 24, true, false)); + + + } //loop over stochastic samples + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; + + TIME(produceOutput_2pt_packed(corrW17_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW18_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW19_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW20_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrW21_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW22_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW23_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW24_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + + + +//Here we perform the last sequential the DN DN case +// + propTS_SS_packed.zero_where(BOTH); + + +#if 1 + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + + PLEGMA_Propagator propTS_SS; + + + //we first implemenet DD pizero DN + if(mu>0) { + mu*=-1.; + solver.UpdateSolver(); + } + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propDN_SS_packed, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + } + + vectorAuxD2.absorbTimeslice(vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); + + //Perform multiplication with glist_insertion[0] + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,-1); + + //Computing sequential propagators UD T_fii with insertion + //glist_insertion[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert DN for sequential propagator DN for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,-1); + //performing smearing + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); + + } + + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + } + + + + PLEGMA_ScattCorrelator corrW33_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW34_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW35_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW36_2pt(source, filtered_sourcemomentumList_2pt); + + + corrW33_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W33"); + corrW34_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W34"); + corrW35_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); + corrW36_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); + + + + + + for (int k=0; k< tSinks.size(); ++k){ + + + for (int i_sample=0; i_sample stochastic_propagator_packed; + + if (k==0 && (dotwopoint==1)){ + + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + + stochastic_propagator_packed.apply_gamma5(); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + + TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); + TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + + TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); + TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); + + + } + } //loop over stochastic samples + if ((dotwopoint==1)){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; + TIME(produceOutput_2pt_packed(corrW33_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table));//because of V4 + TIME(produceOutput_2pt_packed(corrW34_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW35_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrW36_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); + + + } + + + } //loop over tSinks +#endif +#endif + + }//loop over mpi2 + + if (dotwopoint==1){ + +#if 1 +/* outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; + TIME( corrN0_packed.apply_phase()); + TIME( corrN0_packed.apply_sign("N")); + TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrN0_packed.writeHDF5(outfilename)); + + TIME( corrNP_packed.apply_phase() ); + TIME( corrNP_packed.apply_sign("N") ); + TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrNP_packed.writeHDF5(outfilename) ); +*/ + +#endif +/* + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; + TIME(corrP0UP.apply_sign("P")); + TIME(corrP0UP.writeHDF5( outfilename )); + TIME(corrP0DN.apply_sign("P")); + TIME(corrP0DN.writeHDF5( outfilename )); + TIME(corrPPUP.apply_sign("P")); + TIME(corrPPUP.writeHDF5( outfilename )); + TIME(corrPPDN.apply_sign("P")); + TIME(corrPPDN.writeHDF5( outfilename )); +*/ + } + + +#if 1 +/* for (int k=0; k Date: Mon, 19 Jun 2023 14:58:45 +0200 Subject: [PATCH 085/168] correcting conjugation of momentum for W33,34,35,36 for D1ii and W correction --- plegma/nucleon_3pt_n_npi_wd1ii.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi_wd1ii.cpp b/plegma/nucleon_3pt_n_npi_wd1ii.cpp index ae0b8f20..5804ec0c 100644 --- a/plegma/nucleon_3pt_n_npi_wd1ii.cpp +++ b/plegma/nucleon_3pt_n_npi_wd1ii.cpp @@ -1274,12 +1274,12 @@ int main(int argc, char **argv) { stochastic_propagator_packed.apply_gamma5(); - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); From 68ca959365d953ddabe09f91e98d524c6954a55d Mon Sep 17 00:00:00 2001 From: Yan Li Date: Thu, 22 Jun 2023 10:29:07 +0200 Subject: [PATCH 086/168] correct hdf5 group name --- plegma/QuarkLoops_pi0_insertion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index e531b730..daf087ae 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -459,7 +459,7 @@ int main(int argc, char **argv) for (int i = 0; i < num_stoc; i++) { plegma::PLEGMA_ScattCorrelator insertLoop(src, momList3pt_pc); - insertLoop.initialize_diagram(gscatts_c, "stoc" + std::to_string(seed_stoc) + "id" + std::to_string(i) + "_" + std::to_string(num_stoc) + "/up"); + insertLoop.initialize_diagram(gscatts_c, "stoc" + std::to_string(seed_stoc) + "id" + std::to_string(i) + "_1" + "/up"); plegma::PLEGMA_Vector stocSrc, stocProp; From 2ce31f0a286cff638e3e1c5e8fc54e93a3958586 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sat, 8 Jul 2023 16:56:09 +0200 Subject: [PATCH 087/168] production file for NJN --- plegma/nucleon_2pt_3pt_npi.cpp | 63 +++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/plegma/nucleon_2pt_3pt_npi.cpp b/plegma/nucleon_2pt_3pt_npi.cpp index 1bf18879..2e66c8fa 100644 --- a/plegma/nucleon_2pt_3pt_npi.cpp +++ b/plegma/nucleon_2pt_3pt_npi.cpp @@ -70,7 +70,7 @@ int main(int argc, char **argv) { int nsmearGauss_c = 0; int startSource = 0; int nroots=4; - std::string prOrNt = "neutron"; + std::string prOrNt = "proton"; std::string srcInputFile = "./input.src"; std::string outdiagramPrefix=""; std::string outfilename; @@ -175,10 +175,10 @@ int main(int argc, char **argv) { PLEGMA_error("twopt momentumList empty"); if(sourcemomentumList_threept.empty()) PLEGMA_error("threept momentumList empty"); - +/* PLEGMA_Vector vectorSource_oet; vectorSource_oet.randInit(rand_seed1); - +*/ for(int isource = startSource; isource < numSourcePositions; isource++){ @@ -189,15 +189,16 @@ int main(int argc, char **argv) { std::vector> mpi2_twopt = sourcemomentumList_twopt.uniq_p(0); momList list_mpi2_twopt(1,{mpi2_twopt,},{0,}); + std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); + momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); + std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); momList list_mpi2_threept(1,{mpi2_threept,},{0,}); std::vector> mpf1_threept = sourcemomentumList_threept.uniq_p(1); momList list_mpf1_threept(1,{mpf1_threept,},{0,}); - std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); - momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); - +/* PLEGMA_ScattCorrelator corrP0UP(sourcePositions[isource], list_mpi2_twopt); PLEGMA_ScattCorrelator corrP0DN(sourcePositions[isource], list_mpi2_twopt); @@ -210,7 +211,7 @@ int main(int argc, char **argv) { corrPPDN.initialize_diagram(glist_source_meson, glist_sink_meson, "PPDN"); vectorSource_oet.stochastic_Z(nroots); - +*/ site& source = sourcePositions[isource]; site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); @@ -221,7 +222,7 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source[DIM_T]); - +/* auto computeOetPropagator = [&](PLEGMA_Vector& vec_SS, PLEGMA_Vector& vec_SL, double run_mu, WHICHFLAVOR fl, int nSmear, std::vector sourceMom, bool finalize) { // ensuring mu value @@ -280,7 +281,7 @@ int main(int argc, char **argv) { vec_SS.copy(vectorAuxF); } - }; + };*/ auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, double run_mu, WHICHFLAVOR fl, int nSmear, bool finalize) { @@ -345,7 +346,7 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUP; PLEGMA_Propagator propDN; - +/* PLEGMA_Vector oet_mom_zero_up_SS; PLEGMA_Vector oet_mom_zero_dn_SS; @@ -357,7 +358,7 @@ int main(int argc, char **argv) { oet_mom_fini_up_SS.push_back(new PLEGMA_Vector(HOST)); oet_mom_fini_dn_SS.push_back(new PLEGMA_Vector(HOST)); } - +*/ PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1_twopt); TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); @@ -372,7 +373,7 @@ int main(int argc, char **argv) { PLEGMA_Propagator propUP_SL(tSinks.size()>0 ? BOTH:NONE); PLEGMA_Propagator propDN_SL(tSinks.size()>0 ? BOTH:NONE); - PLEGMA_Vector oet_mom_zero_up_SL(tSinks.size()>0 ? BOTH:NONE); +/* PLEGMA_Vector oet_mom_zero_up_SL(tSinks.size()>0 ? BOTH:NONE); PLEGMA_Vector oet_mom_zero_dn_SL(tSinks.size()>0 ? BOTH:NONE); std::vector*> oet_mom_fini_up_SL; @@ -382,7 +383,7 @@ int main(int argc, char **argv) { oet_mom_fini_up_SL.push_back(new PLEGMA_Vector(HOST)); oet_mom_fini_dn_SL.push_back(new PLEGMA_Vector(HOST)); } - +*/ bool computed_light = false; // If twop_filename exists we hold the computation of the light props @@ -392,10 +393,10 @@ int main(int argc, char **argv) { computed_light = true; } - bool computed_light_oet = true; +/* bool computed_light_oet = true; std::vector zero_mom({0,0,0}); TIME(computeOetPropagator(oet_mom_zero_up_SS, oet_mom_zero_up_SL, mu_ud, LIGHT, nsmearGauss, zero_mom, false)); - TIME(computeOetPropagator(oet_mom_zero_dn_SS, oet_mom_zero_dn_SL, -mu_ud, LIGHT, nsmearGauss, zero_mom, false)); + TIME(computeOetPropagator(oet_mom_zero_dn_SS, oet_mom_zero_dn_SL, -mu_ud, LIGHT, nsmearGauss, zero_mom, false));*/ @@ -426,7 +427,7 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon diagram ready\n"); } - +/* //Section M diagrams 2pt functions { PLEGMA_Vector vectorAuxF_SS; @@ -502,7 +503,7 @@ int main(int argc, char **argv) { } //end of loop mpi2 }//section M diagram 2pt functions - +*/ std::vector filter={0,0,0}; @@ -536,8 +537,8 @@ int main(int argc, char **argv) { WHICHPARTICLE nucleon = get_particle(prOrNt); std::vector gammas = {ONE,G1,G2,G3,G4,G5,G5G1,G5G2,G5G3,G5G4};//,S12,S13,S23,S41,S42,S43}; - for (int alpha=0;alpha& prop1, PLEGMA_Propagator3D& prop2, int signProps, PLEGMA_Propagator &propF, std::string fl) { if(not computed_light) { @@ -632,10 +633,14 @@ int main(int argc, char **argv) { TIME(corr.contractNucleonThrp_local(seqProp, propF, signProps, gammas)); } else{ +#if 0 + seqProp.writeHDF5("seqProp"+fl+std::to_string(alpha)+std::to_string(beta)); + propF.writeHDF5("PropF"+fl+std::to_string(alpha)+std::to_string(beta)); +#endif TIME(corr.contractNucleonThrp_local(seqProp, propF, 0, gammas)); } if(signPer < 0) for(size_t iv = 0 ; iv < corr.getTotalSize()*2; iv++) corr.H_elem()[iv] *= signPer; -// THREAD(corr.writeFile(filename, corr_file_format)); +// corr.writeHDF5("TEST"); if (fl=="up"){ corrUp.absorbSourceSinkSpinMom(corr, alpha, beta, i_pf1 ); @@ -667,6 +672,7 @@ int main(int argc, char **argv) { } //loop over beta }//loop over alpha +/* auto computeOetInvThroughSink = [&](PLEGMA_Vector& vec_SC, double run_mu, PLEGMA_Vector3D& prop, int nSmear, WHICHFLAVOR fl, std::vector momentum_f1, int i_gamma_i2, int i_gamma_f2 ) { // ensuring mu positive @@ -960,6 +966,7 @@ int main(int argc, char **argv) { } }//momentum pi2 + */ //Note that we compute NJN for the set //of input momenta pf1 and perform the @@ -972,21 +979,21 @@ int main(int argc, char **argv) { //TIME(corrDn.apply_phase()); if (nucleon==PROTON){ - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"protonup"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource)+"_protonup"; } else{ - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"neutronup"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource)+"_neutronup"; } TIME(corrUp.writeHDF5(outfilename)); if (nucleon==PROTON){ - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"protondn"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource)+"_protondn"; } else{ - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"neutrondn"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource) +"_neutrondn"; } TIME(corrDn.writeHDF5(outfilename)); - +/* { PLEGMA_Vector3D zero_momentum_light; zero_momentum_light.absorb(oet_mom_zero_up_SS, global_fixSinkTime); @@ -1002,9 +1009,9 @@ int main(int argc, char **argv) { computeThreep_meson(+mu_ud, zero_momentum_light, nsmearGauss, LIGHT,"dn", "pizero"); } - +*/ }//tsink - +/* outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P"; TIME(corrPPUP.apply_sign("P")); @@ -1015,7 +1022,7 @@ int main(int argc, char **argv) { TIME(corrP0UP.writeHDF5( outfilename )); TIME(corrP0DN.apply_sign("P")); TIME(corrP0DN.writeHDF5( outfilename )); - +*/ outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; TIME( corrN0.apply_phase()); TIME( corrN0.apply_sign("N")); From b9d8c28167ccb31f5ed74b8fc26365fdce6ec013 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 7 Aug 2023 14:57:44 +0200 Subject: [PATCH 088/168] correcting B7, B8 sequential part, and the V2,V4 for twopoint (has been corrected earlier, just has not been pushed) --- plegma/nucleon_3pt_n_npi.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index acf67fc2..ffa2726f 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -1583,12 +1583,12 @@ int main(int argc, char **argv) { TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, false));//checked + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked TIME(corrW31_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 31, true, false)); TIME(corrW32_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 32, true, false)); - TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, false));//checked + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked TIME(corrW29_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 29, true, false)); TIME(corrW30_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 30, true, false)); @@ -2267,7 +2267,7 @@ int main(int argc, char **argv) { //performing rotation to physical base vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,-1); //performing smearing - vectorAuxF.copy(vectorAuxD); + vectorAuxF.copy(vectorAuxD2); propTS_SL.absorb(vectorAuxF, isc/3, isc%3); TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); vectorAuxF.copy(vectorAuxD); @@ -2423,12 +2423,12 @@ int main(int argc, char **argv) { stochastic_propagator_packed.apply_gamma5(); - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, false)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); From dfbc347514460a6c3b96ff9450574c3b41b2b783 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 21 Aug 2023 16:28:55 +0200 Subject: [PATCH 089/168] including packing for the backward part --- plegma/nucleon_3pt_n_npi.cpp | 48 +++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index ffa2726f..0b40b974 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -267,6 +267,9 @@ int main(int argc, char **argv) { int *attract_lookup_table; attract_lookup_table=(int *)malloc(sizeof(int)*HGC_totalL[3]); + int *attract_lookup_table_backward; + attract_lookup_table_backward=(int *)malloc(sizeof(int)*HGC_totalL[3]); + PLEGMA_Vector vectorSource_stochastic; @@ -621,6 +624,10 @@ int main(int argc, char **argv) { } }; + PLEGMA_Propagator propUP_SS_packed_backward; + PLEGMA_Propagator propDN_SS_packed_backward; + + PLEGMA_Propagator propUP_SS_packed; PLEGMA_Propagator propDN_SS_packed; @@ -632,6 +639,12 @@ int main(int argc, char **argv) { attract_lookup_table[(sourcePositions[isource][DIM_T]+max_source_sink_separations*i_source_parallel+sink)%HGC_totalL[3]]=(sourcePositions[isource][DIM_T]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; } } + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + for (int sink=0; sink propUP_SS; @@ -653,6 +666,13 @@ int main(int argc, char **argv) { source_localPtSinkMtSource[2] = sourcePositions[isource][2]; source_localPtSinkMtSource[3] = (sourcePositions[isource][DIM_T]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site source_localTotalMsink; + source_localTotalMsink[0] = sourcePositions[isource][0]; + source_localTotalMsink[1] = sourcePositions[isource][1]; + source_localTotalMsink[2] = sourcePositions[isource][2]; + source_localTotalMsink[3] = ((sourcePositions[isource][DIM_T]+(i_source_parallel)*max_source_sink_separations)+HGC_totalL[3])%HGC_totalL[3]; + + site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); source_local_reduction[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; @@ -724,6 +744,9 @@ int main(int argc, char **argv) { propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propUP_SS_packed_backward.pack_propagator_from_source_to_sink(propUP_SS, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed_backward.pack_propagator_from_source_to_sink(propDN_SS, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -731,7 +754,10 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrNP_packed(source, list_mpf1_twopt); + PLEGMA_ScattCorrelator corrNP_packed_backward(source, list_mpf1_twopt); + TIME(corrNP_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + TIME(corrNP_packed_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); if (dotwopoint==1){ @@ -745,6 +771,13 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrNP_packed.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP_packed_backward.N_diagrams( reductionsT1N, reductionsT2N )); + + } @@ -1007,7 +1040,7 @@ int main(int argc, char **argv) { } //end of for stochastic samples // auto &momentum_i2 = {0,0,0};//mpi2_twopt[0]; - std::vector momentum_i2= {0,0,0}; + std::vector momentum_i2= {1,0,0}; //List of momenta corresponding to a fix value of p_i2 momList filtered_sourcemomentumList_2pt_single = sourcemomentumList_twopt.extract(momentum_i2, 0); @@ -2884,6 +2917,18 @@ int main(int argc, char **argv) { TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); TIME( corrNP_packed.writeHDF5(outfilename) ); + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt_backward"; + + TIME( corrNP_packed_backward.apply_phase() ); + TIME( corrNP_packed_backward.apply_sign("N") ); + for (int i=0; i<48;++i){ + printf("TABLE %d %d\n",i,attract_lookup_table_backward[i]); + } + TIME( corrNP_packed_backward.applyBoundaryConditions( true, parallel_sources, attract_lookup_table_backward)); + TIME( corrNP_packed_backward.writeHDF5(outfilename) ); + + + #endif @@ -2943,6 +2988,7 @@ int main(int argc, char **argv) { }//loop over source position free(attract_lookup_table); + free(attract_lookup_table_backward); #if 1 for(int i=0; i< n_stochastic_samples; ++i) { stochastic_sources.pop_back(); From c74c0b261c1b893908c23dc8eeefd021353ba4ec Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 21 Aug 2023 22:56:54 +0200 Subject: [PATCH 090/168] working on adding backward part to all the 2pt function --- plegma/nucleon_3pt_n_npi.cpp | 172 ++++++++++++++++++++++++++++++++--- 1 file changed, 159 insertions(+), 13 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 0b40b974..b2cfcdce 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -754,10 +754,10 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrNP_packed(source, list_mpf1_twopt); - PLEGMA_ScattCorrelator corrNP_packed_backward(source, list_mpf1_twopt); + //PLEGMA_ScattCorrelator corrNP_packed_backward(source, list_mpf1_twopt); TIME(corrNP_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); - TIME(corrNP_packed_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + //TIME(corrNP_packed_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); if (dotwopoint==1){ @@ -771,11 +771,11 @@ int main(int argc, char **argv) { //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrNP_packed.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + //TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + //TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrNP_packed_backward.N_diagrams( reductionsT1N, reductionsT2N )); + //TIME(corrNP_packed_backward.N_diagrams( reductionsT1N, reductionsT2N )); @@ -834,23 +834,35 @@ int main(int argc, char **argv) { std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented + std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt_backward;//implemented std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt_backward;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U;//implemented std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U_2pt_backward;//implemented std::vector*> reductions_DD_V3_GAMMAF2D;//implemented std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented + std::vector*> reductions_DD_V3_GAMMAF2D_2pt_backward;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt; + std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt_backward; std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented + std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt_backward;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt_backward;//implemented + std::vector*> reductions_DD_V3_GAMMAF2U_2pt_backward;//implemented + + @@ -869,6 +881,19 @@ int main(int argc, char **argv) { reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V2_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V2_GAMMAF1U_U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V4_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + reductions_UU_V2_GAMMAF1D_U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_UU_V4_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + + reductions_UU_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + + } @@ -946,6 +971,8 @@ int main(int argc, char **argv) { TIME(reductions_UU_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + TIME(reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed_backward, true)); + stoch_piece.apply_gamma5(); TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); @@ -953,6 +980,12 @@ int main(int argc, char **argv) { TIME(reductions_DD_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + TIME(reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME(reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); + + TIME(reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); + stoch_piece.unload(); stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); @@ -962,6 +995,10 @@ int main(int argc, char **argv) { TIME(reductions_UU_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + TIME(reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME(reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); + stoch_piece.apply_gamma5(); @@ -969,6 +1006,11 @@ int main(int argc, char **argv) { TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); + TIME(reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed_backward, true)); + + TIME(reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed_backward, true)); + + } @@ -1051,16 +1093,31 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrD1ii3(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii4(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii1_backward(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii2_backward(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii3_backward(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii4_backward(source, filtered_sourcemomentumList_2pt_single); + + //udu dbard (x_f) dbarubarubar PLEGMA_ScattCorrelator corrD1ii9(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii10(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii9_backward(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii10_backward(source, filtered_sourcemomentumList_2pt_single); + //dud dbaru (x_f) dbarubarubar PLEGMA_ScattCorrelator corrD1ii13(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii14(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii15(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii16(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii13_backward(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii14_backward(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii15_backward(source, filtered_sourcemomentumList_2pt_single); + PLEGMA_ScattCorrelator corrD1ii16_backward(source, filtered_sourcemomentumList_2pt_single); + + corrD1ii1.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii1"); corrD1ii2.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii2"); @@ -1076,6 +1133,21 @@ int main(int argc, char **argv) { corrD1ii16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii16"); + corrD1ii1_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii1"); + corrD1ii2_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii2"); + corrD1ii3_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii3"); + corrD1ii4_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii4"); + + corrD1ii9_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii9"); + corrD1ii10_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii10"); + + corrD1ii13_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii13"); + corrD1ii14_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii14"); + corrD1ii15_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii15"); + corrD1ii16_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii16"); + + + for (int i=0; i reductionsV3_diluted_U_DN(source_reduction, list_mpc); PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt(source_reduction, list_mpf2_twopt); + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt_backward(source_reduction, list_mpf2_twopt); + + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP(source_reduction, list_mpc); PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt(source_reduction, list_mpf2_twopt); PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt(source_reduction, list_mpf2_twopt); + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt_backward(source_reduction, list_mpf2_twopt); + + PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt_backward(source_reduction, list_mpf2_twopt); + + std::vector*> reductionsV4_diluted_STOCHU_DN_UP; std::vector*> reductionsV2_diluted_STOCHU_DN_UP; @@ -1283,6 +1393,16 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt(source_reduction, list_mpf1_twopt); PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHU_DN_UP_2pt_backward(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_UP_2pt_backward(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHD_UP_DN_2pt_backward(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_DN_2pt_backward(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt_backward(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt_backward(source_reduction, list_mpf1_twopt); + + for (int k=0; k reductionsV3_2pt(source_reduction, list_mpf2_twopt); PLEGMA_Propagator propTS_SS_packed; + PLEGMA_Propagator propTS_SS_packed_backward; + PLEGMA_Propagator propTS_SL_packed; #if 1 //First we do the UP - UP case sequential inversion for the proton pizero @@ -1463,6 +1595,7 @@ int main(int argc, char **argv) { } propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propTS_SS_packed_backward.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1496,6 +1629,10 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); @@ -2917,15 +3054,12 @@ int main(int argc, char **argv) { TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); TIME( corrNP_packed.writeHDF5(outfilename) ); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt_backward"; + //outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt_backward"; - TIME( corrNP_packed_backward.apply_phase() ); - TIME( corrNP_packed_backward.apply_sign("N") ); - for (int i=0; i<48;++i){ - printf("TABLE %d %d\n",i,attract_lookup_table_backward[i]); - } - TIME( corrNP_packed_backward.applyBoundaryConditions( true, parallel_sources, attract_lookup_table_backward)); - TIME( corrNP_packed_backward.writeHDF5(outfilename) ); + //TIME( corrNP_packed_backward.apply_phase() ); + //TIME( corrNP_packed_backward.apply_sign("N") ); + //TIME( corrNP_packed_backward.applyBoundaryConditions( true, parallel_sources, attract_lookup_table_backward)); + //TIME( corrNP_packed_backward.writeHDF5(outfilename) ); @@ -2967,6 +3101,18 @@ int main(int argc, char **argv) { reductions_DD_V3_GAMMAF2U_2pt.pop_back(); reductions_DD_V3_GAMMAF2D_2pt.pop_back(); + reductions_DD_V2_GAMMAF1U_U_2pt_backward.pop_back(); + reductions_DD_V2_GAMMAF1U_D_2pt_backward.pop_back(); + reductions_DD_V4_GAMMAF1U_D_2pt_backward.pop_back(); + + reductions_UU_V4_GAMMAF1U_D_2pt_backward.pop_back(); + reductions_UU_V2_GAMMAF1D_U_2pt_backward.pop_back(); + + reductions_UU_V3_GAMMAF2U_2pt_backward.pop_back(); + reductions_DD_V3_GAMMAF2U_2pt_backward.pop_back(); + reductions_DD_V3_GAMMAF2D_2pt_backward.pop_back(); + + } From 35bb1537b4a07cdb0f2410ccdbcc0f973c8f8ec4 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 23 Aug 2023 14:46:09 +0200 Subject: [PATCH 091/168] progressing of adding backward part --- plegma/nucleon_3pt_n_npi.cpp | 594 ++++++++++++++++++++++++++++++++--- 1 file changed, 550 insertions(+), 44 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index b2cfcdce..912394a1 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -10,6 +10,8 @@ std::vector threads; //#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) #define THREAD(fnc) saveTuneCache(false); TIME(fnc) +#define COMPUTEBACKWARD true + using namespace plegma; using namespace quda; static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename","momlisttwopt-filename","momlistthreept-filename", @@ -267,8 +269,10 @@ int main(int argc, char **argv) { int *attract_lookup_table; attract_lookup_table=(int *)malloc(sizeof(int)*HGC_totalL[3]); +#if defined (COMPUTEBACKWARD) int *attract_lookup_table_backward; attract_lookup_table_backward=(int *)malloc(sizeof(int)*HGC_totalL[3]); +#endif @@ -296,11 +300,23 @@ int main(int argc, char **argv) { std::vector*> stochastic_propags_UP_SL; std::vector*> stochastic_propags_DN_SL; +#if defined (COMPUTEBACKWARD) + + PLEGMA_Vector stochastic_oet_prop_u_zero_mom_SS_backward; + +#endif PLEGMA_Vector stochastic_oet_prop_u_zero_mom_SS; +#if defined (COMPUTEBACKWARD) + + PLEGMA_Vector stochastic_oet_prop_d_zero_mom_SS_backward; + +#endif + PLEGMA_Vector stochastic_oet_prop_d_zero_mom_SS; + PLEGMA_Vector stochastic_oet_prop_u_fini_mom_SL; PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SL; @@ -624,9 +640,13 @@ int main(int argc, char **argv) { } }; +#if defined (COMPUTEBACKWARD) + PLEGMA_Propagator propUP_SS_packed_backward; PLEGMA_Propagator propDN_SS_packed_backward; +#endif + PLEGMA_Propagator propUP_SS_packed; PLEGMA_Propagator propDN_SS_packed; @@ -639,12 +659,17 @@ int main(int argc, char **argv) { attract_lookup_table[(sourcePositions[isource][DIM_T]+max_source_sink_separations*i_source_parallel+sink)%HGC_totalL[3]]=(sourcePositions[isource][DIM_T]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; } } + +#if defined (COMPUTEBACKWARD) + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ for (int sink=0; sink propUP_SS; @@ -744,8 +769,11 @@ int main(int argc, char **argv) { propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) propUP_SS_packed_backward.pack_propagator_from_source_to_sink(propUP_SS, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed_backward.pack_propagator_from_source_to_sink(propDN_SS, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -834,34 +862,45 @@ int main(int argc, char **argv) { std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented + +#if defined (COMPUTEBACKWARD) std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt_backward;//implemented +#endif std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented + +#if defined (COMPUTEBACKWARD) std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt_backward;//implemented +#endif std::vector*> reductions_UU_V3_GAMMAF2U;//implemented std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented +#if defined (COMPUTEBACKWARD) std::vector*> reductions_UU_V3_GAMMAF2U_2pt_backward;//implemented - +#endif std::vector*> reductions_DD_V3_GAMMAF2D;//implemented std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented - std::vector*> reductions_DD_V3_GAMMAF2D_2pt_backward;//implemented +#if defined (COMPUTEBACKWARD) + std::vector*> reductions_DD_V3_GAMMAF2D_2pt_backward;//implemented +#endif std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt; +#if defined (COMPUTEBACKWARD) std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt_backward; - +#endif std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented - +#if defined (COMPUTEBACKWARD) std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt_backward;//implemented std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt_backward;//implemented std::vector*> reductions_DD_V3_GAMMAF2U_2pt_backward;//implemented - +#endif @@ -880,7 +919,7 @@ int main(int argc, char **argv) { reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - +#if defined (COMPUTEBACKWARD) reductions_DD_V2_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_DD_V2_GAMMAF1U_U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_DD_V4_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); @@ -892,7 +931,7 @@ int main(int argc, char **argv) { reductions_UU_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - +#endif } @@ -970,22 +1009,22 @@ int main(int argc, char **argv) { stoch_piece.load(); TIME(reductions_UU_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); - +#if defined (COMPUTEBACKWARD) TIME(reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed_backward, true)); - +#endif stoch_piece.apply_gamma5(); TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); TIME(reductions_DD_V2_GAMMAF1U_D_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); TIME(reductions_DD_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); - +#if defined (COMPUTEBACKWARD) TIME(reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propUP_SS_packed_backward, true)); TIME(reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); TIME(reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); - +#endif stoch_piece.unload(); stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); @@ -994,22 +1033,22 @@ int main(int argc, char **argv) { TIME(reductions_UU_V2_GAMMAF1D_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); TIME(reductions_UU_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); - +#if defined (COMPUTEBACKWARD) TIME(reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed_backward, propUP_SS_packed_backward, true)); TIME(reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); - +#endif stoch_piece.apply_gamma5(); TIME(reductions_DD_V3_GAMMAF2D_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); - +#if defined (COMPUTEBACKWARD) TIME(reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed_backward, true)); TIME(reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed_backward, true)); - +#endif } @@ -1092,31 +1131,34 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrD1ii2(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii3(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii4(source, filtered_sourcemomentumList_2pt_single); +#if defined (COMPUTEBACKWARD) PLEGMA_ScattCorrelator corrD1ii1_backward(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii2_backward(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii3_backward(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii4_backward(source, filtered_sourcemomentumList_2pt_single); - +#endif //udu dbard (x_f) dbarubarubar PLEGMA_ScattCorrelator corrD1ii9(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii10(source, filtered_sourcemomentumList_2pt_single); +#if defined (COMPUTEBACKWARD) PLEGMA_ScattCorrelator corrD1ii9_backward(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii10_backward(source, filtered_sourcemomentumList_2pt_single); - +#endif //dud dbaru (x_f) dbarubarubar PLEGMA_ScattCorrelator corrD1ii13(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii14(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii15(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii16(source, filtered_sourcemomentumList_2pt_single); +#if defined (COMPUTEBACKWARD) PLEGMA_ScattCorrelator corrD1ii13_backward(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii14_backward(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii15_backward(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii16_backward(source, filtered_sourcemomentumList_2pt_single); - +#endif corrD1ii1.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii1"); @@ -1132,7 +1174,7 @@ int main(int argc, char **argv) { corrD1ii15.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii15"); corrD1ii16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii16"); - +#if defined (COMPUTEBACKWARD) corrD1ii1_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii1"); corrD1ii2_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii2"); corrD1ii3_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii3"); @@ -1146,7 +1188,7 @@ int main(int argc, char **argv) { corrD1ii15_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii15"); corrD1ii16_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ii16"); - +#endif for (int i=0; i vectortmp1; @@ -1346,6 +1408,10 @@ int main(int argc, char **argv) { vectorAuxF.copy(vectortmp2); stochastic_oet_prop_d_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#if defined (COMPUTEBACKWARD) + stochastic_oet_prop_d_zero_mom_SS_backward.pack_propagator_from_source_to_sink(vectorAuxF, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + } //end of loop on parallel sources }//end of do_stochastic_oet @@ -1365,19 +1431,21 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN(source_reduction, list_mpc); PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt(source_reduction, list_mpf2_twopt); - +#if defined (COMPUTEBACKWARD) PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt_backward(source_reduction, list_mpf2_twopt); - +#endif PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP(source_reduction, list_mpc); PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt(source_reduction, list_mpf2_twopt); PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt(source_reduction, list_mpf2_twopt); + +#if defined (COMPUTEBACKWARD) PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt_backward(source_reduction, list_mpf2_twopt); PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt_backward(source_reduction, list_mpf2_twopt); - +#endif std::vector*> reductionsV4_diluted_STOCHU_DN_UP; @@ -1393,6 +1461,8 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt(source_reduction, list_mpf1_twopt); PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt(source_reduction, list_mpf1_twopt); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHU_DN_UP_2pt_backward(source_reduction, list_mpf1_twopt); PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_UP_2pt_backward(source_reduction, list_mpf1_twopt); @@ -1401,7 +1471,7 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt_backward(source_reduction, list_mpf1_twopt); PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt_backward(source_reduction, list_mpf1_twopt); - +#endif for (int k=0; k corrD1if34(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrD1if56(source, filtered_sourcemomentumList_2pt); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrM_backward( source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if12_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if34_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if56_backward(source, filtered_sourcemomentumList_2pt); +#endif PLEGMA_ScattCorrelator reductionsT1(source_reduction, mptot_filt); PLEGMA_ScattCorrelator reductionsT2(source_reduction, mptot_filt); @@ -1534,8 +1611,9 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsV3_2pt(source_reduction, list_mpf2_twopt); PLEGMA_Propagator propTS_SS_packed; +#if defined (COMPUTEBACKWARD) PLEGMA_Propagator propTS_SS_packed_backward; - +#endif PLEGMA_Propagator propTS_SL_packed; #if 1 //First we do the UP - UP case sequential inversion for the proton pizero @@ -1595,7 +1673,11 @@ int main(int argc, char **argv) { } propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + propTS_SS_packed_backward.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -1605,6 +1687,12 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrTproton_protonpizero1_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero2_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero3_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero4_backward(source, list_mpi2ptot); +#endif //std::vector<> mm=list_mpi2ptot.to_string(); @@ -1616,28 +1704,52 @@ int main(int argc, char **argv) { corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); +#if defined (COMPUTEBACKWARD) + corrTproton_protonpizero1_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq21"); + + corrTproton_protonpizero2_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq22"); + + corrTproton_protonpizero3_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq23"); + + corrTproton_protonpizero4_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); +#endif + if (dotwopoint==1){ PLEGMA_ScattCorrelator corrD1ff1389(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrD1ff24710(source, filtered_sourcemomentumList_2pt); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrD1ff1389_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1ff24710_backward(source, filtered_sourcemomentumList_2pt); +#endif + corrD1ff24710.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); corrD1ff1389.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); +#if defined (COMPUTEBACKWARD) + corrD1ff24710_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); + corrD1ff1389_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); +#endif TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); - TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); - - TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); TIME(corrD1ff24710.LT_diagrams( reductionsT1, reductionsT2, 1 )); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero1_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero2_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + + TIME(corrD1ff24710_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); +#endif TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); @@ -1646,11 +1758,29 @@ int main(int argc, char **argv) { TIME(corrD1ff1389.LT_diagrams( reductionsT1, reductionsT2, 1 )); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propTS_SS_packed_backward)); + TIME(corrTproton_protonpizero3_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propTS_SS_packed_backward)); + TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT2, 0, false, true, true)); + + TIME(corrD1ff1389_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); +#endif + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; TIME(produceOutput_2pt_packed( corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); +#if defined (COMPUTEBACKWARD) + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff_backward"; + + TIME(produceOutput_2pt_packed( corrD1ff24710_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed( corrD1ff1389_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +#endif outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; @@ -1658,7 +1788,17 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero4, outfilename, "T", parallel_sources, attract_lookup_table)); + +#if defined (COMPUTEBACKWARD) + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T_backward"; + + TIME(produceOutput_2pt_packed(corrTproton_protonpizero1_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero2_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero3_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero4_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + } +#endif //creating factors @@ -1691,6 +1831,35 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrW31_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW32_2pt(source, filtered_sourcemomentumList_2pt); +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrB3_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB4_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB5_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB6_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrB17_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB18_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB19_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB20_2pt_backward(source, filtered_sourcemomentumList_2pt); + + + PLEGMA_ScattCorrelator corrW5_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW6_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW7_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW8_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW13_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW14_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW15_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW16_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW29_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW30_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW31_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW32_2pt_backward(source, filtered_sourcemomentumList_2pt); + +#endif corrB3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); corrB4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); @@ -1718,6 +1887,35 @@ int main(int argc, char **argv) { corrW31_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); corrW32_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); +#if defined (COMPUTEBACKWARD) + + corrB3_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); + corrB4_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); + corrB5_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B5"); + corrB6_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B6"); + + corrB17_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B17"); + corrB18_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B18"); + corrB19_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B19"); + corrB20_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B20"); + + + corrW5_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W5"); + corrW6_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W6"); + corrW7_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W7"); + corrW8_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W8"); + + corrW13_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W13"); + corrW14_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W14"); + corrW15_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); + corrW16_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); + + corrW29_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W29"); + corrW30_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W30"); + corrW31_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); + corrW32_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); +#endif +#endif if (dotwopoint==1){ @@ -1736,6 +1934,15 @@ int main(int argc, char **argv) { TIME(corrB4_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 4, true)); TIME(corrB5_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 5, true)); TIME(corrB6_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 6, true)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed_backward, true)); + + TIME(corrB3_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 3, true)); + TIME(corrB4_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 4, true)); + TIME(corrB5_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 5, true)); + TIME(corrB6_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 6, true)); +#endif stochastic_piece.apply_gamma5(); @@ -1745,6 +1952,15 @@ int main(int argc, char **argv) { TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true));//checked + + TIME(corrW13_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 13, true, false)); + + TIME(corrW15_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 15, true, false)); +#endif + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true));//checked @@ -1752,17 +1968,43 @@ int main(int argc, char **argv) { TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true));//checked + + TIME(corrW14_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 14, true, false)); + + TIME(corrW16_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 16, true, false)); + +#endif TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked TIME(corrW31_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 31, true, false)); TIME(corrW32_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 32, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked + + TIME(corrW31_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 31, true, false)); + TIME(corrW32_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 32, true, false)); +#endif + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked TIME(corrW29_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 29, true, false)); TIME(corrW30_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 30, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked + + TIME(corrW29_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 29, true, false)); + TIME(corrW30_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 30, true, false)); +#endif + + stochastic_piece.unload(); @@ -1774,12 +2016,30 @@ int main(int argc, char **argv) { TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked + + TIME(corrW5_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); + + TIME(corrW7_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); +#endif + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); +#if defined (COMPUTEBACKWARD) + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked + + TIME(corrW6_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 6, true, false)); + + TIME(corrW8_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 8, true, false)); +#endif + + stochastic_piece.apply_gamma5(); @@ -1791,6 +2051,17 @@ int main(int argc, char **argv) { TIME(corrB20_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt[i_sample], 0,20, true)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed_backward, true)); + + TIME(corrB17_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample], 0,17, true)); + TIME(corrB18_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample], 0,18, true)); + TIME(corrB19_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample], 0,19, true)); + TIME(corrB20_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample], 0,20, true)); +#endif + + } //loop over sample @@ -1950,6 +2221,21 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrB19_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrB20_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); +#if defined (COMPUTEBACKWARD) + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt_backward"; + TIME(produceOutput_2pt_packed(corrB3_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrB4_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrB5_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrB6_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrB17_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrB18_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrB19_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrB20_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + +#endif + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; TIME(produceOutput_2pt_packed(corrW5_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); @@ -1967,8 +2253,23 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrW31_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrW32_2pt, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - - +#if defined (COMPUTEBACKWARD) + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt_backward"; + TIME(produceOutput_2pt_packed(corrW5_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW6_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW7_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW8_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrW13_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW14_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW15_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW16_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrW29_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW30_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW31_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW32_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); +#endif } @@ -2038,6 +2339,10 @@ int main(int argc, char **argv) { propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + propTS_SS_packed_backward.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -2067,7 +2372,14 @@ int main(int argc, char **argv) { corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); + PLEGMA_ScattCorrelator corrD1ff13141718(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1ff15161920(source, filtered_sourcemomentumList_2pt); + + + corrD1ff13141718.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff13-14-17-18"); + corrD1ff15161920.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff15-16-19-20"); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, 0, false, true, false )); TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); @@ -2077,7 +2389,7 @@ int main(int argc, char **argv) { TIME(corrD1ff13141718.LT_diagrams( reductionsT1, reductionsT2, 1 )); - TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); + TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); TIME(corrTproton_neutronpiplus3.convertTreductiontoDiagram( reductionsT2, 0, false, false, false )); TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); @@ -2092,10 +2404,60 @@ int main(int argc, char **argv) { outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; - TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4, outfilename, "T", parallel_sources, attract_lookup_table)); + + + + +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrTproton_neutronpiplus1_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus2_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus3_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_neutronpiplus4_backward(source, list_mpi2ptot); + + corrTproton_neutronpiplus1_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); + + corrTproton_neutronpiplus2_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq12"); + + corrTproton_neutronpiplus3_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq13"); + + corrTproton_neutronpiplus4_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); + + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, propDN_SS_packed_backward)); + TIME(corrTproton_neutronpiplus1_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, false )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_neutronpiplus2_backward.convertTreductiontoDiagram( reductionsT2, 0, false, false, true )); + + + TIME(corrD1ff13141718_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); + + + TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, propDN_SS_packed_backward)); + TIME(corrTproton_neutronpiplus3_backward.convertTreductiontoDiagram( reductionsT2, 0, false, false, false )); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propTS_SS_packed_backward)); + TIME(corrTproton_neutronpiplus4_backward.convertTreductiontoDiagram( reductionsT1, 0, false, false, true )); + + TIME(corrD1ff15161920_backward.LT_diagrams( reductionsT2, reductionsT1, -1 )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; + + TIME(produceOutput_2pt_packed(corrD1ff13141718_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrD1ff15161920_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + +#endif } PLEGMA_ScattCorrelator corrB9_2pt(source, filtered_sourcemomentumList_2pt); @@ -2150,6 +2512,60 @@ int main(int argc, char **argv) { corrW27_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W27"); corrW28_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W28"); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrB9_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB10_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB11_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB12_2pt_backward(source, filtered_sourcemomentumList_2pt); + + + PLEGMA_ScattCorrelator corrB13_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB14_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB15_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB16_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW17_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW18_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW19_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW20_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW21_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW22_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW23_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW24_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW25_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW26_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW27_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW28_2pt_backward(source, filtered_sourcemomentumList_2pt); + + corrB9_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12","B9"); + corrB10_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B10"); + corrB11_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B11"); + corrB12_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B12"); + + corrB13_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12","B13"); + corrB14_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B14"); + corrB15_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B15"); + corrB16_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B16"); + + corrW17_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W17"); + corrW18_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W18"); + corrW19_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W19"); + corrW20_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W20"); + + corrW21_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W21"); + corrW22_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W22"); + corrW23_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W23"); + corrW24_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W24"); + + + corrW25_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W25"); + corrW26_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W26"); + corrW27_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W27"); + corrW28_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W28"); +#endif + for (int k=0; k< tSinks.size(); ++k){ PLEGMA_ScattCorrelator corrB9(source, filtered_sourcemomentumList); @@ -2242,6 +2658,19 @@ int main(int argc, char **argv) { TIME(corrW18_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 18, true, false)); TIME(corrW20_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 20, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true)); + + TIME(corrW17_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 17, true, false)); + TIME(corrW19_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 19, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true)); + + TIME(corrW18_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 18, true, false)); + TIME(corrW20_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 20, true, false)); +#endif + stochastic_propagator_packed.apply_gamma5(); @@ -2252,6 +2681,16 @@ int main(int argc, char **argv) { TIME(corrB15_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt[i_sample], 0, 15, true, false, false)); TIME(corrB16_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt[i_sample], 0, 16, true, false, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed_backward, true )); + + TIME(corrB13_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 13, true, false, false)); + TIME(corrB14_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 14, true, false, false)); + TIME(corrB15_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample], 0, 15, true, false, false)); + TIME(corrB16_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample], 0, 16, true, false, false)); +#endif + stochastic_propagator_packed.unload(); stochastic_propagator_packed.copy(*stochastic_sources[i_sample], HOST); stochastic_propagator_packed.load(); @@ -2263,6 +2702,16 @@ int main(int argc, char **argv) { TIME(corrB11_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 11, true, false, false)); TIME(corrB12_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 12, true, false, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed_backward, true )); + + TIME(corrB9_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 9, true, false, false)); + TIME(corrB10_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 10, true, false, false)); + TIME(corrB11_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 11, true, false, false)); + TIME(corrB12_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 12, true, false, false)); + +#endif stochastic_propagator_packed.apply_gamma5(); @@ -2287,6 +2736,30 @@ int main(int argc, char **argv) { TIME(corrW22_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 22, true, false)); TIME(corrW24_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 24, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true)); + + TIME(corrW27_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 27, true, false)); + TIME(corrW28_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 28, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME(corrW21_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 21, true, false)); + TIME(corrW23_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 23, true, false)); + + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true)); + + TIME(corrW25_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 25, true, false)); + TIME(corrW26_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 26, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); + + TIME(corrW22_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 22, true, false)); + TIME(corrW24_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 24, true, false)); +#endif + } for (int i_source_parallel=0; i_source_parallel Date: Wed, 23 Aug 2023 17:03:41 +0200 Subject: [PATCH 092/168] working on the backward part --- plegma/nucleon_3pt_n_npi.cpp | 133 +++++++++++++++++++++++++++++++---- 1 file changed, 121 insertions(+), 12 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 912394a1..873a82e6 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -2372,13 +2372,6 @@ int main(int argc, char **argv) { corrTproton_neutronpiplus4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq14"); - PLEGMA_ScattCorrelator corrD1ff13141718(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrD1ff15161920(source, filtered_sourcemomentumList_2pt); - - - corrD1ff13141718.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff13-14-17-18"); - corrD1ff15161920.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff15-16-19-20"); - TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, propDN_SS_packed)); TIME(corrTproton_neutronpiplus1.convertTreductiontoDiagram( reductionsT1, 0, false, true, false )); @@ -2409,15 +2402,16 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus3, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus4, outfilename, "T", parallel_sources, attract_lookup_table)); - - - #if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrTproton_neutronpiplus1_backward(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus2_backward(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus3_backward(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus4_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrD1ff13141718_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1ff15161920_backward(source, filtered_sourcemomentumList_2pt); + corrTproton_neutronpiplus1_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); corrTproton_neutronpiplus2_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq12"); @@ -2952,6 +2946,10 @@ int main(int argc, char **argv) { } propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + propTS_SS_packed_backward.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); } @@ -2986,6 +2984,38 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrTproton_protonpizero5, outfilename, "T", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrTproton_protonpizero6, outfilename, "T", parallel_sources, attract_lookup_table)); + +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrTproton_protonpizero5_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero6_backward(source, list_mpi2ptot); + + PLEGMA_ScattCorrelator corrD1ff56_backward(source, filtered_sourcemomentumList_2pt); + + + corrD1ff56_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff56"); + + corrTproton_protonpizero5_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); + + corrTproton_protonpizero6_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero5_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero6_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + + TIME(corrD1ff56_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff_backward"; + + TIME(produceOutput_2pt_packed( corrD1ff56_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T_backward"; + + TIME(produceOutput_2pt_packed(corrTproton_protonpizero5_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero6_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +#endif } PLEGMA_ScattCorrelator corrB7_2pt(source, filtered_sourcemomentumList_2pt); @@ -3015,7 +3045,35 @@ int main(int argc, char **argv) { corrW35_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); corrW36_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrB7_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB8_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW9_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW10_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW11_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW12_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW33_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW34_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW35_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW36_2pt_backward(source, filtered_sourcemomentumList_2pt); + + + corrB7_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); + corrB8_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); + + corrW9_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W9"); + corrW10_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W10"); + corrW11_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W11"); + corrW12_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W12"); + + corrW33_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W33"); + corrW34_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W34"); + corrW35_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); + corrW36_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); + +#endif @@ -3086,12 +3144,33 @@ int main(int argc, char **argv) { TIME(corrW10_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 10, true, false)); TIME(corrW12_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 12, true, false)); +#if defined (COMPUTEBACKWARD) + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME( corrW9_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 9, true)); + TIME(corrW11_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 11, true)); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); + + TIME(corrW10_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 10, true, false)); + TIME(corrW12_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 12, true, false)); +#endif + stochastic_propagator_packed.apply_gamma5(); TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true)); TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); - TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); + TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed_backward, true)); + TIME(corrB7_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 7, true, false, false)); + TIME(corrB8_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 8, true, false, false)); + +#endif + stochastic_propagator_packed.unload(); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); @@ -3109,6 +3188,19 @@ int main(int argc, char **argv) { TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); + + TIME(corrW33_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 33, true, false)); + TIME(corrW34_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 34, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); + + TIME(corrW35_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 35, true, false)); + TIME(corrW36_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 36, true, false)); +#endif + } for (int i_source_parallel=0; i_source_parallel Date: Thu, 31 Aug 2023 10:38:24 +0200 Subject: [PATCH 093/168] finalizing the inclusion of the backward part (checked) --- plegma/nucleon_3pt_n_npi.cpp | 341 +++++++++++++++++++++++++++-------- 1 file changed, 267 insertions(+), 74 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 873a82e6..b7acfc55 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -325,6 +325,15 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SS; +#if defined (COMPUTEBACKWARD) + + PLEGMA_Vector stochastic_oet_prop_u_fini_mom_SS_backward; + + PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SS_backward; + +#endif + + /****************************************************** * @@ -583,8 +592,6 @@ int main(int argc, char **argv) { std::string sourcepositiontext= (std::string)"_" + ssource; free(ssource); - -#if 1 auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, double run_mu, WHICHFLAVOR fl, int nSmear, site &source_location, bool finalize) { PLEGMA_Gauge3D smearedGauge3D; @@ -1127,6 +1134,7 @@ int main(int argc, char **argv) { //proton pizero x proton pizero //udu ubaru (x_f) dbarubarubar +#if 0 PLEGMA_ScattCorrelator corrD1ii1(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii2(source, filtered_sourcemomentumList_2pt_single); PLEGMA_ScattCorrelator corrD1ii3(source, filtered_sourcemomentumList_2pt_single); @@ -1257,9 +1265,9 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrD1ii14_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward));//Because of V4 TIME(produceOutput_2pt_packed(corrD1ii15_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); TIME(produceOutput_2pt_packed(corrD1ii16_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +#endif #endif -#endif vectorStoc_source_oet.stochastic_Z(nroots); #if 0 @@ -1562,6 +1570,21 @@ int main(int argc, char **argv) { corrPPUP.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); corrPPDN.initialize_diagram(glist_source_meson, glist_sink_meson, "PPDN"); +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrP0UP_backward(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrP0DN_backward(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPUP_backward(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPDN_backward(source, list_mpi2_twopt); + + corrP0UP_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "P0UP"); + corrP0DN_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "P0DN"); + corrPPUP_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + corrPPDN_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "PPDN"); + +#endif + + /****************************************************** @@ -1716,22 +1739,22 @@ int main(int argc, char **argv) { if (dotwopoint==1){ - PLEGMA_ScattCorrelator corrD1ff1389(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrD1ff24710(source, filtered_sourcemomentumList_2pt); -#if defined (COMPUTEBACKWARD) - PLEGMA_ScattCorrelator corrD1ff1389_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrD1ff24710_backward(source, filtered_sourcemomentumList_2pt); -#endif +// PLEGMA_ScattCorrelator corrD1ff1389(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff24710(source, filtered_sourcemomentumList_2pt); +//#if defined (COMPUTEBACKWARD) +// PLEGMA_ScattCorrelator corrD1ff1389_backward(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff24710_backward(source, filtered_sourcemomentumList_2pt); +//#endif - corrD1ff24710.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); - corrD1ff1389.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); +// corrD1ff24710.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); +// corrD1ff1389.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); -#if defined (COMPUTEBACKWARD) - corrD1ff24710_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); - corrD1ff1389_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); -#endif +//#if defined (COMPUTEBACKWARD) +// corrD1ff24710_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); +// corrD1ff1389_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); +//#endif TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); @@ -1739,7 +1762,7 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); - TIME(corrD1ff24710.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff24710.LT_diagrams( reductionsT1, reductionsT2, 1 )); #if defined (COMPUTEBACKWARD) TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); @@ -1748,7 +1771,7 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); TIME(corrTproton_protonpizero2_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); - TIME(corrD1ff24710_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff24710_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); #endif TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); @@ -1756,7 +1779,7 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT2, 0, false, true, true)); - TIME(corrD1ff1389.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff1389.LT_diagrams( reductionsT1, reductionsT2, 1 )); #if defined (COMPUTEBACKWARD) @@ -1764,23 +1787,23 @@ int main(int argc, char **argv) { TIME(corrTproton_protonpizero3_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propTS_SS_packed_backward)); - TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT2, 0, false, true, true)); + TIME(corrTproton_protonpizero4_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true)); - TIME(corrD1ff1389_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff1389_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); #endif - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; - TIME(produceOutput_2pt_packed( corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed( corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); -#if defined (COMPUTEBACKWARD) - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff_backward"; +// TIME(produceOutput_2pt_packed( corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); +//#if defined (COMPUTEBACKWARD) +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff_backward"; - TIME(produceOutput_2pt_packed( corrD1ff24710_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +// TIME(produceOutput_2pt_packed( corrD1ff24710_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed( corrD1ff1389_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); -#endif +// TIME(produceOutput_2pt_packed( corrD1ff1389_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +//#endif outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; @@ -2020,9 +2043,9 @@ int main(int argc, char **argv) { TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked - TIME(corrW5_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); + TIME(corrW5_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 5, true, false)); - TIME(corrW7_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); + TIME(corrW7_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 7, true, false)); #endif TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked @@ -2351,12 +2374,12 @@ int main(int argc, char **argv) { if (dotwopoint==1){ - PLEGMA_ScattCorrelator corrD1ff13141718(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrD1ff15161920(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff13141718(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff15161920(source, filtered_sourcemomentumList_2pt); - corrD1ff13141718.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff13-14-17-18"); - corrD1ff15161920.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff15-16-19-20"); +// corrD1ff13141718.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff13-14-17-18"); +// corrD1ff15161920.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff15-16-19-20"); PLEGMA_ScattCorrelator corrTproton_neutronpiplus1(source, list_mpi2ptot); @@ -2379,7 +2402,7 @@ int main(int argc, char **argv) { TIME(corrTproton_neutronpiplus2.convertTreductiontoDiagram( reductionsT2, 0, false, false, true )); - TIME(corrD1ff13141718.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff13141718.LT_diagrams( reductionsT1, reductionsT2, 1 )); TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propDN_SS_packed)); @@ -2388,12 +2411,12 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); TIME(corrTproton_neutronpiplus4.convertTreductiontoDiagram( reductionsT1, 0, false, false, true )); - TIME(corrD1ff15161920.LT_diagrams( reductionsT2, reductionsT1, -1 )); +// TIME(corrD1ff15161920.LT_diagrams( reductionsT2, reductionsT1, -1 )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; - TIME(produceOutput_2pt_packed(corrD1ff13141718, outfilename, "T", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrD1ff15161920, outfilename, "T", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1ff13141718, outfilename, "T", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1ff15161920, outfilename, "T", parallel_sources, attract_lookup_table)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; @@ -2409,8 +2432,8 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrTproton_neutronpiplus3_backward(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_neutronpiplus4_backward(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrD1ff13141718_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrD1ff15161920_backward(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff13141718_backward(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff15161920_backward(source, filtered_sourcemomentumList_2pt); corrTproton_neutronpiplus1_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq11"); @@ -2428,7 +2451,7 @@ int main(int argc, char **argv) { TIME(corrTproton_neutronpiplus2_backward.convertTreductiontoDiagram( reductionsT2, 0, false, false, true )); - TIME(corrD1ff13141718_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff13141718_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); TIME(reductionsT2.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, propDN_SS_packed_backward)); @@ -2437,14 +2460,14 @@ int main(int argc, char **argv) { TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propTS_SS_packed_backward)); TIME(corrTproton_neutronpiplus4_backward.convertTreductiontoDiagram( reductionsT1, 0, false, false, true )); - TIME(corrD1ff15161920_backward.LT_diagrams( reductionsT2, reductionsT1, -1 )); +// TIME(corrD1ff15161920_backward.LT_diagrams( reductionsT2, reductionsT1, -1 )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; - TIME(produceOutput_2pt_packed(corrD1ff13141718_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrD1ff15161920_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +// TIME(produceOutput_2pt_packed(corrD1ff13141718_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +// TIME(produceOutput_2pt_packed(corrD1ff15161920_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T_backward"; TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus1_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); TIME(produceOutput_2pt_packed(corrTproton_neutronpiplus2_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); @@ -2959,10 +2982,10 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrD1ff56(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff56(source, filtered_sourcemomentumList_2pt); - corrD1ff56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff56"); +// corrD1ff56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff56"); corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); @@ -2974,11 +2997,11 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); - TIME(corrD1ff56.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff56.LT_diagrams( reductionsT1, reductionsT2, 1 )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff"; - TIME(produceOutput_2pt_packed( corrD1ff56, outfilename, "T", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed( corrD1ff56, outfilename, "T", parallel_sources, attract_lookup_table)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; @@ -2990,10 +3013,10 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrTproton_protonpizero5_backward(source, list_mpi2ptot); PLEGMA_ScattCorrelator corrTproton_protonpizero6_backward(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrD1ff56_backward(source, filtered_sourcemomentumList_2pt); +// PLEGMA_ScattCorrelator corrD1ff56_backward(source, filtered_sourcemomentumList_2pt); - corrD1ff56_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff56"); +// corrD1ff56_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff56"); corrTproton_protonpizero5_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); @@ -3005,11 +3028,11 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, propUP_SS_packed_backward)); TIME(corrTproton_protonpizero6_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); - TIME(corrD1ff56_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); +// TIME(corrD1ff56_backward.LT_diagrams( reductionsT1, reductionsT2, 1 )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff_backward"; +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_D1ff_backward"; - TIME(produceOutput_2pt_packed( corrD1ff56_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +// TIME(produceOutput_2pt_packed( corrD1ff56_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T_backward"; @@ -3269,11 +3292,11 @@ int main(int argc, char **argv) { #if defined (COMPUTEBACKWARD) - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_B_2pt_backward"; TIME(produceOutput_2pt_packed(corrB7_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); TIME(produceOutput_2pt_packed(corrB8_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt"; + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt_backward"; TIME(produceOutput_2pt_packed(corrW9_2pt , outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward));//because of V4 TIME(produceOutput_2pt_packed(corrW10_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); TIME(produceOutput_2pt_packed(corrW11_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); @@ -3348,6 +3371,11 @@ int main(int argc, char **argv) { vectorAuxF.copy(vectortmp2); stochastic_oet_prop_u_fini_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#if defined (COMPUTEBACKWARD) + + stochastic_oet_prop_u_fini_mom_SS_backward.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + } @@ -3396,6 +3424,11 @@ int main(int argc, char **argv) { vectorAuxF.copy(vectortmp2); stochastic_oet_prop_d_fini_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#if defined (COMPUTEBACKWARD) + stochastic_oet_prop_d_fini_mom_SS_backward.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + + } // end of parallel sources }//end of finite momentum oet @@ -3423,6 +3456,19 @@ int main(int argc, char **argv) { TIME(reductionsV3_diluted_D_UP_2pt.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed, true)); +#if defined (COMPUTEBACKWARD) + + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS_backward); + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_UP_2pt_backward.V3( st_oet_u_fini, glist_sink_meson, propUP_SS_packed_backward, true)); + + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS_backward); + st_oet_d_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_D_UP_2pt_backward.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed_backward, true)); +#endif + } @@ -3447,6 +3493,15 @@ int main(int argc, char **argv) { st_oet_u_fini.apply_gamma5(); TIME(reductionsV3_diluted_U_DN_2pt.V3( st_oet_u_fini, glist_sink_meson, propDN_SS_packed, true)); + +#if defined (COMPUTEBACKWARD) + + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS_backward); + + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_DN_2pt_backward.V3( st_oet_u_fini, glist_sink_meson, propDN_SS_packed_backward, true)); +#endif } #endif @@ -3497,12 +3552,96 @@ int main(int argc, char **argv) { corrZ20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z20"); - corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); - corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); - corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); - corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); +// corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); +// corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); +// corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); +// corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); + +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrZ5_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ6_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ7_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ8_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ9_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ10_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ11_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ12_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ13_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ14_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ15_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ16_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ17_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ18_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ19_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ20_2pt_backward(source, filtered_sourcemomentumList_2pt); + + + corrZ5_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); + corrZ6_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); + + corrZ7_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z7"); + corrZ8_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z8"); + + corrZ9_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z9"); + corrZ10_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z10"); + + corrZ11_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z11"); + corrZ12_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); + + corrZ13_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); + corrZ14_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); + + corrZ15_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z15"); + corrZ16_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z16"); + + corrZ17_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z17"); + corrZ18_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z18"); + corrZ19_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z19"); + corrZ20_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z20"); + + +// corrM_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); +// corrD1if34_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); +// corrD1if12_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); +// corrD1if56_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); + +#endif + + if (dotwopoint==1){ + +#if defined (COMPUTEBACKWARD) + + TIME(corrZ5_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 5, false )); + TIME(corrZ7_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 7, false )); + + TIME(corrZ6_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 6, false )); + TIME(corrZ8_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 8, false )); + + TIME( corrZ9_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 9, false )); + TIME(corrZ10_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 10,false )); + + TIME(corrZ11_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 11, false )); + TIME(corrZ13_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 13, false )); + + TIME(corrZ12_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 12, false )); + TIME(corrZ14_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 14, false )); + + TIME(corrZ15_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 15, false )); + TIME(corrZ16_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 16, false )); + + TIME(corrZ17_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 17, false )); + TIME(corrZ18_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 18, false )); + + TIME(corrZ19_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 19, false )); + TIME(corrZ20_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 20, false )); + +#endif - if (dotwopoint==1){ TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); @@ -3534,12 +3673,22 @@ int main(int argc, char **argv) { TIME(corrPPDN.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + +#if defined (COMPUTEBACKWARD) + + TIME(corrPPUP_backward.P_diagrams( stochastic_oet_prop_u_zero_mom_SS_backward, stochastic_oet_prop_u_fini_mom_SS_backward, i_mpi2)); + TIME(corrPPDN_backward.P_diagrams( stochastic_oet_prop_d_zero_mom_SS_backward, stochastic_oet_prop_d_fini_mom_SS_backward, i_mpi2)); + TIME(corrP0UP_backward.P_diagrams( stochastic_oet_prop_d_zero_mom_SS_backward, stochastic_oet_prop_u_fini_mom_SS_backward, i_mpi2)); + TIME(corrP0DN_backward.P_diagrams( stochastic_oet_prop_u_zero_mom_SS_backward, stochastic_oet_prop_d_fini_mom_SS_backward, i_mpi2)); + +#endif + #if 1 - TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); - TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); - TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); +// TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); +// TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); +// TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); +// TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; @@ -3565,11 +3714,38 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrZ19_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ20_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_correct_2pt"; - TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); +#if defined (COMPUTEBACKWARD) + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt_backward"; + + TIME(produceOutput_2pt_packed(corrZ5_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ6_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ7_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ8_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ9_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ10_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ11_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ12_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ13_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ14_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ15_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ16_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ17_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ18_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ19_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ20_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + +#endif + +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_correct_2pt"; +// TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); } @@ -3691,6 +3867,21 @@ int main(int argc, char **argv) { TIME(corrPPDN.apply_sign("P")); TIME(corrPPDN.writeHDF5( outfilename )); +#if defined (COMPUTEBACKWARD) + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt_backward"; + TIME(corrP0UP_backward.apply_sign("P")); + TIME(corrP0UP_backward.writeHDF5( outfilename )); + TIME(corrP0DN_backward.apply_sign("P")); + TIME(corrP0DN_backward.writeHDF5( outfilename )); + TIME(corrPPUP_backward.apply_sign("P")); + TIME(corrPPUP_backward.writeHDF5( outfilename )); + TIME(corrPPDN_backward.apply_sign("P")); + TIME(corrPPDN_backward.writeHDF5( outfilename )); + +#endif + + } @@ -3716,6 +3907,8 @@ int main(int argc, char **argv) { reductions_DD_V3_GAMMAF2U_2pt.pop_back(); reductions_DD_V3_GAMMAF2D_2pt.pop_back(); +#if defined (COMPUTEBACKWARD) + reductions_DD_V2_GAMMAF1U_U_2pt_backward.pop_back(); reductions_DD_V2_GAMMAF1U_D_2pt_backward.pop_back(); reductions_DD_V4_GAMMAF1U_D_2pt_backward.pop_back(); @@ -3726,7 +3919,7 @@ int main(int argc, char **argv) { reductions_UU_V3_GAMMAF2U_2pt_backward.pop_back(); reductions_DD_V3_GAMMAF2U_2pt_backward.pop_back(); reductions_DD_V3_GAMMAF2D_2pt_backward.pop_back(); - +#endif } From 6c342a0f40b11f5e3c9665078bd467d7330edaca Mon Sep 17 00:00:00 2001 From: Yan Li Date: Fri, 8 Sep 2023 08:03:12 +0200 Subject: [PATCH 094/168] pi0Insert including P and jPi diagrams --- plegma/pi0Insertion.cpp | 183 +++++++++++++++++++++++++++++----------- 1 file changed, 133 insertions(+), 50 deletions(-) diff --git a/plegma/pi0Insertion.cpp b/plegma/pi0Insertion.cpp index 2813c4d0..fc7e30a5 100644 --- a/plegma/pi0Insertion.cpp +++ b/plegma/pi0Insertion.cpp @@ -1,16 +1,17 @@ /* -Here we compute the pi0 contracted with insertion. -Both 'up' and 'dn' part will be done seperately, through they're +Here we compute P (pion_pion) and jPi (insertion_pion) diagrams. +All parts will be done seperately, through some of them are supposely to be (anti)-conjugate to their momentum-flipped partner. -The conj sign for pion isn't implemented here. -To multiply it with the N-diagram, and construct the M-like NJNpi diagram, +For P, they have the same sign with pion 2pt +(except the possible 1/sqrt(2) for pi0). +(a possible 1j factor will cancel out between source and sink) +For jPi, the sign is the same as if j is for a pion +For juu_pi0u or jdd_pi0d case, +to multiply it with the N-diagram, and construct the M-like NJNpi diagram, we need (up -/+ dn)*i/sqrt(2) for (u+d)/(u-d) insertion, where i/sqrt(2) comes from (-1) for adj-sign of pion and (-i)/sqrt(2) for prefactor of source pion. Note u+d insertion corresponds to up-dn construction. - -Here the f_0(500)/sigma resonance (ubaru+dbard) is also supported. -Just u+d should correspond to up+dn this case. */ #include @@ -23,7 +24,7 @@ std::vector runtime; runtime.pop_back() extern int device; -static std::vector listOpt = {"verbosity", "load-gauge", "nsrc", "src-filename", "seed1", "confnumber", "outdiagramPrefix", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; +static std::vector listOpt = {"verbosity", "load-gauge", "seed1", "confnumber", "outdiagramPrefix", "momlisttwopt-filename", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; int main(int argc, char **argv) { @@ -264,27 +265,41 @@ int main(int argc, char **argv) std::vector gscatts_meson = {}; std::string filenamePost = ""; + std::string filenamePost2 = ""; if (whichMeson == "pi0") { gscatts_meson.push_back(G_5); - filenamePost = "pi0Insert"; - } - else if (whichMeson == "sigma") - { - gscatts_meson.push_back(ID); - filenamePost = "sigmaInsert"; + filenamePost = "jPi"; + filenamePost2 = "P"; } + // else if (whichMeson == "sigma") + // { + // gscatts_meson.push_back(ID); + // filenamePost = "jPsgmi"; + // filenamePost2 = "Psgm"; + // } else { PLEGMA_error("whichMeson = %s not supported", whichMeson); } + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_twopt.c_str()); + plegma::momList momList2pt(3, pathListMomenta_twopt, {1, 2}); // pi2, pf1, pf2 + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList2pt.size()); + if (momList2pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects2pt_pi2 = momList2pt.uniq_p(0); + auto momVects2pt_pf2 = momList2pt.uniq_p(2); + plegma::momList momList2pt_pi2(1, {momVects2pt_pi2}, {0}); + plegma::momList momList2pt_pf2(1, {momVects2pt_pf2}, {0}); + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); plegma::momList momList_3pt(4, pathListMomenta_threept, {1, 2, 3}); // pi2, pf1, pf2, pc PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList_3pt.size()); if (momList_3pt.empty()) PLEGMA_error("threept momentumList empty"); auto momVects_pi2 = momList_3pt.uniq_p(0); + auto momVects_pf2 = momList_3pt.uniq_p(2); auto momVects_pc = momList_3pt.uniq_p(3); plegma::momList momList_pc(1, {momVects_pc}, {0}); @@ -293,11 +308,10 @@ int main(int argc, char **argv) * Main * ******************************************************/ - for (int isource = 0; isource < numSourcePositions; ++isource) + + for (int st = 0; st < HGC_totalL[3]; st++) { - plegma::site &source = sourcePositions[isource]; - PLEGMA_printf(("TestYan: source=" + std::to_string(source[0]) + "_" + std::to_string(source[1]) + "_" + std::to_string(source[2]) + "_" + std::to_string(source[3])).c_str()); - assert(source[0] == source[1] == source[2] == 0 && 0 <= source[3] < HGC_totalL[3]); + struct plegma::site source({0, 0, 0, st}); plegma::PLEGMA_Vector stocXi; { @@ -306,11 +320,12 @@ int main(int argc, char **argv) } int time_i = source[3]; + plegma::PLEGMA_Vector stocPhiU_ti_SS, stocPhiD_ti_SS; plegma::PLEGMA_Vector stocPhiU_ti_SL, stocPhiD_ti_SL; plegma::PLEGMA_Vector3D auxVector3D; auxVector3D.absorb(stocXi, time_i); - solve1(stocPhiU_ti_SL, auxVector3D, time_i, u, SL); - solve1(stocPhiD_ti_SL, auxVector3D, time_i, d, SL); + solve2(stocPhiU_ti_SS, stocPhiU_ti_SL, auxVector3D, time_i, u, SB); + solve2(stocPhiD_ti_SS, stocPhiD_ti_SL, auxVector3D, time_i, d, SB); // Here we do u and d separately for saving mu-changing time // This the u part @@ -318,9 +333,9 @@ int main(int argc, char **argv) { auto &mom_pi2 = momVects_pi2[i_pi2]; std::string str_pi2 = "pi2=" + std::to_string(mom_pi2[0]) + "_" + std::to_string(mom_pi2[1]) + "_" + std::to_string(mom_pi2[2]); - PLEGMA_printf(("TestYan: pi2=" + str_pi2).c_str()); + PLEGMA_printf(("TestYan: " + str_pi2).c_str()); - plegma::PLEGMA_Vector stocPhiD_ti_mpi2_SL; + plegma::PLEGMA_Vector stocPhiD_ti_mpi2_SS, stocPhiD_ti_mpi2_SL; plegma::PLEGMA_Vector3D auxVector3D; { plegma::PLEGMA_Vector aux; @@ -330,32 +345,66 @@ int main(int argc, char **argv) auxVector3D.absorb(aux, time_i); } auxVector3D.mulMomentumPhases(mom_pi2, -1); - solve1(stocPhiD_ti_mpi2_SL, auxVector3D, time_i, d, SL); + solve2(stocPhiD_ti_mpi2_SS, stocPhiD_ti_mpi2_SL, auxVector3D, time_i, d, SB); - plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); - pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/up"); { - plegma::PLEGMA_Vector aux, aux_pi2; - aux.copy(stocPhiU_ti_SL); - aux_pi2.copy(stocPhiD_ti_mpi2_SL); - pi0Insertion.P_diagrams(aux, aux_pi2, -1); + plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); + pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/juu_pi0u"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiU_ti_SL); + aux_pi2.copy(stocPhiD_ti_mpi2_SL); + pi0Insertion.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost; + pi0Insertion.writeHDF5(outfilename); + } + { + plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); + pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/jud_pi-"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiD_ti_SL); + aux_pi2.copy(stocPhiD_ti_mpi2_SL); + pi0Insertion.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost; + pi0Insertion.writeHDF5(outfilename); } - asprintf(&ssource, "st%03d", time_i); - std::string sourcepositiontext = (std::string) "_" + ssource; - free(ssource); - std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_" + filenamePost; - - pi0Insertion.writeHDF5(outfilename); + { + plegma::PLEGMA_ScattCorrelator P_Diagram(source, momList2pt_pf2); + P_Diagram.initialize_diagram(gscatts_meson, gscatts_meson, str_pi2 + "/pi0u_pi0u"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiU_ti_SS); + aux_pi2.copy(stocPhiD_ti_mpi2_SS); + P_Diagram.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost2; + P_Diagram.writeHDF5(outfilename); + } + { + plegma::PLEGMA_ScattCorrelator P_Diagram(source, momList2pt_pf2); + P_Diagram.initialize_diagram(gscatts_meson, gscatts_meson, str_pi2 + "/pi-_pi-"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiD_ti_SS); + aux_pi2.copy(stocPhiD_ti_mpi2_SS); + P_Diagram.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost2; + P_Diagram.writeHDF5(outfilename); + } } // This is the d part for (int i_pi2 = 0; i_pi2 < momVects_pi2.size(); ++i_pi2) { auto &mom_pi2 = momVects_pi2[i_pi2]; std::string str_pi2 = "pi2=" + std::to_string(mom_pi2[0]) + "_" + std::to_string(mom_pi2[1]) + "_" + std::to_string(mom_pi2[2]); - PLEGMA_printf(("TestYan: pi2=" + str_pi2).c_str()); + PLEGMA_printf(("TestYan: " + str_pi2).c_str()); - plegma::PLEGMA_Vector stocPhiU_ti_mpi2_SL; + plegma::PLEGMA_Vector stocPhiU_ti_mpi2_SS, stocPhiU_ti_mpi2_SL; plegma::PLEGMA_Vector3D auxVector3D; { plegma::PLEGMA_Vector aux; @@ -365,23 +414,57 @@ int main(int argc, char **argv) auxVector3D.absorb(aux, time_i); } auxVector3D.mulMomentumPhases(mom_pi2, -1); - solve1(stocPhiU_ti_mpi2_SL, auxVector3D, time_i, u, SL); + solve2(stocPhiU_ti_mpi2_SS, stocPhiU_ti_mpi2_SL, auxVector3D, time_i, u, SB); - plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); - pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/dn"); { - plegma::PLEGMA_Vector aux, aux_pi2; - aux.copy(stocPhiD_ti_SL); - aux_pi2.copy(stocPhiU_ti_mpi2_SL); - pi0Insertion.P_diagrams(aux, aux_pi2, -1); + plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); + pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/jdu_pi+"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiU_ti_SL); + aux_pi2.copy(stocPhiU_ti_mpi2_SL); + pi0Insertion.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost; + pi0Insertion.writeHDF5(outfilename); + } + { + plegma::PLEGMA_ScattCorrelator pi0Insertion(source, momList_pc); + pi0Insertion.initialize_diagram(gscatts_meson, gscatts_c, str_pi2 + "/jdd_pi0d"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiD_ti_SL); + aux_pi2.copy(stocPhiU_ti_mpi2_SL); + pi0Insertion.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost; + pi0Insertion.writeHDF5(outfilename); } - asprintf(&ssource, "st%03d", time_i); - std::string sourcepositiontext = (std::string) "_" + ssource; - free(ssource); - std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_" + filenamePost; - - pi0Insertion.writeHDF5(outfilename); + { + plegma::PLEGMA_ScattCorrelator P_Diagram(source, momList2pt_pf2); + P_Diagram.initialize_diagram(gscatts_meson, gscatts_meson, str_pi2 + "/pi+_pi+"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiU_ti_SS); + aux_pi2.copy(stocPhiU_ti_mpi2_SS); + P_Diagram.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost2; + P_Diagram.writeHDF5(outfilename); + } + { + plegma::PLEGMA_ScattCorrelator P_Diagram(source, momList2pt_pf2); + P_Diagram.initialize_diagram(gscatts_meson, gscatts_meson, str_pi2 + "/pi0d_pi0d"); + { + plegma::PLEGMA_Vector aux, aux_pi2; + aux.copy(stocPhiD_ti_SS); + aux_pi2.copy(stocPhiU_ti_mpi2_SS); + P_Diagram.P_diagrams(aux, aux_pi2, -1); + } + std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost2; + P_Diagram.writeHDF5(outfilename); + } } } } From dfaf0503d6199ed29ecdba7e5c0f500ab6da65b6 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Tue, 19 Sep 2023 09:13:48 +0200 Subject: [PATCH 095/168] add flagfile option --- plegma/QuarkLoops_pi0_insertion.cpp | 6 +++++- plegma/pi0Insertion.cpp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index daf087ae..eb546025 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -41,7 +41,8 @@ int main(int argc, char **argv) initializeOptions(argc, argv, true, listOpt); int confnumber_int; - std::string outdiagramPrefix; + std::string outdiagramPrefix, flagfile; + HGC_options->set("flagfile", "An empty file created indicating the completion of a run", verbosity, flagfile); HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); @@ -473,6 +474,8 @@ int main(int argc, char **argv) } stocSrc.copy(stocSrcUnsmeared); stocProp.copy(stocPropUnsmeared); + // stocProp.writeHDF5(confnumber+"stocProp"); + // stocSrc.writeHDF5(confnumber+"stocSrc"); insertLoop.Loop_diagrams(stocProp, stocSrc, false); std::string outfilename = outdiagramPrefix + confnumber + "_" + filenameEnd; @@ -514,5 +517,6 @@ int main(int argc, char **argv) } finalize(); + std::ofstream output(flagfile); return 0; } diff --git a/plegma/pi0Insertion.cpp b/plegma/pi0Insertion.cpp index fc7e30a5..ba01c336 100644 --- a/plegma/pi0Insertion.cpp +++ b/plegma/pi0Insertion.cpp @@ -36,8 +36,9 @@ int main(int argc, char **argv) initializeOptions(argc, argv, true, listOpt); int seed_oet, confnumber_int; - std::string outdiagramPrefix, whichMeson; + std::string outdiagramPrefix, whichMeson, flagfile; + HGC_options->set("flagfile", "An empty file created indicating the completion of a run", verbosity, flagfile); HGC_options->set("seed_oet", "Seed for initialization of stochastic sources for the oet", verbosity, seed_oet); HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); @@ -470,5 +471,6 @@ int main(int argc, char **argv) } finalize(); + std::ofstream output(flagfile); return 0; } From a606c5d5f4d9ed0ac1ed174111b363f8ebf3aa52 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 5 Oct 2023 10:18:45 +0200 Subject: [PATCH 096/168] correcting backward part of W --- plegma/nucleon_3pt_n_npi.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index b7acfc55..72e37508 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -3173,7 +3173,7 @@ int main(int argc, char **argv) { TIME( corrW9_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 9, true)); TIME(corrW11_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 11, true)); - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); TIME(corrW10_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 10, true, false)); TIME(corrW12_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 12, true, false)); @@ -3218,7 +3218,7 @@ int main(int argc, char **argv) { TIME(corrW33_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 33, true, false)); TIME(corrW34_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 34, true, false)); - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); TIME(corrW35_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 35, true, false)); TIME(corrW36_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 36, true, false)); @@ -3297,10 +3297,10 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrB8_2pt_backward, outfilename, "4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_W_2pt_backward"; - TIME(produceOutput_2pt_packed(corrW9_2pt , outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward));//because of V4 - TIME(produceOutput_2pt_packed(corrW10_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrW11_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrW12_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW9_2pt_backward , outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward));//because of V4 + TIME(produceOutput_2pt_packed(corrW10_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW11_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrW12_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); TIME(produceOutput_2pt_packed(corrW33_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward));//because of V4 TIME(produceOutput_2pt_packed(corrW34_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); From 4ecd106f62a77d1e97dd3d0d279a92106ae698af Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 18 Oct 2023 20:02:56 +0200 Subject: [PATCH 097/168] working on QUDA eigensolver --- utils/PLEGMA_eigSolver.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/PLEGMA_eigSolver.cpp b/utils/PLEGMA_eigSolver.cpp index 8c1f1a66..b6e5139f 100644 --- a/utils/PLEGMA_eigSolver.cpp +++ b/utils/PLEGMA_eigSolver.cpp @@ -49,6 +49,7 @@ EigSolver::EigSolver(EigSolverParams params, QudaDslashType dslashType,bool isRe hostMalloc(h_eigVecs,size_NkV*2*sizeof(double)); if(!isReadEigenVectors) hostMalloc(h_eigVals,p.NkV*2*sizeof(double)); #elif defined(QUDAEIG) + eig_param = newQudaEigParam(); hostMalloc(h_eigVecs,size_NeV*2*sizeof(double)); if(!isReadEigenVectors) hostMalloc(h_eigVals,p.NeV*2*sizeof(double)); hostMalloc(h_eigVecs_p, p.NeV*sizeof(double*)); // need to check if this does the trick @@ -246,9 +247,9 @@ void EigSolver::initEigSolver(){ else if(p.spectrumPart == "LR") eig_param.spectrum = QUDA_SPECTRUM_LR_EIG; else PLEGMA_error("Not implemented"); eig_param.location = QUDA_CUDA_FIELD_LOCATION; - eig_param.nConv = p.NeV; - eig_param.nEv = p.NeV; - eig_param.nKr = p.NkV; + eig_param.n_conv = p.NeV; + eig_param.n_ev = p.NeV; + eig_param.n_kr = p.NkV; eig_param.tol = p.tol; eig_param.batched_rotate = p.batched_rotate; eig_param.require_convergence = QUDA_BOOLEAN_TRUE; @@ -392,7 +393,7 @@ void EigSolver::computeEigVecs(){ if(info == 1) PLEGMA_printf("Warning: Maximum number of iterations reached.\n"); if(info == 3) PLEGMA_error("No shifts could be applied during implicit, Arnoldi update, try increasing NkV\n"); int arpack_log_u = 9999; - if(!p.logFile.empty() && comm_rank() == 0)finilog_(&arpack_log_u); + if(!p.logFile.empty() && comm_rank() == 0) finilog_(&arpack_log_u); free(bmat); free(howmany); From 2d511fcc1389ed60cc8a1642f11043e1cc9c2737 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 19 Oct 2023 06:49:25 +0200 Subject: [PATCH 098/168] adding blocksize option --- utils/PLEGMA_eigSolver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/PLEGMA_eigSolver.cpp b/utils/PLEGMA_eigSolver.cpp index b6e5139f..d382377e 100644 --- a/utils/PLEGMA_eigSolver.cpp +++ b/utils/PLEGMA_eigSolver.cpp @@ -243,6 +243,7 @@ void EigSolver::initEigSolver(){ primme_set_method(p.primme_method, &primme_pars); #elif QUDAEIG eig_param.eig_type = QUDA_EIG_TR_LANCZOS; // Up to now QUDA only provides the thick restarted Lanczos + eig_param.block_size = 1; if(p.spectrumPart == "SR") eig_param.spectrum = QUDA_SPECTRUM_SR_EIG; else if(p.spectrumPart == "LR") eig_param.spectrum = QUDA_SPECTRUM_LR_EIG; else PLEGMA_error("Not implemented"); From 50233e288778f146986f353c87093f1cc4a0c337 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Fri, 20 Oct 2023 13:35:21 +0200 Subject: [PATCH 099/168] set eigsolver up for using m^dag m --- utils/PLEGMA_eigSolver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/PLEGMA_eigSolver.cpp b/utils/PLEGMA_eigSolver.cpp index d382377e..2c74900b 100644 --- a/utils/PLEGMA_eigSolver.cpp +++ b/utils/PLEGMA_eigSolver.cpp @@ -259,6 +259,7 @@ void EigSolver::initEigSolver(){ eig_param.cuda_prec_ritz = QUDA_DOUBLE_PRECISION; eig_param.use_norm_op = QUDA_BOOLEAN_TRUE; // put it on so it will do M^+ M eig_param.use_dagger = QUDA_BOOLEAN_FALSE; + eig_param.compute_gamma5 = QUDA_BOOLEAN_FALSE; eig_param.compute_svd = QUDA_BOOLEAN_FALSE; eig_param.use_poly_acc = G_isACC ? QUDA_BOOLEAN_TRUE : QUDA_BOOLEAN_FALSE; eig_param.poly_deg = G_PolyDeg; From c4462ac56d781c114949a472ea0e90d2490eaf44 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 26 Oct 2023 18:15:07 +0200 Subject: [PATCH 100/168] working QUDA_EIG eigensolver --- utils/PLEGMA_eigSolver.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/PLEGMA_eigSolver.cpp b/utils/PLEGMA_eigSolver.cpp index d382377e..866e4f9b 100644 --- a/utils/PLEGMA_eigSolver.cpp +++ b/utils/PLEGMA_eigSolver.cpp @@ -75,11 +75,15 @@ EigSolver::EigSolver(EigSolverParams params, QudaDslashType dslashType,bool isRe #if defined(QUDAEIG) eig_inv_param = newQudaInvertParam(); setInvertParam(eig_inv_param); + eig_inv_param.residual_type=QUDA_L2_ABSOLUTE_RESIDUAL; +// eig_inv_param.dagger=QUDA_DAG_YES; eig_inv_param.dslash_type = dslashType; eig_inv_param.solve_type = QUDA_DIRECT_SOLVE; eig_inv_param.input_location = QUDA_CPU_FIELD_LOCATION; eig_inv_param.output_location = QUDA_CPU_FIELD_LOCATION; eig_param.invert_param = &eig_inv_param; + eig_param.invert_param->cuda_prec_eigensolver = prec; + eig_param.invert_param->clover_cuda_prec_eigensolver = prec; #endif tmp1 = new PLEGMA_Vector(DEVICE); tmp2 = new PLEGMA_Vector(DEVICE); @@ -257,6 +261,7 @@ void EigSolver::initEigSolver(){ eig_param.check_interval = 10; eig_param.max_restarts = 1000; eig_param.cuda_prec_ritz = QUDA_DOUBLE_PRECISION; + eig_param.compute_gamma5= QUDA_BOOLEAN_FALSE; eig_param.use_norm_op = QUDA_BOOLEAN_TRUE; // put it on so it will do M^+ M eig_param.use_dagger = QUDA_BOOLEAN_FALSE; eig_param.compute_svd = QUDA_BOOLEAN_FALSE; From fcf1c04e634454984e886fe7c24b19ba5cf3ede7 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 8 Nov 2023 10:22:35 +0100 Subject: [PATCH 101/168] set up testing of low mode avg contractions --- lib/kernels/PLEGMA_mesonsOpen.cuh | 148 ++++++++++++++ plegma/pion_LowModeAvg.cpp | 326 ++++++++++++++++++++++++++++++ 2 files changed, 474 insertions(+) create mode 100644 lib/kernels/PLEGMA_mesonsOpen.cuh create mode 100644 plegma/pion_LowModeAvg.cpp diff --git a/lib/kernels/PLEGMA_mesonsOpen.cuh b/lib/kernels/PLEGMA_mesonsOpen.cuh new file mode 100644 index 00000000..1d43db31 --- /dev/null +++ b/lib/kernels/PLEGMA_mesonsOpen.cuh @@ -0,0 +1,148 @@ +#include +using namespace plegma; + +template +__global__ void contract_mesons_open_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][COLS]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); + short int alpha = (is/N_SPINS/N_SPINS/N_SPINS)%N_SPINS; + short int beta = (is/N_SPINS/N_SPINS)%N_SPINS; + short int gamma = (is/N_SPINS)%N_SPINS; + short int delta = is%N_SPINS; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++){ +#pragma unroll + for(int a = 0 ; a < COLS; a++){ + accum = accum + prop1[alpha][beta][b][a] * conj(prop2[delta][gamma][b][a]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, &accum, shared_cache, 1, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) + block2[tid*DGC_localVolume3D + sid3D] = accum; + } +} + +template +void contract_mesons_open_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result, bool all_cols){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = ps.tp.grid.x*ps.tp.block.x/HGC_localVolume3D; + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + if(all_cols) + contract_mesons_open_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + else + contract_mesons_open_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + result[(it*volume+v)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*site_size+ip] += h_partial_block[v*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume; v++) + result[(it*volume+v)*site_size+ip] = h_partial_block[v]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_open(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, bool all_cols){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_open", contract_mesons_open_host, + ps, prop1, prop2, corr, result, all_cols); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp new file mode 100644 index 00000000..b6bd287a --- /dev/null +++ b/plegma/pion_LowModeAvg.cpp @@ -0,0 +1,326 @@ +#include +#include +#include + +using namespace plegma; +using namespace quda; + +//For calculating runtime. +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +extern int device; +static std::vector listOpt = {"verbosity", "load-gauge", "nsrc", "src-filename", "tSinks", "twop-filename", "maxQsq", "Eig-isACC", "Eig-PolyDeg", "Eig-amin", + "Eig-amax", "Eig-spectrumPart", "Eig-tol", "Eig-maxIters", "Eig-NeV", +#if defined(HAVE_ARPACK) || defined(QUDAEIG) + "Eig-NkV", "Eig-logFile", +#elif defined(HAVE_PRIMME) + "Eig-printLevel", "Eig-method-PRIMME", +#endif + "rng-seed", "corr-file-format" +}; + + +int main(int argc, char **argv) +{ + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + int n_stochastic_samples; + int nroots=2; // + int rand_seed1=1234; //random seed for initialization of stochastic sources. + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + std::vector mus; //Twisted mass mus + HGC_options->set("extra-mu", "List of additional mu to run", verbosity, mus); + //std::string Eig_outputFile = "./eigsVdagG5V.dat"; + //HGC_options->set("Eig-outputFile", "Path to dump the eigenvalues and vdag g5 v if low-modes-recon is enabled",verbosity, Eig_outputFile); + bool isReadEigenVecs = false; + bool isWriteEigenVecs = false; + std::string fnameEigenVecsPrefix=""; + HGC_options->set("readEigenVectors", "Where we want to read EigenVectors from file", verbosity, isReadEigenVecs); + HGC_options->set("writeEigenVectors", "Where we want to read EigenVectors from file", verbosity, isWriteEigenVecs); + HGC_options->set("prefixEigenVecsFile", "Path with prefix for the filenames of the eigenvectors", verbosity, fnameEigenVecsPrefix); + #ifdef QUDAEIG + int batched_rotate = 1; + HGC_options->set("batched-rotate", "The size of the batch during Ritz rotation", verbosity, batched_rotate); + #endif + + //=========================================================================================================// + + initializePLEGMA(); + + mus.insert(mus.begin(), mu); //Prepend mu to vector mus. + int nmus = mus.size(); + + //Storing only the smeared gauge + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + //Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + //Initializing solver. + updateOptions(LIGHT); + TIME(QUDA_solver solver(mu)); + + //Initializing stochastic vector using given random seed. + PLEGMA_Vector vector_stoc; + vector_stoc.randInit(rand_seed1); + + //Initialize gamma list. + std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + std::vector glist_sink={ID}; + std::vector glist_test={ID}; + + //Eigensolver to get eigenvalues + #if defined(HAVE_EIGENSOLVER) + EigSolver *eigSol = nullptr; + + EigSolverParams eigParam; + eigParam.NeV = Eig_NeV; + eigParam.isACC = Eig_isACC; + eigParam.PolyDeg = Eig_PolyDeg; + eigParam.amin = Eig_amin; + eigParam.amax = Eig_amax; + eigParam.spectrumPart = Eig_spectrumPart; + eigParam.tol = Eig_tol; + eigParam.maxIters = Eig_maxIters; + #ifdef QUDAEIG + eigParam.batched_rotate = batched_rotate; + #endif + #if defined(HAVE_ARPACK) || defined(QUDAEIG) + eigParam.NkV = Eig_NkV; + eigParam.logFile = Eig_logFile; + #elif defined(HAVE_PRIMME) + eigParam.printLevel = Eig_printLevel; + eigParam.primme_method=getMethod(Eig_method); + #else + PLEGMA_error("No arpack or primme is compiled"); + #endif + TIME(eigSol = new EigSolver(eigParam, dslash_type, isReadEigenVecs, isWriteEigenVecs, fnameEigenVecsPrefix, true)); + //eigSol->dumpEvalsVdagG5V(Eig_outputFile); + #else + PLEGMA_error("No eigenSolver is compiled"); + #endif + + //QUDA_TWISTED_CLOVER_DSLASH is used, so we determine eigenvalues of D(\mu)=V(\Lambda+i\mu)U^\dagger + //V=\Gamma_5 U* + //Need to do this also for -i\mu + //list of lambda, v gamma u', v gamma phi, v gamma eta + #if defined(HAVE_EIGENSOLVER) + //exact-exact part + //=========================================================================================================// + //for(size_t its = 0; its < tSinks.size(); its++){ + //int tsink = tSinks[its]; + int its = 0; + int tsink = 0; + + PLEGMA_Vector eigVec; + PLEGMA_Vector eigVecP; + PLEGMA_Vector eigVecD; + + char * src_string; + asprintf(&src_string, "exact-exact"); + std::string outfilename = twop_filename + src_string + ".h5"; + free(src_string); + + for(int i=0; i < eigSol->getEigVals().size(); i++){ + //double eigVal = std::get<0>(eigSol->getEigVals()[i]); //Doesn't this only get the real part of the eigenvector? Only real eigenvalues if Dirac operator is hermitian. However, here we have to take the twisted mass parameter into account! + long int iorder = std::get<3>(eigSol->getEigVals()[i]); + double *eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + PLEGMA_memcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); +// cudaMemcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); //Copy eigVec_tmp (host) to eigVec (device). + //checkCudaError(); + + for(int j=0; j < eigSol->getEigVals().size(); j++){ + PLEGMA_ScattCorrelator corr(site({0,0,0,tsink}), maxQsq); + //std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + //std::vector glist_sink={ID}; + std::string dataset_name = std::to_string(i) + std::to_string(j); + //TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); + TIME(corr.initialize_diagram(glist_test, glist_sink, "P")); + + //double eigValP = std::get<0>(eigSol->getEigVals()[j]); + iorder = std::get<3>(eigSol->getEigVals()[j]); + double *eigVecP_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + PLEGMA_memcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); +// cudaMemcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); + //checkCudaError(); + eigVecP.apply_gamma5(); //Make eigVecP a left eigenvector by applying gamma5. + TIME(D->apply(eigVecD,eigVecP)); + + //PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); + //PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); + + //TIME(corr.PhiPhi(eigVec, glist_src, eigVecP)); + TIME(corr.PhiPhi(eigVec, glist_test, eigVecD)); + corr.setDatasets((std::vector) {dataset_name}); + TIME(corr.writeHDF5( outfilename )); + } + } + /* + //=========================================================================================================// + + //exact-stochastic part and stochastic-stochastic part + //=========================================================================================================// + //{ + PLEGMA_printf("\n ### Calculations for stochastic source %d - %02d begin now ###\n\n", + its, tsink); + + //We draw a different random vector for every source position + vector_stoc.stochastic_Z(nroots); + + //Take current time slice given by tsink and dilute spins. + //Dilution + PLEGMA_Vector vectortmp1; + PLEGMA_Vector vectortmp2; + vectortmp1.absorbTimeslice(vector_stoc, tsink); + vector_stoc.dilutespin(vectortmp1,0); //put 0 everywhere in the stochastic vector except for the position corresponding to one specific timeslice and mu. + + PLEGMA_Propagator propUP; //Declaration of the two propagators. UP = +mu and DN = -mu + PLEGMA_Propagator propDN; + PLEGMA_Propagator propUP_phi; //The propagators containing phi. + PLEGMA_Propagator propDN_phi; + //PLEGMA_Vector eigVec; //Declaration of eigenvector + + for(int imu=0; imuprojectVector(vectortmp1); //Project vector to obtain "phi". + + if(fl==0) + propUP_phi.absorb(vectortmp1, spinindex, 0); //Last argument is the color index, put to 0 here. + else + propDN_phi.absorb(vectortmp1, spinindex, 0); + } + + propUP.rotateToPhysicalBase_device(+1); + propUP.applyBoundaries_device(tsink); //take into account (antiperiodic) boundary conditions. + propDN.rotateToPhysicalBase_device(-1); + propDN.applyBoundaries_device(tsink); + propUP_phi.rotateToPhysicalBase_device(+1); + propUP_phi.applyBoundaries_device(tsink); + propDN_phi.rotateToPhysicalBase_device(-1); + propDN_phi.applyBoundaries_device(tsink); + + + //exact-stochastic contractions for v gamma eta and v gamma phi terms + //=========================================================================================================// + for(int i=0; i < eigSol->getEigVals().size(); i++){ + //double eigVal = std::get<0>(eigSol->getEigVals()[i]); //Doesn't this only get the real part of the eigenvector? Only real eigenvalues if Dirac operator is hermitian. However, here we have to take the twisted mass parameter into account! + long int iorder = std::get<3>(eigSol->getEigVals()[i]); + double *eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + cudaMemcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); + //checkCudaError(); + + //Initialize new Scatt_Correlator. + PLEGMA_ScattCorrelator mix_corr(site({0,0,0,tsink}), maxQsq); + //std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + //std::vector glist_sink={ID}; + TIME(mix_corr.initialize_diagram(glist_src, glist_sink, "P")); + + TIME(mix_corr.V3(eigVec, glist_src, propUP)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "u"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propDN)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "d"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propUP_phi)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "uphi"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propDN_phi)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "dphi"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + } + + //PLEGMA_printf("Calculating stoc-stoc contributions... \n\n"); + //=========================================================================================================// + + //stochastic-stochastic contractions + //=========================================================================================================// + + PLEGMA_Correlator stoc_corr(corr_space, site({0,0,0,tsink}), maxQsq); + TIME(stoc_corr.contractMesonsNew(propUP, propUP)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "uu"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propUP, propUP, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "uu_open"}); //Leave spin indices open (16x16 indices) + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsNew(propDN, propDN)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "dd"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propDN, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "dd_open"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsNew(propUP, propDN)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "ud"}); //"du" is just the conjugated one, so no need to compute it separately. + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propUP, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "ud_open"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + + //=========================================================================================================// + } + } + //} + //} + */ + #endif + + //finalize(); + + return 0; +} + + /*Open questions: + 1) In the spin dilution part there's a random vector absorbed only for one color component. How do we deal with the other color components. + 2) Is computing eigenvectors for D^\dagger D correct? What about the mus then if we have fully real eigenvalues? They seem not to be taken into account. + 3) Why do the contractions yield not just a number? + 4) Are the eigenvectors determined by the eigensolver right, or left eigenvectors and are they already daggered or not? + 5) How can the other terms, connected to the ones computed here by gamma_5 and daggering, be effectively determined? + */ From 92f71b90951c759ea9fcdc53faab7b720b4bf56c Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 10 Nov 2023 08:56:36 +0100 Subject: [PATCH 102/168] adding some executables --- plegma/pi0Insertion.cpp | 411 +++++++++++++++ plegma/pion_LowModeAvg.cpp | 322 ++++++++++++ plegma/testYan.cpp | 1005 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1738 insertions(+) create mode 100644 plegma/pi0Insertion.cpp create mode 100644 plegma/pion_LowModeAvg.cpp create mode 100644 plegma/testYan.cpp diff --git a/plegma/pi0Insertion.cpp b/plegma/pi0Insertion.cpp new file mode 100644 index 00000000..bb9a7656 --- /dev/null +++ b/plegma/pi0Insertion.cpp @@ -0,0 +1,411 @@ +#include +#include +std::vector runtime; +#define TIME(fnc) \ + runtime.push_back(MPI_Wtime()); \ + fnc; \ + PLEGMA_printf("TIME for " #fnc " %f sec\n", MPI_Wtime() - runtime.back()); \ + runtime.pop_back() + +extern int device; +static std::vector listOpt = {"verbosity", "load-gauge", "nsrc", "src-filename", "seed1", "confnumber", "outdiagramPrefix", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; + +int main(int argc, char **argv) +{ + /****************************************************** + * + * Initialiazation + * + ******************************************************/ + // int confnumber_int; + int rand_seed1; + // std::string outdiagramPrefix = ""; + + // HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + // HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + initializeOptions(argc, argv, true, listOpt); + initializePLEGMA(); + + + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + + + // plegma::PLEGMA_Gauge gauge, smearedGauge; + // gauge.readFile(latfile, LIME_FORMAT); + // gauge.load(); + // gauge.calculatePlaq(); + // initGaugeQuda(gauge, true); + // plaqQuda(); + + // smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + // smearedGauge.calculatePlaq(); + + // updateOptions(LIGHT); + // quda::QUDA_solver solver(mu); + + /****************************************************** + * + * Utilities + * + ******************************************************/ +#if 0 + +#if 1 // general + bool smearQ = true; + + enum FlavorYan + { + u, + d + }; + enum SmearFlagYan + { + SS, + SL, + LS, + LL, + single2double, + SB, + LB + }; +#endif + +#if 1 // solve + auto solve0 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f) + { + FlavorYan f2 = (mu > 0 ? u : d); + double run_mu = (f == f2 ? mu : -mu); + plegma::PLEGMA_Vector auxVector; + + auxVector.rotateToPhysicalBasis(in, run_mu / std::abs(run_mu)); + double norm = auxVector.norm(); + auxVector.scale(1 / norm); + if (f != f2) + { + mu = run_mu; + solver.UpdateSolver(); + } + solver.solve(auxVector, auxVector); + auxVector.scale(norm); + out.rotateToPhysicalBasis(auxVector, run_mu / std::abs(run_mu)); + }; + auto solve1 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); + + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(out, auxVector, f); + return; + } + + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector3D auxVector3D; + + if (s == SL || s == SS) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + } + else + auxVector3D.copy(in); + + auxVector.absorb(auxVector3D, inTime); + solve0(auxVector, auxVector, f); + + if (s == LS || s == SS) + { + out.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + } + else + out.copy(auxVector); + }; + auto solve2 = [&](plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(single2double < s); + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(outL, auxVector, f); + outS.copy(outL); + return; + } + + plegma::PLEGMA_Vector auxVector; + + if (s == SB) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + plegma::PLEGMA_Vector3D auxVector3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + auxVector.absorb(auxVector3D, inTime); + } + else + auxVector.absorb(in, inTime); + + solve0(auxVector, auxVector, f); + + outS.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + outL.copy(auxVector); + }; +#endif + +#if 0 // setupPointPropagator + auto setupPointPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s) + { + if (s < single2double) + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3D; + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVector, auxVector3D, source[DIM_T], f, s); + auxVectorF.copy(auxVector); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorS, auxVectorL; + plegma::PLEGMA_Vector auxVectorSF, auxVectorLF; + plegma::PLEGMA_Vector3D auxVector3D; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve(auxVectorS, auxVectorL, auxVector3D, source[DIM_T], f, s); + auxVectorSF.copy(auxVectorS); + auxVectorLF.copy(auxVectorL); + outS.absorb(auxVectorSF, isc / 3, isc % 3); + outL.absorb(auxVectorLF, isc / 3, isc % 3); + } + } + }; +#endif + +#if 0 // setupSequentialPropagator + auto ToolYan::setupSequentialPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + if (s < single2double) + { + plegma::PLEGMA_Vector auxVectorD; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorD, auxVector3DD, inTime, f, s); + auxVectorF.copy(auxVectorD); + outS.absorb(auxVectorF, isc / 3, isc % 3); + } + } + else + { + plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; + plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + // auxVector3DF.apply_gamma_scatt(G_5); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); + auxVectorFS.copy(auxVectorDS); + auxVectorFL.copy(auxVectorDL); + outS.absorb(auxVectorFS, isc / 3, isc % 3); + outL.absorb(auxVectorFL, isc / 3, isc % 3); + } + } + }; +#endif + +#endif + + /****************************************************** + * + * General input + * + ******************************************************/ + // Get the confnumber for latfile + // char *ssource; + // asprintf(&ssource, "%04d", confnumber_int); + // std::string confnumber = ssource; + // free(ssource); + + // std::vector gscatt_ID = {ID}; + // std::vector gscatt_N = {CG_5}; + // std::vector gscatt_pi = {G_5}; + // std::vector gscatt_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; + // std::vector gamma_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + + // PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + // plegma::momList momList_3pt(4, pathListMomenta_threept, {1, 2, 3}); // pi2, pf1, pf2, pc + // PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList_3pt.size()); + // if (momList_3pt.empty()) + // PLEGMA_error("threept momentumList empty"); + // auto momVects_pi2 = momList_3pt.uniq_p(0); + // auto momVects_pc = momList_3pt.uniq_p(3); + // plegma::momList momList_pc(1, {momVects_pc}, {0}); + + /****************************************************** + * + * Main + * + ******************************************************/ + // for (int isource = 0; isource < numSourcePositions; ++isource) + // { + // plegma::site &source = sourcePositions[isource]; + // PLEGMA_printf(("TestYan: source=" + std::to_string(source[0]) + "_" + std::to_string(source[1]) + "_" + std::to_string(source[2]) + "_" + std::to_string(source[3])).c_str()); + // assert(source[0] == source[1] == source[2] == 0 && 0 <= source[3] < max_source_sink_separations); + // PLEGMA_printf(("TestYan: isource=" + std::to_string(isource)).c_str()); + + // plegma::PLEGMA_Vector stocXi; + // { + // stocXi.randInit(rand_seed1); + // stocXi.stochastic_Z(4); + // } + // int time_i = source[3]; + + // plegma::PLEGMA_Vector stocPhiUTi_SL, stocPhiDTi_SL; + // plegma::PLEGMA_Vector3D auxVector3D; + // auxVector3D.absorb(stocXi, time_i); + // solve1(stocPhiUTi_SL, auxVector3D, time_i, u, SL); + // solve1(stocPhiDTi_SL, auxVector3D, time_i, d, SL); + + // for (int i_pi2 = 0; i_pi2 < momVects_pi2.size(); ++i_pi2) + // { + // auto &mom_pi2 = momVects_pi2[i_pi2]; + // std::string str_pi2 = "pi2=" + std::to_string(mom_pi2[0]) + "_" + std::to_string(mom_pi2[1]) + "_" + std::to_string(mom_pi2[2]); + // PLEGMA_printf(("TestYan: pi2=" + str_pi2).c_str()); + + // plegma::PLEGMA_Vector stocPhiDTi_mpi2_SL, stocPhiUTi_mpi2_SL; + // plegma::PLEGMA_Vector3D auxVector3D; + // auxVector3D.absorb(stocXi, time_i); + // solve1(stocPhiDTi_mpi2_SL, auxVector3D, time_i, d, SL); + // solve1(stocPhiUTi_mpi2_SL, auxVector3D, time_i, u, SL); + + // plegma::PLEGMA_ScattCorrelator pi0Insertion_u(source, momList_pc); + // pi0Insertion_u.initialize_diagram(gscatt_pi, gscatt_c, "u/" + str_pi2); + // { + // plegma::PLEGMA_Vector aux, aux_pi2; + // aux.copy(stocPhiUTi_SL); + // aux_pi2.copy(stocPhiDTi_mpi2_SL); + // pi0Insertion_u.P_diagrams(aux, aux_pi2, -1); + // } + // plegma::PLEGMA_ScattCorrelator pi0Insertion_d(source, momList_pc); + // pi0Insertion_d.initialize_diagram(gscatt_pi, gscatt_c, "d/" + str_pi2); + // { + // plegma::PLEGMA_Vector aux, aux_pi2; + // aux.copy(stocPhiDTi_SL); + // aux_pi2.copy(stocPhiUTi_mpi2_SL); + // pi0Insertion_d.P_diagrams(aux, aux_pi2, -1); + // } + + // asprintf(&ssource, "st%03d", time_i); + // std::string sourcepositiontext = (std::string) "_" + ssource; + // free(ssource); + // std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_pi0Isert"; + + // pi0Insertion_u.writeHDF5(outdiagramPrefix + outfilename); + // pi0Insertion_d.writeHDF5(outdiagramPrefix + outfilename); + // } + // } + + // Below are packed version of the codes + // for (int isource = 0; isource < numSourcePositions; ++isource) + // { + // plegma::site &source = sourcePositions[isource]; + // printTime("source=" + std::to_string(source[0]) + "_" + std::to_string(source[1]) + "_" + std::to_string(source[2]) + "_" + std::to_string(source[3])); + // if (source[3] == -1) + // continue; + // assert(source[0] == source[1] == source[2] == 0 && 0 <= source[3] < max_source_sink_separations); + + // printTime("isource=" + std::to_string(isource)); + + // plegma::PLEGMA_Vector stocXi; + // { + // stocXi.randInit(rand_seed1); + // stocXi.stochastic_Z(4); + // } + // plegma::PLEGMA_Vector stocPhiUTi_SL_Pack, stocPhiDTi_SL_Pack; + // for (int i_source_parallel = 0; i_source_parallel < parallel_sources; ++i_source_parallel) + // { + // int time_i = (source[3] + i_source_parallel * max_source_sink_separations + HGC_totalL[3]) % HGC_totalL[3]; + + // plegma::PLEGMA_Vector stocPhiUTi_SL, stocPhiDTi_SL; + // plegma::PLEGMA_Vector3D auxVector3D; + // auxVector3D.absorb(stocXi, time_i); + // solve1(stocPhiUTi_SL, auxVector3D, time_i, u, SL); + // solve1(stocPhiDTi_SL, auxVector3D, time_i, d, SL); + // stocPhiUTi_SL_Pack.pack_propagator_from_source_to_sink(stocPhiUTi_SL, time_i + max_source_sink_separations, max_source_sink_separations, i_source_parallel == 0 ? true : false); + // stocPhiDTi_SL_Pack.pack_propagator_from_source_to_sink(stocPhiDTi_SL, time_i + max_source_sink_separations, max_source_sink_separations, i_source_parallel == 0 ? true : false); + // } + + // for (int i_pi2 = 0; i_pi2 < momVects_pi2.size(); ++i_pi2) + // { + // auto &mom_pi2 = momVects_pi2[i_pi2]; + // std::string str_pi2 = "pi2=" + std::to_string(mom_pi2[0]) + "_" + std::to_string(mom_pi2[1]) + "_" + std::to_string(mom_pi2[2]); + // printTime(str_pi2); + + // plegma::PLEGMA_Vector stocPhiDTi_mpi2_SL_Pack, stocPhiUTi_mpi2_SL_Pack; + // for (int i_source_parallel = 0; i_source_parallel < parallel_sources; ++i_source_parallel) + // { + // int time_i = (source[3] + i_source_parallel * max_source_sink_separations + HGC_totalL[3]) % HGC_totalL[3]; + + // plegma::PLEGMA_Vector stocPhiDTi_mpi2_SL, stocPhiUTi_mpi2_SL; + // plegma::PLEGMA_Vector3D + // auxVector3D; + // auxVector3D.absorb(stocXi, time_i); + // solve1(stocPhiDTi_mpi2_SL, auxVector3D, time_i, d, SL); + // solve1(stocPhiUTi_mpi2_SL, auxVector3D, time_i, u, SL); + // stocPhiDTi_mpi2_SL_Pack.pack_propagator_from_source_to_sink(stocPhiDTi_mpi2_SL, time_i + max_source_sink_separations, max_source_sink_separations, i_source_parallel == 0 ? true : false); + // stocPhiUTi_mpi2_SL_Pack.pack_propagator_from_source_to_sink(stocPhiUTi_mpi2_SL, time_i + max_source_sink_separations, max_source_sink_separations, i_source_parallel == 0 ? true : false); + // } + + // plegma::PLEGMA_ScattCorrelator pi0Insertion_u(source, momList_pc); + // pi0Insertion_u.initialize_diagram(gscatt_pi, gscatt_c, "u/" + str_pi2); + // { + // plegma::PLEGMA_Vector aux, aux_pi2; + // aux.copy(stocPhiUTi_SL_Pack); + // aux_pi2.copy(stocPhiDTi_mpi2_SL_Pack); + // pi0Insertion_u.P_diagrams(aux, aux_pi2, -1); + // } + // plegma::PLEGMA_ScattCorrelator pi0Insertion_d(source, momList_pc); + // pi0Insertion_d.initialize_diagram(gscatt_pi, gscatt_c, "d/" + str_pi2); + // { + // plegma::PLEGMA_Vector aux, aux_pi2; + // aux.copy(stocPhiDTi_SL_Pack); + // aux_pi2.copy(stocPhiUTi_mpi2_SL_Pack); + // pi0Insertion_d.P_diagrams(aux, aux_pi2, -1); + // } + + // asprintf(&ssource, "st%03d", source[3]); + // std::string sourcepositiontext = (std::string) "_" + ssource; + // free(ssource); + // std::string outfilename = outdiagramPrefix + confnumber + sourcepositiontext + "_pi0Isert"; + + // pi0Insertion_u.writeHDF5(outdiagramPrefix + outfilename); + // pi0Insertion_d.writeHDF5(outdiagramPrefix + outfilename); + // } + // } + + finalize(); + + return 0; +} diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp new file mode 100644 index 00000000..9e777345 --- /dev/null +++ b/plegma/pion_LowModeAvg.cpp @@ -0,0 +1,322 @@ +#include +#include +#include + +using namespace plegma; +using namespace quda; + +//For calculating runtime. +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +extern int device; +static std::vector listOpt = {"verbosity", "load-gauge", "nsrc", "src-filename", "tSinks", "twop-filename", "maxQsq", "Eig-isACC", "Eig-PolyDeg", "Eig-amin", + "Eig-amax", "Eig-spectrumPart", "Eig-tol", "Eig-maxIters", "Eig-NeV", +#if defined(HAVE_ARPACK) || defined(QUDAEIG) + "Eig-NkV", "Eig-logFile", +#elif defined(HAVE_PRIMME) + "Eig-printLevel", "Eig-method-PRIMME", +#endif + "rng-seed", "corr-file-format" +}; + + +int main(int argc, char **argv) +{ + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + int n_stochastic_samples; + int nroots=2; // + int rand_seed1=1234; //random seed for initialization of stochastic sources. + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + std::vector mus; //Twisted mass mus + HGC_options->set("extra-mu", "List of additional mu to run", verbosity, mus); + //std::string Eig_outputFile = "./eigsVdagG5V.dat"; + //HGC_options->set("Eig-outputFile", "Path to dump the eigenvalues and vdag g5 v if low-modes-recon is enabled",verbosity, Eig_outputFile); + bool isReadEigenVecs = false; + bool isWriteEigenVecs = false; + std::string fnameEigenVecsPrefix=""; + HGC_options->set("readEigenVectors", "Where we want to read EigenVectors from file", verbosity, isReadEigenVecs); + HGC_options->set("writeEigenVectors", "Where we want to read EigenVectors from file", verbosity, isWriteEigenVecs); + HGC_options->set("prefixEigenVecsFile", "Path with prefix for the filenames of the eigenvectors", verbosity, fnameEigenVecsPrefix); + + //=========================================================================================================// + + initializePLEGMA(); + + mus.insert(mus.begin(), mu); //Prepend mu to vector mus. + int nmus = mus.size(); + + //Storing only the smeared gauge + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + //Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + //Initializing solver. + updateOptions(LIGHT); + TIME(QUDA_solver solver(mu)); + + //Initializing stochastic vector using given random seed. + PLEGMA_Vector vector_stoc; + vector_stoc.randInit(rand_seed1); + + //Initialize gamma list. + std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + std::vector glist_sink={ID}; + + //Eigensolver to get eigenvalues + #if defined(HAVE_EIGENSOLVER) + EigSolver *eigSol = nullptr; + + EigSolverParams eigParam; + eigParam.NeV = Eig_NeV; + eigParam.isACC = Eig_isACC; + eigParam.PolyDeg = Eig_PolyDeg; + eigParam.amin = Eig_amin; + eigParam.amax = Eig_amax; + eigParam.spectrumPart = Eig_spectrumPart; + eigParam.tol = Eig_tol; + eigParam.maxIters = Eig_maxIters; + #ifdef QUDAEIG + eigParam.batched_rotate = batched_rotate; + #endif + #if defined(HAVE_ARPACK) || defined(QUDAEIG) + eigParam.NkV = Eig_NkV; + eigParam.logFile = Eig_logFile; + #elif defined(HAVE_PRIMME) + eigParam.printLevel = Eig_printLevel; + eigParam.primme_method=getMethod(Eig_method); + #else + PLEGMA_error("No arpack or primme is compiled"); + #endif + TIME(eigSol = new EigSolver(eigParam, dslash_type, isReadEigenVecs, isWriteEigenVecs, fnameEigenVecsPrefix, true)); + //eigSol->dumpEvalsVdagG5V(Eig_outputFile); + #else + PLEGMA_error("No eigenSolver is compiled"); + #endif + + //QUDA_TWISTED_CLOVER_DSLASH is used, so we determine eigenvalues of D(\mu)=V(\Lambda+i\mu)U^\dagger + //V=\Gamma_5 U* + //Need to do this also for -i\mu + //list of lambda, v gamma u', v gamma phi, v gamma eta + #if defined(HAVE_EIGENSOLVER) + //exact-exact part + //=========================================================================================================// + //for(size_t its = 0; its < tSinks.size(); its++){ + //int tsink = tSinks[its]; + int its = 0; + int tsink = 0; + + PLEGMA_Vector eigVec; + PLEGMA_Vector eigVecP; + + for(int i=0; i < eigSol->getEigVals().size(); i++){ + //double eigVal = std::get<0>(eigSol->getEigVals()[i]); //Doesn't this only get the real part of the eigenvector? Only real eigenvalues if Dirac operator is hermitian. However, here we have to take the twisted mass parameter into account! + long int iorder = std::get<3>(eigSol->getEigVals()[i]); + double *eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + PLEGMA_memcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); +// cudaMemcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); //Copy eigVec_tmp (host) to eigVec (device). + //checkCudaError(); + + for(int j=0; j < eigSol->getEigVals().size(); j++){ + PLEGMA_ScattCorrelator corr(site({0,0,0,tsink}), maxQsq); + //std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + //std::vector glist_sink={ID}; + std::string dataset_name = std::to_string(i) + std::to_string(j); + TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); + PLEGMA_printf("sss"); + + char * src_string; + asprintf(&src_string, "exact-exact"); + std::string outfilename = twop_filename + src_string + ".h5"; + free(src_string); + + //double eigValP = std::get<0>(eigSol->getEigVals()[j]); + iorder = std::get<3>(eigSol->getEigVals()[j]); + double *eigVecP_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + PLEGMA_memcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); +// cudaMemcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); + //checkCudaError(); + eigVecP.apply_gamma5(); //Make eigVecP a left eigenvector by applying gamma5. + + PLEGMA_printf("eigVecNorm: %d", eigVec.norm()); + PLEGMA_printf("eigVecPNorm: %d", eigVecP.norm()); + + TIME(corr.PhiPhi(eigVec, glist_src, eigVecP)); + corr.setDatasets((std::vector) {dataset_name}); + TIME(corr.writeHDF5( outfilename )); + } + } + //=========================================================================================================// + + //exact-stochastic part and stochastic-stochastic part + //=========================================================================================================// + //{ + PLEGMA_printf("\n ### Calculations for stochastic source %d - %02d begin now ###\n\n", + its, tsink); + + //We draw a different random vector for every source position + vector_stoc.stochastic_Z(nroots); + + //Take current time slice given by tsink and dilute spins. + //Dilution + PLEGMA_Vector vectortmp1; + PLEGMA_Vector vectortmp2; + vectortmp1.absorbTimeslice(vector_stoc, tsink); + vector_stoc.dilutespin(vectortmp1,0); //put 0 everywhere in the stochastic vector except for the position corresponding to one specific timeslice and mu. + + PLEGMA_Propagator propUP; //Declaration of the two propagators. UP = +mu and DN = -mu + PLEGMA_Propagator propDN; + PLEGMA_Propagator propUP_phi; //The propagators containing phi. + PLEGMA_Propagator propDN_phi; + //PLEGMA_Vector eigVec; //Declaration of eigenvector + + for(int imu=0; imuprojectVector(vectortmp1); //Project vector to obtain "phi". + + if(fl==0) + propUP_phi.absorb(vectortmp1, spinindex, 0); //Last argument is the color index, put to 0 here. + else + propDN_phi.absorb(vectortmp1, spinindex, 0); + } + + propUP.rotateToPhysicalBase_device(+1); + propUP.applyBoundaries_device(tsink); //take into account (antiperiodic) boundary conditions. + propDN.rotateToPhysicalBase_device(-1); + propDN.applyBoundaries_device(tsink); + propUP_phi.rotateToPhysicalBase_device(+1); + propUP_phi.applyBoundaries_device(tsink); + propDN_phi.rotateToPhysicalBase_device(-1); + propDN_phi.applyBoundaries_device(tsink); + + + //exact-stochastic contractions for v gamma eta and v gamma phi terms + //=========================================================================================================// + for(int i=0; i < eigSol->getEigVals().size(); i++){ + //double eigVal = std::get<0>(eigSol->getEigVals()[i]); //Doesn't this only get the real part of the eigenvector? Only real eigenvalues if Dirac operator is hermitian. However, here we have to take the twisted mass parameter into account! + long int iorder = std::get<3>(eigSol->getEigVals()[i]); + double *eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + cudaMemcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); + //checkCudaError(); + + //Initialize new Scatt_Correlator. + PLEGMA_ScattCorrelator mix_corr(site({0,0,0,tsink}), maxQsq); + //std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + //std::vector glist_sink={ID}; + TIME(mix_corr.initialize_diagram(glist_src, glist_sink, "P")); + + TIME(mix_corr.V3(eigVec, glist_src, propUP)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "u"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propDN)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "d"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propUP_phi)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "uphi"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propDN_phi)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "dphi"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + } + + PLEGMA_printf("Calculating stoc-stoc contributions... \n\n"); + //=========================================================================================================// + + //stochastic-stochastic contractions + //=========================================================================================================// +#if 0 + PLEGMA_Correlator stoc_corr(corr_space, site({0,0,0,tsink}), maxQsq); + TIME(stoc_corr.contractMesonsNew(propUP, propUP, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "uu"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propUP, propUP, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "uu_open"}); //Leave spin indices open (16x16 indices) + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsNew(propDN, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "dd"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propDN, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "dd_open"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsNew(propUP, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "ud"}); //"du" is just the conjugated one, so no need to compute it separately. + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propUP, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "ud_open"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + //=========================================================================================================// +#endif + } + } + //} + //} + #endif + + //finalize(); + + return 0; +} + + /*Todo: 1) Find smallest eigenvalue of Dirac operator. + 2) Deflate Dirac operator. + 3) Repeat until sufficient number of eigenvalues has been found. + -> Eigensolver does all this (step 1)-3)). Accessible via eigSol->getEigVals(). + Have only right eigenvectors. -> To get left one transpose and apply gamma5 from the left. + But which eigenvalues are those? Are these for both propagators, or only one of them? Eigenvalues and -vectors are actually the same. Have to perform double sum over them. + Are the vectors ordered in the same way as the eigenvalues? Line 96 gets the index of the eigenvector corresponding to a given eigenvalue. + 4) Use eigenvalues and corresponding eigenvectors to construct terms (a,b)_t + -> Need to find a way to make the contractions. Specifically need to know how to apply gamma_5. Doable by copying the eigenvector (double) to a vector of type PLEGMA_vector. + How do we do this for each lattice site? + What is Gamma in our case? For pions its just gamma_5. + 5) Contract propagators to find the exact-exact part of the correlation function. + */ diff --git a/plegma/testYan.cpp b/plegma/testYan.cpp new file mode 100644 index 00000000..1991f1b4 --- /dev/null +++ b/plegma/testYan.cpp @@ -0,0 +1,1005 @@ +#include +#include +std::vector runtime; +#define TIME(fnc) \ + runtime.push_back(MPI_Wtime()); \ + fnc; \ + PLEGMA_printf("TIME for " #fnc " %f sec\n", MPI_Wtime() - runtime.back()); \ + runtime.pop_back() + +extern int device; +static std::vector listOpt = {"verbosity", "load-gauge", "momlisttwopt-filename", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; + +auto packVector = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) +{ + PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(in, timeSlice, true); + + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + out.absorb(auxVector3D, dt, false); + } +}; +auto packVectorD = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) +{ + PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(in, timeSlice, true); + + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + out.absorb(auxVector3D, dt, false); + } +}; +auto packPropogator = [](plegma::PLEGMA_Propagator &out, plegma::PLEGMA_Propagator &in, int timeSlice) +{ + PLEGMA_Vector auxVector; + for (int isc = 0; isc < 12; isc++) + { + auxVector.absorb(in, isc / 3, isc % 3); + packVector(auxVector, auxVector, timeSlice); + out.absorb(auxVector, isc / 3, isc % 3); + } +}; + +int main(int argc, char **argv) +{ + /****************************************************** + * + * Initialiazation + * + ******************************************************/ + initializeOptions(argc, argv, true, listOpt); + + int confnumber_int; + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + + int seed_stoc; + HGC_options->set("seed_stoc", "Seed for stoc", verbosity, seed_stoc); + + initializePLEGMA(); + + { + plegma::PLEGMA_Gauge gauge, smearedGauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.load(); + gauge.calculatePlaq(); + initGaugeQuda(gauge, true); + plaqQuda(); + + smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3); + smearedGauge.calculatePlaq(); + + updateOptions(LIGHT); + quda::QUDA_solver solver(mu); + +#if 1 // Utilities + +#if 1 // general + bool smearQ = true; + + enum FlavorYan + { + u, + d + }; + enum SmearFlagYan + { + SS, + SL, + LS, + LL, + single2double, + SB, + LB + }; +#endif + +#if 1 // solve + auto solve0 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, FlavorYan f) + { + FlavorYan f2 = (mu > 0 ? u : d); + double run_mu = (f == f2 ? mu : -mu); + plegma::PLEGMA_Vector auxVector; + + auxVector.rotateToPhysicalBasis(in, run_mu / std::abs(run_mu)); + + //double norm = auxVector.norm(); + //auxVector.scale(1 / norm); + if (f != f2) + { + mu = run_mu; + solver.UpdateSolver(); + } + auxVector.writeHDF5("pureinput"); + solver.solve(auxVector, auxVector); + auxVector.writeHDF5("pureoutput"); + //auxVector.scale(norm); + out.rotateToPhysicalBasis(auxVector, run_mu / std::abs(run_mu)); + }; + auto solve1 = [&](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); + + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(out, auxVector, f); + return; + } + + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector3D auxVector3D; + + if (s == SL || s == SS) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + } + else + auxVector3D.copy(in); + + auxVector.absorb(auxVector3D, inTime); + solve0(auxVector, auxVector, f); + + if (s == LS || s == SS) + { + out.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + } + else + out.copy(auxVector); + }; + auto solve2 = [&](plegma::PLEGMA_Vector &outS, plegma::PLEGMA_Vector &outL, plegma::PLEGMA_Vector3D &in, int inTime, FlavorYan f, SmearFlagYan s) + { + assert(single2double < s); + if (!smearQ) + { + plegma::PLEGMA_Vector auxVector; + auxVector.absorb(in, inTime); + solve0(outL, auxVector, f); + outS.copy(outL); + return; + } + + plegma::PLEGMA_Vector auxVector; + + if (s == SB) + { + plegma::PLEGMA_Gauge3D smearedGauge3D; + plegma::PLEGMA_Vector3D auxVector3D; + smearedGauge3D.absorb(smearedGauge, inTime); + auxVector3D.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss); + auxVector.absorb(auxVector3D, inTime); + } + else + auxVector.absorb(in, inTime); + + solve0(auxVector, auxVector, f); + + outS.gaussianSmearing(auxVector, smearedGauge, nsmearGauss, alphaGauss); + outL.copy(auxVector); + }; +#endif + +#if 1 // setupPointPropagator + auto setupPointPropagator1 = [&](plegma::PLEGMA_Propagator &out, plegma::site &source, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); + + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3D; + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve1(auxVector, auxVector3D, source[DIM_T], f, s); + auxVectorF.copy(auxVector); + out.absorb(auxVectorF, isc / 3, isc % 3); + } + }; + auto setupPointPropagator2 = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::site &source, FlavorYan f, SmearFlagYan s) + { + assert(single2double < s); + plegma::PLEGMA_Vector auxVectorS, auxVectorL; + plegma::PLEGMA_Vector auxVectorSF, auxVectorLF; + plegma::PLEGMA_Vector3D auxVector3D; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3D.pointSource(source, isc / 3, isc % 3, DEVICE); + solve2(auxVectorS, auxVectorL, auxVector3D, source[DIM_T], f, s); + if (f==u){ + auxVectorS.writeHDF5("propUP_"+std::to_string(isc / 3)+std::to_string( isc % 3)); + } + else{ + auxVectorS.writeHDF5("propDN_"+std::to_string(isc / 3)+std::to_string( isc % 3)); + } + auxVectorSF.copy(auxVectorS); + auxVectorLF.copy(auxVectorL); + outS.absorb(auxVectorSF, isc / 3, isc % 3); + outL.absorb(auxVectorLF, isc / 3, isc % 3); + } + }; +#endif + +#if 1 // setupSequentialPropagator + auto setupSequentialPropagator1 = [&](plegma::PLEGMA_Propagator &out, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); + + plegma::PLEGMA_Vector auxVectorD; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve1(auxVectorD, auxVector3DD, inTime, f, s); + auxVectorF.copy(auxVectorD); + out.absorb(auxVectorF, isc / 3, isc % 3); + } + }; + auto setupSequentialPropagator2 = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + assert(s > single2double); + + plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; + plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + // auxVector3DF.apply_gamma_scatt(G_5); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + + if (f==d){ + auxVector3DD.writeHDF5("seq_source_dndn_3d_"+std::to_string(isc / 3)+std::to_string( isc % 3)); + } + + solve2(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); + if (f==d){ + auxVectorDL.writeHDF5("seq_propagator_dndn_3d_"+std::to_string(isc / 3)+std::to_string( isc % 3)); + } + auxVectorFS.copy(auxVectorDS); + auxVectorFL.copy(auxVectorDL); + outS.absorb(auxVectorFS, isc / 3, isc % 3); + outL.absorb(auxVectorFL, isc / 3, isc % 3); + } + }; +#endif + +#endif + + /****************************************************** + * + * General input + * + ******************************************************/ + // Get the confnumber for latfile + char *ssource; + asprintf(&ssource, "%04d", confnumber_int); + std::string confnumber = ssource; + free(ssource); + + std::vector gscatts_ID = {ID}; + std::vector gscatts_N = {CG_5}; + std::vector gscatts_pi = {G_5}; + std::vector gscatts_c_temp = {G_4}; + std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; + std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + + std::vector gscatts_meson = {}; + std::string filenameEnd = ""; + + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_twopt.c_str()); + plegma::momList momList2pt(3, pathListMomenta_twopt, {1, 2}); // pi2, pf1, pf2 + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList2pt.size()); + if (momList2pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects2pt_pi2 = momList2pt.uniq_p(0); + plegma::momList momList2pt_pi2(1, {momVects2pt_pi2}, {0}); + + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + plegma::momList momList3pt(4, pathListMomenta_threept, {1, 2, 3}); // pi2, pf1, pf2, pc + PLEGMA_printf("N momenta in sourcemomentumList: %d\n", momList3pt.size()); + if (momList3pt.empty()) + PLEGMA_error("threept momentumList empty"); + auto momVects3pt_pi2 = momList3pt.uniq_p(0); + auto momVects3pt_pf1 = momList3pt.uniq_p(1); + auto momVects3pt_pc = momList3pt.uniq_p(3); + auto momVects3pt_pi1 = momList3pt.pi1(); + plegma::momList momList3pt_pc(1, {momVects3pt_pc}, {0}); + + /****************************************************** + * + * Main + * + ******************************************************/ + + std::string saveDir = "tempData/"; + + struct plegma::site source({1, 2, 3, 4}); + struct plegma::site sourceZero({0, 0, 0, 4}); + + int time_fi = 10; + int time_i = source[DIM_T], time_f = (source[DIM_T] + time_fi) % HGC_totalL[3]; + + plegma::PLEGMA_Propagator propUSS, propUSL; + plegma::PLEGMA_Propagator propDSS, propDSL; + + setupPointPropagator2(propUSS, propUSL, source, u, SB); + setupPointPropagator2(propDSS, propDSL, source, d, SB); + propUSS.writeHDF5(saveDir +"sourceUSS"); + propUSL.writeHDF5(saveDir +"sourceUSL"); + propDSS.writeHDF5(saveDir +"sourceDSS"); propDSL.writeHDF5(saveDir +"sourceDSL"); + + + plegma::PLEGMA_Propagator propUSS_pack, propUSL_pack; + plegma::PLEGMA_Propagator propDSS_pack, propDSL_pack; + packPropogator(propUSS_pack, propUSS, time_f); + packPropogator(propUSL_pack, propUSL, time_f); + packPropogator(propDSS_pack, propDSS, time_f); + packPropogator(propDSL_pack, propDSL, time_f); + + PLEGMA_Propagator seqUSSDSS, seqUSLDSS, seqUSSUSS, seqUSLUSS, seqDSSDSS, seqDSLDSS; + PLEGMA_Propagator seqUSSDSS_pack, seqUSLDSS_pack, seqUSSUSS_pack, seqUSLUSS_pack, seqDSSDSS_pack, seqDSLDSS_pack; + setupSequentialPropagator2(seqUSSDSS, seqUSLDSS, propDSS, time_i, G5, momVects3pt_pi2[0], +1, u, SB); + setupSequentialPropagator2(seqUSSUSS, seqUSLUSS, propUSS, time_i, G5, momVects3pt_pi2[0], +1, u, SB); + setupSequentialPropagator2(seqDSSDSS, seqDSLDSS, propDSS, time_i, G5, momVects3pt_pi2[0], +1, d, SB); + packPropogator(seqUSSDSS_pack, seqUSSDSS, time_f); + packPropogator(seqUSLDSS_pack, seqUSLDSS, time_f); + packPropogator(seqUSSUSS_pack, seqUSSUSS, time_f); + packPropogator(seqUSLUSS_pack, seqUSLUSS, time_f); + packPropogator(seqDSSDSS_pack, seqDSSDSS, time_f); + packPropogator(seqDSLDSS_pack, seqDSLDSS, time_f); + + plegma::PLEGMA_Vector stocXi, stocG5Xi; + plegma::PLEGMA_Vector stocXi_pack, stocG5Xi_pack; + + plegma::PLEGMA_Vector stocPhiUTfSL, stocG5PhiUTfSL; + plegma::PLEGMA_Vector stocPhiDTfSL, stocG5PhiDTfSL; + + plegma::PLEGMA_Vector stocPhiUTiSL, stocPhiDTiSL, stocG5PhiUTiSL, stocG5PhiDTiSL; + plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS, stocPhiDG5Gi2TiSS; // this should acutally be Gi2G5 instead of G5Gi2, though Gi2=G5, they are the same. + plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS_pack, stocPhiDG5Gi2TiSS_pack; + { + plegma::PLEGMA_Vector3D auxVector3D; + stocXi.randInit(0000); + stocXi.stochastic_Z(4); + stocG5Xi.copy(stocXi); + stocG5Xi.apply_gamma5(); + // + packVectorD(stocXi_pack, stocXi, time_f); + packVectorD(stocG5Xi_pack, stocG5Xi, time_f); + + // stocXi.writeHDF5(saveDir + "stocXi"); + // stocXi_pack.writeHDF5(saveDir + "stocXi_pack"); + + auxVector3D.absorb(stocXi, time_f); + solve1(stocPhiUTfSL, auxVector3D, time_f, u, SL); + stocG5PhiUTfSL.copy(stocPhiUTfSL); + stocG5PhiUTfSL.apply_gamma5(); + // + auxVector3D.absorb(stocXi, time_f); + solve1(stocPhiDTfSL, auxVector3D, time_f, d, SL); + stocG5PhiDTfSL.copy(stocPhiDTfSL); + stocG5PhiDTfSL.apply_gamma5(); + + auxVector3D.absorb(stocXi, time_i); + auxVector3D.mulMomentumPhases(momVects3pt_pi2[0], -1); + solve1(stocPhiUTiSL, auxVector3D, time_i, u, SL); + stocG5PhiUTiSL.copy(stocPhiUTiSL); + stocG5PhiUTiSL.apply_gamma5(); + solve1(stocPhiDTiSL, auxVector3D, time_i, d, SL); + stocG5PhiDTiSL.copy(stocPhiDTiSL); + stocG5PhiDTiSL.apply_gamma5(); + // + auxVector3D.absorb(stocXi, time_i); + // apply g5*g5=ID + // auxVector3D.mulMomentumPhases(momVects3pt_pi2[0],+1); + solve1(stocPhiUG5Gi2TiSS, auxVector3D, time_i, u, SS); + solve1(stocPhiDG5Gi2TiSS, auxVector3D, time_i, d, SS); + packVectorD(stocPhiUG5Gi2TiSS_pack, stocPhiUG5Gi2TiSS, time_f); + packVectorD(stocPhiDG5Gi2TiSS_pack, stocPhiDG5Gi2TiSS, time_f); + } + + PLEGMA_Propagator phiV31; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, gscatts_c_temp, seqUSLDSS); + // auxV3.writeHDF5(saveDir + "temp1"); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + auxVector1.zero_where(BOTH); + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + // if (isc == 5) + // auxVector3D.writeHDF5(saveDir + "temp2"); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + // double *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + auxVector1.absorb(auxVector3D1, dt, false); + } + // if (isc == 5) + // auxVector1.writeHDF5(saveDir + "temp3"); + phiV31.absorb(auxVector1, isc / 3, isc % 3); + } + // phiV31.writeHDF5(saveDir + "temp4"); + } + + PLEGMA_Propagator phiV31UU; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, gscatts_c_temp, seqUSLUSS); + // auxV3.writeHDF5(saveDir + "temp1"); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + auxVector1.zero_where(BOTH); + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + // if (isc == 5) + // auxVector3D.writeHDF5(saveDir + "temp2"); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + // double *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + auxVector1.absorb(auxVector3D1, dt, false); + } + // if (isc == 5) + // auxVector1.writeHDF5(saveDir + "temp3"); + phiV31UU.absorb(auxVector1, isc / 3, isc % 3); + } + // phiV31.writeHDF5(saveDir + "temp4"); + } + PLEGMA_Propagator phiV31DD; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c_temp, seqDSLDSS); + // auxV3.writeHDF5(saveDir + "temp1"); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + auxVector1.zero_where(BOTH); + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + // if (isc == 5) + // auxVector3D.writeHDF5(saveDir + "temp2"); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + // double *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + auxVector1.absorb(auxVector3D1, dt, false); + } + // if (isc == 5) + // auxVector1.writeHDF5(saveDir + "temp3"); + phiV31DD.absorb(auxVector1, isc / 3, isc % 3); + } + // phiV31.writeHDF5(saveDir + "temp4"); + } + + PLEGMA_Propagator phiV32; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, gscatts_c_temp, propUSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV32.absorb(auxVector1, isc / 3, isc % 3); + } + } + PLEGMA_Propagator phiV32_DD; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV32_DD.absorb(auxVector1, isc / 3, isc % 3); + } + } + + + PLEGMA_Propagator phiV33; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV33.absorb(auxVector1, isc / 3, isc % 3); + } + } + + PLEGMA_Propagator phiV34; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTiSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocPhiUG5Gi2TiSS_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV34.absorb(auxVector1, isc / 3, isc % 3); + } + } + PLEGMA_Propagator phiV34_UUU; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTiSL); + auxV3.V3(auxVector, gscatts_c_temp, propUSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocPhiUG5Gi2TiSS_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV34_UUU.absorb(auxVector1, isc / 3, isc % 3); + } + } + PLEGMA_Propagator phiV34_DDD; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTiSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); + + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocPhiDG5Gi2TiSS_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + double *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV34_DDD.absorb(auxVector1, isc / 3, isc % 3); + } + } + + auto outputfile = [&](plegma::PLEGMA_ScattCorrelator sc, std::string filename, bool sgn) + { + // momentum phase for pi1 + double phase = 2 * M_PI / (double)HGC_totalL[0] * momVects3pt_pi1[0][0] * source[0] + + 2 * M_PI / (double)HGC_totalL[1] * momVects3pt_pi1[0][1] * source[1] + + 2 * M_PI / (double)HGC_totalL[2] * momVects3pt_pi1[0][2] * source[2]; + double expPhase[2] = {cos(phase), sin(phase)}; + x_e_cx(sc.H_elem(), expPhase, sc.getTotalSize()); + + // additional sign coming from my Mathematica codes + double overall_sign[2] = {-1., 0.}; + if (sgn) + x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); + + if (time_f < time_i) + x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); + // sc.applyBoundaryConditions(true); + sc.writeHDF5(saveDir + filename); + }; + + // p_ju_p&pi0u + // B + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV31UU); + outputfile(cont, "Diagram_uuB1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV31UU, propDSS_pack); + outputfile(cont, "Diagram_uuB2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV31UU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuB3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV31UU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuB4", false); + } + // W + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, seqUSSUSS_pack, phiV32, propDSS_pack); + outputfile(cont, "Diagram_uuW1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, seqUSSUSS_pack, propDSS_pack, phiV32); + outputfile(cont, "Diagram_uuW2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV32, propDSS_pack, seqUSSUSS_pack); + outputfile(cont, "Diagram_uuW3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV32, seqUSSUSS_pack, propDSS_pack); + outputfile(cont, "Diagram_uuW4", false); + } + // Z + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV34_UUU); + outputfile(cont, "Diagram_uuZ1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV34_UUU, propDSS_pack); + outputfile(cont, "Diagram_uuZ2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV34_UUU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuZ3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV34_UUU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuZ4", false); + } + + // p_jd_p&pi0u + // W + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, phiV32_DD, seqUSSUSS_pack); + outputfile(cont, "Diagram_duW1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV32_DD, seqUSSUSS_pack); + outputfile(cont, "Diagram_duW2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, seqUSSUSS_pack, phiV32_DD, propUSS_pack); + outputfile(cont, "Diagram_duW3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, seqUSSUSS_pack, phiV32_DD, propUSS_pack); + outputfile(cont, "Diagram_duW4", false); + } + + // p_ju_p&pi0d + // W + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, seqDSSDSS_pack, phiV32); + outputfile(cont, "Diagram_udW1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV32, seqDSSDSS_pack); + outputfile(cont, "Diagram_udW2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV32, seqDSSDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_udW3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV32, seqDSSDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_udW4", false); + } + + // p_jd_p&pi0d + // B + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV31DD, propUSS_pack); + outputfile(cont, "Diagram_ddB1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, phiV31DD, propUSS_pack); + outputfile(cont, "Diagram_ddB2", false); + } + // V_reduction version + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, momVects3pt_pf1); + auxVector.copy(stocG5Xi_pack); + // auxVector.writeHDF5(saveDir + "t1"); + // propUSS_pack.writeHDF5(saveDir + "t2"); + // propUSS.writeHDF5(saveDir + "t3"); + // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); + + auxV24.V2(auxVector, gscatts_N, propUSS_pack, propUSS_pack); // this and the above line won't produce the same V4, but the same cont3 + auxVector.writeHDF5(saveDir + "test_V2_1"); + propUSS_pack.writeHDF5(saveDir + "test_V2_2"); + auxV24.writeHDF5(saveDir + "test_V2"); + + + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c, seqDSLDSS); + auxVector.writeHDF5(saveDir + "test_V3_1"); + seqDSLDSS.writeHDF5(saveDir + "test_V3_2"); + auxV3.writeHDF5(saveDir + "test_V3"); + + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momList3pt); + cont.initialize_diagram(gscatts_ID, gscatts_ID, gscatts_N, gscatts_pi, gscatts_N, gscatts_c, "12", "B12"); + cont.B_diagrams(auxV3, auxV24, 0, 7, true); + outputfile(cont, "Diagram_ddB1_V", false); + } + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, momVects3pt_pf1); + auxVector.copy(stocG5Xi_pack); + // auxVector.writeHDF5(saveDir + "t1"); + // propUSS_pack.writeHDF5(saveDir + "t2"); + // propUSS.writeHDF5(saveDir + "t3"); + // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); + auxV24.V2(auxVector, gscatts_N, propUSS_pack, propUSS_pack); // this and the above line won't produce the same V4, but the same cont3 + // auxV4.writeHDF5(saveDir + "auxV4"); + + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c, seqDSLDSS); + // auxVector.writeHDF5(saveDir + "auxVector"); + // seqUSLDSS.writeHDF5(saveDir + "seqUSLDSS"); + // auxV3.writeHDF5(saveDir + "auxV3"); + + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momList3pt); + cont.initialize_diagram(gscatts_ID, gscatts_ID, gscatts_N, gscatts_pi, gscatts_N, gscatts_c, "12", "B12"); + cont.B_diagrams(auxV3, auxV24, 0, 8, true); + outputfile(cont, "Diagram_ddB2_V", false); + } + // Z + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV34_DDD, propUSS_pack); + outputfile(cont, "Diagram_ddZ1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, phiV34_DDD, propUSS_pack); + outputfile(cont, "Diagram_ddZ2", false); + } + + // p_ju_n&pi+ B: + plegma::PLEGMA_ScattCorrelator cont1(sourceZero, momVects3pt_pf1); + cont1.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV31); + outputfile(cont1, "cont1", true); // signs: Gf^t + + plegma::PLEGMA_ScattCorrelator cont2(sourceZero, momVects3pt_pf1); + cont2.T1(gscatts_N, gscatts_N, propUSS_pack, phiV31, propDSS_pack); + outputfile(cont2, "cont2", false); + + plegma::PLEGMA_ScattCorrelator cont3(sourceZero, momVects3pt_pf1); + cont3.T2(gscatts_N, gscatts_N, phiV31, propDSS_pack, propUSS_pack); + outputfile(cont3, "cont3", true); // signs: Gf^t + + plegma::PLEGMA_ScattCorrelator cont4(sourceZero, momVects3pt_pf1); + cont4.T1(gscatts_N, gscatts_N, phiV31, propUSS_pack, propDSS_pack); + outputfile(cont4, "cont4", true); // signs: Gfi1^t + + // p_ju_n&pi+ W: + + plegma::PLEGMA_ScattCorrelator cont5(sourceZero, momVects3pt_pf1); + cont5.T2(gscatts_N, gscatts_N, seqUSSDSS_pack, phiV32, propDSS_pack); + outputfile(cont5, "cont5", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont6(sourceZero, momVects3pt_pf1); + cont6.T1(gscatts_N, gscatts_N, seqUSSDSS_pack, phiV32, propDSS_pack); + outputfile(cont6, "cont6", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont7(sourceZero, momVects3pt_pf1); + cont7.T1(gscatts_N, gscatts_N, phiV32, propDSS_pack, seqUSSDSS_pack); + outputfile(cont7, "cont7", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont8(sourceZero, momVects3pt_pf1); + cont8.T1(gscatts_N, gscatts_N, phiV32, seqUSSDSS_pack, propDSS_pack); + outputfile(cont8, "cont8", false); // signs: + + // p_jd_n&pi+ W: + + plegma::PLEGMA_ScattCorrelator cont9(sourceZero, momVects3pt_pf1); + cont9.T1(gscatts_N, gscatts_N, propUSS_pack, phiV33, seqUSSDSS_pack); + outputfile(cont9, "cont9", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont10(sourceZero, momVects3pt_pf1); + cont10.T1(gscatts_N, gscatts_N, propUSS_pack, seqUSSDSS_pack, phiV33); + outputfile(cont10, "cont10", false); // signs: + + plegma::PLEGMA_ScattCorrelator cont11(sourceZero, momVects3pt_pf1); + cont11.T2(gscatts_N, gscatts_N, seqUSSDSS_pack, phiV33, propUSS_pack); + outputfile(cont11, "cont11", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont12(sourceZero, momVects3pt_pf1); + cont12.T1(gscatts_N, gscatts_N, seqUSSDSS_pack, propUSS_pack, phiV33); + outputfile(cont12, "cont12", true); // signs: Gfi1^t + + // p_jd_n&pi+ Z: + + plegma::PLEGMA_ScattCorrelator cont13(sourceZero, momVects3pt_pf1); + cont13.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV34); + outputfile(cont13, "cont13", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont14(sourceZero, momVects3pt_pf1); + cont14.T1(gscatts_N, gscatts_N, propUSS_pack, phiV34, propDSS_pack); + outputfile(cont14, "cont14", false); // signs: + + plegma::PLEGMA_ScattCorrelator cont15(sourceZero, momVects3pt_pf1); + cont15.T2(gscatts_N, gscatts_N, phiV34, propDSS_pack, propUSS_pack); + outputfile(cont15, "cont15", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont16(sourceZero, momVects3pt_pf1); + cont16.T1(gscatts_N, gscatts_N, phiV34, propUSS_pack, propDSS_pack); + outputfile(cont16, "cont16", true); // signs: Gfi1^t + + // V reductions version + // { // B12 + // plegma::PLEGMA_Vector auxVector; + // plegma::PLEGMA_ScattCorrelator auxV4(sourceZero, momVects3pt_pf1); + // auxVector.copy(stocG5Xi_pack); + // auxVector.writeHDF5(saveDir + "t1"); + // propUSS_pack.writeHDF5(saveDir + "t2"); + // propUSS.writeHDF5(saveDir + "t3"); + // // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); + // auxV4.V4(auxVector, GN, propUSS_pack, propDSS_pack); // this and the above line won't produce the same V4, but the same cont3 + // auxV4.writeHDF5(saveDir + "auxV4"); + + // plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + // auxVector.copy(stocG5PhiDTfSL); + // auxV3.V3(auxVector, Gc, seqUSLDSS); + // // auxVector.writeHDF5(saveDir + "auxVector"); + // // seqUSLDSS.writeHDF5(saveDir + "seqUSLDSS"); + // auxV3.writeHDF5(saveDir + "auxV3"); + + // plegma::PLEGMA_ScattCorrelator cont3V(sourceZero, momList); + // cont3V.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); + // cont3V.B_diagrams(auxV3, auxV4, 0, 12, true); + // outputfile(cont3V, "cont3V", false); + // } + + // { // Z11 + // plegma::PLEGMA_Vector auxVector; + // plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, momVects3pt_pf1); + // auxVector.copy(stocPhiUG5Gi2TiSS_pack); + // auxV24.V2(auxVector, GN, propDSS_pack, propUSS_pack); + // auxV24.writeHDF5(saveDir + "Z11auxV24"); + + // plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + // auxVector.copy(stocG5PhiUTiSL); + // auxV3.V3(auxVector, Gc, propDSL); + // auxV3.writeHDF5(saveDir + "Z11auxV3"); + + // plegma::PLEGMA_ScattCorrelator contZ11(sourceZero, momList); + // contZ11.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); + // contZ11.Z_diagrams_without_dilution(auxV3, auxV24, 0, 11); + // outputfile(contZ11, "contZ11", false); + // } + } + + finalize(); + return 0; +} From d51d935a3930ae5cac8fd8c355d540aec8044184 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Fri, 10 Nov 2023 15:17:05 +0100 Subject: [PATCH 103/168] Implemented contraction for MesonsOpen. --- include/PLEGMA_Correlator.h | 5 +++++ lib/PLEGMA_Correlator.cu | 16 ++++++++++++++++ lib/kernels/PLEGMA_kernel_getSet.cuh | 24 ++++++++++++++++++++++++ plegma/pion_LowModeAvg.cpp | 25 +++++++++++++++++-------- 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/include/PLEGMA_Correlator.h b/include/PLEGMA_Correlator.h index 8ff7a189..c83090c8 100644 --- a/include/PLEGMA_Correlator.h +++ b/include/PLEGMA_Correlator.h @@ -201,6 +201,11 @@ namespace plegma { void contractMesonsNew(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2); + + void contractMesonsOpen(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + bool all_cols=true); + void contractMesonsAll(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2); diff --git a/lib/PLEGMA_Correlator.cu b/lib/PLEGMA_Correlator.cu index 47b2bd72..8d553818 100644 --- a/lib/PLEGMA_Correlator.cu +++ b/lib/PLEGMA_Correlator.cu @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,21 @@ contractMesonsNew(PLEGMA_Propagator &prop1, contract_mesons_new(prop1,prop2,*this); } +template +void PLEGMA_Correlator:: +contractMesonsOpen(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + bool all_cols){ + + shape = {4,4,4,4}; + datasets = {"twop_meson_open"}; + groups = {"mesons"}; + description = "open_indeces, prop1_mu,nu prop2_ku,lu"; + + initialize(); + contract_mesons_open(prop1,prop2,*this,all_cols); +} + template void PLEGMA_Correlator:: contractMesonsAll(PLEGMA_Propagator &prop1, diff --git a/lib/kernels/PLEGMA_kernel_getSet.cuh b/lib/kernels/PLEGMA_kernel_getSet.cuh index 32c165a3..fee5dfb2 100644 --- a/lib/kernels/PLEGMA_kernel_getSet.cuh +++ b/lib/kernels/PLEGMA_kernel_getSet.cuh @@ -845,6 +845,30 @@ namespace plegma { sidStride::shift(dirs ...); get(P); } + + template + inline __device__ void get(Float2 P[N_SPINS][N_SPINS][N_COLS][COLS]) const { + #pragma unroll + for(short mu = 0 ; mu < N_SPINS ; mu++) + #pragma unroll + for(short nu = 0 ; nu < N_SPINS ; nu++) + #pragma unroll + for(short c1 = 0 ; c1 < N_COLS ; c1++) + #pragma unroll + for(short c2 = 0 ; c2 < COLS ; c2++) + P[mu][nu][c1][c2] = get(mu, nu, c1, c2); + } + template + inline __device__ void get(Float2 P[N_SPINS][N_SPINS][N_COLS][COLS], const size_t& sid) { + sidStride::setSid(sid); + get(P); + } + template + inline __device__ void get(Float2 P[N_SPINS][N_SPINS][N_COLS][COLS], const size_t& sid, const dir_t&... dirs) { + sidStride::setSid(sid); + sidStride::shift(dirs ...); + get(P); + } }; template diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp index b6bd287a..8de00406 100644 --- a/plegma/pion_LowModeAvg.cpp +++ b/plegma/pion_LowModeAvg.cpp @@ -65,7 +65,16 @@ int main(int argc, char **argv) //Initializing solver. updateOptions(LIGHT); - TIME(QUDA_solver solver(mu)); + TIME(QUDA_solver *solver = new QUDA_solver(mu)); + QudaInvertParam inv_params = solver->getInvParams(); + + QUDA_dirac *D = nullptr; + if(inv_params.dslash_type == QUDA_TWISTED_CLOVER_DSLASH) + D = new QUDA_dirac(QUDA_CLOVER_WILSON_DSLASH); + else if (inv_params.dslash_type == QUDA_TWISTED_MASS_DSLASH) + D = new QUDA_dirac(QUDA_WILSON_DSLASH); + else + PLEGMA_error("Only QUDA_TWISTED_CLOVER_DSLASH and QUDA_TWISTED_MASS_DSLASH are allowed for the one-end trick"); //Initializing stochastic vector using given random seed. PLEGMA_Vector vector_stoc; @@ -132,17 +141,18 @@ int main(int argc, char **argv) //double eigVal = std::get<0>(eigSol->getEigVals()[i]); //Doesn't this only get the real part of the eigenvector? Only real eigenvalues if Dirac operator is hermitian. However, here we have to take the twisted mass parameter into account! long int iorder = std::get<3>(eigSol->getEigVals()[i]); double *eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; - PLEGMA_memcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); + PLEGMA_memcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); // cudaMemcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); //Copy eigVec_tmp (host) to eigVec (device). //checkCudaError(); - + //TIME(D->apply(eigVecD,eigVec)); + for(int j=0; j < eigSol->getEigVals().size(); j++){ PLEGMA_ScattCorrelator corr(site({0,0,0,tsink}), maxQsq); //std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; //std::vector glist_sink={ID}; std::string dataset_name = std::to_string(i) + std::to_string(j); //TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); - TIME(corr.initialize_diagram(glist_test, glist_sink, "P")); + TIME(corr.initialize_diagram(glist_test, glist_sink, "P")); //double eigValP = std::get<0>(eigSol->getEigVals()[j]); iorder = std::get<3>(eigSol->getEigVals()[j]); @@ -150,14 +160,13 @@ int main(int argc, char **argv) PLEGMA_memcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); // cudaMemcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); //checkCudaError(); - eigVecP.apply_gamma5(); //Make eigVecP a left eigenvector by applying gamma5. - TIME(D->apply(eigVecD,eigVecP)); - + eigVecP.apply_gamma5(); //Make eigVecP a right eigenvector by applying gamma5. + TIME(D->apply(eigVecD,eigVecP)); //PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); //PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); //TIME(corr.PhiPhi(eigVec, glist_src, eigVecP)); - TIME(corr.PhiPhi(eigVec, glist_test, eigVecD)); + TIME(corr.PhiPhi(eigVec, glist_test, eigVecD)); corr.setDatasets((std::vector) {dataset_name}); TIME(corr.writeHDF5( outfilename )); } From c782a794a94f6a6aad0f97130dc70a57dbeba566 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Tue, 14 Nov 2023 09:21:13 +0100 Subject: [PATCH 104/168] fixing transpose sign for those involving PhiPhi --- include/PLEGMA_ScattCorrelator.h | 2 +- lib/PLEGMA_ScattCorrelator.cu | 11 +- plegma/testYan.cpp | 831 +++++++++++++++++++++++++++---- 3 files changed, 732 insertions(+), 112 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 78227a7f..5695a487 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -198,7 +198,7 @@ namespace plegma { * @param PLEGMA_Propagator &S3: propagator 3: won't be transposed **/ void T2( std::vector &Gammas_i, std::vector &Gammas_f, PLEGMA_Propagator &S1, PLEGMA_Propagator &S2, PLEGMA_Propagator &S3 ); - void PhiPhi( PLEGMA_Vector &Phi_0, std::vector &Gammas, PLEGMA_Vector &Phi_1 ); + void PhiPhi( PLEGMA_Vector &Phi_0, std::vector &Gammas, PLEGMA_Vector &Phi_1 , bool transpQ = false); //manipulation //Note that in the case of oet B, W diagram g0 refers not to gamma_i2 but to gamma_f2 diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 364ec854..ce2c6206 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -334,7 +334,7 @@ void PLEGMA_ScattCorrelator::T2( std::vector &Gammas_i, std } template -void PLEGMA_ScattCorrelator::PhiPhi( PLEGMA_Vector &Phi_0, std::vector &Gammas, PLEGMA_Vector &Phi_1) { +void PLEGMA_ScattCorrelator::PhiPhi( PLEGMA_Vector &Phi_0, std::vector &Gammas, PLEGMA_Vector &Phi_1, bool transpQ) { int n_gammas = Gammas.size(); this->GList.clear(); @@ -354,6 +354,9 @@ void PLEGMA_ScattCorrelator::PhiPhi( PLEGMA_Vector &Phi_0, std::ve assert(this->source[i]==0); PhixGxPhi_k( *this, Phi_0, Gammas, Phi_1); + if(transpQ){ + this->apply_sign_transp(0); + } } //This routine filters the source time-slice from a PLEGMA_ScattCorrelator //object: i.e. it return all the momenta, gamma, spin, real-imag components @@ -2370,7 +2373,7 @@ void PLEGMA_ScattCorrelator::P_diagrams( std::vector //PhixGf2xPhi //pipi_aux.PhiPhi( Phi_0[beta], this->GList[1], Phi_1[alfa]); //T x N_moms x n_gammas_f2 std::vector tmpGf2 = apply_gamma5_scatt_gamma( this->GList[1], LEFT); - pipi_aux.PhiPhi( phi0beta, tmpGf2, phi1alfa); //T x N_moms x n_gammas_f2 + pipi_aux.PhiPhi( phi0beta, tmpGf2, phi1alfa, true); //T x N_moms x n_gammas_f2 if(i_pi2==-1){ for( int im=0; im::P_diagrams( PLEGMA_Vector &Phi_0, PLE std::vector tmpGf2 = apply_gamma5_scatt_gamma( this->GList[1], LEFT); double norm1=Phi_0.norm(); double norm2=Phi_1.norm(); - pipi_aux.PhiPhi( Phi_0, tmpGf2, Phi_1); //T x N_moms x n_gammas_f2 + pipi_aux.PhiPhi( Phi_0, tmpGf2, Phi_1, true); //T x N_moms x n_gammas_f2 Float g[2]; g[0]=-1;//eq 13 g[1]=0; @@ -2471,7 +2474,7 @@ void PLEGMA_ScattCorrelator::Loop_diagrams( PLEGMA_Vector &Phi_0, clear_output(!accum); PLEGMA_ScattCorrelator auxPhiPhi(this->source, pList(), this->getTotalT()); - auxPhiPhi.PhiPhi(Phi_0, GList[0], Phi_1); + auxPhiPhi.PhiPhi(Phi_0, GList[0], Phi_1, true); x_pe_sy(this->H_elem(), (Float) -1., auxPhiPhi.H_elem(), this->getTotalSize()); } diff --git a/plegma/testYan.cpp b/plegma/testYan.cpp index 1d5f8a09..9ca89178 100644 --- a/plegma/testYan.cpp +++ b/plegma/testYan.cpp @@ -10,6 +10,37 @@ std::vector runtime; extern int device; static std::vector listOpt = {"verbosity", "load-gauge", "momlisttwopt-filename", "momlistthreept-filename", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss"}; +auto packVector = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) +{ + PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(in, timeSlice, true); + + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + out.absorb(auxVector3D, dt, false); + } +}; +auto packVectorD = [](plegma::PLEGMA_Vector &out, plegma::PLEGMA_Vector &in, int timeSlice) +{ + PLEGMA_Vector3D auxVector3D; + auxVector3D.absorb(in, timeSlice, true); + + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + out.absorb(auxVector3D, dt, false); + } +}; +auto packPropogator = [](plegma::PLEGMA_Propagator &out, plegma::PLEGMA_Propagator &in, int timeSlice) +{ + PLEGMA_Vector auxVector; + for (int isc = 0; isc < 12; isc++) + { + auxVector.absorb(in, isc / 3, isc % 3); + packVector(auxVector, auxVector, timeSlice); + out.absorb(auxVector, isc / 3, isc % 3); + } +}; + int main(int argc, char **argv) { /****************************************************** @@ -183,49 +214,50 @@ int main(int argc, char **argv) }; #endif -#if 0 // setupSequentialPropagator - auto ToolYan::setupSequentialPropagator = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) - { - if (s < single2double) - { - plegma::PLEGMA_Vector auxVectorD; - plegma::PLEGMA_Vector auxVectorF; - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3DF; - - for (int isc = 0; isc < 12; isc++) - { - auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); - auxVector3DF.apply_gamma(Gamma); - auxVector3DF.mulMomentumPhases(mom, momSign); - auxVector3DD.copy(auxVector3DF); - solve(auxVectorD, auxVector3DD, inTime, f, s); - auxVectorF.copy(auxVectorD); - outS.absorb(auxVectorF, isc / 3, isc % 3); - } - } - else - { - plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; - plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; - plegma::PLEGMA_Vector3D auxVector3DD; - plegma::PLEGMA_Vector3D auxVector3DF; - - for (int isc = 0; isc < 12; isc++) - { - auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); - // auxVector3DF.apply_gamma_scatt(G_5); - auxVector3DF.apply_gamma(Gamma); - auxVector3DF.mulMomentumPhases(mom, momSign); - auxVector3DD.copy(auxVector3DF); - solve(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); - auxVectorFS.copy(auxVectorDS); - auxVectorFL.copy(auxVectorDL); - outS.absorb(auxVectorFS, isc / 3, isc % 3); - outL.absorb(auxVectorFL, isc / 3, isc % 3); - } - } - }; +#if 1 // setupSequentialPropagator + auto setupSequentialPropagator1 = [&](plegma::PLEGMA_Propagator &out, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + assert(s < single2double); + + plegma::PLEGMA_Vector auxVectorD; + plegma::PLEGMA_Vector auxVectorF; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve1(auxVectorD, auxVector3DD, inTime, f, s); + auxVectorF.copy(auxVectorD); + out.absorb(auxVectorF, isc / 3, isc % 3); + } + }; + auto setupSequentialPropagator2 = [&](plegma::PLEGMA_Propagator &outS, plegma::PLEGMA_Propagator &outL, plegma::PLEGMA_Propagator &in, int inTime, plegma::GAMMAS Gamma, std::vector mom, int momSign, FlavorYan f, SmearFlagYan s) + { + assert(s > single2double); + + plegma::PLEGMA_Vector auxVectorDS, auxVectorDL; + plegma::PLEGMA_Vector auxVectorFS, auxVectorFL; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3DF; + + for (int isc = 0; isc < 12; isc++) + { + auxVector3DF.absorb(in, inTime, isc / 3, isc % 3); + // auxVector3DF.apply_gamma_scatt(G_5); + auxVector3DF.apply_gamma(Gamma); + auxVector3DF.mulMomentumPhases(mom, momSign); + auxVector3DD.copy(auxVector3DF); + solve2(auxVectorDS, auxVectorDL, auxVector3DD, inTime, f, s); + auxVectorFS.copy(auxVectorDS); + auxVectorFL.copy(auxVectorDL); + outS.absorb(auxVectorFS, isc / 3, isc % 3); + outL.absorb(auxVectorFL, isc / 3, isc % 3); + } + }; #endif #endif @@ -244,6 +276,7 @@ int main(int argc, char **argv) std::vector gscatts_ID = {ID}; std::vector gscatts_N = {CG_5}; std::vector gscatts_pi = {G_5}; + std::vector gscatts_c_temp = {G_4}; std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; @@ -264,7 +297,9 @@ int main(int argc, char **argv) if (momList3pt.empty()) PLEGMA_error("threept momentumList empty"); auto momVects3pt_pi2 = momList3pt.uniq_p(0); + auto momVects3pt_pf1 = momList3pt.uniq_p(1); auto momVects3pt_pc = momList3pt.uniq_p(3); + auto momVects3pt_pi1 = momList3pt.pi1(); plegma::momList momList3pt_pc(1, {momVects3pt_pc}, {0}); /****************************************************** @@ -273,93 +308,675 @@ int main(int argc, char **argv) * ******************************************************/ - struct plegma::site source({1, 2, 3, 4}); - struct plegma::site source_reduction({0, 0, 0, 4}); - - plegma::PLEGMA_Propagator propU, propD; - setupPointPropagator1(propU, source, u, LL); - setupPointPropagator1(propD, source, d, LL); - - std::vector glist_source_nucleon = {CG_5}; - std::vector glist_sink_nucleon = {CG_5}; - - std::vector glist_source_meson = {G_5}; - std::vector glist_sink_meson = {G_5}; - - std::vector glist_source_nucleon_unpaired = {ID}; - std::vector glist_sink_nucleon_unpaired = {ID}; - - momList sourcemomentumList_threept(4, pathListMomenta_threept, {1, 2, 3}); + std::string saveDir = "tempData/"; - momList sourcemomentumList_twopt(3, pathListMomenta_twopt, {1, 2}); - - std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); - momList list_mpi2_threept(1, {mpi2_threept}, {0}); - for (int i_mpi2 = 0; i_mpi2 < mpi2_threept.size(); ++i_mpi2) + struct plegma::site source({1, 2, 3, 4}); + struct plegma::site sourceZero({0, 0, 0, 4}); + + int time_fi = 10; + int time_i = source[DIM_T], time_f = (source[DIM_T] + time_fi) % HGC_totalL[3]; + + plegma::PLEGMA_Propagator propUSS, propUSL; + plegma::PLEGMA_Propagator propDSS, propDSL; + + setupPointPropagator2(propUSS, propUSL, source, u, SB); + setupPointPropagator2(propDSS, propDSL, source, d, SB); + + plegma::PLEGMA_Propagator propUSS_pack, propUSL_pack; + plegma::PLEGMA_Propagator propDSS_pack, propDSL_pack; + packPropogator(propUSS_pack, propUSS, time_f); + packPropogator(propUSL_pack, propUSL, time_f); + packPropogator(propDSS_pack, propDSS, time_f); + packPropogator(propDSL_pack, propDSL, time_f); + + PLEGMA_Propagator seqUSSDSS, seqUSLDSS, seqUSSUSS, seqUSLUSS, seqDSSDSS, seqDSLDSS; + PLEGMA_Propagator seqUSSDSS_pack, seqUSLDSS_pack, seqUSSUSS_pack, seqUSLUSS_pack, seqDSSDSS_pack, seqDSLDSS_pack; + setupSequentialPropagator2(seqUSSDSS, seqUSLDSS, propDSS, time_i, G5, momVects3pt_pi2[0], +1, u, SB); + setupSequentialPropagator2(seqUSSUSS, seqUSLUSS, propUSS, time_i, G5, momVects3pt_pi2[0], +1, u, SB); + setupSequentialPropagator2(seqDSSDSS, seqDSLDSS, propDSS, time_i, G5, momVects3pt_pi2[0], +1, d, SB); + packPropogator(seqUSSDSS_pack, seqUSSDSS, time_f); + packPropogator(seqUSLDSS_pack, seqUSLDSS, time_f); + packPropogator(seqUSSUSS_pack, seqUSSUSS, time_f); + packPropogator(seqUSLUSS_pack, seqUSLUSS, time_f); + packPropogator(seqDSSDSS_pack, seqDSSDSS, time_f); + packPropogator(seqDSLDSS_pack, seqDSLDSS, time_f); + + plegma::PLEGMA_Vector stocXi, stocG5Xi; + plegma::PLEGMA_Vector stocXi_pack, stocG5Xi_pack; + + plegma::PLEGMA_Vector stocPhiUTfSL, stocG5PhiUTfSL; + plegma::PLEGMA_Vector stocPhiDTfSL, stocG5PhiDTfSL; + + plegma::PLEGMA_Vector stocPhiUTiSL, stocPhiDTiSL, stocG5PhiUTiSL, stocG5PhiDTiSL; + plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS, stocPhiDG5Gi2TiSS; // this should acutally be Gi2G5 instead of G5Gi2, though Gi2=G5, they are the same. + plegma::PLEGMA_Vector stocPhiUG5Gi2TiSS_pack, stocPhiDG5Gi2TiSS_pack; { + plegma::PLEGMA_Vector3D auxVector3D; + stocXi.randInit(0000); + stocXi.stochastic_Z(4); + stocG5Xi.copy(stocXi); + stocG5Xi.apply_gamma5(); + // + packVectorD(stocXi_pack, stocXi, time_f); + packVectorD(stocG5Xi_pack, stocG5Xi, time_f); + + // stocXi.writeHDF5(saveDir + "stocXi"); + // stocXi_pack.writeHDF5(saveDir + "stocXi_pack"); + + auxVector3D.absorb(stocXi, time_f); + solve1(stocPhiUTfSL, auxVector3D, time_f, u, SL); + stocG5PhiUTfSL.copy(stocPhiUTfSL); + stocG5PhiUTfSL.apply_gamma5(); + // + auxVector3D.absorb(stocXi, time_f); + solve1(stocPhiDTfSL, auxVector3D, time_f, d, SL); + stocG5PhiDTfSL.copy(stocPhiDTfSL); + stocG5PhiDTfSL.apply_gamma5(); + + auxVector3D.absorb(stocXi, time_i); + auxVector3D.mulMomentumPhases(momVects3pt_pi2[0], -1); + solve1(stocPhiUTiSL, auxVector3D, time_i, u, SL); + stocG5PhiUTiSL.copy(stocPhiUTiSL); + stocG5PhiUTiSL.apply_gamma5(); + solve1(stocPhiDTiSL, auxVector3D, time_i, d, SL); + stocG5PhiDTiSL.copy(stocPhiDTiSL); + stocG5PhiDTiSL.apply_gamma5(); + // + auxVector3D.absorb(stocXi, time_i); + // apply g5*g5=ID + // auxVector3D.mulMomentumPhases(momVects3pt_pi2[0],+1); + solve1(stocPhiUG5Gi2TiSS, auxVector3D, time_i, u, SS); + solve1(stocPhiDG5Gi2TiSS, auxVector3D, time_i, d, SS); + packVectorD(stocPhiUG5Gi2TiSS_pack, stocPhiUG5Gi2TiSS, time_f); + packVectorD(stocPhiDG5Gi2TiSS_pack, stocPhiDG5Gi2TiSS, time_f); + } - auto &momentum_i2 = mpi2_threept[i_mpi2]; - // List of momenta corresponding to a fix value of p_i2 - momList filtered_sourcemomentumList = sourcemomentumList_threept.extract(momentum_i2, 0); + PLEGMA_Propagator phiV31; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, gscatts_c_temp, seqUSLDSS); + // auxV3.writeHDF5(saveDir + "temp1"); - momList filtered_sourcemomentumList_2pt = sourcemomentumList_twopt.extract(momentum_i2, 0); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + auxVector1.zero_where(BOTH); + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + // if (isc == 5) + // auxVector3D.writeHDF5(saveDir + "temp2"); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + // float *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + auxVector1.absorb(auxVector3D1, dt, false); + } + // if (isc == 5) + // auxVector1.writeHDF5(saveDir + "temp3"); + phiV31.absorb(auxVector1, isc / 3, isc % 3); + } + // phiV31.writeHDF5(saveDir + "temp4"); + } - std::vector> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); + PLEGMA_Propagator phiV31UU; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, gscatts_c_temp, seqUSLUSS); + // auxV3.writeHDF5(saveDir + "temp1"); - std::vector> mpi2_filt; - mpi2_filt.assign(mptot_filt.size(), momentum_i2); - // PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); - momList list_mpi2ptot(2, {mpi2_filt, mptot_filt}, {1}); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + auxVector1.zero_where(BOTH); + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + // if (isc == 5) + // auxVector3D.writeHDF5(saveDir + "temp2"); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + // float *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + auxVector1.absorb(auxVector3D1, dt, false); + } + // if (isc == 5) + // auxVector1.writeHDF5(saveDir + "temp3"); + phiV31UU.absorb(auxVector1, isc / 3, isc % 3); + } + // phiV31.writeHDF5(saveDir + "temp4"); + } + PLEGMA_Propagator phiV31DD; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c_temp, seqDSLDSS); + // auxV3.writeHDF5(saveDir + "temp1"); - PLEGMA_ScattCorrelator reductionsT1(source_reduction, mptot_filt); - PLEGMA_ScattCorrelator reductionsT2(source_reduction, mptot_filt); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + auxVector1.zero_where(BOTH); + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + // if (isc == 5) + // auxVector3D.writeHDF5(saveDir + "temp2"); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + // float *aux = auxV3.Corr((dt+time_i)%HGC_totalL[3], 0, 0); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + // auxVector1.absorb(auxVector3D1, dt, false); + auxVector1.absorb(auxVector3D1, dt, false); + } + // if (isc == 5) + // auxVector1.writeHDF5(saveDir + "temp3"); + phiV31DD.absorb(auxVector1, isc / 3, isc % 3); + } + // phiV31.writeHDF5(saveDir + "temp4"); + } - PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); - PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); - // PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); - // PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); + PLEGMA_Propagator phiV32; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTfSL); + auxV3.V3(auxVector, gscatts_c_temp, propUSL); - corrTproton_protonpizero1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq21"); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV32.absorb(auxVector1, isc / 3, isc % 3); + } + } + PLEGMA_Propagator phiV32_DD; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); - corrTproton_protonpizero2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq22"); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV32_DD.absorb(auxVector1, isc / 3, isc % 3); + } + } - // corrTproton_protonpizero3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq23"); - // corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, "12", "Tseq24"); + PLEGMA_Propagator phiV33; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); - // PLEGMA_ScattCorrelator corrD1ff1389(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrD1ff24710(source, filtered_sourcemomentumList_2pt); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocG5Xi_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV33.absorb(auxVector1, isc / 3, isc % 3); + } + } - corrD1ff24710.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff2-4-7-10"); - // corrD1ff1389.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "D1ff1-3-8-9"); + PLEGMA_Propagator phiV34; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTiSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); - TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, propU, propD, propU)); - TIME(corrTproton_protonpizero1.convertTreductiontoDiagram(reductionsT1, 0, false, true, true)); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocPhiUG5Gi2TiSS_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV34.absorb(auxVector1, isc / 3, isc % 3); + } + } + PLEGMA_Propagator phiV34_UUU; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiDTiSL); + auxV3.V3(auxVector, gscatts_c_temp, propUSL); - TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, propU, propD, propU)); - TIME(corrTproton_protonpizero2.convertTreductiontoDiagram(reductionsT2, 0, false, true, true)); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocPhiUG5Gi2TiSS_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV34_UUU.absorb(auxVector1, isc / 3, isc % 3); + } + } + PLEGMA_Propagator phiV34_DDD; + { + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + plegma::PLEGMA_Vector auxVector; + auxVector.copy(stocG5PhiUTiSL); + auxV3.V3(auxVector, gscatts_c_temp, propDSL); - TIME(corrD1ff24710.LT_diagrams(reductionsT1, reductionsT2, 1)); - corrD1ff24710.writeHDF5("test_D"); - // TIME(produceOutput_2pt_packed(corrD1ff24710, outfilename, "T", parallel_sources, attract_lookup_table)); + for (int isc = 0; isc < 12; isc++) + { + plegma::PLEGMA_Vector auxVector1; + plegma::PLEGMA_Vector3D auxVector3DD; + plegma::PLEGMA_Vector3D auxVector3D; + auxVector3DD.absorb(stocPhiDG5Gi2TiSS_pack, time_f, true); + auxVector3D.copy(auxVector3DD); + for (int dt = 0; dt < HGC_totalL[3]; dt++) + { + plegma::PLEGMA_Vector3D auxVector3D1; + auxVector3D1.copy(auxVector3D); + float *aux = auxV3.Corr(dt, 0, 0); + std::complex auxC(aux[2 * isc + 0], aux[2 * isc + 1]); + auxVector3D1.cscale(auxC); + auxVector1.absorb(auxVector3D1, dt, false); + } + phiV34_DDD.absorb(auxVector1, isc / 3, isc % 3); + } + } - // TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - // TIME(corrTproton_protonpizero3.convertTreductiontoDiagram(reductionsT1, 0, false, true, true)); + auto outputfile = [&](plegma::PLEGMA_ScattCorrelator sc, std::string filename, bool sgn) + { + // momentum phase for pi1 + float phase = 2 * M_PI / (float)HGC_totalL[0] * momVects3pt_pi1[0][0] * source[0] + + 2 * M_PI / (float)HGC_totalL[1] * momVects3pt_pi1[0][1] * source[1] + + 2 * M_PI / (float)HGC_totalL[2] * momVects3pt_pi1[0][2] * source[2]; + float expPhase[2] = {cos(phase), sin(phase)}; + x_e_cx(sc.H_elem(), expPhase, sc.getTotalSize()); + + // additional sign coming from my Mathematica codes + float overall_sign[2] = {-1., 0.}; + if (sgn) + x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); + + if (time_f < time_i) + x_e_cx(sc.H_elem(), overall_sign, sc.getTotalSize()); + // sc.applyBoundaryConditions(true); + sc.writeHDF5(saveDir + filename); + }; - // TIME(reductionsT1.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); - // TIME(corrTproton_protonpizero4.convertTreductiontoDiagram(reductionsT1, 0, false, true, true)); + // p_ju_p&pi0u + // B + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV31UU); + outputfile(cont, "Diagram_uuB1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV31UU, propDSS_pack); + outputfile(cont, "Diagram_uuB2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV31UU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuB3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV31UU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuB4", false); + } + // W + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, seqUSSUSS_pack, phiV32, propDSS_pack); + outputfile(cont, "Diagram_uuW1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, seqUSSUSS_pack, propDSS_pack, phiV32); + outputfile(cont, "Diagram_uuW2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV32, propDSS_pack, seqUSSUSS_pack); + outputfile(cont, "Diagram_uuW3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV32, seqUSSUSS_pack, propDSS_pack); + outputfile(cont, "Diagram_uuW4", false); + } + // Z + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV34_UUU); + outputfile(cont, "Diagram_uuZ1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV34_UUU, propDSS_pack); + outputfile(cont, "Diagram_uuZ2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV34_UUU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuZ3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV34_UUU, propDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_uuZ4", false); + } - // TIME(corrD1ff1389.LT_diagrams(reductionsT1, reductionsT2, 1)); - // TIME(produceOutput_2pt_packed(corrD1ff1389, outfilename, "T", parallel_sources, attract_lookup_table)); + // p_jd_p&pi0u + // W + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, phiV32_DD, seqUSSUSS_pack); + outputfile(cont, "Diagram_duW1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV32_DD, seqUSSUSS_pack); + outputfile(cont, "Diagram_duW2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, seqUSSUSS_pack, phiV32_DD, propUSS_pack); + outputfile(cont, "Diagram_duW3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, seqUSSUSS_pack, phiV32_DD, propUSS_pack); + outputfile(cont, "Diagram_duW4", false); + } - // TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); - // TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); - // TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); - // TIME(produceOutput_2pt_packed(corrTproton_protonpizero4, outfilename, "T", parallel_sources, attract_lookup_table)); + // p_ju_p&pi0d + // W + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, seqDSSDSS_pack, phiV32); + outputfile(cont, "Diagram_udW1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV32, seqDSSDSS_pack); + outputfile(cont, "Diagram_udW2", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, phiV32, seqDSSDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_udW3", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, phiV32, seqDSSDSS_pack, propUSS_pack); + outputfile(cont, "Diagram_udW4", false); + } - corrTproton_protonpizero1.writeHDF5("test_T"); - corrTproton_protonpizero2.writeHDF5("test_T"); + // p_jd_p&pi0d + // B + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV31DD, propUSS_pack); + outputfile(cont, "Diagram_ddB1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, phiV31DD, propUSS_pack); + outputfile(cont, "Diagram_ddB2", false); } + // V_reduction version + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, momVects3pt_pf1); + auxVector.copy(stocG5Xi_pack); + // auxVector.writeHDF5(saveDir + "t1"); + // propUSS_pack.writeHDF5(saveDir + "t2"); + // propUSS.writeHDF5(saveDir + "t3"); + // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); + + auxV24.V2(auxVector, gscatts_N, propUSS_pack, propUSS_pack); // this and the above line won't produce the same V4, but the same cont3 + auxVector.writeHDF5(saveDir + "test_V2_1"); + propUSS_pack.writeHDF5(saveDir + "test_V2_2"); + auxV24.writeHDF5(saveDir + "test_V2"); + + + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c, seqDSLDSS); + auxVector.writeHDF5(saveDir + "test_V3_1"); + seqUSLDSS.writeHDF5(saveDir + "test_V3_2"); + auxV3.writeHDF5(saveDir + "test_V3"); + + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momList3pt); + cont.initialize_diagram(gscatts_ID, gscatts_ID, gscatts_N, gscatts_pi, gscatts_N, gscatts_c, "12", "B12"); + cont.B_diagrams(auxV3, auxV24, 0, 7, true); + outputfile(cont, "Diagram_ddB1_V", false); + } + { + plegma::PLEGMA_Vector auxVector; + plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, momVects3pt_pf1); + auxVector.copy(stocG5Xi_pack); + // auxVector.writeHDF5(saveDir + "t1"); + // propUSS_pack.writeHDF5(saveDir + "t2"); + // propUSS.writeHDF5(saveDir + "t3"); + // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); + auxV24.V2(auxVector, gscatts_N, propUSS_pack, propUSS_pack); // this and the above line won't produce the same V4, but the same cont3 + // auxV4.writeHDF5(saveDir + "auxV4"); + + plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + auxVector.copy(stocG5PhiUTfSL); + auxV3.V3(auxVector, gscatts_c, seqDSLDSS); + // auxVector.writeHDF5(saveDir + "auxVector"); + // seqUSLDSS.writeHDF5(saveDir + "seqUSLDSS"); + // auxV3.writeHDF5(saveDir + "auxV3"); + + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momList3pt); + cont.initialize_diagram(gscatts_ID, gscatts_ID, gscatts_N, gscatts_pi, gscatts_N, gscatts_c, "12", "B12"); + cont.B_diagrams(auxV3, auxV24, 0, 8, true); + outputfile(cont, "Diagram_ddB2_V", false); + } + // Z + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T2(gscatts_N, gscatts_N, propUSS_pack, phiV34_DDD, propUSS_pack); + outputfile(cont, "Diagram_ddZ1", false); + } + { + plegma::PLEGMA_ScattCorrelator cont(sourceZero, momVects3pt_pf1); + cont.T1(gscatts_N, gscatts_N, propUSS_pack, phiV34_DDD, propUSS_pack); + outputfile(cont, "Diagram_ddZ2", false); + } + + // p_ju_n&pi+ B: + plegma::PLEGMA_ScattCorrelator cont1(sourceZero, momVects3pt_pf1); + cont1.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV31); + outputfile(cont1, "cont1", true); // signs: Gf^t + + plegma::PLEGMA_ScattCorrelator cont2(sourceZero, momVects3pt_pf1); + cont2.T1(gscatts_N, gscatts_N, propUSS_pack, phiV31, propDSS_pack); + outputfile(cont2, "cont2", false); + + plegma::PLEGMA_ScattCorrelator cont3(sourceZero, momVects3pt_pf1); + cont3.T2(gscatts_N, gscatts_N, phiV31, propDSS_pack, propUSS_pack); + outputfile(cont3, "cont3", true); // signs: Gf^t + + plegma::PLEGMA_ScattCorrelator cont4(sourceZero, momVects3pt_pf1); + cont4.T1(gscatts_N, gscatts_N, phiV31, propUSS_pack, propDSS_pack); + outputfile(cont4, "cont4", true); // signs: Gfi1^t + + // p_ju_n&pi+ W: + + plegma::PLEGMA_ScattCorrelator cont5(sourceZero, momVects3pt_pf1); + cont5.T2(gscatts_N, gscatts_N, seqUSSDSS_pack, phiV32, propDSS_pack); + outputfile(cont5, "cont5", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont6(sourceZero, momVects3pt_pf1); + cont6.T1(gscatts_N, gscatts_N, seqUSSDSS_pack, phiV32, propDSS_pack); + outputfile(cont6, "cont6", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont7(sourceZero, momVects3pt_pf1); + cont7.T1(gscatts_N, gscatts_N, phiV32, propDSS_pack, seqUSSDSS_pack); + outputfile(cont7, "cont7", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont8(sourceZero, momVects3pt_pf1); + cont8.T1(gscatts_N, gscatts_N, phiV32, seqUSSDSS_pack, propDSS_pack); + outputfile(cont8, "cont8", false); // signs: + + // p_jd_n&pi+ W: + + plegma::PLEGMA_ScattCorrelator cont9(sourceZero, momVects3pt_pf1); + cont9.T1(gscatts_N, gscatts_N, propUSS_pack, phiV33, seqUSSDSS_pack); + outputfile(cont9, "cont9", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont10(sourceZero, momVects3pt_pf1); + cont10.T1(gscatts_N, gscatts_N, propUSS_pack, seqUSSDSS_pack, phiV33); + outputfile(cont10, "cont10", false); // signs: + + plegma::PLEGMA_ScattCorrelator cont11(sourceZero, momVects3pt_pf1); + cont11.T2(gscatts_N, gscatts_N, seqUSSDSS_pack, phiV33, propUSS_pack); + outputfile(cont11, "cont11", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont12(sourceZero, momVects3pt_pf1); + cont12.T1(gscatts_N, gscatts_N, seqUSSDSS_pack, propUSS_pack, phiV33); + outputfile(cont12, "cont12", true); // signs: Gfi1^t + + // p_jd_n&pi+ Z: + + plegma::PLEGMA_ScattCorrelator cont13(sourceZero, momVects3pt_pf1); + cont13.T1(gscatts_N, gscatts_N, propUSS_pack, propDSS_pack, phiV34); + outputfile(cont13, "cont13", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont14(sourceZero, momVects3pt_pf1); + cont14.T1(gscatts_N, gscatts_N, propUSS_pack, phiV34, propDSS_pack); + outputfile(cont14, "cont14", false); // signs: + + plegma::PLEGMA_ScattCorrelator cont15(sourceZero, momVects3pt_pf1); + cont15.T2(gscatts_N, gscatts_N, phiV34, propDSS_pack, propUSS_pack); + outputfile(cont15, "cont15", true); // signs: Gfi1^t + + plegma::PLEGMA_ScattCorrelator cont16(sourceZero, momVects3pt_pf1); + cont16.T1(gscatts_N, gscatts_N, phiV34, propUSS_pack, propDSS_pack); + outputfile(cont16, "cont16", true); // signs: Gfi1^t + + // V reductions version + // { // B12 + // plegma::PLEGMA_Vector auxVector; + // plegma::PLEGMA_ScattCorrelator auxV4(sourceZero, momVects3pt_pf1); + // auxVector.copy(stocG5Xi_pack); + // auxVector.writeHDF5(saveDir + "t1"); + // propUSS_pack.writeHDF5(saveDir + "t2"); + // propUSS.writeHDF5(saveDir + "t3"); + // // auxV4.V4(auxVector, GN, propDSS_pack, propUSS_pack); + // auxV4.V4(auxVector, GN, propUSS_pack, propDSS_pack); // this and the above line won't produce the same V4, but the same cont3 + // auxV4.writeHDF5(saveDir + "auxV4"); + + // plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + // auxVector.copy(stocG5PhiDTfSL); + // auxV3.V3(auxVector, Gc, seqUSLDSS); + // // auxVector.writeHDF5(saveDir + "auxVector"); + // // seqUSLDSS.writeHDF5(saveDir + "seqUSLDSS"); + // auxV3.writeHDF5(saveDir + "auxV3"); + + // plegma::PLEGMA_ScattCorrelator cont3V(sourceZero, momList); + // cont3V.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); + // cont3V.B_diagrams(auxV3, auxV4, 0, 12, true); + // outputfile(cont3V, "cont3V", false); + // } + + // { // Z11 + // plegma::PLEGMA_Vector auxVector; + // plegma::PLEGMA_ScattCorrelator auxV24(sourceZero, momVects3pt_pf1); + // auxVector.copy(stocPhiUG5Gi2TiSS_pack); + // auxV24.V2(auxVector, GN, propDSS_pack, propUSS_pack); + // auxV24.writeHDF5(saveDir + "Z11auxV24"); + + // plegma::PLEGMA_ScattCorrelator auxV3(sourceZero, momList3pt_pc); + // auxVector.copy(stocG5PhiUTiSL); + // auxV3.V3(auxVector, Gc, propDSL); + // auxV3.writeHDF5(saveDir + "Z11auxV3"); + + // plegma::PLEGMA_ScattCorrelator contZ11(sourceZero, momList); + // contZ11.initialize_diagram(GID, GID, GN, Gpi, GN, Gc, "12", "B12"); + // contZ11.Z_diagrams_without_dilution(auxV3, auxV24, 0, 11); + // outputfile(contZ11, "contZ11", false); + // } } finalize(); From a3dca23a98fba1484a43f3a2f3546f1fc7bd9054 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 15 Nov 2023 11:32:39 +0100 Subject: [PATCH 105/168] testing of lowModeAvg --- plegma/pion_LowModeAvg.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp index 8de00406..41cec95b 100644 --- a/plegma/pion_LowModeAvg.cpp +++ b/plegma/pion_LowModeAvg.cpp @@ -83,7 +83,7 @@ int main(int argc, char **argv) //Initialize gamma list. std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; std::vector glist_sink={ID}; - std::vector glist_test={ID}; + std::vector glist_test={G_5}; //Eigensolver to get eigenvalues #if defined(HAVE_EIGENSOLVER) @@ -160,10 +160,11 @@ int main(int argc, char **argv) PLEGMA_memcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); // cudaMemcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); //checkCudaError(); - eigVecP.apply_gamma5(); //Make eigVecP a right eigenvector by applying gamma5. + //eigVecP.apply_gamma5(); //Make eigVecP a right eigenvector by applying gamma5. TIME(D->apply(eigVecD,eigVecP)); - //PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); - //PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); + PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); + PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); + PLEGMA_printf("eigVecDNorm: %f\n", eigVecD.norm()); //TIME(corr.PhiPhi(eigVec, glist_src, eigVecP)); TIME(corr.PhiPhi(eigVec, glist_test, eigVecD)); From 2d7d8d10e905e233b3b2f6e5fad08b8d29f56bc3 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 16 Nov 2023 15:57:08 +0100 Subject: [PATCH 106/168] including tensor charges gamma structures --- include/PLEGMA_gammas.h | 41 +++++++++++++++++++++++++++--- include/global/PLEGMA_enums.h | 22 +++++++++++++--- include/utils/PLEGMA_scatt_utils.h | 18 +++++++------ utils/PLEGMA_scatt_utils.cpp | 36 ++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 15 deletions(-) diff --git a/include/PLEGMA_gammas.h b/include/PLEGMA_gammas.h index b3613448..395ccfa3 100644 --- a/include/PLEGMA_gammas.h +++ b/include/PLEGMA_gammas.h @@ -8,7 +8,7 @@ namespace plegma{ #define CONSTANT #endif -static const CONSTANT float gamma_scatt[35][4][2] = +static const CONSTANT float gamma_scatt[43][4][2] = {{{1,0},{1,0},{1,0},{1,0}}, // 1 {{0,1},{0,1},{0,-1},{0,-1}}, // g1 {{1,0},{-1,0},{-1,0},{1,0}}, // g2 @@ -44,8 +44,16 @@ static const CONSTANT float gamma_scatt[35][4][2] = {{0,-1},{0,1},{0,1},{0,-1}}, //Cg5gt {{0,1},{0,-1},{0,-1},{0,1}}, //Cgtg5 {{0,-1},{0,1},{0,1},{0,-1}}, //Cg5gtg5 + {{1,0},{-1,0},{1,0},{-1,0}}, // -I/2 [g1,g2] + {{0,1},{0,-1},{0,1},{0,-1}}, // -I/2 [g1,g3] + {{1,0},{1,0},{1,0},{1,0}}, // -I/2 [g2,g3] + {{1,0},{1,0},{1,0},{1,0}}, // -I/2 [g4,g1] + {{0,-1},{0,1},{0,-1},{0,1}}, // -I/2 [g4,g2] + {{1,0},{-1,0},{1,0},{-1,0}}, // -I/2 [g4,g3] + {{0,1},{0,-1},{0,1},{0,-1}}, // -C + {{0,1},{0,-1},{0,1},{0,-1}}, // -Cg5 }; -static const CONSTANT short int gammaInd_scatt[35][4][2] = +static const CONSTANT short int gammaInd_scatt[41][4][2] = {{{0,0},{1,1},{2,2},{3,3}}, // 1 {{0,3},{1,2},{2,1},{3,0}}, // g1 {{0,3},{1,2},{2,1},{3,0}}, // g2 @@ -81,8 +89,17 @@ static const CONSTANT short int gammaInd_scatt[35][4][2] = {{0,1},{1,0},{2,3},{3,2}}, // Cg5gt {{0,1},{1,0},{2,3},{3,2}}, // Cgtg5 {{0,3},{1,2},{2,1},{3,0}}, // Cg5gtg5 + {{0,0},{1,1},{2,2},{3,3}}, // -I/2 [g1,g2] + {{0,1},{1,0},{2,3},{3,2}}, // -I/2 [g1,g3] + {{0,1},{1,0},{2,3},{3,2}}, // -I/2 [g2,g3] + {{0,3},{1,2},{2,1},{3,0}}, // -I/2 [g4,g1] + {{0,3},{1,2},{2,1},{3,0}}, // -I/2 [g4,g2] + {{0,2},{1,3},{2,0},{3,1}}, // -I/2 [g4,g3] + {{0,3},{1,2},{2,1},{3,0}}, // -C + {{0,1},{1,0},{2,3},{3,2}}, // -Cg5 + }; -static const CONSTANT short int gammaTranspSign_scatt[35] = +static const CONSTANT short int gammaTranspSign_scatt[41] = { +1,// 1 -1,// g1 @@ -119,10 +136,18 @@ static const CONSTANT short int gammaTranspSign_scatt[35] = -1,// Cg5gt -1,// Cgtg5 +1,// Cg5gtg5 + +1,// -I/2 [g1,g2] + -1,// -I/2 [g1,g3] + +1,// -I/2 [g2,g3] + +1,// -I/2 [g4,g1] + -1,// -I/2 [g4,g2] + +1,// -I/2 [g4,g3] + -1,// -C + -1,// -Cg5 }; // gamma4 * G.T.conjugate() * gamma4 = gammaAdjointSign * G -static const CONSTANT short int gammaAdjointSign_scatt[35] = +static const CONSTANT short int gammaAdjointSign_scatt[41] = { +1,// 1 -1,// g1 @@ -159,5 +184,13 @@ static const CONSTANT short int gammaAdjointSign_scatt[35] = +1,// Cg5gt +1,// Cgtg5 +1,// Cg5gtg5 + +1,// -I/2 [g1,g2] + -1,// -I/2 [g1,g3] + +1,// -I/2 [g2,g3] + -1,// -I/2 [g4,g1] + +1,// -I/2 [g4,g2] + -1,// -I/2 [g4,g3] + -1,// -C + +1,// -Cg5 }; } diff --git a/include/global/PLEGMA_enums.h b/include/global/PLEGMA_enums.h index 397d6543..2cf03539 100644 --- a/include/global/PLEGMA_enums.h +++ b/include/global/PLEGMA_enums.h @@ -57,8 +57,16 @@ enum GAMMAS_SCATT {ID, CG_4, CG_5_G_4, CG_4_G_5, - CG_5_G_4_G_5}; // Do not change this order -const std::string GAMMAS_SCATT_STR[35] = {"1", + CG_5_G_4_G_5, + S12, + S13, + S23, + S41, + S42, + S43, + MC, + MCG5}; // Do not change this order +const std::string GAMMAS_SCATT_STR[43] = {"1", "g1", "g2", "g3", @@ -92,7 +100,15 @@ const std::string GAMMAS_SCATT_STR[35] = {"1", "Cg4", "Cg5g4", "Cg4g5", - "Cg5g4g5"}; + "Cg5g4g5", + "S12", + "S13", + "S23", + "S41", + "S42", + "S43", + "MC", + "MCG5"}; diff --git a/include/utils/PLEGMA_scatt_utils.h b/include/utils/PLEGMA_scatt_utils.h index 92b54907..67ca1f0d 100644 --- a/include/utils/PLEGMA_scatt_utils.h +++ b/include/utils/PLEGMA_scatt_utils.h @@ -332,20 +332,21 @@ template __inline__ void V_M_V( Float * V1, Float * V2, GAMMAS_SCATT gamma, bool transp, Float *Dest ){ *(Dest+0)=0.; *(Dest+1)=0.; + assert(gamma == CG_5); #pragma unroll for(int nz_e = 0 ; nz_e < 4 ; nz_e++){ int beta0= (!transp) ? gammaInd_scatt[gamma][nz_e][0] : gammaInd_scatt[gamma][nz_e][1]; int beta1= (!transp) ? gammaInd_scatt[gamma][nz_e][1] : gammaInd_scatt[gamma][nz_e][0]; #pragma unroll for (int nz_c = 0; nz_c < 3; nz_c++) { - *(Dest+0)+= +V1[2*(beta0*N_COLS+nz_c)+0]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+0] + *(Dest+0)+= //+V1[2*(beta0*N_COLS+nz_c)+0]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+0] -V1[2*(beta0*N_COLS+nz_c)+0]*gamma_scatt[gamma][nz_e][1]*V2[2*(beta1*N_COLS+nz_c)+1] - -V1[2*(beta0*N_COLS+nz_c)+1]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+1] + //-V1[2*(beta0*N_COLS+nz_c)+1]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+1] -V1[2*(beta0*N_COLS+nz_c)+1]*gamma_scatt[gamma][nz_e][1]*V2[2*(beta1*N_COLS+nz_c)+0]; *(Dest+1)+= -V1[2*(beta0*N_COLS+nz_c)+1]*gamma_scatt[gamma][nz_e][1]*V2[2*(beta1*N_COLS+nz_c)+1] - +V1[2*(beta0*N_COLS+nz_c)+1]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+0] - +V1[2*(beta0*N_COLS+nz_c)+0]*gamma_scatt[gamma][nz_e][1]*V2[2*(beta1*N_COLS+nz_c)+0] - +V1[2*(beta0*N_COLS+nz_c)+0]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+1]; + //+V1[2*(beta0*N_COLS+nz_c)+1]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+0] + +V1[2*(beta0*N_COLS+nz_c)+0]*gamma_scatt[gamma][nz_e][1]*V2[2*(beta1*N_COLS+nz_c)+0]; + //+V1[2*(beta0*N_COLS+nz_c)+0]*gamma_scatt[gamma][nz_e][0]*V2[2*(beta1*N_COLS+nz_c)+1]; } } } @@ -410,6 +411,7 @@ __inline__ void V_MVM( Float * V1, GAMMAS_SCATT gamma1, GAMMAS_SCATT gamma2, Flo **/ template __inline__ void V_TR_MM( Float * V1, GAMMAS_SCATT gamma,bool transp, Float *Dest ){ + assert(gamma==CG_5); #pragma unroll for (int nz_c = 0 ; nz_c < 3 ; nz_c++){ *(Dest+2*nz_c+0) = 0; @@ -421,10 +423,10 @@ __inline__ void V_TR_MM( Float * V1, GAMMAS_SCATT gamma,bool transp, Float *Dest for(int nz_e_inner = 0 ; nz_e_inner < 4 ; nz_e_inner++){ int beta0=(!transp) ? gammaInd_scatt[gamma][nz_e_inner][0] : gammaInd_scatt[gamma][nz_e_inner][1]; int beta1=(!transp) ? gammaInd_scatt[gamma][nz_e_inner][1] : gammaInd_scatt[gamma][nz_e_inner][0]; - *(Dest+2*nz_c+0)+=+gamma_scatt[gamma][nz_e_inner][0]*V1[2*(beta1*N_SPINS*N_COLS+beta0*N_COLS+nz_c)+0] + *(Dest+2*nz_c+0)+=//+gamma_scatt[gamma][nz_e_inner][0]*V1[2*(beta1*N_SPINS*N_COLS+beta0*N_COLS+nz_c)+0] -gamma_scatt[gamma][nz_e_inner][1]*V1[2*(beta1*N_SPINS*N_COLS+beta0*N_COLS+nz_c)+1]; - *(Dest+2*nz_c+1)+=+gamma_scatt[gamma][nz_e_inner][1]*V1[2*(beta1*N_SPINS*N_COLS+beta0*N_COLS+nz_c)+0] - +gamma_scatt[gamma][nz_e_inner][0]*V1[2*(beta1*N_SPINS*N_COLS+beta0*N_COLS+nz_c)+1]; + *(Dest+2*nz_c+1)+=+gamma_scatt[gamma][nz_e_inner][1]*V1[2*(beta1*N_SPINS*N_COLS+beta0*N_COLS+nz_c)+0]; + //+gamma_scatt[gamma][nz_e_inner][0]*V1[2*(beta1*N_SPINS*N_COLS+beta0*N_COLS+nz_c)+1]; } } diff --git a/utils/PLEGMA_scatt_utils.cpp b/utils/PLEGMA_scatt_utils.cpp index 19312fc9..0d5f5a80 100644 --- a/utils/PLEGMA_scatt_utils.cpp +++ b/utils/PLEGMA_scatt_utils.cpp @@ -127,6 +127,24 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) case(CG_3_G_4_G_5): return CG_3_G_4; break; + case(S12): + return S43; + break; + case(S13): + return; + break; + case(S23): + return S41; + break; + case(S41): + return S23; + break; + case(S42): + return CG_5; + break; + case(S43): + return; + break; } break; case(LEFT): @@ -188,6 +206,24 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) case(CG_3_G_4_G_5): return CG_3_G_4; break; + case(S12): + return S43; + break; + case(S13): + return MC; + break; + case(S23): + return S41; + break; + case(S41): + return S23; + break; + case(S42): + return CG_5; + break; + case(S43): + return S12; + break; } default: PLEGMA_error("Gamma matrix multiplication with gamma is not implemented for the particular source gamma %d\n",source); From c3bb6e4b206f98be416b6b70906f066a5d84c9b0 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 17 Nov 2023 10:02:36 +0100 Subject: [PATCH 107/168] correcting some bugs --- include/PLEGMA_gammas.h | 6 +- include/global/PLEGMA_enums.h | 12 +-- lib/kernels/PLEGMA_baryons.cuh | 2 +- plegma/CMakeLists.txt | 20 +++- plegma/Calc_2pt_marconi.cpp | 189 +++++++++++++++++++++++++++++++++ utils/PLEGMA_scatt_utils.cpp | 42 ++++---- 6 files changed, 237 insertions(+), 34 deletions(-) create mode 100644 plegma/Calc_2pt_marconi.cpp diff --git a/include/PLEGMA_gammas.h b/include/PLEGMA_gammas.h index 395ccfa3..05af3df2 100644 --- a/include/PLEGMA_gammas.h +++ b/include/PLEGMA_gammas.h @@ -53,7 +53,7 @@ static const CONSTANT float gamma_scatt[43][4][2] = {{0,1},{0,-1},{0,1},{0,-1}}, // -C {{0,1},{0,-1},{0,1},{0,-1}}, // -Cg5 }; -static const CONSTANT short int gammaInd_scatt[41][4][2] = +static const CONSTANT short int gammaInd_scatt[43][4][2] = {{{0,0},{1,1},{2,2},{3,3}}, // 1 {{0,3},{1,2},{2,1},{3,0}}, // g1 {{0,3},{1,2},{2,1},{3,0}}, // g2 @@ -99,7 +99,7 @@ static const CONSTANT short int gammaInd_scatt[41][4][2] = {{0,1},{1,0},{2,3},{3,2}}, // -Cg5 }; -static const CONSTANT short int gammaTranspSign_scatt[41] = +static const CONSTANT short int gammaTranspSign_scatt[43] = { +1,// 1 -1,// g1 @@ -147,7 +147,7 @@ static const CONSTANT short int gammaTranspSign_scatt[41] = }; // gamma4 * G.T.conjugate() * gamma4 = gammaAdjointSign * G -static const CONSTANT short int gammaAdjointSign_scatt[41] = +static const CONSTANT short int gammaAdjointSign_scatt[43] = { +1,// 1 -1,// g1 diff --git a/include/global/PLEGMA_enums.h b/include/global/PLEGMA_enums.h index 2cf03539..60a4462c 100644 --- a/include/global/PLEGMA_enums.h +++ b/include/global/PLEGMA_enums.h @@ -58,12 +58,12 @@ enum GAMMAS_SCATT {ID, CG_5_G_4, CG_4_G_5, CG_5_G_4_G_5, - S12, - S13, - S23, - S41, - S42, - S43, + S_12, + S_13, + S_23, + S_41, + S_42, + S_43, MC, MCG5}; // Do not change this order const std::string GAMMAS_SCATT_STR[43] = {"1", diff --git a/lib/kernels/PLEGMA_baryons.cuh b/lib/kernels/PLEGMA_baryons.cuh index 6426b788..5fee7158 100644 --- a/lib/kernels/PLEGMA_baryons.cuh +++ b/lib/kernels/PLEGMA_baryons.cuh @@ -189,7 +189,7 @@ static void contract_baryons_host( ProfileStruct &ps, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - d_partial_block=(Float2*)device_malloc(sizeof(Float2) ); + d_partial_block=(Float2*)device_malloc(alloc_size*sizeof(Float2) ); // cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); // Checking for allocation error. In case we return and let the tuner handle the error. cudaError_t error=cudaPeekAtLastError(); diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index e9209e12..a7801451 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -46,6 +46,9 @@ target_link_libraries(Calc_2pt ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt_wilson Calc_2pt_wilson.cpp) target_link_libraries(Calc_2pt_wilson ${PLEGMA_LIBS}) +cuda_add_executable(Calc_2pt_marconi Calc_2pt_marconi.cpp) +target_link_libraries(Calc_2pt_marconi ${PLEGMA_LIBS}) + cuda_add_executable(TestFrame EXCLUDE_FROM_ALL TestFrame.cpp) target_link_libraries(TestFrame ${PLEGMA_LIBS}) @@ -76,15 +79,18 @@ target_link_libraries(Source ${PLEGMA_LIBS}) cuda_add_executable(Random EXCLUDE_FROM_ALL Random.cpp) target_link_libraries(Random ${PLEGMA_LIBS}) +cuda_add_executable(pion_LowModeAvg EXCLUDE_FROM_ALL pion_LowModeAvg.cpp) +target_link_libraries(pion_LowModeAvg ${PLEGMA_LIBS}) + +cuda_add_executable(eigVecs EXCLUDE_FROM_ALL eigVecs.cpp) +target_link_libraries(eigVecs ${PLEGMA_LIBS}) + cuda_add_executable(Dilution EXCLUDE_FROM_ALL Dilution.cpp) target_link_libraries(Dilution ${PLEGMA_LIBS}) cuda_add_executable(testLinksSmearings EXCLUDE_FROM_ALL testLinksSmearings.cpp) target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) -cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) -target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) - cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) target_link_libraries(testYan ${PLEGMA_LIBS}) @@ -127,6 +133,9 @@ target_link_libraries(Zfac ${PLEGMA_LIBS}) cuda_add_executable(ZfacStaple ZfacStaple.cpp) target_link_libraries(ZfacStaple ${PLEGMA_LIBS}) +cuda_add_executable(PDFs_nucleon PDFs_nucleon.cpp) +target_link_libraries(PDFs_nucleon ${PLEGMA_LIBS}) + cuda_add_executable(TMDPDFs_mesons_Juwels TMDPDFs_mesons_Juwels.cpp) target_link_libraries(TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) @@ -142,8 +151,13 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(nucleon_delta_test ${PLEGMA_LIBS}) cuda_add_executable(nucleon_3pt_n_npi EXCLUDE_FROM_ALL nucleon_3pt_n_npi.cpp) target_link_libraries(nucleon_3pt_n_npi ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi_test EXCLUDE_FROM_ALL nucleon_3pt_n_npi_test.cpp) + target_link_libraries(nucleon_3pt_n_npi_test ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi_wd1ii EXCLUDE_FROM_ALL nucleon_3pt_n_npi_wd1ii.cpp) target_link_libraries(nucleon_3pt_n_npi_wd1ii ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi_factors EXCLUDE_FROM_ALL nucleon_3pt_n_npi_factors.cpp) + target_link_libraries(nucleon_3pt_n_npi_factors ${PLEGMA_LIBS}) cuda_add_executable(piNdiagrams_oet piNdiagrams_oet.cpp) target_link_libraries(piNdiagrams_oet ${PLEGMA_LIBS}) cuda_add_executable(checking_Doet checking_Doet.cpp) diff --git a/plegma/Calc_2pt_marconi.cpp b/plegma/Calc_2pt_marconi.cpp new file mode 100644 index 00000000..8aa227b0 --- /dev/null +++ b/plegma/Calc_2pt_marconi.cpp @@ -0,0 +1,189 @@ +#include +#include + +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) TIME(fnc) + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", + "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space", "xiMomSm","sinkMom"}; + +int main(int argc, char **argv) +{ + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + std::vector mu_s; + std::vector mu_c; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i sinkMom = {0,0,0}; + + std::string given_twop_filename = twop_filename; + { + PLEGMA_Gauge smearedGauge(BOTH); + double max_mom = 0; + { + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + //Momentum smearing: put the momentum phase to smeared gauge field + std::complex momSmScale[N_DIMS]; + std::complex I(0,1); + for(int i = 0 ; i < N_DIMS; i++) { + momSmScale[i] = std::exp(-(xiMomSm*2.*PI*sinkMom[i]/HGC_totalL[i])*I); + max_mom = max_mom>pow(xiMomSm*sinkMom[i],2) ? max_mom:pow(xiMomSm*sinkMom[i],2); + } + if(max_mom>0) + smearedGauge.scaleDirWise(momSmScale); + } + if(run_ud) { + updateOptions(LIGHT); + mu = mu_ud; + } else if(mu_s.size()>0) { + updateOptions(STRANGE); + mu = mu_s[0]; + } else { + updateOptions(CHARM); + mu = mu_c[0]; + } + TIME(QUDA_solver solver(mu)); + std::vector threads; + + + for(int isource = 0 ; isource < numSourcePositions; isource++){ + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n", + isource, sourcePositions[isource][0], sourcePositions[isource][1], + sourcePositions[isource][2], sourcePositions[isource][3]); + + site& source = sourcePositions[isource]; + PLEGMA_Propagator propUP(run_ud ? BOTH : NONE); + PLEGMA_Propagator propDN(run_ud ? BOTH : NONE); + + char * src_string; + asprintf(&src_string, "_sx%02dsy%02dsz%02dst%03d", source[0], source[1], source[2], source[3]); + twop_filename = given_twop_filename + std::string("_") + ((nsmearGauss>0) ? "SS" : "LL") + + "_gN" + std::to_string(nsmearGauss) + "a" + convNumToStr(alphaGauss) + + "_aN" + std::to_string(nsmearAPE) + "a" + convNumToStr(alphaAPE) + src_string; + free(src_string); + + if(max_mom > 0) { + asprintf(&src_string, "_mx%02dmy%02dmz%02d_xi%0.2f", sinkMom[0], sinkMom[1], sinkMom[2], xiMomSm); + twop_filename = twop_filename + src_string; + free(src_string); + } + twop_filename = twop_filename+".h5"; + + if(access( twop_filename.c_str(), F_OK ) != -1) + continue; + + { + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source[DIM_T]); + + auto computePropagator = [&](PLEGMA_Propagator& prop, const double run_mu, WHICHFLAVOR fl, int nSmear) { + // ensuring mu value + if(mu != run_mu) { + updateOptions(fl); + mu = run_mu; + solver.UpdateSolver(); + } + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorInOut; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut.absorb(vector2,source[DIM_T]); + } + // Inverting + PLEGMA_printf("Going to invert %s for component %d\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); + vectorInOut.unload(); + vectorInOut.writeHDF5("testinputbooster"); + vectorInOut.load(); + TIME(solver.solve(vectorInOut, vectorInOut)); + vectorInOut.unload(); + vectorInOut.writeHDF5("testoutputbooster"); + vectorInOut.load(); + + { // Smearing the solution + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop.absorb(vectorAuxF, isc/3, isc%3); + } + } + prop.rotateToPhysicalBase_device(run_mu/abs(run_mu)); + prop.applyBoundaries_device(source[DIM_T]); + }; + + TIME(computePropagator(propUP, mu_ud, LIGHT, nsmearGauss)); + TIME(computePropagator(propDN, -mu_ud, LIGHT, nsmearGauss)); + } + + PLEGMA_Correlator corr(corr_space, source, maxQsq); + TIME(corr.contractMesonsNew(propUP, propDN)); + char *dset1, *dset2; + asprintf(&dset1, "twop_mesons_new_u[%+1.1e]d[%+1.1e]", mu_ud, -1*mu_ud); + asprintf(&dset2, "twop_mesons_new_d[%+1.1e]u[%+1.1e]", -1*mu_ud, mu_ud); + corr.setDatasets((std::vector) {dset1}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + TIME(corr.contractBaryons(propUP, propDN)); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + +#ifdef PLEGMA_UDSC_BARYONS + PLEGMA_Propagator none(NONE); + TIME(corr.contractBaryonsUDSC(propUP, propDN, none, none)); + + char * group; + asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]", mu_ud, -1*mu_ud); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); +#endif + } + while(not threads.empty()) {threads.back().join(); threads.pop_back();} + } + + //finalize(); + return 0; +} + diff --git a/utils/PLEGMA_scatt_utils.cpp b/utils/PLEGMA_scatt_utils.cpp index 0d5f5a80..3f53c421 100644 --- a/utils/PLEGMA_scatt_utils.cpp +++ b/utils/PLEGMA_scatt_utils.cpp @@ -127,23 +127,23 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) case(CG_3_G_4_G_5): return CG_3_G_4; break; - case(S12): - return S43; + case(S_12): + return S_43; break; - case(S13): - return; + case(S_13): + return MC; break; - case(S23): - return S41; + case(S_23): + return S_41; break; - case(S41): - return S23; + case(S_41): + return S_23; break; - case(S42): + case(S_42): return CG_5; break; - case(S43): - return; + case(S_43): + return S_12; break; } break; @@ -206,23 +206,23 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) case(CG_3_G_4_G_5): return CG_3_G_4; break; - case(S12): - return S43; + case(S_12): + return S_43; break; - case(S13): + case(S_13): return MC; break; - case(S23): - return S41; + case(S_23): + return S_41; break; - case(S41): - return S23; + case(S_41): + return S_23; break; - case(S42): + case(S_42): return CG_5; break; - case(S43): - return S12; + case(S_43): + return S_12; break; } default: From fa679e4475013a2fc1c5559c45ebc5727ff18405 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 20 Nov 2023 10:25:23 +0100 Subject: [PATCH 108/168] Only determine upper triangle of contractions in LowModeAvg --- plegma/CMakeLists.txt | 15 ++++++--------- plegma/pion_LowModeAvg.cpp | 29 +++++++++++++---------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index e9209e12..e5c94c9e 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -82,15 +82,6 @@ target_link_libraries(Dilution ${PLEGMA_LIBS}) cuda_add_executable(testLinksSmearings EXCLUDE_FROM_ALL testLinksSmearings.cpp) target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) -cuda_add_executable(piNdiagrams_3pt_N_Npi EXCLUDE_FROM_ALL piNdiagrams_3pt_N_Npi.cpp) -target_link_libraries(piNdiagrams_3pt_N_Npi ${PLEGMA_LIBS}) - -cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) -target_link_libraries(testYan ${PLEGMA_LIBS}) - -cuda_add_executable(pi0Insertion EXCLUDE_FROM_ALL pi0Insertion.cpp) -target_link_libraries(pi0Insertion ${PLEGMA_LIBS}) - cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) @@ -176,3 +167,9 @@ target_link_libraries(mesons_simple ${PLEGMA_LIBS}) cuda_add_executable(Zfac_diagGI Zfac_diagGI.cpp) target_link_libraries(Zfac_diagGI ${PLEGMA_LIBS}) + +cuda_add_executable(eigVecs eigVecs.cpp) +target_link_libraries(eigVecs ${PLEGMA_LIBS}) + +cuda_add_executable(pion_LowModeAvg pion_LowModeAvg.cpp) +target_link_libraries(pion_LowModeAvg ${PLEGMA_LIBS}) diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp index 41cec95b..6cc4fca4 100644 --- a/plegma/pion_LowModeAvg.cpp +++ b/plegma/pion_LowModeAvg.cpp @@ -77,13 +77,13 @@ int main(int argc, char **argv) PLEGMA_error("Only QUDA_TWISTED_CLOVER_DSLASH and QUDA_TWISTED_MASS_DSLASH are allowed for the one-end trick"); //Initializing stochastic vector using given random seed. - PLEGMA_Vector vector_stoc; - vector_stoc.randInit(rand_seed1); + //PLEGMA_Vector vector_stoc; + //vector_stoc.randInit(rand_seed1); //Initialize gamma list. std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; std::vector glist_sink={ID}; - std::vector glist_test={G_5}; + //std::vector glist_test={G_5}; //Eigensolver to get eigenvalues #if defined(HAVE_EIGENSOLVER) @@ -146,13 +146,11 @@ int main(int argc, char **argv) //checkCudaError(); //TIME(D->apply(eigVecD,eigVec)); - for(int j=0; j < eigSol->getEigVals().size(); j++){ + for(int j=i; j < eigSol->getEigVals().size(); j++){ PLEGMA_ScattCorrelator corr(site({0,0,0,tsink}), maxQsq); - //std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; - //std::vector glist_sink={ID}; std::string dataset_name = std::to_string(i) + std::to_string(j); //TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); - TIME(corr.initialize_diagram(glist_test, glist_sink, "P")); + TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); //double eigValP = std::get<0>(eigSol->getEigVals()[j]); iorder = std::get<3>(eigSol->getEigVals()[j]); @@ -160,16 +158,15 @@ int main(int argc, char **argv) PLEGMA_memcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); // cudaMemcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); //checkCudaError(); - //eigVecP.apply_gamma5(); //Make eigVecP a right eigenvector by applying gamma5. - TIME(D->apply(eigVecD,eigVecP)); - PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); - PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); - PLEGMA_printf("eigVecDNorm: %f\n", eigVecD.norm()); - - //TIME(corr.PhiPhi(eigVec, glist_src, eigVecP)); - TIME(corr.PhiPhi(eigVec, glist_test, eigVecD)); + eigVecP.apply_gamma5(); + //PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); + //PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); + //PLEGMA_printf("eigVecDNorm: %f\n", eigVecD.norm()); + + TIME(corr.PhiPhi(eigVec, glist_src, eigVecP)); + //TIME(corr.PhiPhi(eigVecP, glist_test, eigVecD)); corr.setDatasets((std::vector) {dataset_name}); - TIME(corr.writeHDF5( outfilename )); + TIME(corr.writeHDF5( outfilename )); } } /* From 9b7c957d655794a980295e8a257cf2882bf4c231 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 20 Nov 2023 10:38:24 +0100 Subject: [PATCH 109/168] commenting out arpack logs --- utils/PLEGMA_eigSolver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/PLEGMA_eigSolver.cpp b/utils/PLEGMA_eigSolver.cpp index 866e4f9b..0d1f5b60 100644 --- a/utils/PLEGMA_eigSolver.cpp +++ b/utils/PLEGMA_eigSolver.cpp @@ -221,11 +221,11 @@ void EigSolver::initEigSolver(){ int arpack_log_u = 9999; if(!p.logFile.empty() && comm_rank() == 0){ char *tmps = strdup(p.logFile.c_str()); - initlog_(&arpack_log_u, tmps, p.logFile.length()); +// initlog_(&arpack_log_u, tmps, p.logFile.length()); free(tmps); int msglvl0 = 0;//, msglvl1 = 1, msglvl2 = 2, msglvl3 = 3; int msglvl3 = 3; - pmcinitdebug_(&arpack_log_u, &msglvl3, &msglvl3, &msglvl0, &msglvl3, &msglvl0, &msglvl0, &msglvl3); +// pmcinitdebug_(&arpack_log_u, &msglvl3, &msglvl3, &msglvl0, &msglvl3, &msglvl0, &msglvl0, &msglvl3); } #elif HAVE_PRIMME primme_initialize(&primme_pars); @@ -399,7 +399,7 @@ void EigSolver::computeEigVecs(){ if(info == 1) PLEGMA_printf("Warning: Maximum number of iterations reached.\n"); if(info == 3) PLEGMA_error("No shifts could be applied during implicit, Arnoldi update, try increasing NkV\n"); int arpack_log_u = 9999; - if(!p.logFile.empty() && comm_rank() == 0) finilog_(&arpack_log_u); +// if(!p.logFile.empty() && comm_rank() == 0) finilog_(&arpack_log_u); free(bmat); free(howmany); From 18f4419a55963177989066b0ab2b71e3cc866a1b Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 20 Nov 2023 16:14:40 +0100 Subject: [PATCH 110/168] adding sm_80 for the GPU_ARCH list --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4348da2c..5c46547f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,8 +122,8 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS DEVEL RELEASE STRICT DEBUG string(REPLACE ":" ";" LIBRARY_DIRS $ENV{LD_LIBRARY_PATH}) set(DEFAULT_GPU_ARCH sm_60) -set(GPU_ARCH ${DEFAULT_GPU_ARCH} CACHE STRING "set the GPU architecture (sm_20, sm_21, sm_30, sm_35, sm_37, sm_50, sm_52, sm_60, sm_70)") -set_property(CACHE GPU_ARCH PROPERTY STRINGS sm_20 sm_21 sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_70) +set(GPU_ARCH ${DEFAULT_GPU_ARCH} CACHE STRING "set the GPU architecture (sm_20, sm_21, sm_30, sm_35, sm_37, sm_50, sm_52, sm_60, sm_70, sm_80)") +set_property(CACHE GPU_ARCH PROPERTY STRINGS sm_20 sm_21 sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_70 sm_80) # max threads set(PLEGMA_MAX_THREADS 256 CACHE INT "maximum number of threads per block in tuner") From 40e0f8ef8f466e68164168c03122a499b23727c3 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 20 Nov 2023 16:21:27 +0100 Subject: [PATCH 111/168] removing Cgigt from gammas_scatt due to not enough constant memory --- include/PLEGMA_gammas.h | 56 +++++++++++++++++------------------ include/global/PLEGMA_enums.h | 18 +++++------ utils/PLEGMA_scatt_utils.cpp | 8 ++--- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/include/PLEGMA_gammas.h b/include/PLEGMA_gammas.h index 05af3df2..4e9c353f 100644 --- a/include/PLEGMA_gammas.h +++ b/include/PLEGMA_gammas.h @@ -8,7 +8,7 @@ namespace plegma{ #define CONSTANT #endif -static const CONSTANT float gamma_scatt[43][4][2] = +static const CONSTANT float gamma_scatt[37][4][2] = {{{1,0},{1,0},{1,0},{1,0}}, // 1 {{0,1},{0,1},{0,-1},{0,-1}}, // g1 {{1,0},{-1,0},{-1,0},{1,0}}, // g2 @@ -18,12 +18,12 @@ static const CONSTANT float gamma_scatt[43][4][2] = {{-1,0},{1,0},{1,0},{-1,0}}, // Cgx {{0,-1},{0,-1},{0,1},{0,1}}, // Cgy {{1,0},{1,0},{-1,0},{-1,0}}, // Cgz - {{-1,0},{1,0},{-1,0},{1,0}}, // Cgxgt - {{0,-1},{0,-1},{0,-1},{0,-1}}, // Cgygt - {{1,0},{1,0},{1,0},{1,0}}, // Cgzgt - {{-1,0},{1,0},{-1,0},{1,0}}, // Cgxgtg5 - {{0,-1},{0,-1},{0,-1},{0,-1}}, // Cgygtg5 - {{1,0},{1,0},{1,0},{1,0}}, //Cgzgtg5 +// {{-1,0},{1,0},{-1,0},{1,0}}, // Cgxgt +// {{0,-1},{0,-1},{0,-1},{0,-1}}, // Cgygt +// {{1,0},{1,0},{1,0},{1,0}}, // Cgzgt +// {{-1,0},{1,0},{-1,0},{1,0}}, // Cgxgtg5 +// {{0,-1},{0,-1},{0,-1},{0,-1}}, // Cgygtg5 +// {{1,0},{1,0},{1,0},{1,0}}, //Cgzgtg5 {{0,-1},{0,-1},{0,1},{0,1}}, //g5g1 {{0,1},{0,1},{0,-1},{0,-1}}, //g1g5 {{-1,0},{1,0},{1,0},{-1,0}}, //g5g2 @@ -53,7 +53,7 @@ static const CONSTANT float gamma_scatt[43][4][2] = {{0,1},{0,-1},{0,1},{0,-1}}, // -C {{0,1},{0,-1},{0,1},{0,-1}}, // -Cg5 }; -static const CONSTANT short int gammaInd_scatt[43][4][2] = +static const CONSTANT short int gammaInd_scatt[37][4][2] = {{{0,0},{1,1},{2,2},{3,3}}, // 1 {{0,3},{1,2},{2,1},{3,0}}, // g1 {{0,3},{1,2},{2,1},{3,0}}, // g2 @@ -63,12 +63,12 @@ static const CONSTANT short int gammaInd_scatt[43][4][2] = {{0,0},{1,1},{2,2},{3,3}}, // Cgx {{0,0},{1,1},{2,2},{3,3}}, // Cgy {{0,1},{1,0},{2,3},{3,2}}, // Cgz - {{0,0},{1,1},{2,2},{3,3}}, // Cgxgt - {{0,0},{1,1},{2,2},{3,3}}, // Cgygt - {{0,1},{1,0},{2,3},{3,2}}, // Cgzgt - {{0,2},{1,3},{2,0},{3,1}}, // Cgxgtg5 - {{0,2},{1,3},{2,0},{3,1}}, // Cgygtg5 - {{0,3},{1,2},{2,1},{3,0}}, // Cgzgtg5 +// {{0,0},{1,1},{2,2},{3,3}}, // Cgxgt +// {{0,0},{1,1},{2,2},{3,3}}, // Cgygt +// {{0,1},{1,0},{2,3},{3,2}}, // Cgzgt +// {{0,2},{1,3},{2,0},{3,1}}, // Cgxgtg5 +// {{0,2},{1,3},{2,0},{3,1}}, // Cgygtg5 +// {{0,3},{1,2},{2,1},{3,0}}, // Cgzgtg5 {{0,1},{1,0},{2,3},{3,2}}, // g5g1 {{0,1},{1,0},{2,3},{3,2}}, // g1g5 {{0,1},{1,0},{2,3},{3,2}}, // g5g2 @@ -99,7 +99,7 @@ static const CONSTANT short int gammaInd_scatt[43][4][2] = {{0,1},{1,0},{2,3},{3,2}}, // -Cg5 }; -static const CONSTANT short int gammaTranspSign_scatt[43] = +static const CONSTANT short int gammaTranspSign_scatt[37] = { +1,// 1 -1,// g1 @@ -110,12 +110,12 @@ static const CONSTANT short int gammaTranspSign_scatt[43] = +1,// Cgx +1,// Cgy +1,// Cgz - +1,// Cgxgt - +1,// Cgygt - +1,// Cgzgt - +1,// Cgxgtg5 - +1,// Cgygtg5 - +1,// Cgzgtg5 +// +1,// Cgxgt +// +1,// Cgygt +// +1,// Cgzgt +// +1,// Cgxgtg5 +// +1,// Cgygtg5 +// +1,// Cgzgtg5 +1,// g5g1 +1,// g1g5 -1,// g5g2 @@ -147,7 +147,7 @@ static const CONSTANT short int gammaTranspSign_scatt[43] = }; // gamma4 * G.T.conjugate() * gamma4 = gammaAdjointSign * G -static const CONSTANT short int gammaAdjointSign_scatt[43] = +static const CONSTANT short int gammaAdjointSign_scatt[37] = { +1,// 1 -1,// g1 @@ -158,12 +158,12 @@ static const CONSTANT short int gammaAdjointSign_scatt[43] = +1,// Cgx -1,// Cgy +1,// Cgz - +1,// Cgxgt - -1,// Cgygt - +1,// Cgzgt - -1,// Cgxgtg5 - +1,// Cgygtg5 - -1,// Cgzgtg5 +// +1,// Cgxgt +// -1,// Cgygt +// +1,// Cgzgt +// -1,// Cgxgtg5 +// +1,// Cgygtg5 +// -1,// Cgzgtg5 -1,// g5g1 -1,// g1g5 -1,// g5g2 diff --git a/include/global/PLEGMA_enums.h b/include/global/PLEGMA_enums.h index 60a4462c..b9b5bf1b 100644 --- a/include/global/PLEGMA_enums.h +++ b/include/global/PLEGMA_enums.h @@ -32,12 +32,12 @@ enum GAMMAS_SCATT {ID, CG_1, CG_2, CG_3, - CG_1_G_4, +/* CG_1_G_4, CG_2_G_4, CG_3_G_4, CG_1_G_4_G_5, CG_2_G_4_G_5, - CG_3_G_4_G_5, + CG_3_G_4_G_5, */ G_5_G_1, G_1_G_5, G_5_G_2, @@ -66,7 +66,7 @@ enum GAMMAS_SCATT {ID, S_43, MC, MCG5}; // Do not change this order -const std::string GAMMAS_SCATT_STR[43] = {"1", +const std::string GAMMAS_SCATT_STR[37] = {"1", "g1", "g2", "g3", @@ -75,12 +75,12 @@ const std::string GAMMAS_SCATT_STR[43] = {"1", "cg1", "cg2", "cg3", - "cg1g4", - "cg2g4", - "cg3g4", - "cg1g4g5", - "cg2g4g5", - "cg3g4g5", + // "cg1g4", + // "cg2g4", + // "cg3g4", + // "cg1g4g5", + // "cg2g4g5", + // "cg3g4g5", "g5g1", "g1g5", "g5g2", diff --git a/utils/PLEGMA_scatt_utils.cpp b/utils/PLEGMA_scatt_utils.cpp index 3a5d356b..a397f767 100644 --- a/utils/PLEGMA_scatt_utils.cpp +++ b/utils/PLEGMA_scatt_utils.cpp @@ -109,7 +109,7 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) case(CG_3): return CG_3_G_5; break; - case(CG_1_G_4): +/* case(CG_1_G_4): return CG_1_G_4_G_5; break; case(CG_2_G_4): @@ -126,7 +126,7 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) break; case(CG_3_G_4_G_5): return CG_3_G_4; - break; + break; */ case(S_12): return S_43; break; @@ -200,7 +200,7 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) case(CG_3): return G_5_CG_3; break; - case(CG_1_G_4): +/* case(CG_1_G_4): return CG_1_G_4_G_5; break; case(CG_2_G_4): @@ -217,7 +217,7 @@ GAMMAS_SCATT apply_g5(GAMMAS_SCATT source, LEFTRIGHT LR) break; case(CG_3_G_4_G_5): return CG_3_G_4; - break; + break;*/ case(S_12): return S_43; break; From 9048db39bfb7d5433430a11fb1b2aed9a1393b98 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 21 Nov 2023 08:52:28 +0100 Subject: [PATCH 112/168] including eigvecnum feature to the ScattCorrelator class --- include/PLEGMA_ScattCorrelator.h | 6 +++- lib/PLEGMA_ScattCorrelator.cu | 55 ++++++++++++++++++++++++++++++-- plegma/CMakeLists.txt | 10 ------ 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index 5695a487..a7a9098d 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -26,6 +26,7 @@ namespace plegma { protected: std::vector> GList; + int eigvecnum; momList plist; std::string labels; // index_struct = "gsssc" (because spin first) @@ -41,7 +42,7 @@ namespace plegma { PLEGMA_ScattCorrelator(site source, std::vector> fixMomsVec, int totalT=HGC_totalL[DIM_T]); - PLEGMA_ScattCorrelator(site source, momList &listmom, int totalT=HGC_totalL[DIM_T]); + PLEGMA_ScattCorrelator(site source, momList &listmom, int totalT=HGC_totalL[DIM_T], int eigvecnum=1); ~PLEGMA_ScattCorrelator(){;} @@ -228,6 +229,9 @@ namespace plegma { //manipulation to construct N like diagram from NjN void absorbSourceSinkSpinMom(PLEGMA_ScattCorrelator &srcCorr, int alpha, int beta, int pf1, bool forcetozero=false); + // manipulation constructing exact exact part of the deflated correlation function + void absorbEigIndex( PLEGMA_ScattCorrelator &srcCorr, int eigindex, bool forcetozero=false); + //manipulation to construct P like diagram from pi j pi void absorbGammai2Gammaf2momentumf2(PLEGMA_ScattCorrelator &srcCorr, int i_gamma_i2, int i_gamma_f2, int i_pf1, bool forcetozero=false ); diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index ce2c6206..167435b9 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -41,12 +41,19 @@ PLEGMA_ScattCorrelator::PLEGMA_ScattCorrelator(site source, std::vector PLEGMA_ScattCorrelator::PLEGMA_ScattCorrelator(site source, std::vector> fixMomsList, int totalT): PLEGMA_Correlator(MOMENTUM_SPACE,source,0,totalT) { this->setFixMomList(fixMomsList); } - +/* template PLEGMA_ScattCorrelator::PLEGMA_ScattCorrelator(site source, momList &listmom, int totalT): PLEGMA_Correlator(MOMENTUM_SPACE,source,0,totalT), plist(listmom) { auto mlist = this->plist.tolist(); this->setFixMomList( mlist ); } +*/ +template +PLEGMA_ScattCorrelator::PLEGMA_ScattCorrelator(site source, momList &listmom, int totalT, int eigvecnum): PLEGMA_Correlator(MOMENTUM_SPACE,source,0,totalT), plist(listmom), eigvecnum(eigvecnum) { + auto mlist = this->plist.tolist(); + this->setFixMomList( mlist ); +} + //######################### //# Auxiliary functions # @@ -60,6 +67,7 @@ void PLEGMA_ScattCorrelator::setOffsets( ){ switch(l){ case('t'): assert(this->corr_mom_space); ranges.push_back( this->corr_mom_space->DimT() ); break; case('m'): assert(this->corr_mom_space); ranges.push_back( this->corr_mom_space->Nmoms() ); break; + case('n'): assert(this->eigvecnum>1); ranges.push_back(this->eigvecnum*(this->eigvecnum+1)/2); break; case('g'): assert(g_count::initialize_diagram( std::vectorinitialize(); //Offsets - this->labels="tmgg"; + if (this->eigvecnum ==1 ){ + this->labels="tmgg"; + } + else{ + this->labels="ntmgg"; + } this->setOffsets(); this->clear_output(true); @@ -3659,6 +3672,44 @@ void PLEGMA_ScattCorrelator::absorbGammai2Gammaf2momentumf2(PLEGMA_ScattC } } +template +void PLEGMA_ScattCorrelator::absorbEigIndex( PLEGMA_ScattCorrelator &srcCorr, int eigindex){ + + int n_gammas_i1 = this->GList[0].size(); + int n_gammas_f1 = this->GList[1].size(); + int TIME = this->localT(); + + if (forcetozero == true && !this->labels.empty()){ + int tot_size = 2*this->getTotalSize(); + memset( this->H_elem(), 0, tot_size*sizeof(Float) ); + } + + + if (TIME==0) return; + if ((eigindex <0) || (eigindex> (this->eigvecnum*(this->eigvecnum+1)/2))){ + PLEGMA_error("Wrong eigenvectorindex in absorbEigIndex\n"); + } + + + int Nmoms = srcCorr.Nmoms(); + if (this->Nmoms() != Nmoms){ + PLEGMA_error("Destination correlator has a different momentum list\n"); + + auto imap = this->pList().index_map(); + + #pragma omp parallel for + for(int i_m=0; i_mCorr(eigindex,t,i_m,g1,g2)[0]=srcCorr.H_elem(t, i_m, g1, g2)[0]; + this->Corr(eigindex,t,i_m,g1,g2)[1]=srcCorr.H_elem(t, i_m, g1, g2)[1]; + } + } + } + } + } +} template void PLEGMA_ScattCorrelator::absorbSourceSinkSpinMom(PLEGMA_ScattCorrelator &srcCorr, int alpha, int beta, int pf1, bool forcetozero){ diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 55128f05..03dcd07b 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -79,12 +79,6 @@ target_link_libraries(Source ${PLEGMA_LIBS}) cuda_add_executable(Random EXCLUDE_FROM_ALL Random.cpp) target_link_libraries(Random ${PLEGMA_LIBS}) -cuda_add_executable(pion_LowModeAvg EXCLUDE_FROM_ALL pion_LowModeAvg.cpp) -target_link_libraries(pion_LowModeAvg ${PLEGMA_LIBS}) - -cuda_add_executable(eigVecs EXCLUDE_FROM_ALL eigVecs.cpp) -target_link_libraries(eigVecs ${PLEGMA_LIBS}) - cuda_add_executable(Dilution EXCLUDE_FROM_ALL Dilution.cpp) target_link_libraries(Dilution ${PLEGMA_LIBS}) @@ -145,13 +139,9 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(nucleon_delta_test ${PLEGMA_LIBS}) cuda_add_executable(nucleon_3pt_n_npi EXCLUDE_FROM_ALL nucleon_3pt_n_npi.cpp) target_link_libraries(nucleon_3pt_n_npi ${PLEGMA_LIBS}) - cuda_add_executable(nucleon_3pt_n_npi_test EXCLUDE_FROM_ALL nucleon_3pt_n_npi_test.cpp) - target_link_libraries(nucleon_3pt_n_npi_test ${PLEGMA_LIBS}) cuda_add_executable(nucleon_3pt_n_npi_wd1ii EXCLUDE_FROM_ALL nucleon_3pt_n_npi_wd1ii.cpp) target_link_libraries(nucleon_3pt_n_npi_wd1ii ${PLEGMA_LIBS}) - cuda_add_executable(nucleon_3pt_n_npi_factors EXCLUDE_FROM_ALL nucleon_3pt_n_npi_factors.cpp) - target_link_libraries(nucleon_3pt_n_npi_factors ${PLEGMA_LIBS}) cuda_add_executable(piNdiagrams_oet piNdiagrams_oet.cpp) target_link_libraries(piNdiagrams_oet ${PLEGMA_LIBS}) cuda_add_executable(checking_Doet checking_Doet.cpp) From 9d50b65592c3859c3dde70600d4504428e677d06 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 21 Nov 2023 10:28:38 +0100 Subject: [PATCH 113/168] writing only once --- plegma/pion_LowModeAvg.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp index c82a6111..8939e160 100644 --- a/plegma/pion_LowModeAvg.cpp +++ b/plegma/pion_LowModeAvg.cpp @@ -138,10 +138,18 @@ int main(int argc, char **argv) PLEGMA_Vector eigVecD; char * src_string; + + std::vector moms_pf={0,0,0}; + momList momlist(1, {moms_pf,}, {0,}); + + PLEGMA_ScattCorrelator corr(site({0,0,0,0}),momlist,HGC_totalL[DIM_T],Eig_NeV); + + TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); asprintf(&src_string, "exact-exact"); std::string outfilename = twop_filename + src_string + ".h5"; free(src_string); + int index=0; for(int i=0; i < eigSol->getEigVals().size(); i++){ //double eigVal = std::get<0>(eigSol->getEigVals()[i]); //Doesn't this only get the real part of the eigenvector? Only real eigenvalues if Dirac operator is hermitian. However, here we have to take the twisted mass parameter into account! long int iorder = std::get<3>(eigSol->getEigVals()[i]); @@ -152,10 +160,8 @@ int main(int argc, char **argv) //TIME(D->apply(eigVecD,eigVec)); for(int j=i; j < eigSol->getEigVals().size(); j++){ - PLEGMA_ScattCorrelator corr(site({0,0,0,tsink}), maxQsq); std::string dataset_name = std::to_string(i) + std::to_string(j); //TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); - TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); //double eigValP = std::get<0>(eigSol->getEigVals()[j]); iorder = std::get<3>(eigSol->getEigVals()[j]); @@ -164,16 +170,21 @@ int main(int argc, char **argv) // cudaMemcpy(eigVecP.D_elem(), eigVecP_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); //checkCudaError(); eigVecP.apply_gamma5(); + + PLEGMA_ScattCorrelator corr_temp( site({0,0,0,0}),momlist); + TIME(corr_temp.initialize_diagram(glist_src, glist_sink, "P")); + //PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); //PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); //PLEGMA_printf("eigVecDNorm: %f\n", eigVecD.norm()); - TIME(corr.PhiPhi(eigVec, glist_src, eigVecP)); - //TIME(corr.PhiPhi(eigVecP, glist_test, eigVecD)); - corr.setDatasets((std::vector) {dataset_name}); - TIME(corr.writeHDF5( outfilename )); + TIME(corr_temp.PhiPhi(eigVec, glist_src, eigVecP)); + TIME(corr.absorbEigIndex(corr_temp, index)); + index++; } } + + TIME(corr.writeHDF5( outfilename )); /* //=========================================================================================================// From 6269180ba5aa8ea6374056a8dd7887930e5fddc4 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 21 Nov 2023 14:24:05 +0100 Subject: [PATCH 114/168] correcting errors --- lib/PLEGMA_ScattCorrelator.cu | 7 ++++--- plegma/pion_LowModeAvg.cpp | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 167435b9..ad2de7b1 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -3673,7 +3673,7 @@ void PLEGMA_ScattCorrelator::absorbGammai2Gammaf2momentumf2(PLEGMA_ScattC } template -void PLEGMA_ScattCorrelator::absorbEigIndex( PLEGMA_ScattCorrelator &srcCorr, int eigindex){ +void PLEGMA_ScattCorrelator::absorbEigIndex( PLEGMA_ScattCorrelator &srcCorr, int eigindex, bool forcetozero){ int n_gammas_i1 = this->GList[0].size(); int n_gammas_f1 = this->GList[1].size(); @@ -3702,8 +3702,9 @@ void PLEGMA_ScattCorrelator::absorbEigIndex( PLEGMA_ScattCorrelatorCorr(eigindex,t,i_m,g1,g2)[0]=srcCorr.H_elem(t, i_m, g1, g2)[0]; - this->Corr(eigindex,t,i_m,g1,g2)[1]=srcCorr.H_elem(t, i_m, g1, g2)[1]; + int index=t*Nmoms*2*n_gammas_f1*n_gammas_i1+i_m*2*n_gammas_f1*n_gammas_i1+g2*2*n_gammas_i1+2*g1; + this->Corr(eigindex,t,i_m,g1,g2)[0]=srcCorr.H_elem()[index]; + this->Corr(eigindex,t,i_m,g1,g2)[1]=srcCorr.H_elem()[index+1]; } } } diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp index 8939e160..4be7de0a 100644 --- a/plegma/pion_LowModeAvg.cpp +++ b/plegma/pion_LowModeAvg.cpp @@ -71,8 +71,8 @@ int main(int argc, char **argv) PLEGMA_Vector vector_stoc; vector_stoc.randInit(rand_seed1); - TIME(QUDA_solver *solver = new QUDA_solver(mu)); - QudaInvertParam inv_params = solver->getInvParams(); +// TIME(QUDA_solver *solver = ne QUDA_solver(mu)); + QudaInvertParam inv_params = solver.getInvParams(); QUDA_dirac *D = nullptr; if(inv_params.dslash_type == QUDA_TWISTED_CLOVER_DSLASH) @@ -171,7 +171,7 @@ int main(int argc, char **argv) //checkCudaError(); eigVecP.apply_gamma5(); - PLEGMA_ScattCorrelator corr_temp( site({0,0,0,0}),momlist); + PLEGMA_ScattCorrelator corr_temp( site({0,0,0,0}),momlist); TIME(corr_temp.initialize_diagram(glist_src, glist_sink, "P")); //PLEGMA_printf("eigVecNorm: %f\n", eigVec.norm()); From 41023c9de025ae28d06f7eefc4cf276418b256a1 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 21 Nov 2023 16:21:35 +0100 Subject: [PATCH 115/168] correcting the shape of the dataset --- lib/PLEGMA_ScattCorrelator.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index ad2de7b1..3699da22 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1108,7 +1108,7 @@ void PLEGMA_ScattCorrelator::initialize_diagram( std::vectordatasets = {name_of_diagram,}; //Shape - this->shape = { (int)(this->GList[0].size())*(int)(this->GList[1].size()) }; + this->shape = { (int)(this->eigvecnum*(this->eigvecnum+1)/2.)*(int)(this->GList[0].size())*(int)(this->GList[1].size()) }; //initialize this->initialize(); From 65097a0a78b2fb7bba6d5402e2609e5943f8e529 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 21 Nov 2023 19:20:14 +0100 Subject: [PATCH 116/168] correcting some bugs --- lib/PLEGMA_ScattCorrelator.cu | 21 +++++++++++++-------- plegma/pion_LowModeAvg.cpp | 6 +++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 3699da22..ccd68dc7 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1079,6 +1079,9 @@ void PLEGMA_ScattCorrelator::initialize_diagram( std::vector> tmpvector= {G_i2, G_f2}; std::string tmp=""; + if (this->eigvecnum !=1){ + tmp+="/eigvecnum/"; + } for (int i=0; i elements=tmpvector[i]; @@ -1108,7 +1111,7 @@ void PLEGMA_ScattCorrelator::initialize_diagram( std::vectordatasets = {name_of_diagram,}; //Shape - this->shape = { (int)(this->eigvecnum*(this->eigvecnum+1)/2.)*(int)(this->GList[0].size())*(int)(this->GList[1].size()) }; + this->shape = { (int)(this->eigvecnum*(this->eigvecnum+1)/2.),(int)(this->GList[0].size())*(int)(this->GList[1].size()) }; //initialize this->initialize(); @@ -1118,7 +1121,7 @@ void PLEGMA_ScattCorrelator::initialize_diagram( std::vectorlabels="tmgg"; } else{ - this->labels="ntmgg"; + this->labels="tmngg"; } this->setOffsets(); @@ -3632,7 +3635,7 @@ void PLEGMA_ScattCorrelator::absorbGammai2Gammaf2momentumf2(PLEGMA_ScattC } } } - } + } } else{ int derivLoopLength; @@ -3685,17 +3688,20 @@ void PLEGMA_ScattCorrelator::absorbEigIndex( PLEGMA_ScattCorrelatorpList().index_map(); + if (TIME==0) return; if ((eigindex <0) || (eigindex> (this->eigvecnum*(this->eigvecnum+1)/2))){ PLEGMA_error("Wrong eigenvectorindex in absorbEigIndex\n"); } - int Nmoms = srcCorr.Nmoms(); if (this->Nmoms() != Nmoms){ PLEGMA_error("Destination correlator has a different momentum list\n"); + } - auto imap = this->pList().index_map(); #pragma omp parallel for for(int i_m=0; i_m::absorbEigIndex( PLEGMA_ScattCorrelatorCorr(eigindex,t,i_m,g1,g2)[0]=srcCorr.H_elem()[index]; - this->Corr(eigindex,t,i_m,g1,g2)[1]=srcCorr.H_elem()[index+1]; + this->Corr(t,i_m,eigindex,g1,g2)[0]=srcCorr.H_elem()[index]; + this->Corr(t,i_m,eigindex,g1,g2)[1]=srcCorr.H_elem()[index+1]; } } } } - } } template diff --git a/plegma/pion_LowModeAvg.cpp b/plegma/pion_LowModeAvg.cpp index 4be7de0a..c82b5066 100644 --- a/plegma/pion_LowModeAvg.cpp +++ b/plegma/pion_LowModeAvg.cpp @@ -87,8 +87,8 @@ int main(int argc, char **argv) //vector_stoc.randInit(rand_seed1); //Initialize gamma list. - std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; - std::vector glist_sink={ID}; + std::vector glist_sink={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + std::vector glist_src={ID}; //Eigensolver to get eigenvalues #if defined(HAVE_EIGENSOLVER) @@ -178,7 +178,7 @@ int main(int argc, char **argv) //PLEGMA_printf("eigVecPNorm: %f\n", eigVecP.norm()); //PLEGMA_printf("eigVecDNorm: %f\n", eigVecD.norm()); - TIME(corr_temp.PhiPhi(eigVec, glist_src, eigVecP)); + TIME(corr_temp.PhiPhi(eigVec, glist_sink, eigVecP)); TIME(corr.absorbEigIndex(corr_temp, index)); index++; } From a865c12e64a180b55dcceb47ac38296005b8bd35 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 22 Nov 2023 19:28:37 +0100 Subject: [PATCH 117/168] added improved version of LowModeAvg --- plegma/pion_LowModeAvg_exact.cpp | 336 +++++++++++++++++++++++++++++++ 1 file changed, 336 insertions(+) create mode 100644 plegma/pion_LowModeAvg_exact.cpp diff --git a/plegma/pion_LowModeAvg_exact.cpp b/plegma/pion_LowModeAvg_exact.cpp new file mode 100644 index 00000000..48cf9c9e --- /dev/null +++ b/plegma/pion_LowModeAvg_exact.cpp @@ -0,0 +1,336 @@ +#include +#include +#include + +using namespace plegma; +using namespace quda; + +//For calculating runtime. +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +extern int device; +static std::vector listOpt = {"verbosity", "load-gauge", "nsrc", "src-filename", "tSinks", "twop-filename", "maxQsq", "Eig-isACC", "Eig-PolyDeg", "Eig-amin", + "Eig-amax", "Eig-spectrumPart", "Eig-tol", "Eig-maxIters", "Eig-NeV", +#if defined(HAVE_ARPACK) || defined(QUDAEIG) + "Eig-NkV", "Eig-logFile", +#elif defined(HAVE_PRIMME) + "Eig-printLevel", "Eig-method-PRIMME", +#endif + "rng-seed", "corr-file-format" +}; + + +int main(int argc, char **argv) +{ + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + int n_stochastic_samples; + int nroots=2; // + int rand_seed1=1234; //random seed for initialization of stochastic sources. + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + std::vector mus; //Twisted mass mus + HGC_options->set("extra-mu", "List of additional mu to run", verbosity, mus); + //std::string Eig_outputFile = "./eigsVdagG5V.dat"; + //HGC_options->set("Eig-outputFile", "Path to dump the eigenvalues and vdag g5 v if low-modes-recon is enabled",verbosity, Eig_outputFile); + bool isReadEigenVecs = false; + bool isWriteEigenVecs = false; + std::string fnameEigenVecsPrefix=""; + HGC_options->set("readEigenVectors", "Where we want to read EigenVectors from file", verbosity, isReadEigenVecs); + HGC_options->set("writeEigenVectors", "Where we want to read EigenVectors from file", verbosity, isWriteEigenVecs); + HGC_options->set("prefixEigenVecsFile", "Path with prefix for the filenames of the eigenvectors", verbosity, fnameEigenVecsPrefix); + #ifdef QUDAEIG + int batched_rotate = 1; + HGC_options->set("batched-rotate", "The size of the batch during Ritz rotation", verbosity, batched_rotate); + #endif + + //=========================================================================================================// + + initializePLEGMA(); + + mus.insert(mus.begin(), mu); //Prepend mu to vector mus. + int nmus = mus.size(); + + //Storing only the smeared gauge + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + //Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); +/* + //Initializing solver. + updateOptions(LIGHT); + TIME(QUDA_solver *solver = new QUDA_solver(mu)); + QudaInvertParam inv_params = solver->getInvParams(); + + QUDA_dirac *D = nullptr; + if(inv_params.dslash_type == QUDA_TWISTED_CLOVER_DSLASH) + D = new QUDA_dirac(QUDA_CLOVER_WILSON_DSLASH); + else if (inv_params.dslash_type == QUDA_TWISTED_MASS_DSLASH) + D = new QUDA_dirac(QUDA_WILSON_DSLASH); + else + PLEGMA_error("Only QUDA_TWISTED_CLOVER_DSLASH and QUDA_TWISTED_MASS_DSLASH are allowed for the one-end trick"); +*/ + //Initializing stochastic vector using given random seed. + //PLEGMA_Vector vector_stoc; + //vector_stoc.randInit(rand_seed1); + + //Initialize gamma list. + std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + std::vector glist_sink={ID}; + //std::vector glist_test={G_5}; + + //Eigensolver to get eigenvalues + #if defined(HAVE_EIGENSOLVER) + EigSolver *eigSol = nullptr; + + EigSolverParams eigParam; + eigParam.NeV = Eig_NeV; + eigParam.isACC = Eig_isACC; + eigParam.PolyDeg = Eig_PolyDeg; + eigParam.amin = Eig_amin; + eigParam.amax = Eig_amax; + eigParam.spectrumPart = Eig_spectrumPart; + eigParam.tol = Eig_tol; + eigParam.maxIters = Eig_maxIters; + #ifdef QUDAEIG + eigParam.batched_rotate = batched_rotate; + #endif + #if defined(HAVE_ARPACK) || defined(QUDAEIG) + eigParam.NkV = Eig_NkV; + eigParam.logFile = Eig_logFile; + #elif defined(HAVE_PRIMME) + eigParam.printLevel = Eig_printLevel; + eigParam.primme_method=getMethod(Eig_method); + #else + PLEGMA_error("No arpack or primme is compiled"); + #endif + TIME(eigSol = new EigSolver(eigParam, dslash_type, isReadEigenVecs, isWriteEigenVecs, fnameEigenVecsPrefix, true)); + //eigSol->dumpEvalsVdagG5V(Eig_outputFile); + #else + PLEGMA_error("No eigenSolver is compiled"); + #endif + + //QUDA_TWISTED_CLOVER_DSLASH is used, so we determine eigenvalues of D(\mu)=V(\Lambda+i\mu)U^\dagger + //V=\Gamma_5 U* + //Need to do this also for -i\mu + //list of lambda, v gamma u', v gamma phi, v gamma eta + #if defined(HAVE_EIGENSOLVER) + //exact-exact part + //=========================================================================================================// + //for(size_t its = 0; its < tSinks.size(); its++){ + //int tsink = tSinks[its]; + int its = 0; + int tsink = 0; + int np = 9; + int eigvecnum = 10; + PLEGMA_printf("\neigvecnum:%d\n", eigvecnum); + int eigindex = 0; + + PLEGMA_Vector eigVec; + + std::vector>> vecs; + for(int i=0;i>(DEVICE)); + + char * src_string; + asprintf(&src_string, "exact-exact"); + std::string outfilename = twop_filename + src_string + ".h5"; + free(src_string); + + PLEGMA_ScattCorrelator corr(site({0,0,0,tsink}), maxQsq); + TIME(corr.initialize_diagram(glist_src, glist_sink, "P")); + PLEGMA_ScattCorrelator AccCorr(site({0,0,0,tsink}), maxQsq, eigvecnum); + AccCorr.initialize_diagram(glist_src, glist_sink, "P"); + + for(int i=0; i < eigSol->getEigVals().size(); i++){ + long int iorder = std::get<3>(eigSol->getEigVals()[i]); + double *eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + PLEGMA_memcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); + + for(int j=i; j < eigSol->getEigVals().size(); j+=np){ + TIME( + int maxnp = std::min(np,(int)eigSol->getEigVals().size()-j); + for(int k=0;k(eigSol->getEigVals()[j+k]); + eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + qudaMemcpyAsync(vecs[k]->D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice, device::get_stream(k)); + } + + for(int k=0;k vectortmp1; + PLEGMA_Vector vectortmp2; + vectortmp1.absorbTimeslice(vector_stoc, tsink); + vector_stoc.dilutespin(vectortmp1,0); //put 0 everywhere in the stochastic vector except for the position corresponding to one specific timeslice and mu. + + PLEGMA_Propagator propUP; //Declaration of the two propagators. UP = +mu and DN = -mu + PLEGMA_Propagator propDN; + PLEGMA_Propagator propUP_phi; //The propagators containing phi. + PLEGMA_Propagator propDN_phi; + //PLEGMA_Vector eigVec; //Declaration of eigenvector + + for(int imu=0; imuprojectVector(vectortmp1); //Project vector to obtain "phi". + + if(fl==0) + propUP_phi.absorb(vectortmp1, spinindex, 0); //Last argument is the color index, put to 0 here. + else + propDN_phi.absorb(vectortmp1, spinindex, 0); + } + + propUP.rotateToPhysicalBase_device(+1); + propUP.applyBoundaries_device(tsink); //take into account (antiperiodic) boundary conditions. + propDN.rotateToPhysicalBase_device(-1); + propDN.applyBoundaries_device(tsink); + propUP_phi.rotateToPhysicalBase_device(+1); + propUP_phi.applyBoundaries_device(tsink); + propDN_phi.rotateToPhysicalBase_device(-1); + propDN_phi.applyBoundaries_device(tsink); + + + //exact-stochastic contractions for v gamma eta and v gamma phi terms + //=========================================================================================================// + for(int i=0; i < eigSol->getEigVals().size(); i++){ + //double eigVal = std::get<0>(eigSol->getEigVals()[i]); //Doesn't this only get the real part of the eigenvector? Only real eigenvalues if Dirac operator is hermitian. However, here we have to take the twisted mass parameter into account! + long int iorder = std::get<3>(eigSol->getEigVals()[i]); + double *eigVec_tmp = eigSol->getEigVecs() + iorder*eigSol->getSize_per_Vec()*2; + cudaMemcpy(eigVec.D_elem(), eigVec_tmp, eigSol->getBytes_per_Vec(), cudaMemcpyHostToDevice); + //checkCudaError(); + + //Initialize new Scatt_Correlator. + PLEGMA_ScattCorrelator mix_corr(site({0,0,0,tsink}), maxQsq); + //std::vector glist_src={ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4}; + //std::vector glist_sink={ID}; + TIME(mix_corr.initialize_diagram(glist_src, glist_sink, "P")); + + TIME(mix_corr.V3(eigVec, glist_src, propUP)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "u"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propDN)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "d"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propUP_phi)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "uphi"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + TIME(mix_corr.V3(eigVec, glist_src, propDN_phi)); + mix_corr.setDatasets((std::vector) {datasetPrefix + std::to_string(i) + "dphi"}); + TIME(mix_corr.writeHDF5( outfilename_exactstoc )); + } + + //PLEGMA_printf("Calculating stoc-stoc contributions... \n\n"); + //=========================================================================================================// + + //stochastic-stochastic contractions + //=========================================================================================================// + + PLEGMA_Correlator stoc_corr(corr_space, site({0,0,0,tsink}), maxQsq); + TIME(stoc_corr.contractMesonsNew(propUP, propUP)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "uu"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propUP, propUP, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "uu_open"}); //Leave spin indices open (16x16 indices) + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsNew(propDN, propDN)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "dd"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propDN, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "dd_open"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsNew(propUP, propDN)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "ud"}); //"du" is just the conjugated one, so no need to compute it separately. + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + TIME(stoc_corr.contractMesonsOpen(propUP, propDN, false)); + stoc_corr.setDatasets((std::vector) {datasetPrefix + "ud_open"}); + TIME(stoc_corr.writeHDF5( outfilename_stocstoc )); + + //=========================================================================================================// + } + } + //} + //} + */ + #endif + + //finalize(); + + return 0; +} + + /*Open questions: + 1) In the spin dilution part there's a random vector absorbed only for one color component. How do we deal with the other color components. + 2) Is computing eigenvectors for D^\dagger D correct? What about the mus then if we have fully real eigenvalues? They seem not to be taken into account. + 3) Why do the contractions yield not just a number? + 4) Are the eigenvectors determined by the eigensolver right, or left eigenvectors and are they already daggered or not? + 5) How can the other terms, connected to the ones computed here by gamma_5 and daggering, be effectively determined? + */ From e358238bf83d99360c21acfe2d927facfb95f0a6 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Tue, 12 Dec 2023 09:02:28 +0100 Subject: [PATCH 118/168] include tensor --- plegma/QuarkLoops_pi0_insertion.cpp | 4 ++-- plegma/pi0Insertion.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plegma/QuarkLoops_pi0_insertion.cpp b/plegma/QuarkLoops_pi0_insertion.cpp index eb546025..7933e04c 100644 --- a/plegma/QuarkLoops_pi0_insertion.cpp +++ b/plegma/QuarkLoops_pi0_insertion.cpp @@ -272,8 +272,8 @@ int main(int argc, char **argv) free(ssource); std::vector gscatts_ID = {ID}; - std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; - std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4, S_12, S_23, S_13, S_41, S_42, S_43}; + // std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; std::vector gscatts_meson = {}; std::string filenameEnd = ""; diff --git a/plegma/pi0Insertion.cpp b/plegma/pi0Insertion.cpp index ba01c336..10175f5a 100644 --- a/plegma/pi0Insertion.cpp +++ b/plegma/pi0Insertion.cpp @@ -261,8 +261,8 @@ int main(int argc, char **argv) free(ssource); std::vector gscatts_ID = {ID}; - std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4}; - std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; + std::vector gscatts_c = {ID, G_1, G_2, G_3, G_4, G_5, G_5_G_1, G_5_G_2, G_5_G_3, G_5_G_4, S_12, S_23, S_13, S_41, S_42, S_43}; + // std::vector gammas_c = {ONE, G1, G2, G3, G4, G5, G5G1, G5G2, G5G3, G5G4}; std::vector gscatts_meson = {}; std::string filenamePost = ""; @@ -425,6 +425,11 @@ int main(int argc, char **argv) aux.copy(stocPhiU_ti_SL); aux_pi2.copy(stocPhiU_ti_mpi2_SL); pi0Insertion.P_diagrams(aux, aux_pi2, -1); + // if(st==3 && mom_pi2[0]==0 && mom_pi2[1]==0 && mom_pi2[2]==0) + // { + // aux.writeHDF5("aux"); + // aux_pi2.writeHDF5("aux_pu2"); + // } } std::string outfilename = outdiagramPrefix + confnumber + "_" + filenamePost; pi0Insertion.writeHDF5(outfilename); From 3b7b9235b09a1c9ccbd463b6ab7c3be1f2825e10 Mon Sep 17 00:00:00 2001 From: pittlerf Date: Thu, 25 Jan 2024 08:58:55 +0100 Subject: [PATCH 119/168] correcting dimension of P diagram --- lib/PLEGMA_ScattCorrelator.cu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index ccd68dc7..941ea9fe 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1111,7 +1111,12 @@ void PLEGMA_ScattCorrelator::initialize_diagram( std::vectordatasets = {name_of_diagram,}; //Shape - this->shape = { (int)(this->eigvecnum*(this->eigvecnum+1)/2.),(int)(this->GList[0].size())*(int)(this->GList[1].size()) }; + if (this->eigvecnum >1){ + this->shape = { (int)(this->eigvecnum*(this->eigvecnum+1)/2.),(int)(this->GList[0].size())*(int)(this->GList[1].size()) }; + } + else{ + this->shape = { (int)(this->GList[0].size())*(int)(this->GList[1].size()) }; + } //initialize this->initialize(); From 5ce25ef2b4a18a4481127c333733562d6efd812d Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 8 Jul 2024 17:22:13 +0200 Subject: [PATCH 120/168] making compatible with the latest QUDA develop branch --- lib/CMakeLists.txt | 2 ++ lib/kernels/PLEGMA_kernel_tuner.cuh | 6 +++--- lib/kernels/PLEGMA_vector_utils.cuh | 12 ++++++------ plegma/CMakeLists.txt | 3 --- utils/CMakeLists.txt | 2 +- utils/QUDA_interface.cpp | 8 ++++---- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ba3b9da5..f232ac3c 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -74,6 +74,8 @@ LIST(REMOVE_ITEM PLEGMA_OBJS ${QUDA_CU_OBJS}) # include_directories include_directories(${QUDA_HOME}/lib/) +include_directories(${QUDA_HOME}/_deps/eigen-src/) +include_directories(${QUDA_SRC}/include/targets/cuda/) #PLEGMA: include_directories(code_pieces) include_directories(SYSTEM ${PLEGMA_GSLHOME}/include) diff --git a/lib/kernels/PLEGMA_kernel_tuner.cuh b/lib/kernels/PLEGMA_kernel_tuner.cuh index 67b3c810..df11e3f3 100644 --- a/lib/kernels/PLEGMA_kernel_tuner.cuh +++ b/lib/kernels/PLEGMA_kernel_tuner.cuh @@ -49,14 +49,14 @@ struct ProfileStruct{ }; template -struct seq { }; +struct sequential { }; template struct gens : gens { }; template struct gens<0, S...> { - typedef seq type; + typedef sequential type; }; // class to perform the kernel tuning @@ -171,7 +171,7 @@ protected: // launching utilities template - void callKernel(TuneParam tp, const qudaStream_t stream, seq) { + void callKernel(TuneParam tp, const qudaStream_t stream, sequential) { if( typeid(ProfileStruct &)==typeid(std::get<0>(args))) { // in case ProfileStruct is the first argument we call it as a function (*kernel)(std::get(args)...); diff --git a/lib/kernels/PLEGMA_vector_utils.cuh b/lib/kernels/PLEGMA_vector_utils.cuh index afc2164c..f5c0ebd5 100644 --- a/lib/kernels/PLEGMA_vector_utils.cuh +++ b/lib/kernels/PLEGMA_vector_utils.cuh @@ -147,11 +147,11 @@ static void copy_to_QUDA(FloatIn* in,ColorSpinorField &qudaVec, bool isEven){ dim3 gridDim( (HGC_localVolume + blockDim.x -1)/blockDim.x , 1 , 1); if( qudaVec.SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ if( isEven ) - copy_to_QUDA<<>>(in,(FloatOut*) qudaVec.V(), NULL); + copy_to_QUDA<<>>(in,(FloatOut*) qudaVec.data(), NULL); else - copy_to_QUDA<<>>(in, NULL,(FloatOut*) qudaVec.V()); + copy_to_QUDA<<>>(in, NULL,(FloatOut*) qudaVec.data()); } else - copy_to_QUDA<<>>(in, (FloatOut*) qudaVec.Even().V(),(FloatOut*) qudaVec.Odd().V()); + copy_to_QUDA<<>>(in, (FloatOut*) qudaVec.Even().data(),(FloatOut*) qudaVec.Odd().data()); } template @@ -212,11 +212,11 @@ static void copy_from_QUDA(FloatOut* out, ColorSpinorField &qudaVec, bool isEven ProfileStruct ps(HGC_localVolume); if( qudaVec.SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ if( isEven ) - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel,out,(FloatIn*) qudaVec.V(), (FloatIn*) NULL); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel,out,(FloatIn*) qudaVec.data(), (FloatIn*) NULL); else - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) NULL,(FloatIn*) qudaVec.V()); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) NULL,(FloatIn*) qudaVec.data()); } else - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) qudaVec.Even().V(),(FloatIn*) qudaVec.Odd().V()); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) qudaVec.Even().data(),(FloatIn*) qudaVec.Odd().data()); } template diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 03dcd07b..9944bb61 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -181,8 +181,5 @@ target_link_libraries(mesons_simple ${PLEGMA_LIBS}) cuda_add_executable(Zfac_diagGI Zfac_diagGI.cpp) target_link_libraries(Zfac_diagGI ${PLEGMA_LIBS}) -cuda_add_executable(eigVecs eigVecs.cpp) -target_link_libraries(eigVecs ${PLEGMA_LIBS}) - cuda_add_executable(pion_LowModeAvg pion_LowModeAvg.cpp) target_link_libraries(pion_LowModeAvg ${PLEGMA_LIBS}) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 51d4e37b..df050f78 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -4,5 +4,5 @@ file(GLOB PLEGMA_UTILS ) cuda_add_library(PLEGMAutils STATIC ${PLEGMA_UTILS}) -target_include_directories(PLEGMAutils SYSTEM PRIVATE ${QUDA_SRC}/lib ) +target_include_directories(PLEGMAutils SYSTEM PRIVATE ${QUDA_SRC}/lib ${QUDA_HOME}/_deps/eigen-src/ ) add_dependencies(PLEGMAutils BoostPP) diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index caebe769..676547a5 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -82,7 +82,7 @@ void gFixingLandauOVR_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge & double* buf[N_DIMS]; for(int i=0; i*get(Profiler_name()) = ((std::string)("Solver profiler mu=")+to_string(mu)).c_str(); profiler->TPSTOP(QUDA_PROFILE_TOTAL); @@ -365,7 +365,7 @@ ColorSpinorField *QUDA_solver::solve(ColorSpinorField * rhs){ profiler->TPSTART(QUDA_PROFILE_TOTAL); ColorSpinorField *in = NULL; ColorSpinorField *out = NULL; - D->prepare(in,out,*x,*rhs,inv_param.solution_type); + D->prepare(*in,*out,*x,*rhs,inv_param.solution_type); (*solver)(*out, *in); D->reconstruct(*x,*rhs,inv_param.solution_type); profiler->TPSTOP(QUDA_PROFILE_TOTAL); From 58aa350c67dfce9417d916e77f03961bd6be4698 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 9 Jul 2024 17:08:03 +0200 Subject: [PATCH 121/168] working on integrating the latest quda branch --- include/PLEGMA_Vector.h | 8 ++--- include/utils/QUDA_interface.h | 8 ++--- lib/PLEGMA_Vector.cu | 8 ++--- utils/QUDA_interface.cpp | 54 +++++++++++++++++++--------------- 4 files changed, 42 insertions(+), 36 deletions(-) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index aea2c177..64ab0be5 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -25,8 +25,8 @@ namespace plegma { PLEGMA_Vector(ALLOCATION_FLAG alloc_flag=BOTH, GHOST_FLAG ghost_flag=FIRST_SIDE); ~PLEGMA_Vector(){;} - void copyToQUDA( quda::ColorSpinorField *cudaVector, bool isEv = false); - void copyFromQUDA( quda::ColorSpinorField *cudaVector, bool isEv = false); + void copyToQUDA( std::vectorcudaVector, bool isEv = false); + void copyFromQUDA( std::vector cudaVector, bool isEv = false); /** @brief Applies N times Gaussian(Wuppertal) smearing operator on all time-slices of a vector. NOTE: works also for Vector3D @@ -105,8 +105,8 @@ namespace plegma { }; - template void copyToQUDA(quda::ColorSpinorField *cudaVector, Float* delem, bool isEv = false); // delem is a device pointer - template void copyFromQUDA(Float* delem, quda::ColorSpinorField *cudaVector, bool isEv = false); + template void copyToQUDA(std::vector cudaVector, Float* delem, bool isEv = false); // delem is a device pointer + template void copyFromQUDA(Float* delem, std::vector cudaVector, bool isEv = false); ///////////////////////////////////// // CLASS: PLEGMA_Vector3D /////////// diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index 296dc016..af8544ff 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -17,7 +17,7 @@ namespace quda { QudaMultigridParam mg_param; Dirac *D, *DSloppy, *DPre; DiracMatrix *M, *MSloppy, *MPre; - ColorSpinorField *b, *x; + std::vector b, x; #ifdef QUDA_INCLUDES_COMMIT_775a033 QudaEigParam *mg_eig_param; #endif @@ -28,9 +28,9 @@ namespace quda { void UpdateSolver(); QUDA_solver(double mu); virtual ~QUDA_solver(); - ColorSpinorField* solve(ColorSpinorField * rhs); + std::vector solve(std::vector rhs); template - ColorSpinorField* solve(PLEGMA_Vector &vectorIn); + std::vector solve(PLEGMA_Vector &vectorIn); template void solve(PLEGMA_Vector &out, PLEGMA_Vector &in); template @@ -43,7 +43,7 @@ namespace quda { DiracParam dParam; QudaInvertParam inv_param; Dirac *D; - ColorSpinorField *in, *out; + std::vector in, out; template void apply(); public: //only QUDA_WILSON_DSLASH, QUDA_CLOVER_WILSON_DSLASH, QUDA_TWISTED_MASS_DSLASH, QUDA_TWISTED_CLOVER_DSLASH diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 49166e5e..b6f1e3d8 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -82,13 +82,13 @@ void PLEGMA_Vector::gaussianSmearing(PLEGMA_Vector &vecIn, template -void PLEGMA_Vector::copyToQUDA(ColorSpinorField *qudaVector, bool isEv){ - copy_to_QUDA(this->d_elem, *qudaVector, isEv); +void PLEGMA_Vector::copyToQUDA(std::vectorqudaVector, bool isEv){ + copy_to_QUDA(this->d_elem, qudaVector[0], isEv); } template -void PLEGMA_Vector::copyFromQUDA(ColorSpinorField *qudaVector, bool isEv){ - copy_from_QUDA(this->d_elem, *qudaVector, isEv); +void PLEGMA_Vector::copyFromQUDA(std::vectorqudaVector, bool isEv){ + copy_from_QUDA(this->d_elem, qudaVector[0], isEv); } template diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index 676547a5..3f9b8914 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -203,8 +203,8 @@ QUDA_solver::QUDA_solver(double mu) { inv_param.input_location); ColorSpinorParam cudaParam(cpuParam, inv_param,inv_param.input_location); cudaParam.create = QUDA_ZERO_FIELD_CREATE; - b = new ColorSpinorField(cudaParam); - x = new ColorSpinorField(cudaParam); + b.push_back(ColorSpinorField(cudaParam)); + x.push_back(ColorSpinorField(cudaParam)); profiler->TPSTOP(QUDA_PROFILE_TOTAL); profiler->Print(); @@ -221,8 +221,10 @@ QUDA_solver::~QUDA_solver(){ delete solver; delete solverParam; delete profiler; - delete b; - delete x; + b.pop_back(); + x.pop_back(); + //delete b; + //delete x; delete M; delete MSloppy; delete MPre; @@ -361,13 +363,15 @@ void QUDA_solver::UpdateSolver() profiler->TPRESET(); } -ColorSpinorField *QUDA_solver::solve(ColorSpinorField * rhs){ +std::vector QUDA_solver::solve(std::vector rhs){ profiler->TPSTART(QUDA_PROFILE_TOTAL); - ColorSpinorField *in = NULL; - ColorSpinorField *out = NULL; - D->prepare(*in,*out,*x,*rhs,inv_param.solution_type); - (*solver)(*out, *in); - D->reconstruct(*x,*rhs,inv_param.solution_type); + std::vector in(1); + std::vector out(1); +// ColorSpinorField *in = NULL; +// ColorSpinorField *out = NULL; + D->prepare(in,out,x,rhs,inv_param.solution_type); + (*solver)(out, in); + D->reconstruct(x,rhs,inv_param.solution_type); profiler->TPSTOP(QUDA_PROFILE_TOTAL); profiler->Print(); profiler->TPRESET(); @@ -376,7 +380,7 @@ ColorSpinorField *QUDA_solver::solve(ColorSpinorField * rhs){ template -ColorSpinorField *QUDA_solver::solve(PLEGMA_Vector &vectorIn){ +std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn){ bool flag_eo=false; if( inv_param.matpc_type == QUDA_MATPC_EVEN_EVEN ) flag_eo = true; @@ -402,8 +406,8 @@ void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &v template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); -template ColorSpinorField *QUDA_solver::solve(PLEGMA_Vector &vectorIn); -template ColorSpinorField *QUDA_solver::solve(PLEGMA_Vector &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn){ @@ -420,7 +424,7 @@ template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_V //######################### Quda Dirac operator class ################################ QUDA_dirac::QUDA_dirac(QudaDslashType dslashType): - D(nullptr), in(nullptr), out(nullptr){ + D(nullptr), in(), out(){ if(dslashType != QUDA_WILSON_DSLASH && dslashType != QUDA_CLOVER_WILSON_DSLASH && dslashType != QUDA_TWISTED_MASS_DSLASH @@ -439,24 +443,26 @@ QUDA_dirac::QUDA_dirac(QudaDslashType dslashType): inv_param.input_location); ColorSpinorParam cudaParam(cpuParam, inv_param,inv_param.input_location); cudaParam.create = QUDA_ZERO_FIELD_CREATE; - in = new ColorSpinorField(cudaParam); - out = new ColorSpinorField(cudaParam); - if(in->SiteSubset() != QUDA_FULL_SITE_SUBSET || out->SiteSubset() != QUDA_FULL_SITE_SUBSET) - PLEGMA_error("cudaColorSpinorField should be a full vector for this class"); + in.push_back(ColorSpinorField(cudaParam)); + out.push_back(ColorSpinorField(cudaParam)); +// if(in[0]->SiteSubset() != QUDA_FULL_SITE_SUBSET || out[0]->SiteSubset() != QUDA_FULL_SITE_SUBSET) +// PLEGMA_error("cudaColorSpinorField should be a full vector for this class"); } QUDA_dirac::~QUDA_dirac(){ delete D; - delete in; - delete out; + in.pop_back(); + out.pop_back(); +// delete in; +// delete out; } template void QUDA_dirac::apply(){ switch (type){ - case(M): D->M(*out,*in); break; - case(Mdag): D->Mdag(*out,*in); break; - case(MdagM): D->MdagM(*out,*in); break; - case(MMdag): D->MMdag(*out,*in); break; + case(M): D->M(out,in); break; + case(Mdag): D->Mdag(out,in); break; + case(MdagM): D->MdagM(out,in); break; + case(MMdag): D->MMdag(out,in); break; } } From 4f91dea739cbd755127dd5ef0436003bc7b83a51 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 11 Jul 2024 11:36:27 +0200 Subject: [PATCH 122/168] finalizing with the latest QUDA branch, nucleon 2pt crosschecked --- include/PLEGMA_Vector.h | 8 +++---- include/utils/QUDA_interface.h | 2 +- lib/PLEGMA_Vector.cu | 24 +++++++++---------- lib/kernels/PLEGMA_vector_utils.cuh | 36 ++++++++++++++--------------- utils/QUDA_interface.cpp | 15 +++++++----- 5 files changed, 44 insertions(+), 41 deletions(-) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index 64ab0be5..03f1ca70 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -25,8 +25,8 @@ namespace plegma { PLEGMA_Vector(ALLOCATION_FLAG alloc_flag=BOTH, GHOST_FLAG ghost_flag=FIRST_SIDE); ~PLEGMA_Vector(){;} - void copyToQUDA( std::vectorcudaVector, bool isEv = false); - void copyFromQUDA( std::vector cudaVector, bool isEv = false); + void copyToQUDA( std::vector& cudaVector, bool isEv = false); + void copyFromQUDA( std::vector& cudaVector, bool isEv = false); /** @brief Applies N times Gaussian(Wuppertal) smearing operator on all time-slices of a vector. NOTE: works also for Vector3D @@ -105,8 +105,8 @@ namespace plegma { }; - template void copyToQUDA(std::vector cudaVector, Float* delem, bool isEv = false); // delem is a device pointer - template void copyFromQUDA(Float* delem, std::vector cudaVector, bool isEv = false); + template void copyToQUDA(std::vector& cudaVector, Float* delem, bool isEv = false); // delem is a device pointer + template void copyFromQUDA(Float* delem, std::vector& cudaVector, bool isEv = false); ///////////////////////////////////// // CLASS: PLEGMA_Vector3D /////////// diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index af8544ff..d444590a 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -28,7 +28,7 @@ namespace quda { void UpdateSolver(); QUDA_solver(double mu); virtual ~QUDA_solver(); - std::vector solve(std::vector rhs); + std::vector solve(std::vector& rhs); template std::vector solve(PLEGMA_Vector &vectorIn); template diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index b6f1e3d8..2cd812a7 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -82,13 +82,13 @@ void PLEGMA_Vector::gaussianSmearing(PLEGMA_Vector &vecIn, template -void PLEGMA_Vector::copyToQUDA(std::vectorqudaVector, bool isEv){ - copy_to_QUDA(this->d_elem, qudaVector[0], isEv); +void PLEGMA_Vector::copyToQUDA(std::vector& qudaVector, bool isEv){ + copy_to_QUDA(this->d_elem, (qudaVector), isEv); } template -void PLEGMA_Vector::copyFromQUDA(std::vectorqudaVector, bool isEv){ - copy_from_QUDA(this->d_elem, qudaVector[0], isEv); +void PLEGMA_Vector::copyFromQUDA( std::vector& qudaVector, bool isEv){ + copy_from_QUDA(this->d_elem, (qudaVector), isEv); } template @@ -463,19 +463,19 @@ template class PLEGMA_Vector; namespace plegma{ template - void copyToQUDA(ColorSpinorField *qudaVector, Float* delem, bool isEv){ - copy_to_QUDA(delem, *qudaVector, isEv); + void copyToQUDA(std::vector& qudaVector, Float* delem, bool isEv){ + copy_to_QUDA(delem, qudaVector, isEv); } - template void copyToQUDA(ColorSpinorField *qudaVector, float* delem, bool isEv); - template void copyToQUDA(ColorSpinorField *qudaVector, double* delem, bool isEv); + template void copyToQUDA(std::vector&qudaVector, float* delem, bool isEv); + template void copyToQUDA(std::vector&qudaVector, double* delem, bool isEv); template - void copyFromQUDA(Float* delem, ColorSpinorField *qudaVector, bool isEv){ - copy_from_QUDA(delem, *qudaVector, isEv); + void copyFromQUDA(Float* delem, std::vector&qudaVector, bool isEv){ + copy_from_QUDA(delem, qudaVector, isEv); } - template void copyFromQUDA(float* delem, ColorSpinorField *qudaVector, bool isEv); - template void copyFromQUDA(double* delem, ColorSpinorField *qudaVector, bool isEv); + template void copyFromQUDA(float* delem, std::vector& qudaVector, bool isEv); + template void copyFromQUDA(double* delem, std::vector& qudaVector, bool isEv); //----------------------------------// // class PLEGMA_Vector3D // diff --git a/lib/kernels/PLEGMA_vector_utils.cuh b/lib/kernels/PLEGMA_vector_utils.cuh index f5c0ebd5..6709d28a 100644 --- a/lib/kernels/PLEGMA_vector_utils.cuh +++ b/lib/kernels/PLEGMA_vector_utils.cuh @@ -142,26 +142,26 @@ static __global__ void copy_to_QUDA(FloatIn *in, FloatOut *outEven, FloatOut *ou } template -static void copy_to_QUDA(FloatIn* in,ColorSpinorField &qudaVec, bool isEven){ +static void copy_to_QUDA(FloatIn* in, std::vector& qudaVec, bool isEven){ dim3 blockDim( THREADS_PER_BLOCK , 1, 1); dim3 gridDim( (HGC_localVolume + blockDim.x -1)/blockDim.x , 1 , 1); - if( qudaVec.SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ + if( (qudaVec[0]).SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ if( isEven ) - copy_to_QUDA<<>>(in,(FloatOut*) qudaVec.data(), NULL); + copy_to_QUDA<<>>(in,(FloatOut*) (qudaVec[0]).data(), NULL); else - copy_to_QUDA<<>>(in, NULL,(FloatOut*) qudaVec.data()); + copy_to_QUDA<<>>(in, NULL,(FloatOut*) (qudaVec[0]).data()); } else - copy_to_QUDA<<>>(in, (FloatOut*) qudaVec.Even().data(),(FloatOut*) qudaVec.Odd().data()); + copy_to_QUDA<<>>(in, (FloatOut*) (qudaVec[0]).Even().data(),(FloatOut*) (qudaVec[0]).Odd().data()); } template -static void copy_to_QUDA(FloatIn* in, ColorSpinorField &qudaVec, bool isEven){ - if( qudaVec.Precision() == QUDA_SINGLE_PRECISION ) +static void copy_to_QUDA(FloatIn* in,std::vector& qudaVec, bool isEven){ + if( (qudaVec[0]).Precision() == QUDA_SINGLE_PRECISION ) copy_to_QUDA(in, qudaVec, isEven); - else if ( qudaVec.Precision() == QUDA_DOUBLE_PRECISION ) + else if ( (qudaVec[0]).Precision() == QUDA_DOUBLE_PRECISION ) copy_to_QUDA(in, qudaVec, isEven); else - PLEGMA_error("Precision %d not supported", qudaVec.Precision()); + PLEGMA_error("Precision %d not supported", (qudaVec[0]).Precision()); checkQudaError(); } @@ -208,25 +208,25 @@ static __global__ void copy_from_QUDA_kernel(FloatOut *out, FloatIn *inEven, Flo } template -static void copy_from_QUDA(FloatOut* out, ColorSpinorField &qudaVec, bool isEven){ +static void copy_from_QUDA(FloatOut* out, std::vector& qudaVec, bool isEven){ ProfileStruct ps(HGC_localVolume); - if( qudaVec.SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ + if( (qudaVec[0]).SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ if( isEven ) - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel,out,(FloatIn*) qudaVec.data(), (FloatIn*) NULL); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel,out,(FloatIn*) (qudaVec[0]).data(), (FloatIn*) NULL); else - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) NULL,(FloatIn*) qudaVec.data()); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) NULL,(FloatIn*) (qudaVec[0]).data()); } else - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) qudaVec.Even().data(),(FloatIn*) qudaVec.Odd().data()); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) (qudaVec[0]).Even().data(),(FloatIn*) (qudaVec[0]).Odd().data()); } template -static void copy_from_QUDA(FloatOut* out, ColorSpinorField &qudaVec, bool isEven){ - if( qudaVec.Precision() == QUDA_SINGLE_PRECISION ) +static void copy_from_QUDA(FloatOut* out, std::vector &qudaVec, bool isEven){ + if( (qudaVec[0]).Precision() == QUDA_SINGLE_PRECISION ) copy_from_QUDA(out, qudaVec, isEven); - else if ( qudaVec.Precision() == QUDA_DOUBLE_PRECISION ) + else if ( (qudaVec[0]).Precision() == QUDA_DOUBLE_PRECISION ) copy_from_QUDA(out, qudaVec, isEven); else - PLEGMA_error("Precision %d not supported", qudaVec.Precision()); + PLEGMA_error("Precision %d not supported", (qudaVec[0]).Precision()); checkQudaError(); } diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index 3f9b8914..94321f01 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -203,6 +203,7 @@ QUDA_solver::QUDA_solver(double mu) { inv_param.input_location); ColorSpinorParam cudaParam(cpuParam, inv_param,inv_param.input_location); cudaParam.create = QUDA_ZERO_FIELD_CREATE; + b.push_back(ColorSpinorField(cudaParam)); x.push_back(ColorSpinorField(cudaParam)); @@ -363,13 +364,14 @@ void QUDA_solver::UpdateSolver() profiler->TPRESET(); } -std::vector QUDA_solver::solve(std::vector rhs){ +std::vector QUDA_solver::solve(std::vector& rhs){ profiler->TPSTART(QUDA_PROFILE_TOTAL); - std::vector in(1); - std::vector out(1); -// ColorSpinorField *in = NULL; -// ColorSpinorField *out = NULL; - D->prepare(in,out,x,rhs,inv_param.solution_type); + + ColorSpinorField in; + ColorSpinorField out; + + D->prepare(out,in,x[0],rhs[0],inv_param.solution_type); + (*solver)(out, in); D->reconstruct(x,rhs,inv_param.solution_type); profiler->TPSTOP(QUDA_PROFILE_TOTAL); @@ -401,6 +403,7 @@ void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &v inv_param.mass_normalization == QUDA_ASYMMETRIC_MASS_NORMALIZATION) { vectorOut.scale(2*inv_param.kappa); } + } template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); From 5445bf3bcc68ef6f71c9f77f970e6ab0d8b50373 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 15 Jul 2024 13:03:13 +0200 Subject: [PATCH 123/168] correcting error --- plegma/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 9944bb61..4c30ff89 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -1,4 +1,6 @@ set(PLEGMA_LIBS PLEGMA PLEGMAutils ${CMAKE_THREAD_LIBS_INIT} ${QUDA_LIB} ${CUDA_LIBS} cuda) +include_directories(${QUDA_HOME}/_deps/eigen-src/) + LIST(APPEND PLEGMA_LIBS ${MPI_CXX_LIBRARIES}) From bc07cabacc9c1083ff48ee5488a33e4ddf25e1ab Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 18 Sep 2024 16:41:33 +0200 Subject: [PATCH 124/168] removing individual diagrams from the library and adding a function Recombination --- include/PLEGMA_ScattCorrelator.h | 12 +++++ lib/PLEGMA_ScattCorrelator.cu | 37 ++++++++++++++- plegma/nucleon_3pt_n_npi.cpp | 81 +++++++++++++++++--------------- 3 files changed, 91 insertions(+), 39 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index a7a9098d..f75e9dd6 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -262,6 +262,18 @@ namespace plegma { //diagrams + void Recombination(PLEGMA_ScattCorrelator &srcV3, + PLEGMA_ScattCorrelator &srcV2, + bool matrix, + int index_abs, + bool transp_source_sink, + int ig_i2, + bool transpgamma_i1, + bool transpgamma_f1, + bool oet=false, + bool threept=false, + bool accum=false); + void B_diagrams( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum=false, bool oet=false, bool threept=false ); void W_diagrams( PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagramm_index, bool accum=false, bool threept=false ); void W_diagrams_oet(PLEGMA_ScattCorrelator &srcV6, std::shared_ptr &Phi0, std::vector*> &Phi_1, int input_mom_f2, int diagram_index, bool accum=false); diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 941ea9fe..57cfb826 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1644,6 +1644,35 @@ void PLEGMA_ScattCorrelator::D1ii_diagrams(PLEGMA_ScattCorrelator } } + +template +void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator &srcV3, + PLEGMA_ScattCorrelator &srcV2, + bool matrix, + int index_abs, + bool transp_source_sink, + int ig_i2, + bool transpgamma_i1, + bool transpgamma_f1, + bool oet, + bool threept, + bool accum){ + + if(ig_i2 >= this->GList[3].size()) PLEGMA_error("ig_i2 = %d but Gi2 list size is %d\n", ig_i2, this->GList[3].size() ); + + this->clear_output(!accum, 5, ig_i2); + + Float factor[2]={-1.,0.};//-1 from eqs. (20),(23), .... + + if (matrix == true){ + this->V3V2reduction_matrix( srcV3, srcV2, index_abs, transp_source_sink,i_gi2, transpgamma_i1, factor, transpgamma_f1, oet, threept); + } + else{ + this->V3V2reduction( srcV3, srcV2, index_abs, transp_source_sink, ig_i2, transpgamma_i1, factor, transpgamma_f1, oet, threept); + } + +} + template void PLEGMA_ScattCorrelator::B_diagrams(PLEGMA_ScattCorrelator &srcV3, PLEGMA_ScattCorrelator &srcV2, int ig_i2, int diagram_index, bool accum, bool oet, bool threept) { @@ -3290,8 +3319,10 @@ void PLEGMA_ScattCorrelator::contractMesonThrp_local(PLEGMA_Vector PLEGMA_Vector &fwdProp, std::vector gammas){ this->shape = {(int) gammas.size()}; - this->datasets = {"threep"}; - this->groups = {"Local"}; +// this->datasets = {"threep"}; +// if (this->groups.empty()){ +// this->groups = {"Local"}; +// } this->description = getGammasString_scatt(gammas); this->initialize(); @@ -3299,6 +3330,8 @@ void PLEGMA_ScattCorrelator::contractMesonThrp_local(PLEGMA_Vector PhixGxPhi_k(*this,fwdProp, gammas, bwdProp); + this->apply_sign_transp(0); + } diff --git a/plegma/nucleon_3pt_n_npi.cpp b/plegma/nucleon_3pt_n_npi.cpp index 72e37508..b179be01 100644 --- a/plegma/nucleon_3pt_n_npi.cpp +++ b/plegma/nucleon_3pt_n_npi.cpp @@ -123,7 +123,7 @@ int main(int argc, char **argv) { std::vector glist_source_nucleon_unpaired={ID}; std::vector glist_sink_nucleon_unpaired={ID}; - std::vector glist_insertion = {ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4};//,S12,S13,S23,S41,S42,S43}; + std::vector glist_insertion = {ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4,S_12,S_13,S_23,S_41,S_42,S_43}; int n_stochastic_samples; int max_source_sink_separations; @@ -350,8 +350,10 @@ int main(int argc, char **argv) { if (readStochSamples==0){ vectorSource_stochastic.stochastic_Z(nroots); - vectorSource_stochastic.unload(); - vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); + PLEGMA_Vector tempf; + tempf.copy(vectorSource_stochastic); + tempf.unload(); + tempf.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); #if 0 PLEGMA_Vector vectorRead(BOTH); vectorRead.readFile("stochastic_source.0000.00000_plegma_conventions.lime",LIME_FORMAT); @@ -361,17 +363,16 @@ int main(int argc, char **argv) { vectorRead.unload(); stochastic_sources[i]->copy(vectorRead,HOST); #endif - stochastic_sources[i]->copy(vectorSource_stochastic,HOST); + stochastic_sources[i]->copy(tempf,HOST); vectorSource_stochastic.load(); } else{ std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; PLEGMA_printf("Read stochastic source from: %s\n",inputfilename.c_str()); - PLEGMA_Vector vectorRead(BOTH); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_sources[i]->copy(vectorRead,HOST); - inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; PLEGMA_Vector vectorFloat(BOTH); + vectorFloat.readFile(inputfilename,LIME_FORMAT); + stochastic_sources[i]->copy(vectorFloat,HOST); + inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); vectorFloat.readFile(inputfilename,LIME_FORMAT); stochastic_propagator_2pt_SS[i]->copy(vectorFloat,HOST); @@ -1128,7 +1129,7 @@ int main(int argc, char **argv) { } //end of for stochastic samples // auto &momentum_i2 = {0,0,0};//mpi2_twopt[0]; - std::vector momentum_i2= {1,0,0}; + std::vector momentum_i2= {0,0,0}; //List of momenta corresponding to a fix value of p_i2 momList filtered_sourcemomentumList_2pt_single = sourcemomentumList_twopt.extract(momentum_i2, 0); @@ -1201,32 +1202,37 @@ int main(int argc, char **argv) { for (int i=0; i Date: Wed, 18 Sep 2024 16:51:19 +0200 Subject: [PATCH 125/168] inlude executables --- plegma/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 03dcd07b..dcec078c 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -70,6 +70,9 @@ target_link_libraries(nucleon_2pt_3pt_npi ${PLEGMA_LIBS}) cuda_add_executable(mesons_3pt mesons_3pt.cpp) target_link_libraries(mesons_3pt ${PLEGMA_LIBS}) +cuda_add_executable(mesons_3pt_npi mesons_3pt_npi.cpp) +target_link_libraries(mesons_3pt_npi ${PLEGMA_LIBS}) + cuda_add_executable(correcting_ZM EXCLUDE_FROM_ALL correcting_ZM.cpp) target_link_libraries(correcting_ZM ${PLEGMA_LIBS}) @@ -124,6 +127,9 @@ target_link_libraries(ZfacStaple ${PLEGMA_LIBS}) cuda_add_executable(PDFs_nucleon PDFs_nucleon.cpp) target_link_libraries(PDFs_nucleon ${PLEGMA_LIBS}) +cuda_add_executable(GPDs_nucleon GPDs_nucleon.cpp) +target_link_libraries(GPDs_nucleon ${PLEGMA_LIBS}) + cuda_add_executable(TMDPDFs_mesons_Juwels TMDPDFs_mesons_Juwels.cpp) target_link_libraries(TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) @@ -142,6 +148,13 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) cuda_add_executable(nucleon_3pt_n_npi_wd1ii EXCLUDE_FROM_ALL nucleon_3pt_n_npi_wd1ii.cpp) target_link_libraries(nucleon_3pt_n_npi_wd1ii ${PLEGMA_LIBS}) + + cuda_add_executable(nucleon_3pt_n_npi_T EXCLUDE_FROM_ALL nucleon_3pt_n_npi_T.cpp) + target_link_libraries(nucleon_3pt_n_npi_T ${PLEGMA_LIBS}) + + cuda_add_executable(nucleon_3pt_n_npi_N EXCLUDE_FROM_ALL nucleon_3pt_n_npi_N.cpp) + target_link_libraries(nucleon_3pt_n_npi_N ${PLEGMA_LIBS}) + cuda_add_executable(piNdiagrams_oet piNdiagrams_oet.cpp) target_link_libraries(piNdiagrams_oet ${PLEGMA_LIBS}) cuda_add_executable(checking_Doet checking_Doet.cpp) @@ -154,6 +167,8 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(QuarkLoops_pi0_insertion ${PLEGMA_LIBS}) cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) target_link_libraries(testYan ${PLEGMA_LIBS}) + cuda_add_executable(converttofloat EXCLUDE_FROM_ALL convert_double_float.cpp) + target_link_libraries(converttofloat ${PLEGMA_LIBS}) endif(PLEGMA_SCATTERING_CONTRACTIONS) From c88c3070defe2a93b74a40464e8d8f531b08a413 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sat, 5 Oct 2024 17:23:00 +0200 Subject: [PATCH 126/168] executable computing nsigma threepoint functions --- plegma/nucleon_3pt_n_npi_sigma.cpp | 3094 ++++++++++++++++++++++++++++ 1 file changed, 3094 insertions(+) create mode 100644 plegma/nucleon_3pt_n_npi_sigma.cpp diff --git a/plegma/nucleon_3pt_n_npi_sigma.cpp b/plegma/nucleon_3pt_n_npi_sigma.cpp new file mode 100644 index 00000000..093a5599 --- /dev/null +++ b/plegma/nucleon_3pt_n_npi_sigma.cpp @@ -0,0 +1,3094 @@ +#include +#include +#include +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) saveTuneCache(false); TIME(fnc) + +#define COMPUTEBACKWARD true + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename","momlisttwopt-filename","momlistthreept-filename", + "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space", "tSinks","Projs", "threep-filename","confnumber", "nstochSamples"}; + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *attract_look_up_table){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + + +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions_3pt( true, n_coherent_source, attract_look_up_table, source_sink_separation )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.writeHDF5( outputFilename )); +} + +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *attract_look_up_table + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); + TIME(source.writeHDF5( outputFilename )); +} + + +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions_3pt( true,n_coherent_source, attract_look_up_table, source_sink_separation )); + TIME(source.writeHDF5( outputFilename )); +} + + +int main(int argc, char **argv) { + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + std::vector mu_s; + std::vector mu_c; + int rand_seed1=1234; + int rand_seed2=5678; + int confnumber_int; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i glist_source_nucleon={CG_5}; + std::vector glist_sink_nucleon={CG_5}; + + std::vector glist_source_meson={ID}; + std::vector glist_sink_meson={ID}; + + std::vector glist_source_nucleon_unpaired={ID}; + std::vector glist_sink_nucleon_unpaired={ID}; + std::vector glist_insertion = {ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4,S_12,S_13,S_23,S_41,S_42,S_43};//,S12,S13,S23,S41,S42,S43}; + + int n_stochastic_samples; + int max_source_sink_separations; + int dotwopoint; + int readStochSamples; + //setVerbosity(QUDA_DEBUG_VERBOSE); + + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + HGC_options->set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); + HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + HGC_options->set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + HGC_options->set("seed2", "Seed for intiialization of stochastic sources", verbosity, rand_seed2); + HGC_options->set("dotwopoint", "Doing also the twopoint functions", verbosity,dotwopoint); + HGC_options->set("readStochSamples", "Flag for switching read/building stochastic propagators", verbosity, readStochSamples); + + + + //=========================================================================================================// + initializePLEGMA(); + + + { + PLEGMA_Gauge smearedGauge(BOTH); + PLEGMA_Gauge contractGauge(BOTH); + { + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + // Gauge for contractions + contractGauge.copy(gauge); + // apply boundary conditions since is needed for the covariant derivative + applyBoundaryConditions(contractGauge,true); + } + + updateOptions(LIGHT); + TIME(QUDA_solver solver(mu)); + + std::string given_twop_filename = twop_filename; + std::string given_threep_filename = threep_filename; + + //Get the confnumber for latfile + char *ssource; + asprintf(&ssource,"%04d", confnumber_int); + std::string confnumber= ssource; + free(ssource); + + + //Reading the momentum lists + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + momList sourcemomentumList_threept(4,pathListMomenta_threept,{1,2,3}); + PLEGMA_printf("N momenta in sourcemomentumList: %d\n",sourcemomentumList_threept.size()); + //We have four types of momenta in the list here + //The first three entries are the pi2 pion source momentum + //The second three entries are the pf1 nucleon sink momentum + //The third three entries are the pf2 pion sink momentum (it is assumed that pf2 is the same as -pf1) + //The fourth three entries are the pc momentum at the insertion + //pf1 + pf2 = 0, momentum at the sink is zero , the the pion momentum + //at sink follows from the nucleon momentum + //In addition the following momentum conversations are imposed + //pi1 + pi2 = pc so the momentum phase factor is calculated as pc-pi2 + //We define the list of momenta such that the total momentum should be the [2] \ + //column, the pc, and of coarse it is understand that this refers to the source only. + //At the sink we have always zero momentum + + momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); + //For the twopoint functions we have also three momentum + //first is pi2 + //second is pf1 + //third is pf2 + //and in this case the total momentum is defined as the sum of pf1 and pf2 + //to get pi1 we have to subtract pi2 from the total momentum + + + if(sourcemomentumList_twopt.empty()) + PLEGMA_error("twopt momentumList empty"); + if(sourcemomentumList_threept.empty()) + PLEGMA_error("threept momentumList empty"); + + std::vector> mpi2_twopt = sourcemomentumList_twopt.uniq_p(0); + momList list_mpi2_twopt(1,{mpi2_twopt,},{0,}); + + std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); + momList list_mpi2_threept(1,{mpi2_threept,},{0,}); + + std::vector> mpf1_threept = sourcemomentumList_threept.uniq_p(1); + momList list_mpf1_threept(1,{mpf1_threept,},{0,}); + + std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); + momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); + + std::vector> mpc = sourcemomentumList_threept.uniq_p(3); + momList list_mpc(1,{mpc,},{0,}); + + std::vector> mpf2_twopt = sourcemomentumList_twopt.uniq_p(2); + momList list_mpf2_twopt(1,{mpf2_twopt,},{0,}); + + + int parallel_sources=HGC_totalL[3]/max_source_sink_separations; + std::vector lookuptable_UP; + std::vector lookuptable_DN; + + + for (int i=0; i vectorSource_stochastic; + vectorSource_stochastic.randInit(rand_seed1); + + PLEGMA_Vector vectorStoc_source_oet; + vectorStoc_source_oet.randInit(rand_seed1); + + + //Computing with ubaru insertion + //Step (1) produce the stochastic sample + //Step (2) produce the stochastic propagators + //Step (3) produce standard point to all propagators + //Step (4) produce factors with point to all + //Step (5) produce sequential through the source with momenta pi2 + //Step (6) produce factors with the sequential + //Step (7) doing the recombination + //Step (8) doing the one end trick calculation for the Z diagrams + + std::vector*> stochastic_sources; + + std::vector*> stochastic_propagator_2pt_SS; + + std::vector*> stochastic_propags_UP_SL; + + std::vector*> stochastic_propags_DN_SL; +#if defined (COMPUTEBACKWARD) + + PLEGMA_Vector stochastic_oet_prop_u_zero_mom_SS_backward; + +#endif + + PLEGMA_Vector stochastic_oet_prop_u_zero_mom_SS; + +#if defined (COMPUTEBACKWARD) + + PLEGMA_Vector stochastic_oet_prop_d_zero_mom_SS_backward; + +#endif + + PLEGMA_Vector stochastic_oet_prop_d_zero_mom_SS; + + + PLEGMA_Vector stochastic_oet_prop_u_fini_mom_SL; + + PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SL; + + PLEGMA_Vector stochastic_oet_prop_u_fini_mom_SS; + + PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SS; + +#if defined (COMPUTEBACKWARD) + + PLEGMA_Vector stochastic_oet_prop_u_fini_mom_SS_backward; + + PLEGMA_Vector stochastic_oet_prop_d_fini_mom_SS_backward; + +#endif + + + + /****************************************************** + * + *Step 1: Producing the stochastic sources + * + ******************************************************/ +#if 1 + for (int i=0; i(HOST)); + if (dotwopoint==1){ + stochastic_propagator_2pt_SS.push_back(new PLEGMA_Vector(HOST)); + } + if (readStochSamples==0){ + + vectorSource_stochastic.stochastic_Z(nroots); + vectorSource_stochastic.unload(); + vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); +#if 0 + PLEGMA_Vector vectorRead(BOTH); + vectorRead.readFile("stochastic_source.0000.00000_plegma_conventions.lime",LIME_FORMAT); + vectorRead.load(); + vectorRead.rotate_uk_ch_g5g4(); + vectorRead.apply_gamma(G2); + vectorRead.unload(); + stochastic_sources[i]->copy(vectorRead,HOST); +#endif + stochastic_sources[i]->copy(vectorSource_stochastic,HOST); + vectorSource_stochastic.load(); + } + else{ + std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read stochastic source from: %s\n",inputfilename.c_str()); + PLEGMA_Vector vectorRead(BOTH); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_sources[i]->copy(vectorRead,HOST); + inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_Vector vectorFloat(BOTH); + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorFloat.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_2pt_SS[i]->copy(vectorFloat,HOST); + } + } + + + /****************************************************** + * + *Step 2: Producing the stochastic propagators + * + ******************************************************/ + + if ((dotwopoint==1) && (readStochSamples==0)){ + for (int i=0; i vectorInOut, vectorAuxD1,vectorAuxD2; + + vectorAuxD1.copy(*stochastic_sources[i], HOST); + vectorAuxD1.load(); + + //Step(3) Smearing all the time slice + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + //In vectorAuxD2 we store the results for the inversion + vectorAuxD2.scale(0.0); + + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(5) pick out a particular timeslice from the source + // + //PLEGMA_Vector3D vec3D; + //vec3D.absorb(vectorAuxD1, timeidx); + //vectorInOut.absorb(vec3D, timeidx); + //vectorInOut.copy(vectorAuxD1); + vectorInOut.absorbTimeslice(vectorAuxD1, timeidx); + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + //Step(7) absorbing the particular timeslice to a 4d vector + //vec3D.absorb(vectorInOut, timeidx); + //vectorAuxD2.absorb(vec3D, timeidx, false); + vectorAuxD2.absorbTimeslice(vectorInOut, timeidx, false); + } + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2,+1)); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(8) Save the propagator to the disk + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD2); + vectorAuxF.unload(); + vectorAuxF.writeLIME("globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber); + } + + //Step(9) Save the propagator to the host memory + vectorAuxD2.unload(); + stochastic_propagator_2pt_SS[i]->copy(vectorAuxD2,HOST); + vectorAuxD2.load(); + + } + } + +#endif + +#if 1 + if(mu<0) + { + mu = -mu; + solver.UpdateSolver(); + } + + int countindex=0; + for (int isource=0; isource smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, timeSlice ); + for(int i=0; i< n_stochastic_samples; ++i) { + vectorSource_stochastic.copy( *stochastic_sources[i], HOST); + vectorSource_stochastic.load(); + PLEGMA_Vector vectorInOut, vectorAuxD1; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vectorInOut.copy(vectorSource_stochastic); + vector1.absorb(vectorInOut,timeSlice); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorInOut.absorb(vector2,timeSlice); + } + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); + + //Step(5) pick out a particular timeslice from the source + vectorInOut.absorbTimeslice(vectorAuxD1, timeSlice); + + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,+1)); + + //Step(7) Smearing all the time slice in the propagator + //We do not perform smearing for stochastic propagator + //because it always ends at the insertion + //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorAuxD1.unload(); + //PLEGMA_printf("Save the stochastic source for sample %d\n",i); + //std::string nstoch=std::to_string(i); + //vectorAuxD1.writeHDF5("stochastic_propagators_UP"+nstoch+"_t"+std::to_string(timeSlice)); + + //writeHDF5(outfilename) + stochastic_propags_UP_SL.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_UP_SL[countindex]->copy(vectorAuxD1, HOST); + countindex++; + //(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + vectorAuxD1.load(); + + } + lookuptable_UP[timeSlice]=(countindex-1)/n_stochastic_samples; + } + } + } + } + if(mu>0) + { + mu = -mu; + solver.UpdateSolver(); + } + + + countindex=0; + for (int isource=0; isource smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, timeSlice ); + for(int i=0; i< n_stochastic_samples; ++i) { + vectorSource_stochastic.copy( *stochastic_sources[i], HOST); + vectorSource_stochastic.load(); + PLEGMA_Vector vectorInOut,vectorAuxD1; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vectorInOut.copy(vectorSource_stochastic); + vector1.absorb(vectorInOut,timeSlice); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorInOut.absorb(vector2,timeSlice); + } + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); + + //Step(5) pick out a particular timeslice from the source + vectorInOut.absorbTimeslice(vectorAuxD1, timeSlice); + + //Step(6) Solve + TIME(solver.solve(vectorInOut, vectorInOut)); + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); + + //Step(7) Smearing all the time slice in the propagator + //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //vectorAuxD1.unload(); + //PLEGMA_printf("Save the stochastic source for sample %d\n",i); + //std::string nstoch=std::to_string(i); + //vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch+"_t"+std::to_string(timeSlice)); + + vectorAuxD1.unload(); + stochastic_propags_DN_SL.push_back(new PLEGMA_Vector(HOST)); + stochastic_propags_DN_SL[countindex]->copy(vectorAuxD1, HOST); + countindex++; + + //stochastic_propags_DN_SL[(isource*tSinks.size()*parallel_sources+k*parallel_sources+l)*n_stochastic_samples+i]->copy(vectorInOut, HOST); + vectorAuxD1.load(); + + } + lookuptable_DN[timeSlice]=(countindex-1)/n_stochastic_samples; + } + } + } + } + +#endif + + + /****************************************************** + * + * Step 3: Computing the point to all propagators + * + ******************************************************/ + + for(int isource = startSource; isource < numSourcePositions; isource++){ + + + site source = sourcePositions[isource]; + + site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); + //updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); + + asprintf(&ssource,"sx%02dsy%02dsz%02dst%03d", sourcePositions[isource][0], sourcePositions[isource][1], sourcePositions[isource][2], sourcePositions[isource][3]); + std::string sourcepositiontext= (std::string)"_" + ssource; + free(ssource); + + auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, + double run_mu, WHICHFLAVOR fl, int nSmear, site &source_location, bool finalize) { + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_location[DIM_T]); + // ensuring mu value + if(mu != run_mu) { + updateOptions(fl); + mu = run_mu; + solver.UpdateSolver(); + } + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorInOut; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source_location, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut.absorb(vector2,source_location[DIM_T]); + } + // Inverting + PLEGMA_printf("Going to invert %s for component %d\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + TIME(solver.solve(vectorInOut, vectorInOut)); + + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + + if(prop_SL.getAllocation() != NONE) { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorInOut); + prop_SL.absorb(vectorAuxF, isc/3, isc%3); + } + { // Smearing the solution + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop_SS.absorb(vectorAuxF, isc/3, isc%3); + } + } + if(finalize) { + prop_SS.rotateToPhysicalBase_device(run_mu/abs(run_mu)); + prop_SS.applyBoundaries_device(source[DIM_T]); + } + }; + +#if defined (COMPUTEBACKWARD) + + PLEGMA_Propagator propUP_SS_packed_backward; + PLEGMA_Propagator propDN_SS_packed_backward; + +#endif + + + PLEGMA_Propagator propUP_SS_packed; + PLEGMA_Propagator propDN_SS_packed; + + PLEGMA_Propagator propUP_SL_packed; + PLEGMA_Propagator propDN_SL_packed; + + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + for (int sink=0; sink propUP_SS; + PLEGMA_Propagator propDN_SS; + + PLEGMA_Propagator propUP_SL; + PLEGMA_Propagator propDN_SL; + + //site source_local = sourcePositions[isource]; + //source_local[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site source_local; + source_local[0] = sourcePositions[isource][0]; + source_local[1] = sourcePositions[isource][1]; + source_local[2] = sourcePositions[isource][2]; + source_local[3] = (sourcePositions[isource][DIM_T]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site source_localPtSinkMtSource; + source_localPtSinkMtSource[0] = sourcePositions[isource][0]; + source_localPtSinkMtSource[1] = sourcePositions[isource][1]; + source_localPtSinkMtSource[2] = sourcePositions[isource][2]; + source_localPtSinkMtSource[3] = (sourcePositions[isource][DIM_T]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + site source_localTotalMsink; + source_localTotalMsink[0] = sourcePositions[isource][0]; + source_localTotalMsink[1] = sourcePositions[isource][1]; + source_localTotalMsink[2] = sourcePositions[isource][2]; + source_localTotalMsink[3] = ((sourcePositions[isource][DIM_T]+(i_source_parallel)*max_source_sink_separations)+HGC_totalL[3])%HGC_totalL[3]; + + + site source_local_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + source_local_reduction[3]=(sourcePositions[isource][3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + + PLEGMA_ScattCorrelator corrNP(source_local, list_mpf1_twopt); + TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + + PLEGMA_ScattCorrelator corrN0(source_local, list_mpf1_twopt); + TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + + + // If twop_filename exists we hold the computation of the light props + TIME(computePropagator(propUP_SS, propUP_SL, mu_ud, LIGHT, nsmearGauss, source_local, false)); + TIME(computePropagator(propDN_SS, propDN_SL, -mu_ud, LIGHT, nsmearGauss, source_local, false)); + + if (dotwopoint==1){ + + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS, propDN_SS, propUP_SS)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } + + //Computing T reductions+recombination + + { + PLEGMA_ScattCorrelator reductionsT1N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; + TIME( corrN0.apply_phase()); + TIME( corrN0.apply_sign("N")); + TIME( corrN0.applyBoundaryConditions( true )); + TIME( corrN0.writeHDF5(outfilename)); + + TIME( corrNP.apply_phase() ); + TIME( corrNP.apply_sign("N") ); + TIME( corrNP.applyBoundaryConditions( true ) ); + TIME( corrNP.writeHDF5(outfilename) ); + } + + /*{ + PLEGMA_printf("Save propagator for the up and dn quark\n"); + PLEGMA_Vector vectorAuxPrint(BOTH); + for(int isc = 0 ; isc < 12 ; isc++){ + std::string spin=std::to_string(isc/3); + std::string col=std::to_string(isc%3); + + vectorAuxPrint.absorb(propUP_SS,isc/3,isc%3); + vectorAuxPrint.unload(); + vectorAuxPrint.writeHDF5("propUPSS_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); + } + }*/ + + propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + propUP_SS_packed_backward.pack_propagator_from_source_to_sink(propUP_SS, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SS_packed_backward.pack_propagator_from_source_to_sink(propDN_SS, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + + propUP_SL_packed.pack_propagator_from_source_to_sink(propUP_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + propDN_SL_packed.pack_propagator_from_source_to_sink(propDN_SL, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + } //parallel source position + + + PLEGMA_ScattCorrelator corrNP_packed(source, list_mpf1_twopt); + //PLEGMA_ScattCorrelator corrNP_packed_backward(source, list_mpf1_twopt); + + TIME(corrNP_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + //TIME(corrNP_packed_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + + if (dotwopoint==1){ + + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP_packed.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + //TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + //TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + //TIME(corrNP_packed_backward.N_diagrams( reductionsT1N, reductionsT2N )); + + + + } + + } + + PLEGMA_ScattCorrelator corrN0_packed(source, list_mpf1_twopt); + TIME(corrN0_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + + if (dotwopoint==1){ + + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0_packed.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + } + + } + + /****************************************************** + * + * Step 4: Computing the factors from the point to all + * and + * stochastic pieces + * + ******************************************************/ + + + //We implement the UD part first + //The neutron piplus at the source + + //We can compute V2 contractions for B and V3 contraction for W first + //without having to compute it for all the iterations in the loop + //over the sequential momentum + //Provided we have the same pf1,pf2 pairs for all pi2 sequential momentum + //For the saved V2 and V3 reductions we have to use all possible unique pf1 and pf2 + + //Here the prefix UU means that reduction is based phi and xi, without the gamma_5 + //We replace U(x_f2,x_f1) with phi(x_f2) xi^dagger(x_f1) + //phi goes to V2 reduction and xi goes to V3 reduction + + + //Here the prefix DD means that reduction is based phi*g5 and xi*g5 + //We replace D(x_f2,x_f1) with xi(x_f2)*gamma_5* phi^dagger(x_f1) *gamma_5 + //phi goes to V3 reduction and xi goes to V2 reduction + + //For the proton pizero x neutron piplus + + + std::vector*> reductions_UU_V2_GAMMAF1D_U;//implemented + std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt;//implemented + +#if defined (COMPUTEBACKWARD) + std::vector*> reductions_UU_V2_GAMMAF1D_U_2pt_backward;//implemented +#endif + + std::vector*> reductions_UU_V4_GAMMAF1U_D;//implemented + + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt;//implemented + +#if defined (COMPUTEBACKWARD) + std::vector*> reductions_UU_V4_GAMMAF1U_D_2pt_backward;//implemented +#endif + + + std::vector*> reductions_UU_V3_GAMMAF2U;//implemented + std::vector*> reductions_UU_V3_GAMMAF2U_2pt;//implemented +#if defined (COMPUTEBACKWARD) + std::vector*> reductions_UU_V3_GAMMAF2U_2pt_backward;//implemented +#endif + std::vector*> reductions_DD_V3_GAMMAF2D;//implemented + std::vector*> reductions_DD_V3_GAMMAF2D_2pt;//implemented + +#if defined (COMPUTEBACKWARD) + std::vector*> reductions_DD_V3_GAMMAF2D_2pt_backward;//implemented +#endif + + std::vector*> reductions_DD_V2_GAMMAF1U_U;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt; +#if defined (COMPUTEBACKWARD) + std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt_backward; +#endif + std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented + std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented +#if defined (COMPUTEBACKWARD) + std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt_backward;//implemented + std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt_backward;//implemented + std::vector*> reductions_DD_V3_GAMMAF2U_2pt_backward;//implemented +#endif + + + + + + for(int i=0; i< n_stochastic_samples; ++i) { + if (dotwopoint==1){ + reductions_DD_V2_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + + reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); +#if defined (COMPUTEBACKWARD) + reductions_DD_V2_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V2_GAMMAF1U_U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_DD_V4_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + reductions_UU_V2_GAMMAF1D_U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + reductions_UU_V4_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); + + + reductions_UU_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); + reductions_DD_V3_GAMMAF2D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); +#endif + + } + + + for (int k=0; k< tSinks.size(); ++k){ + try + { + reductions_DD_V2_GAMMAF1U_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductions_UU_V2_GAMMAF1D_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + reductions_UU_V4_GAMMAF1U_D.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + + reductions_UU_V3_GAMMAF2U.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + reductions_DD_V3_GAMMAF2D.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpc)); + + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store factors"); + exit(1); + } + } + } + + + for (int i_sample=0; i_sample stochastic_source; + stochastic_source.copy(*stochastic_sources[i_sample],HOST); + stochastic_source.load(); + + for (int k=0; k< tSinks.size();++k){ + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + PLEGMA_Propagator propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + + for (int i_source_parallel=0; i_source_parallel stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallelV2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); + + //B4,B6 + //B10,B12 + TIME(reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k]->V4( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propDNpacked_to_sink, true)); + + if (k==0 && (dotwopoint==1)){ + PLEGMA_Vector stoch_piece; + stoch_piece.unload(); + stoch_piece.copy(*stochastic_sources[i_sample],HOST); + stoch_piece.load(); + + TIME(reductions_UU_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); +#if defined (COMPUTEBACKWARD) + TIME(reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed_backward, true)); +#endif + stoch_piece.apply_gamma5(); + TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); + + TIME(reductions_DD_V2_GAMMAF1U_D_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + + TIME(reductions_DD_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); +#if defined (COMPUTEBACKWARD) + TIME(reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME(reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); + + TIME(reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); +#endif + + stoch_piece.unload(); + stoch_piece.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); + stoch_piece.load(); + + TIME(reductions_UU_V2_GAMMAF1D_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); + + TIME(reductions_UU_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); +#if defined (COMPUTEBACKWARD) + TIME(reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propDN_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME(reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); +#endif + + stoch_piece.apply_gamma5(); + + TIME(reductions_DD_V3_GAMMAF2D_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); + + TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); +#if defined (COMPUTEBACKWARD) + TIME(reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed_backward, true)); + + TIME(reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed_backward, true)); +#endif + + + } + + + //W5,W6,W7,W8 + //W9,W10,W11,W12,W17,W18,W19,W20 + PLEGMA_Vector stochastic_propagator_packed; + for (int i_source_parallel=0; i_source_parallel temporary; + site maxinsertion_local; + maxinsertion_local[0] = sourcePositions[isource][0]; + maxinsertion_local[1] = sourcePositions[isource][1]; + maxinsertion_local[2] = sourcePositions[isource][2]; + maxinsertion_local[3] = (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site sink_local; + sink_local[0] = sourcePositions[isource][0]; + sink_local[1] = sourcePositions[isource][1]; + sink_local[2] = sourcePositions[isource][2]; + sink_local[3] = (source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[sink_local[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + + stochastic_propagator_packed.apply_gamma5(); + + + TIME(reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k]->V3( stochastic_propagator_packed, glist_insertion, propUP_SL_packed, true)); + + //For D(xf1,xf2) + + stochastic_propagator_packed.apply_gamma5(); + + + for (int i_source_parallel=0; i_source_parallel temporary; + site maxinsertion_local; + maxinsertion_local[0] = sourcePositions[isource][0]; + maxinsertion_local[1] = sourcePositions[isource][1]; + maxinsertion_local[2] = sourcePositions[isource][2]; + maxinsertion_local[3] = (sourcePositions[isource][DIM_T]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + site sink_local; + sink_local[0] = sourcePositions[isource][0]; + sink_local[1] = sourcePositions[isource][1]; + sink_local[2] = sourcePositions[isource][2]; + sink_local[3] = (sourcePositions[isource][DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + temporary.unload(); + temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[sink_local[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); + + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + + + stochastic_propagator_packed.apply_gamma5(); + + + //W13,W14,W15,W16 + //W21,W22,W23,W24 + TIME(reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k]->V3( stochastic_propagator_packed, glist_insertion, propDN_SL_packed, true)); + + //B7,B8 + //B1,B2 + TIME(reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k]->V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, true)); + + } //end of for source sink separations + } //end of for stochastic samples + +// auto &momentum_i2 = {0,0,0};//mpi2_twopt[0]; + std::vector momentum_i2= {1,0,0}; + //List of momenta corresponding to a fix value of p_i2 + + vectorStoc_source_oet.stochastic_Z(nroots); +#if 0 + +/* { + PLEGMA_Vector tmm(BOTH); + tmm.copy(*stochastic_sources[0],HOST); + tmm.load(); + vectorStoc_source_oet.copy(tmm); + }*/ + + //PLEGMA_printf("DONE stochastic factors\n"); + +#endif +#if 1 + /****************************************************** + * + * Step 5: Computing OET propagators for UP DN + * + * + ******************************************************/ + + { + + //Doing for +mu for the UP propagator spin dilution oet + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + for (int i_source_parallel=0; i_source_parallel vectortmp1; + PLEGMA_Vector vectortmp2; + PLEGMA_Vector vectorSave_diluted; + + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorStoc_source_oet, source_local[DIM_T]); + + vector1.apply_gamma_scatt( glist_source_meson[0]); + vector1.apply_gamma5(); + + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, source_local[DIM_T]); + + } + + vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); + + //Doing the zero momentum stochastic propagator with spin dilution + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,+1); + //Gaussian smearing of the propagator + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + + //temporary1.pack_propagator_from_source_to_sink(temporary2, maxinsertion_local[3], max_source_sink_separations, l == 0 ? true : false); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_u_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + + stochastic_oet_prop_u_zero_mom_SS_backward.pack_propagator_from_source_to_sink(vectorAuxF, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#endif + + + } //end of loop on parallel sources + + //stochastic_oet_prop_u_zero_mom_SS.unload(); + //stochastic_oet_prop_u_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_u"); + //stochastic_oet_prop_u_zero_mom_SS.load(); + + + //PLEGMA_printf("DONE OET zero mom up\n"); + + //Doing for -mu for the DN propagator spin dilution oet + if(mu>0) { + mu*=-1.; + solver.UpdateSolver(); + } + + for (int i_source_parallel=0; i_source_parallel vectortmp1; + PLEGMA_Vector vectortmp2; + PLEGMA_Vector vectorSave_diluted; + + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorStoc_source_oet, source_local[3]); + + vector1.apply_gamma_scatt( glist_source_meson[0]); + vector1.apply_gamma5(); + + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, source_local[3]); + } + + vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); + //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); + //Doing the zero momentum stochastic propagator with spin dilution + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,-1); + //Gaussian smearing of the propagator + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_d_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + stochastic_oet_prop_d_zero_mom_SS_backward.pack_propagator_from_source_to_sink(vectorAuxF, source_localTotalMsink[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + + } //end of loop on parallel sources + }//end of do_stochastic_oet + + + //PLEGMA_printf("DONE OET zero mom dn\n"); + +#endif + +#if 1 + /****************************************************** + * + * Step 4: Computing the zero momentum oet factors + * i.e. V2 and V4 reductions + * + * + ******************************************************/ + + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt(source_reduction, list_mpf2_twopt); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator reductionsV3_diluted_U_DN_2pt_backward(source_reduction, list_mpf2_twopt); +#endif + + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt(source_reduction, list_mpf2_twopt); + + PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt(source_reduction, list_mpf2_twopt); + + +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator reductionsV3_diluted_D_UP_2pt_backward(source_reduction, list_mpf2_twopt); + + PLEGMA_ScattCorrelator reductionsV3_diluted_U_UP_2pt_backward(source_reduction, list_mpf2_twopt); +#endif + + + std::vector*> reductionsV4_diluted_STOCHU_DN_UP; + std::vector*> reductionsV2_diluted_STOCHU_DN_UP; + std::vector*> reductionsV2_diluted_STOCHD_UP_UP; + + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHU_DN_UP_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_UP_2pt(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHD_UP_DN_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_DN_2pt(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt(source_reduction, list_mpf1_twopt); + +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHU_DN_UP_2pt_backward(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_UP_2pt_backward(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV4_diluted_STOCHD_UP_DN_2pt_backward(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_DN_2pt_backward(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHD_UP_UP_2pt_backward(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV2_diluted_STOCHU_DN_DN_2pt_backward(source_reduction, list_mpf1_twopt); +#endif + + for (int k=0; k(source_reduction, list_mpf1_threept)); + reductionsV2_diluted_STOCHU_DN_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + reductionsV2_diluted_STOCHD_UP_UP.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_threept)); + } + catch(std::bad_alloc&){ + PLEGMA_printf("Memory allocation fails to store V24 factors oet"); + exit(1); + } + } + for (int k=0; k propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + for (int i_source_parallel=0; i_source_parallel st_oet_u_zeropacked_to_sink; + PLEGMA_Vector st_oet_d_zeropacked_to_sink; + + for (int i_source_parallel=0; i_source_parallelV2( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); + TIME(reductionsV2_diluted_STOCHD_UP_UP[k]->V2( st_oet_d_zeropacked_to_sink, glist_sink_nucleon, propUPpacked_to_sink, propUPpacked_to_sink, true)); + TIME(reductionsV4_diluted_STOCHU_DN_UP[k]->V4( st_oet_u_zeropacked_to_sink, glist_sink_nucleon, propDNpacked_to_sink, propUPpacked_to_sink, true)); + + if (k==0 && (dotwopoint==1)){ + + TIME(reductionsV2_diluted_STOCHU_DN_DN_2pt.V2( stochastic_oet_prop_u_zero_mom_SS, glist_sink_nucleon, propDN_SS_packed, propDN_SS_packed, true)); + TIME(reductionsV2_diluted_STOCHU_DN_UP_2pt.V2( stochastic_oet_prop_u_zero_mom_SS, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); + + TIME(reductionsV4_diluted_STOCHD_UP_DN_2pt.V4( stochastic_oet_prop_d_zero_mom_SS, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + TIME(reductionsV2_diluted_STOCHD_UP_DN_2pt.V2( stochastic_oet_prop_d_zero_mom_SS, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); + + TIME(reductionsV2_diluted_STOCHD_UP_UP_2pt.V2( stochastic_oet_prop_d_zero_mom_SS, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); + TIME(reductionsV4_diluted_STOCHU_DN_UP_2pt.V4( stochastic_oet_prop_u_zero_mom_SS, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, true)); + +#if defined (COMPUTEBACKWARD) + TIME(reductionsV2_diluted_STOCHU_DN_DN_2pt_backward.V2( stochastic_oet_prop_u_zero_mom_SS_backward, glist_sink_nucleon, propDN_SS_packed_backward, propDN_SS_packed_backward, true)); + TIME(reductionsV2_diluted_STOCHU_DN_UP_2pt_backward.V2( stochastic_oet_prop_u_zero_mom_SS_backward, glist_sink_nucleon, propDN_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME(reductionsV4_diluted_STOCHD_UP_DN_2pt_backward.V4( stochastic_oet_prop_d_zero_mom_SS_backward, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); + TIME(reductionsV2_diluted_STOCHD_UP_DN_2pt_backward.V2( stochastic_oet_prop_d_zero_mom_SS_backward, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); + + TIME(reductionsV2_diluted_STOCHD_UP_UP_2pt_backward.V2( stochastic_oet_prop_d_zero_mom_SS_backward, glist_sink_nucleon, propUP_SS_packed_backward, propUP_SS_packed_backward, true)); + TIME(reductionsV4_diluted_STOCHU_DN_UP_2pt_backward.V4( stochastic_oet_prop_u_zero_mom_SS_backward, glist_sink_nucleon, propDN_SS_packed_backward, propUP_SS_packed_backward, true)); + +#endif + } + + } + +#endif + + //P diagram + PLEGMA_ScattCorrelator corrP0UP(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrP0DN(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPUP(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPDN(source, list_mpi2_twopt); + + corrP0UP.initialize_diagram(glist_source_meson, glist_sink_meson, "P0UP"); + corrP0DN.initialize_diagram(glist_source_meson, glist_sink_meson, "P0DN"); + corrPPUP.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + corrPPDN.initialize_diagram(glist_source_meson, glist_sink_meson, "PPDN"); + +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrP0UP_backward(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrP0DN_backward(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPUP_backward(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPPDN_backward(source, list_mpi2_twopt); + + corrP0UP_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "P0UP"); + corrP0DN_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "P0DN"); + corrPPUP_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + corrPPDN_backward.initialize_diagram(glist_source_meson, glist_sink_meson, "PPDN"); + +#endif + + + + + /****************************************************** + * + * Step 4: Computing the sequential for the UU part + * proton pizero up + * + * + ******************************************************/ + + //We first have a loop over all unique the source meson momentum p_i2 + for (int i_mpi2=0; i_mpi2> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); + + std::vector> mpi2_filt ; + mpi2_filt.assign(mptot_filt.size(),momentum_i2); + //PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); + momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); + +#if 1 + + PLEGMA_ScattCorrelator reductionsV2(source_reduction, list_mpf1_threept); + PLEGMA_ScattCorrelator reductionsV2_2pt(source_reduction, list_mpf1_twopt); + + PLEGMA_ScattCorrelator corrM( source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if12(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if34(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if56(source, filtered_sourcemomentumList_2pt); + +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrM_backward( source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if12_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if34_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrD1if56_backward(source, filtered_sourcemomentumList_2pt); +#endif + PLEGMA_ScattCorrelator reductionsT1(source_reduction, mptot_filt); + PLEGMA_ScattCorrelator reductionsT2(source_reduction, mptot_filt); + + PLEGMA_ScattCorrelator reductionsV3(source_reduction, list_mpc); + PLEGMA_ScattCorrelator reductionsV3_2pt(source_reduction, list_mpf2_twopt); + + PLEGMA_Propagator propTS_SS_packed; +#if defined (COMPUTEBACKWARD) + PLEGMA_Propagator propTS_SS_packed_backward; +#endif + PLEGMA_Propagator propTS_SL_packed; +#if 1 + //First we do the UP - UP case sequential inversion for the proton pizero + for (int i_source_parallel=0; i_source_parallel < parallel_sources;++i_source_parallel){ + + PLEGMA_Propagator propTS_SS; + PLEGMA_Propagator propTS_SL; + + + //we first implemenet UD + //Ensure mu is positive + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propUP_SS_packed, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + } + + vectorAuxD2.absorbTimeslice(vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); + + //Perform multiplication with glist_insertion[0] + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,+1); + + //Computing sequential propagators UD T_fii with insertion + //glist_insertion[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert UP for sequential propagator UP for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,+1); + //performing smearing + vectorAuxF.copy(vectorAuxD2); + propTS_SL.absorb(vectorAuxF, isc/3, isc%3); + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); + + } + + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + + propTS_SS_packed_backward.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + } + + + PLEGMA_ScattCorrelator corrTproton_protonpizero1(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero2(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero3(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero4(source, list_mpi2ptot); +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrTproton_protonpizero1_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero2_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero3_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero4_backward(source, list_mpi2ptot); +#endif + + //std::vector<> mm=list_mpi2ptot.to_string(); + + corrTproton_protonpizero1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq21"); + + corrTproton_protonpizero2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq22"); + + corrTproton_protonpizero3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq23"); + + corrTproton_protonpizero4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); + +#if defined (COMPUTEBACKWARD) + corrTproton_protonpizero1_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq21"); + + corrTproton_protonpizero2_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq22"); + + corrTproton_protonpizero3_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq23"); + + corrTproton_protonpizero4_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq24"); +#endif + + if (dotwopoint==1){ + + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero1_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero2_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + +#endif + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_protonpizero3.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propTS_SS_packed)); + TIME(corrTproton_protonpizero4.convertTreductiontoDiagram( reductionsT2, 0, false, true, true)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propTS_SS_packed_backward)); + TIME(corrTproton_protonpizero3_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propTS_SS_packed_backward)); + TIME(corrTproton_protonpizero4_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true)); + +#endif + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + + TIME(produceOutput_2pt_packed(corrTproton_protonpizero1, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero2, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero3, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero4, outfilename, "T", parallel_sources, attract_lookup_table)); + +#if defined (COMPUTEBACKWARD) + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T_backward"; + + TIME(produceOutput_2pt_packed(corrTproton_protonpizero1_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero2_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero3_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero4_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + + } +#endif + + + //creating factors + + PLEGMA_Vector stochastic_propagator_packed; + + PLEGMA_ScattCorrelator corrB3_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB4_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB5_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB6_2pt(source, filtered_sourcemomentumList_2pt); + + + PLEGMA_ScattCorrelator corrW5_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW6_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW8_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW13_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW14_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW15_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW16_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW29_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW30_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW31_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW32_2pt(source, filtered_sourcemomentumList_2pt); + +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrB3_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB4_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB5_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB6_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW5_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW6_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW7_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW8_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW13_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW14_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW15_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW16_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW29_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW30_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW31_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW32_2pt_backward(source, filtered_sourcemomentumList_2pt); + +#endif + + corrB3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); + corrB4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); + corrB5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B5"); + corrB6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B6"); + + corrW5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W5"); + corrW6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W6"); + corrW7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W7"); + corrW8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W8"); + + corrW13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W13"); + corrW14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W14"); + corrW15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); + corrW16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); + + corrW29_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W29"); + corrW30_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W30"); + corrW31_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); + corrW32_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); + +#if defined (COMPUTEBACKWARD) + + corrB3_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B3"); + corrB4_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B4"); + corrB5_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B5"); + corrB6_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B6"); + + corrW5_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W5"); + corrW6_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W6"); + corrW7_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W7"); + corrW8_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W8"); + + corrW13_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W13"); + corrW14_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W14"); + corrW15_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); + corrW16_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); + + corrW29_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W29"); + corrW30_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W30"); + corrW31_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); + corrW32_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); +#endif +#endif + + + if (dotwopoint==1){ + + for (int i_sample=0; i_sample stochastic_piece; + stochastic_piece.unload(); + stochastic_piece.copy(*stochastic_sources[i_sample], HOST); + stochastic_piece.load(); + + //V3 + TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed, true)); + +// TIME(corrB3_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 3, true)); + TIME(corrB3_2pt.Recombination(reductionsV3_2pt,*reductions_UU_V2_GAMMAF1D_U_2pt[i_sample],false,0,false,0,true,false,false,false,true)); +// TIME(corrB4_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 4, true)); + TIME(corrB4_2pt.Recombination(reductionsV3_2pt,*reductions_UU_V4_GAMMAF1U_D_2pt[i_sample],false,2,false,0,true,true,false,false,true)); +// TIME(corrB5_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 5, true)); + TIME(corrB5_2pt.Recombination(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample],true,1,false,0,true,false,false,false,true)); +// TIME(corrB6_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 6, true)); + TIME(corrB6_2pt.Recombination(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample],true,0,false,0,false,true,false,false,true)); +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed_backward, true)); + +// TIME(corrB3_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 3, true)); + TIME(corrB3_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample],false,0,false,0,true,false,false,false,true)); +// TIME(corrB4_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 4, true)); + TIME(corrB4_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample],false,2,false,0,true,true,false,false,true)); +// TIME(corrB5_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 5, true)); + TIME(corrB5_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample],true,1,false,0,true,false,false,false,true)); +// TIME(corrB6_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 6, true)); + TIME(corrB6_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample],true,0,false,0,false,true,false,false,true)); + +#endif + + + stochastic_piece.apply_gamma5(); + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true));//checked + + TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); + + TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true));//checked + + TIME(corrW13_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 13, true, false)); + + TIME(corrW15_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 15, true, false)); +#endif + + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true));//checked + + TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); + + TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true));//checked + + TIME(corrW14_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 14, true, false)); + + TIME(corrW16_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 16, true, false)); + +#endif + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked + + TIME(corrW31_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 31, true, false)); + TIME(corrW32_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 32, true, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked + + TIME(corrW31_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 31, true, false)); + TIME(corrW32_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 32, true, false)); +#endif + + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked + + TIME(corrW29_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 29, true, false)); + TIME(corrW30_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 30, true, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked + + TIME(corrW29_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 29, true, false)); + TIME(corrW30_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 30, true, false)); +#endif + + + + + stochastic_piece.unload(); + stochastic_piece.copy(*stochastic_propagator_2pt_SS[i_sample], HOST); + stochastic_piece.load(); + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked + + TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); + + TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked + + TIME(corrW5_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 5, true, false)); + + TIME(corrW7_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 7, true, false)); +#endif + + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked + + TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); + + TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); + +#if defined (COMPUTEBACKWARD) + TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked + + TIME(corrW6_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 6, true, false)); + + TIME(corrW8_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 8, true, false)); +#endif + + } //loop over sample + + + + }//loop over doing twopoint + + for (int k=0; k= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + + PLEGMA_ScattCorrelator corrB3(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB4(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB6(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrW5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW6(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW8(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrW13(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW14(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW15(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW16(source, filtered_sourcemomentumList); + + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"B3_deltat_%d",tSinks[k]); + corrB3.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B4_deltat_%d",tSinks[k]); + corrB4.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B5_deltat_%d",tSinks[k]); + corrB5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B6_deltat_%d",tSinks[k]); + corrB6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W5_deltat_%d",tSinks[k]); + corrW5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W6_deltat_%d",tSinks[k]); + corrW6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W7_deltat_%d",tSinks[k]); + corrW7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W8_deltat_%d",tSinks[k]); + corrW8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W13_deltat_%d",tSinks[k]); + corrW13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W14_deltat_%d",tSinks[k]); + corrW14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W15_deltat_%d",tSinks[k]); + corrW15.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W16_deltat_%d",tSinks[k]); + corrW16.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + free(ssource); + + PLEGMA_Propagator propTS_SS_packed_to_sink; + + for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propTS_SS_packed_to_sink.pack_propagator_as_sink(propTS_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + } + + PLEGMA_Propagator propUPpacked_to_sink; + PLEGMA_Propagator propDNpacked_to_sink; + { + for (int j=0; j< parallel_sources;++j){ + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, global_fixSinkTime, tsinkMtsource, j==0 ? true : false); + } + } + + for (int i_sample=0; i_sample temporary; + temporary.copy(*stochastic_propags_DN_SL[lookuptable_DN[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); + + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (sourcePositions[isource][3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + + stochastic_propagator_packed.apply_gamma5(); + + //V3 + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true)); + + TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true, false, true)); + TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true, false, true)); + TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true, false, true)); + TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true, false, true)); + + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + PLEGMA_Vector stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallel propTS_SS; + PLEGMA_Propagator propTS_SL; + + + //we first implemenet DD pizero DN + if(mu>0) { + mu*=-1.; + solver.UpdateSolver(); + } + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD2; + //Performing the smearing + { + PLEGMA_Vector3D vector1, vector2; + vectorAuxF.absorb(propDN_SS_packed, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + + vector1.mulMomentumPhases(momentum_i2,1); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectorAuxD.absorb(vector2, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]); + } + + vectorAuxD2.absorbTimeslice(vectorAuxD, (source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], false); + + //Perform multiplication with glist_insertion[0] + vectorAuxD2.apply_gamma_scatt(glist_source_meson[0]); + //Perform rotation to the physical basis + vectorAuxD.rotateToPhysicalBasis(vectorAuxD2,-1); + + //Computing sequential propagators UD T_fii with insertion + //glist_insertion[0]=gamma_5 and momentum momentum_i2 + PLEGMA_printf("Going to invert DN for sequential propagator DN for component %d\n", isc); + //performing the inversion + TIME(solver.solve(vectorAuxD, vectorAuxD)); + //performing rotation to physical base + vectorAuxD2.rotateToPhysicalBasis(vectorAuxD,-1); + //performing smearing + vectorAuxF.copy(vectorAuxD2); + propTS_SL.absorb(vectorAuxF, isc/3, isc%3); + TIME(vectorAuxD.gaussianSmearing(vectorAuxD2, smearedGauge, nsmearGauss, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + propTS_SS.absorb(vectorAuxF, isc/3, isc%3); + + } + + propTS_SS_packed.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + propTS_SS_packed_backward.pack_propagator_from_source_to_sink(propTS_SS, (source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + propTS_SL_packed.pack_propagator_from_source_to_sink(propTS_SL, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + } + + if (dotwopoint==1){ + + PLEGMA_ScattCorrelator corrTproton_protonpizero5(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero6(source, list_mpi2ptot); + + corrTproton_protonpizero5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); + + corrTproton_protonpizero6.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero5.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, propUP_SS_packed)); + TIME(corrTproton_protonpizero6.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T"; + + TIME(produceOutput_2pt_packed(corrTproton_protonpizero5, outfilename, "T", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero6, outfilename, "T", parallel_sources, attract_lookup_table)); + +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrTproton_protonpizero5_backward(source, list_mpi2ptot); + PLEGMA_ScattCorrelator corrTproton_protonpizero6_backward(source, list_mpi2ptot); + + corrTproton_protonpizero5_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq25"); + + corrTproton_protonpizero6_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon,"12", "Tseq26"); + + TIME(reductionsT1.T1(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero5_backward.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_nucleon,glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, propUP_SS_packed_backward)); + TIME(corrTproton_protonpizero6_backward.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_T_backward"; + + TIME(produceOutput_2pt_packed(corrTproton_protonpizero5_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrTproton_protonpizero6_backward, outfilename, "T", parallel_sources, attract_lookup_table_backward)); +#endif + } + + PLEGMA_ScattCorrelator corrB7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB8_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW9_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW10_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW11_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW12_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW33_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW34_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW35_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW36_2pt(source, filtered_sourcemomentumList_2pt); + + + corrB7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); + corrB8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); + + corrW9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W9"); + corrW10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W10"); + corrW11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W11"); + corrW12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W12"); + + corrW33_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W33"); + corrW34_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W34"); + corrW35_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); + corrW36_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); + +#if defined (COMPUTEBACKWARD) + PLEGMA_ScattCorrelator corrB7_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrB8_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW9_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW10_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW11_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW12_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrW33_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW34_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW35_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrW36_2pt_backward(source, filtered_sourcemomentumList_2pt); + + + corrB7_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); + corrB8_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); + + corrW9_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W9"); + corrW10_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W10"); + corrW11_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W11"); + corrW12_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W12"); + + corrW33_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W33"); + corrW34_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W34"); + corrW35_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); + corrW36_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); + +#endif + + + + for (int k=0; k< tSinks.size(); ++k){ + + PLEGMA_ScattCorrelator corrB7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB8(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrW9(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW10(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW11(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW12(source, filtered_sourcemomentumList); + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"B7_deltat_%d",tSinks[k]); + corrB7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"B8_deltat_%d",tSinks[k]); + corrB8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"W9_deltat_%d",tSinks[k]); + corrW9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W10_deltat_%d",tSinks[k]); + corrW10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W11_deltat_%d",tSinks[k]); + corrW11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"W12_deltat_%d",tSinks[k]); + corrW12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + free(ssource); + + PLEGMA_Propagator propTS_SS_packed_to_sink; + { + for (int i_source_parallel=0; i_source_parallel= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propTS_SS_packed_to_sink.pack_propagator_as_sink(propTS_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + } + } + + PLEGMA_Propagator propUPpacked_to_sink; + + for (int i_source_parallel=0; i_source_parallel< parallel_sources;++i_source_parallel){ + int tsinkMtsource = tSinks[k]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int global_fixSinkTime = (tsinkMtsource + source[3]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; + propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, global_fixSinkTime, tsinkMtsource, i_source_parallel==0 ? true : false); + } + + + for (int i_sample=0; i_sample stochastic_propagator_packed; + + if (k==0 && (dotwopoint==1)){ + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_propagator_2pt_SS[i_sample],HOST); + stochastic_propagator_packed.load(); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); + + TIME( corrW9_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 9, true)); + TIME(corrW11_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 11, true)); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); + + TIME(corrW10_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 10, true, false)); + TIME(corrW12_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 12, true, false)); + +#if defined (COMPUTEBACKWARD) + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME( corrW9_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 9, true)); + TIME(corrW11_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 11, true)); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); + + TIME(corrW10_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 10, true, false)); + TIME(corrW12_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 12, true, false)); +#endif + + stochastic_propagator_packed.apply_gamma5(); + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true)); + + TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); + TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed_backward, true)); + TIME(corrB7_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 7, true, false, false)); + TIME(corrB8_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 8, true, false, false)); + +#endif + + + stochastic_propagator_packed.unload(); + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + + stochastic_propagator_packed.apply_gamma5(); + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); + + TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); + TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); + + TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); + TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); + +#if defined (COMPUTEBACKWARD) + + TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); + + TIME(corrW33_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 33, true, false)); + TIME(corrW34_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 34, true, false)); + + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); + + TIME(corrW35_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 35, true, false)); + TIME(corrW36_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 36, true, false)); +#endif + + + } + for (int i_source_parallel=0; i_source_parallel temporary; + temporary.copy(*stochastic_propags_UP_SL[lookuptable_UP[(source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]]*n_stochastic_samples+i_sample],HOST); + temporary.load(); + + stochastic_propagator_packed.pack_propagator_from_source_to_sink(temporary, (source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + } + + stochastic_propagator_packed.apply_gamma5(); + + TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true)); + + TIME(corrB7.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 7, true, false, true)); + TIME(corrB8.B_diagrams(reductionsV3, *reductions_DD_V2_GAMMAF1U_U[i_sample*tSinks.size()+k], 0, 8, true, false, true)); + + stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); + stochastic_propagator_packed.load(); + + PLEGMA_Vector stochastic_source_packed; + for (int i_source_parallel=0; i_source_parallel vectortmp1; + PLEGMA_Vector vectortmp2; + PLEGMA_Vector vectorSource_finite_mom; + + //Doing for +mu for the UP propagator spin dilution oet + if(mu<0) { + mu*=-1.; + solver.UpdateSolver(); + } + + + for (int i_source_parallel=0; i_source_parallel tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); + vectortmp1.zero_device(); + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorSource_finite_mom, source_local[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, source_local[3],true); + + } + + + //Transforming to physical base for the UP quark + vectortmp2.rotateToPhysicalBasis(vectortmp1,+1); + + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,+1); + PLEGMA_Vector vectorAuxF; + + vectorAuxF.copy(vectortmp1); + stochastic_oet_prop_u_fini_mom_SL.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_u_fini_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + + stochastic_oet_prop_u_fini_mom_SS_backward.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + + } + + + //Doing for +mu for the DN propagator spin dilution oet + if(mu>0) { + mu*=-1.; + solver.UpdateSolver(); + } + + + for (int i_source_parallel=0; i_source_parallel tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectorSource_finite_mom.mulMomentumPhases(tmp_4Dmom,-1); + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorSource_finite_mom, source_local[3]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, source_local[3]); + + } + + //Transforming to physical base for the UP quark + vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); + + //Doing the inversion + TIME(solver.solve(vectortmp2, vectortmp2)); + + //Rotate back immediately to the physical basis + vectortmp1.rotateToPhysicalBasis(vectortmp2,-1); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectortmp1); + stochastic_oet_prop_d_fini_mom_SL.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3],max_source_sink_separations, i_source_parallel == 0 ? true : false); + + TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss )); + + vectorAuxF.copy(vectortmp2); + stochastic_oet_prop_d_fini_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel+1)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); + +#if defined (COMPUTEBACKWARD) + stochastic_oet_prop_d_fini_mom_SS_backward.pack_propagator_from_source_to_sink(vectorAuxF,(source[3]+(i_source_parallel)*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); +#endif + + + } // end of parallel sources + + }//end of finite momentum oet +#if 1 + { + PLEGMA_Vector st_oet_d_fini; + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SL); + + st_oet_d_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_D_UP.V3( st_oet_d_fini, glist_insertion, propUP_SL_packed, true)); + + if (dotwopoint==1){ + PLEGMA_Vector st_oet_u_fini; + + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS); + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_UP_2pt.V3( st_oet_u_fini, glist_sink_meson, propUP_SS_packed, true)); + + PLEGMA_Vector st_oet_d_fini; + + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS); + st_oet_d_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_D_UP_2pt.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed, true)); + +#if defined (COMPUTEBACKWARD) + + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS_backward); + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_UP_2pt_backward.V3( st_oet_u_fini, glist_sink_meson, propUP_SS_packed_backward, true)); + + st_oet_d_fini.copy(stochastic_oet_prop_d_fini_mom_SS_backward); + st_oet_d_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_D_UP_2pt_backward.V3( st_oet_d_fini, glist_sink_meson, propUP_SS_packed_backward, true)); +#endif + + + } + + + } +#endif +#if 1 + //for (int i=0; i< 4; ++i){ + { + PLEGMA_Vector st_oet_u_fini; + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SL); + + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_DN.V3( st_oet_u_fini, glist_insertion, propDN_SL_packed, true)); + } +#if 1 + if (dotwopoint==1){ + PLEGMA_Vector st_oet_u_fini; + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS); + + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_DN_2pt.V3( st_oet_u_fini, glist_sink_meson, propDN_SS_packed, true)); + +#if defined (COMPUTEBACKWARD) + + st_oet_u_fini.copy(stochastic_oet_prop_u_fini_mom_SS_backward); + + st_oet_u_fini.apply_gamma5(); + + TIME(reductionsV3_diluted_U_DN_2pt_backward.V3( st_oet_u_fini, glist_sink_meson, propDN_SS_packed_backward, true)); +#endif + } +#endif + + + PLEGMA_ScattCorrelator corrZ5_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ6_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ7_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ8_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ9_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ10_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ11_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ12_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ13_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ14_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ15_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ16_2pt(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ17_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ18_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ19_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ20_2pt(source, filtered_sourcemomentumList_2pt); + + + corrZ5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); + corrZ6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); + + corrZ7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z7"); + corrZ8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z8"); + + corrZ9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z9"); + corrZ10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z10"); + + corrZ11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z11"); + corrZ12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); + + corrZ13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); + corrZ14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); + + corrZ15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z15"); + corrZ16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z16"); + + corrZ17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z17"); + corrZ18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z18"); + corrZ19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z19"); + corrZ20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z20"); + + +// corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); +// corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); +// corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); +// corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); + +#if defined (COMPUTEBACKWARD) + + PLEGMA_ScattCorrelator corrZ5_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ6_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ7_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ8_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ9_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ10_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ11_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ12_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ13_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ14_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ15_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ16_2pt_backward(source, filtered_sourcemomentumList_2pt); + + PLEGMA_ScattCorrelator corrZ17_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ18_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ19_2pt_backward(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ20_2pt_backward(source, filtered_sourcemomentumList_2pt); + + + corrZ5_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); + corrZ6_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z6"); + + corrZ7_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z7"); + corrZ8_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z8"); + + corrZ9_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z9"); + corrZ10_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z10"); + + corrZ11_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z11"); + corrZ12_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); + + corrZ13_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); + corrZ14_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); + + corrZ15_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z15"); + corrZ16_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z16"); + + corrZ17_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z17"); + corrZ18_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z18"); + corrZ19_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z19"); + corrZ20_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z20"); + + +// corrM_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); +// corrD1if34_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); +// corrD1if12_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); +// corrD1if56_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); + +#endif + + if (dotwopoint==1){ + +#if defined (COMPUTEBACKWARD) + + TIME(corrZ5_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 5, false )); + TIME(corrZ7_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 7, false )); + + TIME(corrZ6_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 6, false )); + TIME(corrZ8_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 8, false )); + + TIME( corrZ9_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 9, false )); + TIME(corrZ10_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 10,false )); + + TIME(corrZ11_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 11, false )); + TIME(corrZ13_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 13, false )); + + TIME(corrZ12_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 12, false )); + TIME(corrZ14_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 14, false )); + + TIME(corrZ15_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 15, false )); + TIME(corrZ16_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 16, false )); + + TIME(corrZ17_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 17, false )); + TIME(corrZ18_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 18, false )); + + TIME(corrZ19_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 19, false )); + TIME(corrZ20_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 20, false )); + +#endif + + + TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); + TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); + + TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); + TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); + + TIME( corrZ9_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 9, false )); + TIME(corrZ10_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 10,false )); + + TIME(corrZ11_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 11, false )); + TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); + + TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); + TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); + + TIME(corrZ15_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 15, false )); + TIME(corrZ16_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 16, false )); + + TIME(corrZ17_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 17, false )); + TIME(corrZ18_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 18, false )); + + TIME(corrZ19_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 19, false )); + TIME(corrZ20_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 20, false )); + +#endif + + TIME(corrPPUP.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); + TIME(corrPPDN.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + TIME(corrP0UP.P_diagrams( stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS, i_mpi2)); + TIME(corrP0DN.P_diagrams( stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS, i_mpi2)); + +#if defined (COMPUTEBACKWARD) + + TIME(corrPPUP_backward.P_diagrams( stochastic_oet_prop_u_zero_mom_SS_backward, stochastic_oet_prop_u_fini_mom_SS_backward, i_mpi2)); + TIME(corrPPDN_backward.P_diagrams( stochastic_oet_prop_d_zero_mom_SS_backward, stochastic_oet_prop_d_fini_mom_SS_backward, i_mpi2)); + TIME(corrP0UP_backward.P_diagrams( stochastic_oet_prop_d_zero_mom_SS_backward, stochastic_oet_prop_u_fini_mom_SS_backward, i_mpi2)); + TIME(corrP0DN_backward.P_diagrams( stochastic_oet_prop_u_zero_mom_SS_backward, stochastic_oet_prop_d_fini_mom_SS_backward, i_mpi2)); + +#endif + +#if 1 + +// TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); +// TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); +// TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); +// TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; + + + TIME(produceOutput_2pt_packed(corrZ5_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ6_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ7_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ8_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ9_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ10_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ11_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ12_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ15_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ16_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); + + TIME(produceOutput_2pt_packed(corrZ17_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ18_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ19_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + TIME(produceOutput_2pt_packed(corrZ20_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); + +#if defined (COMPUTEBACKWARD) + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt_backward"; + + TIME(produceOutput_2pt_packed(corrZ5_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ6_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ7_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ8_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ9_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ10_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ11_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ12_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ13_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ14_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ15_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ16_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); + + TIME(produceOutput_2pt_packed(corrZ17_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ18_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ19_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + TIME(produceOutput_2pt_packed(corrZ20_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); + +#endif + +// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_correct_2pt"; +// TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); +// TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); + + + } +#endif + +#if 1 + for (int k=0; k corrZ5(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ6(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ7(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ8(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrZ9(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ10(source, filtered_sourcemomentumList); + + PLEGMA_ScattCorrelator corrZ11(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ12(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ13(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrZ14(source, filtered_sourcemomentumList); + + ssource=(char *)malloc(sizeof(char)*100); + sprintf(ssource,"Z5_deltat_%d",tSinks[k]); + corrZ5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z6_deltat_%d",tSinks[k]); + corrZ6.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z7_deltat_%d",tSinks[k]); + corrZ7.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z8_deltat_%d",tSinks[k]); + corrZ8.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z9_deltat_%d",tSinks[k]); + corrZ9.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z10_deltat_%d",tSinks[k]); + corrZ10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z11_deltat_%d",tSinks[k]); + corrZ11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z12_deltat_%d",tSinks[k]); + corrZ12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + + sprintf(ssource,"Z13_deltat_%d",tSinks[k]); + corrZ13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + sprintf(ssource,"Z14_deltat_%d",tSinks[k]); + corrZ14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); + free(ssource); + + TIME(corrZ5.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 5, false, true )); + TIME(corrZ7.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 7, false, true )); + + TIME(corrZ6.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 6, false, true )); + TIME(corrZ8.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 8, false, true )); + + TIME(corrZ9.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 9, false, true )); + TIME(corrZ10.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 10,false, true )); + + + TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11, false, true )); + TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13, false, true )); + + TIME(corrZ12.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 12, false, true )); + TIME(corrZ14.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 14, false, true )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z"; + + TIME(produceOutput_3pt(corrZ5, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ6, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ7, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ8, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + + TIME(produceOutput_3pt(corrZ9, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ10, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + + TIME(produceOutput_3pt(corrZ11, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ12, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ13, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + TIME(produceOutput_3pt(corrZ14, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); + + + }//end for loop source sink separations +#endif + + }//loop over mpi2 + + if (dotwopoint==1){ + +#if 1 + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; + TIME( corrN0_packed.apply_phase()); + TIME( corrN0_packed.apply_sign("N")); + TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrN0_packed.writeHDF5(outfilename)); + + TIME( corrNP_packed.apply_phase() ); + TIME( corrNP_packed.apply_sign("N") ); + TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); + TIME( corrNP_packed.writeHDF5(outfilename) ); + + //outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt_backward"; + + //TIME( corrNP_packed_backward.apply_phase() ); + //TIME( corrNP_packed_backward.apply_sign("N") ); + //TIME( corrNP_packed_backward.applyBoundaryConditions( true, parallel_sources, attract_lookup_table_backward)); + //TIME( corrNP_packed_backward.writeHDF5(outfilename) ); + + + + +#endif + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; + TIME(corrP0UP.apply_sign("P")); + TIME(corrP0UP.writeHDF5( outfilename )); + TIME(corrP0DN.apply_sign("P")); + TIME(corrP0DN.writeHDF5( outfilename )); + TIME(corrPPUP.apply_sign("P")); + TIME(corrPPUP.writeHDF5( outfilename )); + TIME(corrPPDN.apply_sign("P")); + TIME(corrPPDN.writeHDF5( outfilename )); + +#if defined (COMPUTEBACKWARD) + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt_backward"; + TIME(corrP0UP_backward.apply_sign("P")); + TIME(corrP0UP_backward.writeHDF5( outfilename )); + TIME(corrP0DN_backward.apply_sign("P")); + TIME(corrP0DN_backward.writeHDF5( outfilename )); + TIME(corrPPUP_backward.apply_sign("P")); + TIME(corrPPUP_backward.writeHDF5( outfilename )); + TIME(corrPPDN_backward.apply_sign("P")); + TIME(corrPPDN_backward.writeHDF5( outfilename )); + +#endif + + + } + + +#if 1 + for (int k=0; k Date: Wed, 23 Oct 2024 14:36:26 +0200 Subject: [PATCH 127/168] progressing with the recombination for the sigma nucleon --- plegma/CMakeLists.txt | 14 - plegma/nucleon_3pt_n_npi_sigma.cpp | 468 ++++++++++++++++++++++------- 2 files changed, 363 insertions(+), 119 deletions(-) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 2e85d395..3bc3282e 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -72,9 +72,6 @@ target_link_libraries(nucleon_2pt_3pt_npi ${PLEGMA_LIBS}) cuda_add_executable(mesons_3pt mesons_3pt.cpp) target_link_libraries(mesons_3pt ${PLEGMA_LIBS}) -cuda_add_executable(mesons_3pt_npi mesons_3pt_npi.cpp) -target_link_libraries(mesons_3pt_npi ${PLEGMA_LIBS}) - cuda_add_executable(correcting_ZM EXCLUDE_FROM_ALL correcting_ZM.cpp) target_link_libraries(correcting_ZM ${PLEGMA_LIBS}) @@ -129,9 +126,6 @@ target_link_libraries(ZfacStaple ${PLEGMA_LIBS}) cuda_add_executable(PDFs_nucleon PDFs_nucleon.cpp) target_link_libraries(PDFs_nucleon ${PLEGMA_LIBS}) -cuda_add_executable(GPDs_nucleon GPDs_nucleon.cpp) -target_link_libraries(GPDs_nucleon ${PLEGMA_LIBS}) - cuda_add_executable(TMDPDFs_mesons_Juwels TMDPDFs_mesons_Juwels.cpp) target_link_libraries(TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) @@ -151,12 +145,6 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) cuda_add_executable(nucleon_3pt_n_npi_wd1ii EXCLUDE_FROM_ALL nucleon_3pt_n_npi_wd1ii.cpp) target_link_libraries(nucleon_3pt_n_npi_wd1ii ${PLEGMA_LIBS}) - cuda_add_executable(nucleon_3pt_n_npi_T EXCLUDE_FROM_ALL nucleon_3pt_n_npi_T.cpp) - target_link_libraries(nucleon_3pt_n_npi_T ${PLEGMA_LIBS}) - - cuda_add_executable(nucleon_3pt_n_npi_N EXCLUDE_FROM_ALL nucleon_3pt_n_npi_N.cpp) - target_link_libraries(nucleon_3pt_n_npi_N ${PLEGMA_LIBS}) - cuda_add_executable(piNdiagrams_oet piNdiagrams_oet.cpp) target_link_libraries(piNdiagrams_oet ${PLEGMA_LIBS}) cuda_add_executable(checking_Doet checking_Doet.cpp) @@ -169,8 +157,6 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(QuarkLoops_pi0_insertion ${PLEGMA_LIBS}) cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) target_link_libraries(testYan ${PLEGMA_LIBS}) - cuda_add_executable(converttofloat EXCLUDE_FROM_ALL convert_double_float.cpp) - target_link_libraries(converttofloat ${PLEGMA_LIBS}) endif(PLEGMA_SCATTERING_CONTRACTIONS) diff --git a/plegma/nucleon_3pt_n_npi_sigma.cpp b/plegma/nucleon_3pt_n_npi_sigma.cpp index 093a5599..967cb9b2 100644 --- a/plegma/nucleon_3pt_n_npi_sigma.cpp +++ b/plegma/nucleon_3pt_n_npi_sigma.cpp @@ -1769,64 +1769,98 @@ int main(int argc, char **argv) { stochastic_piece.apply_gamma5(); TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true));//checked + TIME(corrW13_2pt.Recombination(*reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); - TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); +// TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); - TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); + TIME(corrW15_2pt.Recombination( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); + + //TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true));//checked - TIME(corrW13_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 13, true, false)); + TIME(corrW13_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); + + //TIME(corrW13_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 13, true, false)); + + TIME(corrW15_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); - TIME(corrW15_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 15, true, false)); + //TIME(corrW15_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 15, true, false)); #endif TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true));//checked - TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); + TIME(corrW14_2pt.Recombination( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); + +// TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); + + TIME(corrW16_2pt.Recombination( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); - TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); +// TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true));//checked - TIME(corrW14_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 14, true, false)); + TIME(corrW14_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); - TIME(corrW16_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 16, true, false)); +// TIME(corrW14_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 14, true, false)); -#endif + TIME(corrW16_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); + +// TIME(corrW16_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 16, true, false)); +#endif TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked - TIME(corrW31_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 31, true, false)); - TIME(corrW32_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 32, true, false)); + TIME(corrW31_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); + +// TIME(corrW31_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 31, true, false)); + + TIME(corrW32_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 2, true, 0, true, false, false, false, true)); + +// TIME(corrW32_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 32, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked - TIME(corrW31_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 31, true, false)); - TIME(corrW32_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 32, true, false)); + + TIME(corrW31_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); + +// TIME(corrW31_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 31, true, false)); + + TIME(corrW32_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, true, false, false, false, true)); + +// TIME(corrW32_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 32, true, false)); #endif TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked - TIME(corrW29_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 29, true, false)); - TIME(corrW30_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 30, true, false)); + TIME(corrW29_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); + +// TIME(corrW29_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 29, true, false)); +// + TIME(corrW30_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 2, false, 0,true, false, false, false, true)); + +// TIME(corrW30_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 30, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked - TIME(corrW29_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 29, true, false)); - TIME(corrW30_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 30, true, false)); -#endif + TIME(corrW29_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); + +// TIME(corrW29_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 29, true, false)); + + TIME(corrW30_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 2, false, 0,true, false, false, false, true)); +// TIME(corrW30_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 30, true, false)); +#endif stochastic_piece.unload(); @@ -1834,31 +1868,45 @@ int main(int argc, char **argv) { stochastic_piece.load(); TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked - TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); + TIME(corrW5_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 0,true, false, false, false, true)); + +// TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); - TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); + TIME(corrW7_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 1, false, 0, true, false, false, false, true)); +// TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked - TIME(corrW5_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 5, true, false)); + TIME(corrW5_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 0,true, false, false, false, true)); + +// TIME(corrW5_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 5, true, false)); - TIME(corrW7_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 7, true, false)); + TIME(corrW7_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 1, false, 0, true, false, false, false, true)); + +// TIME(corrW7_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 7, true, false)); #endif TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked - TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); + TIME(corrW6_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, true, false, false, false, true)); + +// TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); - TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); + TIME(corrW8_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); + +// TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked - TIME(corrW6_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 6, true, false)); + TIME(corrW6_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 1, false, 0, true, false, false, false, true)); +// TIME(corrW6_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 6, true, false)); + + TIME(corrW8_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); - TIME(corrW8_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 8, true, false)); +// TIME(corrW8_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 8, true, false)); #endif } //loop over sample @@ -1953,10 +2001,21 @@ int main(int argc, char **argv) { //V3 TIME(reductionsV3.V3( stochastic_propagator_packed, glist_insertion, propTS_SL_packed, true)); - TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true, false, true)); - TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true, false, true)); - TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true, false, true)); - TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true, false, true)); + TIME(corrB3.Recombination(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], false,0,false,0,true,false,false,true,true)); + +// TIME(corrB3.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 3, true, false, true)); + + TIME(corrB4.Recombination(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], false,2,false,0,true,true,false, true,true)); + +// TIME(corrB4.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 4, true, false, true)); + + TIME(corrB5.Recombination(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], true,1,false,0,true,false,false,true,true)); + +// TIME(corrB5.B_diagrams(reductionsV3, *reductions_UU_V2_GAMMAF1D_U[i_sample*tSinks.size()+k], 0, 5, true, false, true)); + + TIME(corrB6.Recombination(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], true,0,false,0,false,true,false,true,true)); + +// TIME(corrB6.B_diagrams(reductionsV3, *reductions_UU_V4_GAMMAF1U_D[i_sample*tSinks.size()+k], 0, 6, true, false, true)); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); stochastic_propagator_packed.load(); @@ -1971,23 +2030,55 @@ int main(int argc, char **argv) { TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, true));//checked - TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true, true)); + TIME(corrW5.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, true, 0, false, 0,true, false, false, true, true)); + + - TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true, true)); +// TIME(corrW5.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 5, true, true)); + + TIME(corrW7.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, false, 1, false, 0, true, false, false, true, true)); + + +// TIME(corrW7.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 7, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propDNpacked_to_sink, propTS_SS_packed_to_sink, true));//checked - TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true, true)); - TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true, true)); + + TIME(corrW6.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, true, 1, false, 0, true, false, false, true, true)); + + +// TIME(corrW6.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 6, true, true)); + + TIME(corrW8.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, false, 0, false, 0, true, false, false, true, true)); + + + +// TIME(corrW8.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()], reductionsV2, 0, 8, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true));//checked - TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true, true)); - TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true, true)); + + TIME(corrW13.Recombination( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, false, 0, false, 0, false, true, false, true, true)); + + + // TIME(corrW13.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 13, true, true)); + + TIME(corrW15.Recombination( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, false, 2, true, 0, false, true, false, true, true)); + + +// TIME(corrW15.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 15, true, true)); TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propUPpacked_to_sink, propTS_SS_packed_to_sink, true));//checked - TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true, true)); - TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true, true)); + + TIME(corrW14.Recombination( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, false, 2, true, 0, false, true, false, true, true)); + + +// TIME(corrW14.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 14, true, true)); + + TIME(corrW16.Recombination( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, false, 0, false, 0, false, true, false, true, true)); + + +// TIME(corrW16.W_diagrams( *reductions_DD_V3_GAMMAF2D[i_sample*tSinks.size()+k], reductionsV2, 0, 16, true, true)); }//loop over stochastic samples @@ -2290,42 +2381,68 @@ int main(int argc, char **argv) { stochastic_propagator_packed.load(); TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); + TIME( corrW9_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); + +// TIME( corrW9_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 9, true)); - TIME( corrW9_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 9, true)); - TIME(corrW11_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 11, true)); + TIME(corrW11_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, true, false, false, false, true)); +// TIME(corrW11_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 11, true)); TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); - TIME(corrW10_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 10, true, false)); - TIME(corrW12_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 12, true, false)); + TIME(corrW10_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt,false, 1, false, 0, true, false, false, false, true )); +// TIME(corrW10_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 10, true, false)); + + TIME(corrW12_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 9, true, false, false, false, true)); +// TIME(corrW12_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 12, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); - TIME( corrW9_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 9, true)); - TIME(corrW11_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 11, true)); + TIME( corrW9_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); + +// TIME( corrW9_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 9, true)); + + TIME(corrW11_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt,true, 1, false, 0, true, false, false, false, true)); + +// TIME(corrW11_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 11, true)); TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); - TIME(corrW10_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 10, true, false)); - TIME(corrW12_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 12, true, false)); + TIME(corrW10_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 1, false, 0, true, false, false, false, true )); + +// TIME(corrW10_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 10, true, false)); + + TIME(corrW12_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 9, true, false, false, false, true)); + +// TIME(corrW12_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 12, true, false)); #endif stochastic_propagator_packed.apply_gamma5(); TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed, true)); - TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); - TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); + TIME(corrB7_2pt.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], false, 2, true, 0, false, true, false, false, true)); + +// TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); + + TIME(corrB8_2pt.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], false, 0, false, 0, false, true, false, false, true)); + +// TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV3_2pt.V3( stochastic_propagator_packed, glist_sink_meson, propTS_SS_packed_backward, true)); - TIME(corrB7_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 7, true, false, false)); - TIME(corrB8_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 8, true, false, false)); -#endif + TIME(corrB7_2pt_backward.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], false, 2, true, 0, false, true, false, false, true)); + +// TIME(corrB7_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 7, true, false, false)); + TIME(corrB8_2pt_backward.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], false, 0, false, 0, false, true, false, false, true)); + +// TIME(corrB8_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 8, true, false, false)); + +#endif stochastic_propagator_packed.unload(); stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); @@ -2335,25 +2452,46 @@ int main(int argc, char **argv) { TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); - TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); - TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); + TIME(corrW33_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 2, false, 0, true, false, false, false, true)); + +// TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); + + TIME(corrW34_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); + +// TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); + TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); - TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); - TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); + TIME(corrW35_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt,false, 2, true, 0, true, false, false, false, true)); + +// TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); + + TIME(corrW36_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); + +// TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); - TIME(corrW33_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 33, true, false)); - TIME(corrW34_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 34, true, false)); + TIME(corrW33_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt,false, 2, false, 0, true, false, false, false, true)); + +// TIME(corrW33_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 33, true, false)); + + TIME(corrW34_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); + +// TIME(corrW34_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 34, true, false)); TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); - TIME(corrW35_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 35, true, false)); - TIME(corrW36_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 36, true, false)); + TIME(corrW35_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, true, false, false, false, true)); + +// TIME(corrW35_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 35, true, false)); + + TIME(corrW36_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); + +// TIME(corrW36_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 36, true, false)); #endif @@ -2386,13 +2524,24 @@ int main(int argc, char **argv) { TIME(reductionsV2.V2( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true)); - TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true, true)); - TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true, true)); + TIME( corrW9.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2,false, 0, false, 0, true, false, false, true, true)); + +// TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true, true)); + + TIME(corrW11.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, true, 1, false, 0, true, false, false, true, true)); + +// TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true, true)); TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true)); - TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true, true)); - TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true, true)); + + TIME(corrW10.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, false, 1, false, 0, true, false, false, true, true )); + +// TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true, true)); + + TIME(corrW12.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, true, 0, false, 9, true, false, false, true, true)); + +// TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true, true)); } //loop over stochastic samples @@ -2747,57 +2896,135 @@ int main(int argc, char **argv) { if (dotwopoint==1){ #if defined (COMPUTEBACKWARD) + TIME(corrZ5_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, false, 0, false, 0, true, false, false, false, true )); + +// TIME(corrZ5_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 5, false )); + + TIME(corrZ7_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, true, 1, false, 0, true, false, false, false, true )); + +// TIME(corrZ7_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 7, false )); + + TIME(corrZ6_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, false, 1, false, 0, true, false, false, false, true )); + +// TIME(corrZ6_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 6, false )); + + TIME(corrZ8_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, true, 0, false, 0, true, false, false, false , true )); + +// TIME(corrZ8_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 8, false )); - TIME(corrZ5_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 5, false )); - TIME(corrZ7_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 7, false )); + TIME( corrZ9_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, false, 2, true, 0, false, true, false, false, true)); - TIME(corrZ6_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 6, false )); - TIME(corrZ8_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 8, false )); - TIME( corrZ9_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 9, false )); - TIME(corrZ10_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 10,false )); +// TIME( corrZ9_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 9, false )); - TIME(corrZ11_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 11, false )); - TIME(corrZ13_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 13, false )); + TIME(corrZ10_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward,false, 0, false, 0, false, true, false, false, true )); - TIME(corrZ12_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 12, false )); - TIME(corrZ14_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 14, false )); +// TIME(corrZ10_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 10,false )); +// + TIME(corrZ11_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward,false, 2, true, 0, true, false, false, false, true)); - TIME(corrZ15_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 15, false )); - TIME(corrZ16_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 16, false )); +// TIME(corrZ11_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 11, false )); - TIME(corrZ17_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 17, false )); - TIME(corrZ18_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 18, false )); + TIME(corrZ13_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward,true, 1, false, 0, false, false, false, false, true )); + +// TIME(corrZ13_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 13, false )); + + TIME(corrZ12_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, false, 2, false, 0, true, false, false, false, true)); +// TIME(corrZ12_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 12, false )); + + TIME(corrZ14_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, true, 0, false, 0, false, false, false, false, true )); + +// TIME(corrZ14_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 14, false )); + + TIME(corrZ15_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, false, 0, false, 0, false, true, false, false, true)); + +// TIME(corrZ15_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 15, false )); + TIME(corrZ16_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, false, 2, true, 0, false, true, false, false, true)); + +// TIME(corrZ16_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 16, false )); + + TIME(corrZ17_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, false, 2, true, 0, true, false, false, false, true)); + +// TIME(corrZ17_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 17, false )); + TIME(corrZ18_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, true, 1, false, 0, false, false, false, false, true)); + +// TIME(corrZ18_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 18, false )); + + TIME(corrZ19_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, false, 2, false, 0, true, false, false, false, true)); + +// TIME(corrZ19_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 19, false )); + + TIME(corrZ20_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, true, 0, false, 0, false, false, false, false, true )); + +// TIME(corrZ20_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 20, false )); - TIME(corrZ19_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 19, false )); - TIME(corrZ20_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 20, false )); #endif - TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); - TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); + TIME(corrZ5_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, false, 0, false, 0, true, false, false, false, true )); + +// TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); - TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); - TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); + TIME(corrZ7_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, true, 1, false, 0, true, false, false, false, true )); + +// TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); + + TIME(corrZ6_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, false, 1, false, 0, true, false, false, false, true )); + +// TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); + + TIME(corrZ8_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, true, 0, false, 0, true, false, false, false , true )); + +// TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); - TIME( corrZ9_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 9, false )); - TIME(corrZ10_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 10,false )); + TIME( corrZ9_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, false, 2, true, 0, false, true, false, false, true)); - TIME(corrZ11_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 11, false )); - TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); +// TIME( corrZ9_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 9, false )); - TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); - TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); + TIME(corrZ10_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt,false, 0, false, 0, false, true, false, false, true )); - TIME(corrZ15_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 15, false )); - TIME(corrZ16_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 16, false )); + // TIME(corrZ10_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 10,false )); - TIME(corrZ17_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 17, false )); - TIME(corrZ18_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 18, false )); + TIME(corrZ11_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, false, 2, true, 0, true, false, false, false, true)); - TIME(corrZ19_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 19, false )); - TIME(corrZ20_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 20, false )); +// TIME(corrZ11_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 11, false )); + + TIME(corrZ13_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, true, 1, false, 0, false, false, false, false, true )); + +// TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); + + TIME(corrZ12_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt,false, 2, false, 0, true, false, false, false, true)); + +// TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); + + TIME(corrZ14_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, true, 0, false, 0, false, false, false, false, true )); + +// TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); + + TIME(corrZ15_2pt.Recombonation( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, false, 0, false, 0, false, true, false, false, true)); + +// TIME(corrZ15_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 15, false )); + + TIME(corrZ16_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, false, 2, true, 0, false, true, false, false, true)); + +// TIME(corrZ16_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 16, false )); + + TIME(corrZ17_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, false, 2, true, 0, true, false, false, false, true)); + +// TIME(corrZ17_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 17, false )); + + TIME(corrZ18_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt,true, 1, false, 0, false, false, false, false, true)); + +// TIME(corrZ18_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 18, false )); + + TIME(corrZ19_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, false, 2, false, 0, true, false, false, false, true)); + +// TIME(corrZ19_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 19, false )); + + TIME(corrZ20_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, true, 0, false, 0, false, false, false, false, true )); + +// TIME(corrZ20_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 20, false )); #endif @@ -2926,21 +3153,52 @@ int main(int argc, char **argv) { corrZ14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); free(ssource); - TIME(corrZ5.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 5, false, true )); - TIME(corrZ7.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 7, false, true )); + TIME(corrZ5.Recombination( reductionsV3_diluted_D_UP, *reductionsV2_diluted_STOCHU_DN_UP[k], false, 0, false, 0, true, false, false, true, true )); + +// TIME(corrZ5.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 5, false, true )); + + TIME(corrZ7.Recombination( reductionsV3_diluted_D_UP, *reductionsV2_diluted_STOCHU_DN_UP[k], true, 1, false, 0, true, false, false, true, true )); + + +// TIME(corrZ7.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 7, false, true )); + + TIME(corrZ6.Recombination( reductionsV3_diluted_D_UP, *reductionsV4_diluted_STOCHU_DN_UP[k], false, 1, false, 0, true, false, false, true, true )); + + +// TIME(corrZ6.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 6, false, true )); + + TIME(corrZ8.Recombination( reductionsV3_diluted_D_UP, *reductionsV4_diluted_STOCHU_DN_UP[k], true, 0, false, 0, true, false, false, true , true )); + +// TIME(corrZ8.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 8, false, true )); + + TIME(corrZ9.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHD_UP_UP[k],false, 2, true, 0, false, true, false, true, true)); + +// TIME(corrZ9.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 9, false, true )); + + TIME(corrZ10.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHD_UP_UP[k],false, 0, false, 0, false, true, false, true, true )); + + +// TIME(corrZ10.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 10,false, true )); + + TIME(corrZ11.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHU_DN_UP[k],false, 2, true, 0, true, false, false, true, true)); + + +// TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11, false, true )); + + TIME(corrZ13.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHU_DN_UP[k],true, 1, false, 0, false, false, false, true, true )); + + +// TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13, false, true )); + + TIME(corrZ12.Recombination( reductionsV3_diluted_U_DN, *reductionsV4_diluted_STOCHU_DN_UP[k], false, 2, false, 0, true, false, false,true, true)); - TIME(corrZ6.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 6, false, true )); - TIME(corrZ8.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 8, false, true )); - TIME(corrZ9.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 9, false, true )); - TIME(corrZ10.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 10,false, true )); +// TIME(corrZ12.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 12, false, true )); + TIME(corrZ14.Recombination( reductionsV3_diluted_U_DN, *reductionsV4_diluted_STOCHU_DN_UP[k], true, 0, false, 0, false, false, false, true, true )); - TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11, false, true )); - TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13, false, true )); - TIME(corrZ12.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 12, false, true )); - TIME(corrZ14.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 14, false, true )); + // TIME(corrZ14.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 14, false, true )); outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z"; From f96e64edfc4b488c281fda79ccdb3c70903c8769 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 15 Nov 2024 14:17:43 +0100 Subject: [PATCH 128/168] updating N sigma analysis --- plegma/nucleon_3pt_n_npi_sigma.cpp | 628 +---------------------------- 1 file changed, 7 insertions(+), 621 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi_sigma.cpp b/plegma/nucleon_3pt_n_npi_sigma.cpp index 967cb9b2..928a9bcb 100644 --- a/plegma/nucleon_3pt_n_npi_sigma.cpp +++ b/plegma/nucleon_3pt_n_npi_sigma.cpp @@ -522,14 +522,6 @@ int main(int argc, char **argv) { //Step(6) We rotate back the propagator to the physical basis TIME(vectorAuxD1.rotateToPhysicalBasis(vectorInOut,-1)); - //Step(7) Smearing all the time slice in the propagator - //TIME(vectorInOut.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - - //vectorAuxD1.unload(); - //PLEGMA_printf("Save the stochastic source for sample %d\n",i); - //std::string nstoch=std::to_string(i); - //vectorAuxD1.writeHDF5("stochastic_propagators_DN"+nstoch+"_t"+std::to_string(timeSlice)); - vectorAuxD1.unload(); stochastic_propags_DN_SL.push_back(new PLEGMA_Vector(HOST)); stochastic_propags_DN_SL[countindex]->copy(vectorAuxD1, HOST); @@ -718,11 +710,8 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsT2N(source_local_reduction, sourcemomentumList_twopt.uniq_p(1)); //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); - //PLEGMA_printf("Nucleon T2 reduction\n"); TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS, propUP_SS, propDN_SS)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); } outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; @@ -736,19 +725,6 @@ int main(int argc, char **argv) { TIME( corrNP.applyBoundaryConditions( true ) ); TIME( corrNP.writeHDF5(outfilename) ); } - - /*{ - PLEGMA_printf("Save propagator for the up and dn quark\n"); - PLEGMA_Vector vectorAuxPrint(BOTH); - for(int isc = 0 ; isc < 12 ; isc++){ - std::string spin=std::to_string(isc/3); - std::string col=std::to_string(isc%3); - - vectorAuxPrint.absorb(propUP_SS,isc/3,isc%3); - vectorAuxPrint.unload(); - vectorAuxPrint.writeHDF5("propUPSS_"+spin+"_c"+col+"_t_"+std::to_string(source_local[3])); - } - }*/ propUP_SS_packed.pack_propagator_from_source_to_sink(propUP_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); propDN_SS_packed.pack_propagator_from_source_to_sink(propDN_SS, source_localPtSinkMtSource[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -763,56 +739,6 @@ int main(int argc, char **argv) { } //parallel source position - - PLEGMA_ScattCorrelator corrNP_packed(source, list_mpf1_twopt); - //PLEGMA_ScattCorrelator corrNP_packed_backward(source, list_mpf1_twopt); - - TIME(corrNP_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); - //TIME(corrNP_packed_backward.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); - - if (dotwopoint==1){ - - { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, propUP_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrNP_packed.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); - //TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - //TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, propUP_SS_packed_backward)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - //TIME(corrNP_packed_backward.N_diagrams( reductionsT1N, reductionsT2N )); - - - - } - - } - - PLEGMA_ScattCorrelator corrN0_packed(source, list_mpf1_twopt); - TIME(corrN0_packed.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); - - if (dotwopoint==1){ - - { - PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN_SS_packed, propUP_SS_packed, propDN_SS_packed)); - //PLEGMA_printf("Nucleon T2 reduction ready\n"); - TIME(corrN0_packed.N_diagrams( reductionsT1N, reductionsT2N )); - //PLEGMA_printf("Nucleon diagram ready\n"); - } - - } - /****************************************************** * * Step 4: Computing the factors from the point to all @@ -876,13 +802,7 @@ int main(int argc, char **argv) { #if defined (COMPUTEBACKWARD) std::vector*> reductions_DD_V2_GAMMAF1U_U_2pt_backward; #endif - std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt;//implemented - std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt;//implemented - std::vector*> reductions_DD_V3_GAMMAF2U_2pt;//implemented #if defined (COMPUTEBACKWARD) - std::vector*> reductions_DD_V4_GAMMAF1U_D_2pt_backward;//implemented - std::vector*> reductions_DD_V2_GAMMAF1U_D_2pt_backward;//implemented - std::vector*> reductions_DD_V3_GAMMAF2U_2pt_backward;//implemented #endif @@ -891,28 +811,22 @@ int main(int argc, char **argv) { for(int i=0; i< n_stochastic_samples; ++i) { if (dotwopoint==1){ - reductions_DD_V2_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_DD_V2_GAMMAF1U_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - reductions_DD_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_UU_V2_GAMMAF1D_U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_UU_V4_GAMMAF1U_D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_UU_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - reductions_DD_V3_GAMMAF2U_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2D_2pt.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); #if defined (COMPUTEBACKWARD) - reductions_DD_V2_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_DD_V2_GAMMAF1U_U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); - reductions_DD_V4_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_UU_V2_GAMMAF1D_U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_UU_V4_GAMMAF1U_D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf1_twopt)); reductions_UU_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); - reductions_DD_V3_GAMMAF2U_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); reductions_DD_V3_GAMMAF2D_2pt_backward.push_back(new PLEGMA_ScattCorrelator(source_reduction, list_mpf2_twopt)); #endif @@ -998,15 +912,11 @@ int main(int argc, char **argv) { stoch_piece.apply_gamma5(); TIME(reductions_DD_V2_GAMMAF1U_U_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propUP_SS_packed, true)); - TIME(reductions_DD_V2_GAMMAF1U_D_2pt[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); - TIME(reductions_DD_V4_GAMMAF1U_D_2pt[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed, propDN_SS_packed, true)); #if defined (COMPUTEBACKWARD) TIME(reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propUP_SS_packed_backward, true)); - TIME(reductions_DD_V2_GAMMAF1U_D_2pt_backward[i_sample]->V2( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); - TIME(reductions_DD_V4_GAMMAF1U_D_2pt_backward[i_sample]->V4( stoch_piece, glist_sink_nucleon, propUP_SS_packed_backward, propDN_SS_packed_backward, true)); #endif stoch_piece.unload(); @@ -1026,11 +936,9 @@ int main(int argc, char **argv) { TIME(reductions_DD_V3_GAMMAF2D_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed, true)); - TIME(reductions_DD_V3_GAMMAF2U_2pt[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed, true)); #if defined (COMPUTEBACKWARD) TIME(reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propDN_SS_packed_backward, true)); - TIME(reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample]->V3( stoch_piece, glist_sink_meson, propUP_SS_packed_backward, true)); #endif @@ -1185,7 +1093,6 @@ int main(int argc, char **argv) { //Gaussian smearing of the propagator TIME(vectortmp2.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); - //temporary1.pack_propagator_from_source_to_sink(temporary2, maxinsertion_local[3], max_source_sink_separations, l == 0 ? true : false); PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectortmp2); stochastic_oet_prop_u_zero_mom_SS.pack_propagator_from_source_to_sink(vectorAuxF, maxinsertion_local[3], max_source_sink_separations, i_source_parallel == 0 ? true : false); @@ -1199,10 +1106,6 @@ int main(int argc, char **argv) { } //end of loop on parallel sources - //stochastic_oet_prop_u_zero_mom_SS.unload(); - //stochastic_oet_prop_u_zero_mom_SS.writeHDF5("zero_momentum_oet_smeared_u"); - //stochastic_oet_prop_u_zero_mom_SS.load(); - //PLEGMA_printf("DONE OET zero mom up\n"); @@ -1251,7 +1154,6 @@ int main(int argc, char **argv) { } vectortmp2.rotateToPhysicalBasis(vectortmp1,-1); - //stochastic_source_spin_diluted_momzero.writeLIME(outfile_V+"source_reduction_momentum"+std::to_string(spinindex)); //Doing the zero momentum stochastic propagator with spin dilution //Doing the inversion TIME(solver.solve(vectortmp2, vectortmp2)); @@ -1352,7 +1254,6 @@ int main(int argc, char **argv) { sink_local[1] = sourcePositions[isource][1]; sink_local[2] = sourcePositions[isource][2]; sink_local[3] = (source[3]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - //int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; propUPpacked_to_sink.pack_propagator_as_sink(propUP_SS_packed, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); propDNpacked_to_sink.pack_propagator_as_sink(propDN_SS_packed, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); } @@ -1368,7 +1269,6 @@ int main(int argc, char **argv) { sink_local[2] = sourcePositions[isource][2]; sink_local[3] = (source[DIM_T]+tSinks[k]+i_source_parallel*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; - //int global_fixSinkTime = (tsinkMtsource + source[3]+j*max_source_sink_separations+HGC_totalL[3])%HGC_totalL[3]; st_oet_u_zeropacked_to_sink.pack_propagator_as_sink(stochastic_oet_prop_u_zero_mom_SS, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); st_oet_d_zeropacked_to_sink.pack_propagator_as_sink(stochastic_oet_prop_d_zero_mom_SS, sink_local[3], tsinkMtsource, i_source_parallel==0 ? true : false); } @@ -1657,10 +1557,6 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrW15_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW16_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW29_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW30_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW31_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW32_2pt(source, filtered_sourcemomentumList_2pt); #if defined (COMPUTEBACKWARD) @@ -1679,10 +1575,6 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrW15_2pt_backward(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW16_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW29_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW30_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW31_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW32_2pt_backward(source, filtered_sourcemomentumList_2pt); #endif @@ -1701,10 +1593,6 @@ int main(int argc, char **argv) { corrW15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); corrW16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); - corrW29_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W29"); - corrW30_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W30"); - corrW31_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); - corrW32_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); #if defined (COMPUTEBACKWARD) @@ -1723,10 +1611,6 @@ int main(int argc, char **argv) { corrW15_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W15"); corrW16_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W16"); - corrW29_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W29"); - corrW30_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W30"); - corrW31_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W31"); - corrW32_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W32"); #endif #endif @@ -1743,25 +1627,17 @@ int main(int argc, char **argv) { //V3 TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed, true)); -// TIME(corrB3_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 3, true)); TIME(corrB3_2pt.Recombination(reductionsV3_2pt,*reductions_UU_V2_GAMMAF1D_U_2pt[i_sample],false,0,false,0,true,false,false,false,true)); -// TIME(corrB4_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 4, true)); TIME(corrB4_2pt.Recombination(reductionsV3_2pt,*reductions_UU_V4_GAMMAF1U_D_2pt[i_sample],false,2,false,0,true,true,false,false,true)); -// TIME(corrB5_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample], 0, 5, true)); TIME(corrB5_2pt.Recombination(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt[i_sample],true,1,false,0,true,false,false,false,true)); -// TIME(corrB6_2pt.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample], 0, 6, true)); TIME(corrB6_2pt.Recombination(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt[i_sample],true,0,false,0,false,true,false,false,true)); #if defined (COMPUTEBACKWARD) TIME(reductionsV3_2pt.V3( stochastic_piece, glist_sink_meson, propTS_SS_packed_backward, true)); -// TIME(corrB3_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 3, true)); TIME(corrB3_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample],false,0,false,0,true,false,false,false,true)); -// TIME(corrB4_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 4, true)); TIME(corrB4_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample],false,2,false,0,true,true,false,false,true)); -// TIME(corrB5_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample], 0, 5, true)); TIME(corrB5_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V2_GAMMAF1D_U_2pt_backward[i_sample],true,1,false,0,true,false,false,false,true)); -// TIME(corrB6_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample], 0, 6, true)); TIME(corrB6_2pt_backward.Recombination(reductionsV3_2pt,*reductions_UU_V4_GAMMAF1U_D_2pt_backward[i_sample],true,0,false,0,false,true,false,false,true)); #endif @@ -1771,11 +1647,8 @@ int main(int argc, char **argv) { TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true));//checked TIME(corrW13_2pt.Recombination(*reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); -// TIME(corrW13_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 13, true, false)); - TIME(corrW15_2pt.Recombination( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); - //TIME(corrW15_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 15, true, false)); #if defined (COMPUTEBACKWARD) @@ -1783,11 +1656,8 @@ int main(int argc, char **argv) { TIME(corrW13_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); - //TIME(corrW13_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 13, true, false)); - TIME(corrW15_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); - //TIME(corrW15_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 15, true, false)); #endif @@ -1795,11 +1665,8 @@ int main(int argc, char **argv) { TIME(corrW14_2pt.Recombination( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); -// TIME(corrW14_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 14, true, false)); - TIME(corrW16_2pt.Recombination( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); -// TIME(corrW16_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt[i_sample], reductionsV2_2pt, 0, 16, true, false)); #if defined (COMPUTEBACKWARD) @@ -1807,59 +1674,8 @@ int main(int argc, char **argv) { TIME(corrW14_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, false, true, false, false, true)); -// TIME(corrW14_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 14, true, false)); - TIME(corrW16_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, false, true, false, false, true)); -// TIME(corrW16_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2D_2pt_backward[i_sample], reductionsV2_2pt, 0, 16, true, false)); - -#endif - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked - - TIME(corrW31_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); - -// TIME(corrW31_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 31, true, false)); - - TIME(corrW32_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrW32_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 32, true, false)); - -#if defined (COMPUTEBACKWARD) - - TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked - - - TIME(corrW31_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); - -// TIME(corrW31_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 31, true, false)); - - TIME(corrW32_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrW32_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 32, true, false)); -#endif - - TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed, propDN_SS_packed, true));//checked - - TIME(corrW29_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); - -// TIME(corrW29_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 29, true, false)); -// - TIME(corrW30_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 2, false, 0,true, false, false, false, true)); - -// TIME(corrW30_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 30, true, false)); - -#if defined (COMPUTEBACKWARD) - - TIME(reductionsV2_2pt.V4( stochastic_piece, glist_sink_nucleon, propTS_SS_packed_backward, propDN_SS_packed_backward, true));//checked - - - TIME(corrW29_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); - -// TIME(corrW29_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 29, true, false)); - - TIME(corrW30_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 2, false, 0,true, false, false, false, true)); - -// TIME(corrW30_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 30, true, false)); #endif @@ -1870,10 +1686,7 @@ int main(int argc, char **argv) { TIME(corrW5_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 0,true, false, false, false, true)); -// TIME(corrW5_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 5, true, false)); - TIME(corrW7_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 1, false, 0, true, false, false, false, true)); -// TIME(corrW7_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 7, true, false)); #if defined (COMPUTEBACKWARD) @@ -1881,38 +1694,28 @@ int main(int argc, char **argv) { TIME(corrW5_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 0,true, false, false, false, true)); -// TIME(corrW5_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 5, true, false)); - TIME(corrW7_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 1, false, 0, true, false, false, false, true)); -// TIME(corrW7_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 7, true, false)); #endif TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed, propTS_SS_packed, true));//checked TIME(corrW6_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, true, false, false, false, true)); -// TIME(corrW6_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 6, true, false)); - TIME(corrW8_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); -// TIME(corrW8_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 8, true, false)); - #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V2( stochastic_piece, glist_sink_nucleon, propDN_SS_packed_backward, propTS_SS_packed_backward, true));//checked TIME(corrW6_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 1, false, 0, true, false, false, false, true)); -// TIME(corrW6_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 6, true, false)); TIME(corrW8_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); -// TIME(corrW8_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 8, true, false)); #endif } //loop over sample - - + }//loop over doing twopoint for (int k=0; k corrW11_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW12_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW33_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW34_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW35_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW36_2pt(source, filtered_sourcemomentumList_2pt); corrB7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); @@ -2286,11 +2044,6 @@ int main(int argc, char **argv) { corrW11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W11"); corrW12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W12"); - corrW33_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W33"); - corrW34_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W34"); - corrW35_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); - corrW36_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); - #if defined (COMPUTEBACKWARD) PLEGMA_ScattCorrelator corrB7_2pt_backward(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrB8_2pt_backward(source, filtered_sourcemomentumList_2pt); @@ -2300,11 +2053,6 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrW11_2pt_backward(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrW12_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW33_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW34_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW35_2pt_backward(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrW36_2pt_backward(source, filtered_sourcemomentumList_2pt); - corrB7_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B7"); corrB8_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "B8"); @@ -2314,11 +2062,6 @@ int main(int argc, char **argv) { corrW11_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W11"); corrW12_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W12"); - corrW33_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W33"); - corrW34_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W34"); - corrW35_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W35"); - corrW36_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "W36"); - #endif @@ -2383,39 +2126,27 @@ int main(int argc, char **argv) { TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); TIME( corrW9_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); -// TIME( corrW9_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 9, true)); - TIME(corrW11_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, true, false, false, false, true)); -// TIME(corrW11_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 11, true)); TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed, propUP_SS_packed, true)); TIME(corrW10_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt,false, 1, false, 0, true, false, false, false, true )); -// TIME(corrW10_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 10, true, false)); - TIME(corrW12_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 9, true, false, false, false, true)); -// TIME(corrW12_2pt.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 12, true, false)); + TIME(corrW12_2pt.Recombination( *reductions_UU_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 0, true, false, false, false, true)); #if defined (COMPUTEBACKWARD) TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); TIME( corrW9_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 0, false, 0, true, false, false, false, true)); -// TIME( corrW9_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 9, true)); - TIME(corrW11_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt,true, 1, false, 0, true, false, false, false, true)); -// TIME(corrW11_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 11, true)); - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propTS_SS_packed_backward, propUP_SS_packed_backward, true)); TIME(corrW10_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 1, false, 0, true, false, false, false, true )); -// TIME(corrW10_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 10, true, false)); - - TIME(corrW12_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 9, true, false, false, false, true)); + TIME(corrW12_2pt_backward.Recombination( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 0, true, false, false, false, true)); -// TIME(corrW12_2pt_backward.W_diagrams( *reductions_UU_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 12, true, false)); #endif stochastic_propagator_packed.apply_gamma5(); @@ -2424,11 +2155,9 @@ int main(int argc, char **argv) { TIME(corrB7_2pt.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], false, 2, true, 0, false, true, false, false, true)); -// TIME(corrB7_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 7, true, false, false)); TIME(corrB8_2pt.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], false, 0, false, 0, false, true, false, false, true)); -// TIME(corrB8_2pt.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt[i_sample], 0, 8, true, false, false)); #if defined (COMPUTEBACKWARD) @@ -2436,65 +2165,12 @@ int main(int argc, char **argv) { TIME(corrB7_2pt_backward.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], false, 2, true, 0, false, true, false, false, true)); -// TIME(corrB7_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 7, true, false, false)); TIME(corrB8_2pt_backward.Recombination(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], false, 0, false, 0, false, true, false, false, true)); -// TIME(corrB8_2pt_backward.B_diagrams(reductionsV3_2pt, *reductions_DD_V2_GAMMAF1U_U_2pt_backward[i_sample], 0, 8, true, false, false)); #endif - stochastic_propagator_packed.unload(); - stochastic_propagator_packed.copy(*stochastic_sources[i_sample],HOST); - stochastic_propagator_packed.load(); - - stochastic_propagator_packed.apply_gamma5(); - - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); - - TIME(corrW33_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, false, 2, false, 0, true, false, false, false, true)); - -// TIME(corrW33_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 33, true, false)); - - TIME(corrW34_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); - -// TIME(corrW34_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 34, true, false)); - - - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed, propTS_SS_packed, true)); - - TIME(corrW35_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt,false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrW35_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 35, true, false)); - - TIME(corrW36_2pt.Recombination( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); - -// TIME(corrW36_2pt.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt[i_sample], reductionsV2_2pt, 0, 36, true, false)); - -#if defined (COMPUTEBACKWARD) - - TIME(reductionsV2_2pt.V4( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); - - TIME(corrW33_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt,false, 2, false, 0, true, false, false, false, true)); - -// TIME(corrW33_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 33, true, false)); - - TIME(corrW34_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 0, false, 0, false, false, false, false, true)); - -// TIME(corrW34_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 34, true, false)); - - TIME(reductionsV2_2pt.V2( stochastic_propagator_packed, glist_sink_nucleon, propUP_SS_packed_backward, propTS_SS_packed_backward, true)); - - TIME(corrW35_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrW35_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 35, true, false)); - - TIME(corrW36_2pt_backward.Recombination( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, true, 1, false, 0, false, false, false, false, true)); - -// TIME(corrW36_2pt_backward.W_diagrams( *reductions_DD_V3_GAMMAF2U_2pt_backward[i_sample], reductionsV2_2pt, 0, 36, true, false)); -#endif - - } for (int i_source_parallel=0; i_source_parallel temporary; @@ -2526,22 +2202,14 @@ int main(int argc, char **argv) { TIME( corrW9.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2,false, 0, false, 0, true, false, false, true, true)); -// TIME( corrW9.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 9, true, true)); - TIME(corrW11.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, true, 1, false, 0, true, false, false, true, true)); -// TIME(corrW11.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 11, true, true)); - TIME(reductionsV2.V4( stochastic_source_packed, glist_sink_nucleon, propTS_SS_packed_to_sink, propUPpacked_to_sink, true)); TIME(corrW10.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, false, 1, false, 0, true, false, false, true, true )); -// TIME(corrW10.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 10, true, true)); - - TIME(corrW12.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, true, 0, false, 9, true, false, false, true, true)); - -// TIME(corrW12.W_diagrams( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, 0, 12, true, true)); + TIME(corrW12.Recombination( *reductions_UU_V3_GAMMAF2U[i_sample*tSinks.size()+k], reductionsV2, true, 0, false, 0, true, false, false, true, true)); } //loop over stochastic samples @@ -2566,10 +2234,6 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrW11_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrW12_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW33_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table));//because of V4 - TIME(produceOutput_2pt_packed(corrW34_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW35_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrW36_2pt, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table)); #if defined (COMPUTEBACKWARD) @@ -2583,11 +2247,6 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrW11_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); TIME(produceOutput_2pt_packed(corrW12_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrW33_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward));//because of V4 - TIME(produceOutput_2pt_packed(corrW34_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrW35_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrW36_2pt_backward, outfilename,"4pt", n_stochastic_samples, parallel_sources, attract_lookup_table_backward)); - #endif } @@ -2795,18 +2454,6 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrZ9_2pt(source, filtered_sourcemomentumList_2pt); PLEGMA_ScattCorrelator corrZ10_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ11_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ12_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ13_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ14_2pt(source, filtered_sourcemomentumList_2pt); - - PLEGMA_ScattCorrelator corrZ15_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ16_2pt(source, filtered_sourcemomentumList_2pt); - - PLEGMA_ScattCorrelator corrZ17_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ18_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ19_2pt(source, filtered_sourcemomentumList_2pt); - PLEGMA_ScattCorrelator corrZ20_2pt(source, filtered_sourcemomentumList_2pt); corrZ5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); @@ -2818,26 +2465,6 @@ int main(int argc, char **argv) { corrZ9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z9"); corrZ10_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z10"); - corrZ11_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z11"); - corrZ12_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); - - corrZ13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); - corrZ14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); - - corrZ15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z15"); - corrZ16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z16"); - - corrZ17_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z17"); - corrZ18_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z18"); - corrZ19_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z19"); - corrZ20_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z20"); - - -// corrM.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); -// corrD1if34.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); -// corrD1if12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); -// corrD1if56.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); - #if defined (COMPUTEBACKWARD) PLEGMA_ScattCorrelator corrZ5_2pt_backward(source, filtered_sourcemomentumList_2pt); @@ -2871,26 +2498,6 @@ int main(int argc, char **argv) { corrZ9_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z9"); corrZ10_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z10"); - corrZ11_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z11"); - corrZ12_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z12"); - - corrZ13_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z13"); - corrZ14_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z14"); - - corrZ15_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z15"); - corrZ16_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z16"); - - corrZ17_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z17"); - corrZ18_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z18"); - corrZ19_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z19"); - corrZ20_2pt_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z20"); - - -// corrM_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "32", "MNPPP"); -// corrD1if34_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP01"); -// corrD1if12_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MNPP02"); -// corrD1if56_backward.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "MN0PP"); - #endif if (dotwopoint==1){ @@ -2898,133 +2505,36 @@ int main(int argc, char **argv) { #if defined (COMPUTEBACKWARD) TIME(corrZ5_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, false, 0, false, 0, true, false, false, false, true )); -// TIME(corrZ5_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 5, false )); TIME(corrZ7_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, true, 1, false, 0, true, false, false, false, true )); -// TIME(corrZ7_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 7, false )); TIME(corrZ6_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, false, 1, false, 0, true, false, false, false, true )); -// TIME(corrZ6_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 6, false )); TIME(corrZ8_2pt_backward.Recombination( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, true, 0, false, 0, true, false, false, false , true )); -// TIME(corrZ8_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 8, false )); TIME( corrZ9_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, false, 2, true, 0, false, true, false, false, true)); -// TIME( corrZ9_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 9, false )); - TIME(corrZ10_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward,false, 0, false, 0, false, true, false, false, true )); -// TIME(corrZ10_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHD_UP_UP_2pt_backward, 0, 10,false )); -// - TIME(corrZ11_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward,false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrZ11_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 11, false )); - - TIME(corrZ13_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward,true, 1, false, 0, false, false, false, false, true )); - -// TIME(corrZ13_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV2_diluted_STOCHU_DN_UP_2pt_backward, 0, 13, false )); - - TIME(corrZ12_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, false, 2, false, 0, true, false, false, false, true)); -// TIME(corrZ12_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 12, false )); - - TIME(corrZ14_2pt_backward.Recombination( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, true, 0, false, 0, false, false, false, false, true )); - -// TIME(corrZ14_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt_backward, reductionsV4_diluted_STOCHU_DN_UP_2pt_backward, 0, 14, false )); - - TIME(corrZ15_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, false, 0, false, 0, false, true, false, false, true)); - -// TIME(corrZ15_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 15, false )); - TIME(corrZ16_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, false, 2, true, 0, false, true, false, false, true)); - -// TIME(corrZ16_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHU_DN_DN_2pt_backward, 0, 16, false )); - - TIME(corrZ17_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrZ17_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 17, false )); - TIME(corrZ18_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, true, 1, false, 0, false, false, false, false, true)); - -// TIME(corrZ18_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV2_diluted_STOCHD_UP_DN_2pt_backward, 0, 18, false )); - - TIME(corrZ19_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, false, 2, false, 0, true, false, false, false, true)); - -// TIME(corrZ19_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 19, false )); - - TIME(corrZ20_2pt_backward.Recombination( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, true, 0, false, 0, false, false, false, false, true )); - -// TIME(corrZ20_2pt_backward.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt_backward, reductionsV4_diluted_STOCHD_UP_DN_2pt_backward, 0, 20, false )); - - #endif TIME(corrZ5_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, false, 0, false, 0, true, false, false, false, true )); -// TIME(corrZ5_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 5, false )); - TIME(corrZ7_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, true, 1, false, 0, true, false, false, false, true )); -// TIME(corrZ7_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 7, false )); - TIME(corrZ6_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, false, 1, false, 0, true, false, false, false, true )); -// TIME(corrZ6_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 6, false )); - TIME(corrZ8_2pt.Recombination( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, true, 0, false, 0, true, false, false, false , true )); -// TIME(corrZ8_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 8, false )); - TIME( corrZ9_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, false, 2, true, 0, false, true, false, false, true)); -// TIME( corrZ9_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 9, false )); - TIME(corrZ10_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt,false, 0, false, 0, false, true, false, false, true )); - // TIME(corrZ10_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHD_UP_UP_2pt, 0, 10,false )); - - TIME(corrZ11_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrZ11_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 11, false )); - - TIME(corrZ13_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, true, 1, false, 0, false, false, false, false, true )); - -// TIME(corrZ13_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV2_diluted_STOCHU_DN_UP_2pt, 0, 13, false )); - - TIME(corrZ12_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt,false, 2, false, 0, true, false, false, false, true)); - -// TIME(corrZ12_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 12, false )); - - TIME(corrZ14_2pt.Recombination( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, true, 0, false, 0, false, false, false, false, true )); - -// TIME(corrZ14_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN_2pt, reductionsV4_diluted_STOCHU_DN_UP_2pt, 0, 14, false )); - - TIME(corrZ15_2pt.Recombonation( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, false, 0, false, 0, false, true, false, false, true)); - -// TIME(corrZ15_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 15, false )); - - TIME(corrZ16_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, false, 2, true, 0, false, true, false, false, true)); - -// TIME(corrZ16_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHU_DN_DN_2pt, 0, 16, false )); - - TIME(corrZ17_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, false, 2, true, 0, true, false, false, false, true)); - -// TIME(corrZ17_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 17, false )); - - TIME(corrZ18_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt,true, 1, false, 0, false, false, false, false, true)); - -// TIME(corrZ18_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV2_diluted_STOCHD_UP_DN_2pt, 0, 18, false )); - - TIME(corrZ19_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, false, 2, false, 0, true, false, false, false, true)); - -// TIME(corrZ19_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 19, false )); - - TIME(corrZ20_2pt.Recombination( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, true, 0, false, 0, false, false, false, false, true )); - -// TIME(corrZ20_2pt.Z_diagrams_without_dilution( reductionsV3_diluted_U_UP_2pt, reductionsV4_diluted_STOCHD_UP_DN_2pt, 0, 20, false )); #endif @@ -3044,11 +2554,6 @@ int main(int argc, char **argv) { #if 1 -// TIME(corrM.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS )); -// TIME(corrD1if56.M_diagrams( corrN0_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); -// TIME(corrD1if34.M_diagrams( corrNP_packed, stochastic_oet_prop_d_zero_mom_SS, stochastic_oet_prop_u_fini_mom_SS)); -// TIME(corrD1if12.M_diagrams( corrNP_packed, stochastic_oet_prop_u_zero_mom_SS, stochastic_oet_prop_d_fini_mom_SS)); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z_2pt"; @@ -3060,18 +2565,6 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrZ9_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); TIME(produceOutput_2pt_packed(corrZ10_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ11_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ12_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ13_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ14_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - - TIME(produceOutput_2pt_packed(corrZ15_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ16_2pt, outfilename, "4pt", parallel_sources, attract_lookup_table)); - - TIME(produceOutput_2pt_packed(corrZ17_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ18_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ19_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); - TIME(produceOutput_2pt_packed(corrZ20_2pt, outfilename,"4pt", parallel_sources, attract_lookup_table)); #if defined (COMPUTEBACKWARD) @@ -3085,28 +2578,8 @@ int main(int argc, char **argv) { TIME(produceOutput_2pt_packed(corrZ9_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); TIME(produceOutput_2pt_packed(corrZ10_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ11_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ12_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ13_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ14_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - - TIME(produceOutput_2pt_packed(corrZ15_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ16_2pt_backward, outfilename, "4pt", parallel_sources, attract_lookup_table_backward)); - - TIME(produceOutput_2pt_packed(corrZ17_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ18_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ19_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - TIME(produceOutput_2pt_packed(corrZ20_2pt_backward, outfilename,"4pt", parallel_sources, attract_lookup_table_backward)); - #endif -// outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_M_correct_2pt"; -// TIME(produceOutput_2pt_packed(corrM, outfilename,"4pt", parallel_sources, attract_lookup_table)); -// TIME(produceOutput_2pt_packed(corrD1if12, outfilename,"4pt", parallel_sources, attract_lookup_table)); -// TIME(produceOutput_2pt_packed(corrD1if34, outfilename,"4pt", parallel_sources, attract_lookup_table)); -// TIME(produceOutput_2pt_packed(corrD1if56, outfilename,"4pt", parallel_sources, attract_lookup_table)); - - } #endif @@ -3121,11 +2594,6 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrZ9(source, filtered_sourcemomentumList); PLEGMA_ScattCorrelator corrZ10(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrZ11(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrZ12(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrZ13(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrZ14(source, filtered_sourcemomentumList); - ssource=(char *)malloc(sizeof(char)*100); sprintf(ssource,"Z5_deltat_%d",tSinks[k]); corrZ5.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); @@ -3142,64 +2610,17 @@ int main(int argc, char **argv) { sprintf(ssource,"Z10_deltat_%d",tSinks[k]); corrZ10.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"Z11_deltat_%d",tSinks[k]); - corrZ11.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"Z12_deltat_%d",tSinks[k]); - corrZ12.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - - sprintf(ssource,"Z13_deltat_%d",tSinks[k]); - corrZ13.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); - sprintf(ssource,"Z14_deltat_%d",tSinks[k]); - corrZ14.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_insertion, "12", ssource); free(ssource); TIME(corrZ5.Recombination( reductionsV3_diluted_D_UP, *reductionsV2_diluted_STOCHU_DN_UP[k], false, 0, false, 0, true, false, false, true, true )); - -// TIME(corrZ5.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 5, false, true )); - TIME(corrZ7.Recombination( reductionsV3_diluted_D_UP, *reductionsV2_diluted_STOCHU_DN_UP[k], true, 1, false, 0, true, false, false, true, true )); - - -// TIME(corrZ7.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV2_diluted_STOCHU_DN_UP, k, 7, false, true )); - TIME(corrZ6.Recombination( reductionsV3_diluted_D_UP, *reductionsV4_diluted_STOCHU_DN_UP[k], false, 1, false, 0, true, false, false, true, true )); - - -// TIME(corrZ6.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 6, false, true )); - TIME(corrZ8.Recombination( reductionsV3_diluted_D_UP, *reductionsV4_diluted_STOCHU_DN_UP[k], true, 0, false, 0, true, false, false, true , true )); - -// TIME(corrZ8.Z_diagrams_without_dilution( reductionsV3_diluted_D_UP, reductionsV4_diluted_STOCHU_DN_UP, k, 8, false, true )); - TIME(corrZ9.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHD_UP_UP[k],false, 2, true, 0, false, true, false, true, true)); -// TIME(corrZ9.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 9, false, true )); - TIME(corrZ10.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHD_UP_UP[k],false, 0, false, 0, false, true, false, true, true )); -// TIME(corrZ10.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHD_UP_UP,k, 10,false, true )); - - TIME(corrZ11.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHU_DN_UP[k],false, 2, true, 0, true, false, false, true, true)); - - -// TIME(corrZ11.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 11, false, true )); - - TIME(corrZ13.Recombination( reductionsV3_diluted_U_DN, *reductionsV2_diluted_STOCHU_DN_UP[k],true, 1, false, 0, false, false, false, true, true )); - - -// TIME(corrZ13.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV2_diluted_STOCHU_DN_UP,k, 13, false, true )); - - TIME(corrZ12.Recombination( reductionsV3_diluted_U_DN, *reductionsV4_diluted_STOCHU_DN_UP[k], false, 2, false, 0, true, false, false,true, true)); - - -// TIME(corrZ12.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 12, false, true )); - - TIME(corrZ14.Recombination( reductionsV3_diluted_U_DN, *reductionsV4_diluted_STOCHU_DN_UP[k], true, 0, false, 0, false, false, false, true, true )); - - - // TIME(corrZ14.Z_diagrams_without_dilution( reductionsV3_diluted_U_DN, reductionsV4_diluted_STOCHU_DN_UP,k, 14, false, true )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_Z"; TIME(produceOutput_3pt(corrZ5, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); @@ -3210,11 +2631,6 @@ int main(int argc, char **argv) { TIME(produceOutput_3pt(corrZ9, outfilename, "4pt", parallel_sources, attract_lookup_table, tSinks[k] )); TIME(produceOutput_3pt(corrZ10, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); - TIME(produceOutput_3pt(corrZ11, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); - TIME(produceOutput_3pt(corrZ12, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); - TIME(produceOutput_3pt(corrZ13, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); - TIME(produceOutput_3pt(corrZ14, outfilename,"4pt", parallel_sources, attract_lookup_table, tSinks[k] )); - }//end for loop source sink separations #endif @@ -3223,30 +2639,6 @@ int main(int argc, char **argv) { if (dotwopoint==1){ -#if 1 - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt"; - TIME( corrN0_packed.apply_phase()); - TIME( corrN0_packed.apply_sign("N")); - TIME( corrN0_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); - TIME( corrN0_packed.writeHDF5(outfilename)); - - TIME( corrNP_packed.apply_phase() ); - TIME( corrNP_packed.apply_sign("N") ); - TIME( corrNP_packed.applyBoundaryConditions( true, parallel_sources, attract_lookup_table)); - TIME( corrNP_packed.writeHDF5(outfilename) ); - - //outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N_2pt_backward"; - - //TIME( corrNP_packed_backward.apply_phase() ); - //TIME( corrNP_packed_backward.apply_sign("N") ); - //TIME( corrNP_packed_backward.applyBoundaryConditions( true, parallel_sources, attract_lookup_table_backward)); - //TIME( corrNP_packed_backward.writeHDF5(outfilename) ); - - - - -#endif - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; TIME(corrP0UP.apply_sign("P")); TIME(corrP0UP.writeHDF5( outfilename )); @@ -3287,27 +2679,21 @@ int main(int argc, char **argv) { for(int i_samples=0; i_samples< n_stochastic_samples; ++i_samples) { if (dotwopoint==1){ reductions_DD_V2_GAMMAF1U_U_2pt.pop_back(); - reductions_DD_V2_GAMMAF1U_D_2pt.pop_back(); - reductions_DD_V4_GAMMAF1U_D_2pt.pop_back(); reductions_UU_V4_GAMMAF1U_D_2pt.pop_back(); reductions_UU_V2_GAMMAF1D_U_2pt.pop_back(); reductions_UU_V3_GAMMAF2U_2pt.pop_back(); - reductions_DD_V3_GAMMAF2U_2pt.pop_back(); reductions_DD_V3_GAMMAF2D_2pt.pop_back(); #if defined (COMPUTEBACKWARD) reductions_DD_V2_GAMMAF1U_U_2pt_backward.pop_back(); - reductions_DD_V2_GAMMAF1U_D_2pt_backward.pop_back(); - reductions_DD_V4_GAMMAF1U_D_2pt_backward.pop_back(); reductions_UU_V4_GAMMAF1U_D_2pt_backward.pop_back(); reductions_UU_V2_GAMMAF1D_U_2pt_backward.pop_back(); reductions_UU_V3_GAMMAF2U_2pt_backward.pop_back(); - reductions_DD_V3_GAMMAF2U_2pt_backward.pop_back(); reductions_DD_V3_GAMMAF2D_2pt_backward.pop_back(); #endif From 83f65b583e8d0d2d236369e1b770555bae92fc98 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 18 Nov 2024 16:58:13 +0100 Subject: [PATCH 129/168] correcting bug --- lib/PLEGMA_ScattCorrelator.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 57cfb826..8f3c36b4 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -1665,7 +1665,7 @@ void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator Float factor[2]={-1.,0.};//-1 from eqs. (20),(23), .... if (matrix == true){ - this->V3V2reduction_matrix( srcV3, srcV2, index_abs, transp_source_sink,i_gi2, transpgamma_i1, factor, transpgamma_f1, oet, threept); + this->V3V2reduction_matrix( srcV3, srcV2, index_abs, transp_source_sink,ig_i2, transpgamma_i1, factor, transpgamma_f1, oet, threept); } else{ this->V3V2reduction( srcV3, srcV2, index_abs, transp_source_sink, ig_i2, transpgamma_i1, factor, transpgamma_f1, oet, threept); From 1812520b9cfa742f759cd4422459a87b05ecfca0 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 18 Nov 2024 16:59:41 +0100 Subject: [PATCH 130/168] incorporating the multiple right hand side solver --- include/PLEGMA_Vector.h | 8 +- include/utils/QUDA_interface.h | 11 ++- include/utils/QUDA_params.h | 1 + lib/PLEGMA_Vector.cu | 24 +++--- lib/kernels/PLEGMA_vector_utils.cuh | 44 +++++------ utils/PLEGMA_Options.cpp | 4 + utils/QUDA_interface.cpp | 111 +++++++++++++++++++--------- utils/QUDA_params.cpp | 2 + 8 files changed, 126 insertions(+), 79 deletions(-) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index 03f1ca70..3d1a6768 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -25,8 +25,8 @@ namespace plegma { PLEGMA_Vector(ALLOCATION_FLAG alloc_flag=BOTH, GHOST_FLAG ghost_flag=FIRST_SIDE); ~PLEGMA_Vector(){;} - void copyToQUDA( std::vector& cudaVector, bool isEv = false); - void copyFromQUDA( std::vector& cudaVector, bool isEv = false); + void copyToQUDA( std::vector& cudaVector, int src, bool isEv = false); + void copyFromQUDA( std::vector& cudaVector, int src, bool isEv = false); /** @brief Applies N times Gaussian(Wuppertal) smearing operator on all time-slices of a vector. NOTE: works also for Vector3D @@ -105,8 +105,8 @@ namespace plegma { }; - template void copyToQUDA(std::vector& cudaVector, Float* delem, bool isEv = false); // delem is a device pointer - template void copyFromQUDA(Float* delem, std::vector& cudaVector, bool isEv = false); + template void copyToQUDA(std::vector& cudaVector, Float* delem, int src, bool isEv = false); // delem is a device pointer + template void copyFromQUDA(Float* delem, std::vector& cudaVector, int src, bool isEv = false); ///////////////////////////////////// // CLASS: PLEGMA_Vector3D /////////// diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index d444590a..b441b330 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -26,15 +26,15 @@ namespace quda { QudaInvertParam getInvParams() const{return inv_param;} SolverParam* getSolverParam() const{return solverParam;} void UpdateSolver(); - QUDA_solver(double mu); + QUDA_solver(double mu, int nsrc); virtual ~QUDA_solver(); std::vector solve(std::vector& rhs); template - std::vector solve(PLEGMA_Vector &vectorIn); + std::vector solve(std::vector> &vectorIn); template - void solve(PLEGMA_Vector &out, PLEGMA_Vector &in); + void solve(std::vector> &out, std::vector> &in); template - void runOneIter(PLEGMA_Vector &out, PLEGMA_Vector &in); + void runOneIter(std::vector> &out, std::vector> &in); }; enum APP_TYPE {M,Mdag,MdagM,MMdag}; @@ -52,8 +52,7 @@ namespace quda { void print(){dParam.print();} void switchMu(double mu); void switchKappa(double kappa); - template void apply(PLEGMA_Vector &out, PLEGMA_Vector &in, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default it is without any normalization + template void apply(std::vector> &out, std::vector> &in, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default it is without any normalization template void apply(Float *dout, Float *din, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default is without any normalization // Note that dout and din are device pointers }; } - diff --git a/include/utils/QUDA_params.h b/include/utils/QUDA_params.h index 97642676..12dc5d70 100644 --- a/include/utils/QUDA_params.h +++ b/include/utils/QUDA_params.h @@ -71,6 +71,7 @@ define(QudaSetupType setup_type, QUDA_NULL_VECTOR_SETUP); define(bool pre_orthonormalize, false); define(bool post_orthonormalize, true); define(double omega, 0.85); +define(int n_vec_batch[QUDA_MAX_MG_LEVEL], {}); define(QudaInverterType coarse_solver[QUDA_MAX_MG_LEVEL], {}); define(QudaInverterType smoother_type[QUDA_MAX_MG_LEVEL], {}); define(double coarse_solver_tol[QUDA_MAX_MG_LEVEL], {}); diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 2cd812a7..1cbb1492 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -82,13 +82,13 @@ void PLEGMA_Vector::gaussianSmearing(PLEGMA_Vector &vecIn, template -void PLEGMA_Vector::copyToQUDA(std::vector& qudaVector, bool isEv){ - copy_to_QUDA(this->d_elem, (qudaVector), isEv); +void PLEGMA_Vector::copyToQUDA(std::vector& qudaVector, int src, bool isEv){ + copy_to_QUDA(this->d_elem, (qudaVector), src, isEv); } template -void PLEGMA_Vector::copyFromQUDA( std::vector& qudaVector, bool isEv){ - copy_from_QUDA(this->d_elem, (qudaVector), isEv); +void PLEGMA_Vector::copyFromQUDA( std::vector& qudaVector, int src, bool isEv){ + copy_from_QUDA(this->d_elem, (qudaVector), src, isEv); } template @@ -463,19 +463,19 @@ template class PLEGMA_Vector; namespace plegma{ template - void copyToQUDA(std::vector& qudaVector, Float* delem, bool isEv){ - copy_to_QUDA(delem, qudaVector, isEv); + void copyToQUDA(std::vector& qudaVector, Float* delem, int src, bool isEv){ + copy_to_QUDA(delem, qudaVector, src, isEv); } - template void copyToQUDA(std::vector&qudaVector, float* delem, bool isEv); - template void copyToQUDA(std::vector&qudaVector, double* delem, bool isEv); + template void copyToQUDA(std::vector&qudaVector, float* delem, int src, bool isEv); + template void copyToQUDA(std::vector&qudaVector, double* delem, int src, bool isEv); template - void copyFromQUDA(Float* delem, std::vector&qudaVector, bool isEv){ - copy_from_QUDA(delem, qudaVector, isEv); + void copyFromQUDA(Float* delem, std::vector&qudaVector, int src, bool isEv){ + copy_from_QUDA(delem, qudaVector, src, isEv); } - template void copyFromQUDA(float* delem, std::vector& qudaVector, bool isEv); - template void copyFromQUDA(double* delem, std::vector& qudaVector, bool isEv); + template void copyFromQUDA(float* delem, std::vector& qudaVector, int src, bool isEv); + template void copyFromQUDA(double* delem, std::vector& qudaVector, int src, bool isEv); //----------------------------------// // class PLEGMA_Vector3D // diff --git a/lib/kernels/PLEGMA_vector_utils.cuh b/lib/kernels/PLEGMA_vector_utils.cuh index 6709d28a..bc246516 100644 --- a/lib/kernels/PLEGMA_vector_utils.cuh +++ b/lib/kernels/PLEGMA_vector_utils.cuh @@ -142,26 +142,26 @@ static __global__ void copy_to_QUDA(FloatIn *in, FloatOut *outEven, FloatOut *ou } template -static void copy_to_QUDA(FloatIn* in, std::vector& qudaVec, bool isEven){ +static void copy_to_QUDA(FloatIn* in, std::vector& qudaVec, int src, bool isEven){ dim3 blockDim( THREADS_PER_BLOCK , 1, 1); dim3 gridDim( (HGC_localVolume + blockDim.x -1)/blockDim.x , 1 , 1); - if( (qudaVec[0]).SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ + if( (qudaVec[src]).SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ if( isEven ) - copy_to_QUDA<<>>(in,(FloatOut*) (qudaVec[0]).data(), NULL); + copy_to_QUDA<<>>(in,(FloatOut*) (qudaVec[src]).data(), NULL); else - copy_to_QUDA<<>>(in, NULL,(FloatOut*) (qudaVec[0]).data()); + copy_to_QUDA<<>>(in, NULL,(FloatOut*) (qudaVec[src]).data()); } else - copy_to_QUDA<<>>(in, (FloatOut*) (qudaVec[0]).Even().data(),(FloatOut*) (qudaVec[0]).Odd().data()); + copy_to_QUDA<<>>(in, (FloatOut*) (qudaVec[src]).Even().data(),(FloatOut*) (qudaVec[src]).Odd().data()); } template -static void copy_to_QUDA(FloatIn* in,std::vector& qudaVec, bool isEven){ - if( (qudaVec[0]).Precision() == QUDA_SINGLE_PRECISION ) - copy_to_QUDA(in, qudaVec, isEven); - else if ( (qudaVec[0]).Precision() == QUDA_DOUBLE_PRECISION ) - copy_to_QUDA(in, qudaVec, isEven); +static void copy_to_QUDA(FloatIn* in,std::vector& qudaVec,int src, bool isEven){ + if( (qudaVec[src]).Precision() == QUDA_SINGLE_PRECISION ) + copy_to_QUDA(in, qudaVec, src, isEven); + else if ( (qudaVec[src]).Precision() == QUDA_DOUBLE_PRECISION ) + copy_to_QUDA(in, qudaVec, src, isEven); else - PLEGMA_error("Precision %d not supported", (qudaVec[0]).Precision()); + PLEGMA_error("Precision %d not supported", (qudaVec[src]).Precision()); checkQudaError(); } @@ -208,25 +208,25 @@ static __global__ void copy_from_QUDA_kernel(FloatOut *out, FloatIn *inEven, Flo } template -static void copy_from_QUDA(FloatOut* out, std::vector& qudaVec, bool isEven){ +static void copy_from_QUDA(FloatOut* out, std::vector& qudaVec,int src, bool isEven){ ProfileStruct ps(HGC_localVolume); - if( (qudaVec[0]).SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ + if( (qudaVec[src]).SiteSubset() == QUDA_PARITY_SITE_SUBSET ){ if( isEven ) - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel,out,(FloatIn*) (qudaVec[0]).data(), (FloatIn*) NULL); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel,out,(FloatIn*) (qudaVec[src]).data(), (FloatIn*) NULL); else - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) NULL,(FloatIn*) (qudaVec[0]).data()); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) NULL,(FloatIn*) (qudaVec[src]).data()); } else - tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) (qudaVec[0]).Even().data(),(FloatIn*) (qudaVec[0]).Odd().data()); + tuneAndRun(ps, "copy_from_QUDA_kernel", copy_from_QUDA_kernel, out, (FloatIn*) (qudaVec[src]).Even().data(),(FloatIn*) (qudaVec[src]).Odd().data()); } template -static void copy_from_QUDA(FloatOut* out, std::vector &qudaVec, bool isEven){ - if( (qudaVec[0]).Precision() == QUDA_SINGLE_PRECISION ) - copy_from_QUDA(out, qudaVec, isEven); - else if ( (qudaVec[0]).Precision() == QUDA_DOUBLE_PRECISION ) - copy_from_QUDA(out, qudaVec, isEven); +static void copy_from_QUDA(FloatOut* out, std::vector &qudaVec, int src, bool isEven){ + if( (qudaVec[src]).Precision() == QUDA_SINGLE_PRECISION ) + copy_from_QUDA(out, qudaVec, src, isEven); + else if ( (qudaVec[src]).Precision() == QUDA_DOUBLE_PRECISION ) + copy_from_QUDA(out, qudaVec, src, isEven); else - PLEGMA_error("Precision %d not supported", (qudaVec[0]).Precision()); + PLEGMA_error("Precision %d not supported", (qudaVec[src]).Precision()); checkQudaError(); } diff --git a/utils/PLEGMA_Options.cpp b/utils/PLEGMA_Options.cpp index 716f5fd4..d6d72978 100644 --- a/utils/PLEGMA_Options.cpp +++ b/utils/PLEGMA_Options.cpp @@ -288,6 +288,10 @@ void qudaOptions(Options &opt){ isFound=opt.set("Q-mg-nu-pre", "Number of pre-smoother applications, 0-20", verbosity, tpl_int_int); map_to_array_MG(tpl_int_int, nu_pre, 0, 128, "ERROR: invalid pre-smoother applications"); + default_map_MG(tpl_int_int, 1); + isFound=opt.set("Q-mg-n-vec-batch", "batch size when computing null space vectors, 1-20", verbosity, tpl_int_int); + map_to_array_MG(tpl_int_int, n_vec_batch, 0, 128, "ERROR: invalid n-vec-batch"); + default_map_MG(tpl_int_int, 4); isFound=opt.set("Q-mg-nu-post", "Number of post-smoother applications, 0-20", verbosity, tpl_int_int); map_to_array_MG(tpl_int_int, nu_post, 0, 128, "ERROR: invalid post-smoother applications"); diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index 94321f01..e235645e 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -135,7 +135,7 @@ void plaqQuda() { PLEGMA_printf("TEST: Calculated plaquette in QUDA: %f (sp: %f, T: %f)\n", plq[0], plq[1], plq[2]); } -QUDA_solver::QUDA_solver(double mu) { +QUDA_solver::QUDA_solver(double mu, int nsrc) { profiler = new TimeProfile(("Solver profiler mu="+to_string(mu)).c_str()); profiler->TPSTART(QUDA_PROFILE_TOTAL); @@ -179,6 +179,9 @@ QUDA_solver::QUDA_solver(double mu) { inv_param.gflops = 0; inv_param.iter = 0; + inv_param.num_src= nsrc; + inv_param.num_src_per_sub_partition= nsrc; + D = NULL; DSloppy = NULL; DPre = NULL; @@ -204,14 +207,20 @@ QUDA_solver::QUDA_solver(double mu) { ColorSpinorParam cudaParam(cpuParam, inv_param,inv_param.input_location); cudaParam.create = QUDA_ZERO_FIELD_CREATE; - b.push_back(ColorSpinorField(cudaParam)); - x.push_back(ColorSpinorField(cudaParam)); + for (int i=0; i < nsrc; ++i){ + + b.push_back(ColorSpinorField(cudaParam)); + x.push_back(ColorSpinorField(cudaParam)); + + } profiler->TPSTOP(QUDA_PROFILE_TOTAL); profiler->Print(); profiler->TPRESET(); } + + QUDA_solver::~QUDA_solver(){ if(use_mg){ destroyMultigridQuda(mg_preconditioner); @@ -222,8 +231,10 @@ QUDA_solver::~QUDA_solver(){ delete solver; delete solverParam; delete profiler; - b.pop_back(); - x.pop_back(); + for (int i=0; i smoother_tol = param->smoother_tol[level]; current->cycle_type = param->cycle_type[level]; current->global_reduction = param->global_reduction[level]; + current->n_vec_batch= param->n_vec_batch[level]; current->omega = param->omega[level]; current->smoother = param->smoother[level]; @@ -367,12 +379,26 @@ void QUDA_solver::UpdateSolver() std::vector QUDA_solver::solve(std::vector& rhs){ profiler->TPSTART(QUDA_PROFILE_TOTAL); - ColorSpinorField in; - ColorSpinorField out; + std::vector in(rhs.size()); + std::vector out(rhs.size()); - D->prepare(out,in,x[0],rhs[0],inv_param.solution_type); + PLEGMA_printf("Prepare starts\n"); + D->prepare(out,in,x,rhs,inv_param.solution_type); + PLEGMA_printf("Prepare ends\n"); + if (getVerbosity() >= 0) { + auto in_norm = blas::norm2(in); + auto out_norm = blas::norm2(out); + for (auto i = 0u; i < in.size(); i++) + PLEGMA_printf("Prepared: source = %g, solution = %g\n", in_norm[i], out_norm[i]); + } + printf("Maxiter %d\n",solverParam->maxiter); (*solver)(out, in); + + PLEGMA_printf("Solver done"); + if (inv_param.iter == solverParam->maxiter){ + PLEGMA_error("Max iteration reached in the inversion\n"); + } D->reconstruct(x,rhs,inv_param.solution_type); profiler->TPSTOP(QUDA_PROFILE_TOTAL); profiler->Print(); @@ -382,46 +408,51 @@ std::vector QUDA_solver::solve(std::vector& template -std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn){ +std::vector QUDA_solver::solve(std::vector> &vectorIn){ bool flag_eo=false; if( inv_param.matpc_type == QUDA_MATPC_EVEN_EVEN ) flag_eo = true; - vectorIn.copyToQUDA(b,flag_eo); + for (int i=0; i -void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn){ +void QUDA_solver::solve(std::vector> &vectorOut, std::vector> &vectorIn){ bool flag_eo = false; if( inv_param.matpc_type == QUDA_MATPC_EVEN_EVEN ) flag_eo = true; x = solve(vectorIn); - vectorOut.copyFromQUDA( x, flag_eo); + for (int i=0; i &vectorOut, PLEGMA_Vector &vectorIn); -template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::solve(std::vector> &vectorOut, std::vector> &vectorIn); +template void QUDA_solver::solve(std::vector> &vectorOut, std::vector> &vectorIn); -template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); -template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); +template std::vector QUDA_solver::solve(std::vector> &vectorIn); +template std::vector QUDA_solver::solve(std::vector> &vectorIn); template -void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn){ +void QUDA_solver::runOneIter(std::vector> &vectorOut, std::vector> &vectorIn){ int maxiter = solverParam->maxiter; solverParam->maxiter = 1; solve(vectorOut, vectorIn); solverParam->maxiter = maxiter; } -template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); -template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::runOneIter(std::vector> &vectorOut, std::vector> &vectorIn); +template void QUDA_solver::runOneIter(std::vector> &vectorOut,std::vector>&vectorIn); //######################### Quda Dirac operator class ################################ @@ -470,29 +501,39 @@ template void QUDA_dirac::apply(){ } template -void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType){ - Pin.copyToQUDA(in); +void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType){ + for (int i=0; i(); - Pout.copyFromQUDA(out); - if (normType == QUDA_MASS_NORMALIZATION || normType == QUDA_ASYMMETRIC_MASS_NORMALIZATION) Pout.scale(1./(2*inv_param.kappa)); + for (int i=0; i(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(std::vector> &Pout, std::vector>&Pin, QudaMassNormalization normType); template void QUDA_dirac::apply(Float *dout, Float *din, QudaMassNormalization normType){ - plegma::copyToQUDA(in,din); + for (int i=0; i(); - plegma::copyFromQUDA(dout,out); + for (int i=0; i(N_SPINS*N_COLS*HGC_localVolume, (Float) (1./(2*inv_param.kappa)), dout); + cuBLAS::scal(inv_param.num_src*N_SPINS*N_COLS*HGC_localVolume, (Float) (1./(2*inv_param.kappa)), dout); } template void QUDA_dirac::apply(float *dout, float *din, QudaMassNormalization normType); diff --git a/utils/QUDA_params.cpp b/utils/QUDA_params.cpp index 0da580f9..1f93f43f 100644 --- a/utils/QUDA_params.cpp +++ b/utils/QUDA_params.cpp @@ -218,6 +218,7 @@ void setMultigridParam(QudaMultigridParam &mg_param) { mg_param.setup_maxiter[i] = setup_maxiter; mg_param.spin_block_size[i] = 1; mg_param.n_vec[i] = nvec[i] == 0 ? 24 : nvec[i]; // default to 24 vectors if not set + mg_param.n_vec_batch[i]=n_vec_batch[i]; mg_param.precision_null[i] = prec_null; // precision to store the null-space basis mg_param.nu_pre[i] = nu_pre[i]; mg_param.nu_post[i] = nu_post[i]; @@ -424,6 +425,7 @@ void setInvertParam(QudaInvertParam &inv_param) { inv_param.maxiter_precondition = 1; inv_param.omega = 1.0; + inv_param.verbosity = verbosity_level; } From 1c822be5521fdccbdc3905a0a9f3fc15afd72292 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 18 Nov 2024 17:00:30 +0100 Subject: [PATCH 131/168] applying the multiple right hand side solve to Calc_2pt --- plegma/Calc_2pt.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/plegma/Calc_2pt.cpp b/plegma/Calc_2pt.cpp index 42e21aed..271ee2f8 100644 --- a/plegma/Calc_2pt.cpp +++ b/plegma/Calc_2pt.cpp @@ -66,7 +66,7 @@ int main(int argc, char **argv) updateOptions(CHARM); mu = mu_c[0]; } - TIME(QUDA_solver solver(mu)); + TIME(QUDA_solver solver(mu,12)); std::vector threads; @@ -89,25 +89,26 @@ int main(int argc, char **argv) mu = run_mu; solver.UpdateSolver(); } + + std::vector> vectorInOut(12); for(int isc = 0 ; isc < 12 ; isc++){ - PLEGMA_Vector vectorInOut; - { // Smearing the source - PLEGMA_Vector3D vector1, vector2; - vector1.pointSource(source, isc/3, isc%3, DEVICE); - TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); - vectorInOut.absorb(vector2,source[DIM_T]); - } + // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + (vectorInOut[isc]).absorb(vector2,source[DIM_T]); + } // Inverting - PLEGMA_printf("Going to invert %s for component %d\n", - fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); - TIME(solver.solve(vectorInOut, vectorInOut)); - { // Smearing the solution + PLEGMA_printf("Going to invert %s for all component\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM")); + TIME(solver.solve(vectorInOut, vectorInOut)); + for(int isc = 0 ; isc < 12 ; isc++) + { // Smearing the solution PLEGMA_Vector vectorAuxD; PLEGMA_Vector vectorAuxF; - TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + TIME(vectorAuxD.gaussianSmearing(vectorInOut[isc], smearedGauge, nSmear, alphaGauss)); vectorAuxF.copy(vectorAuxD); prop.absorb(vectorAuxF, isc/3, isc%3); - } } prop.rotateToPhysicalBase_device(run_mu/abs(run_mu)); prop.applyBoundaries_device(source[DIM_T]); From c555c7ae483bf9db1f30b8ad6ff43bd0954126e7 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 27 Nov 2024 13:49:16 +0100 Subject: [PATCH 132/168] checking the number of iterations returned by QUDA --- utils/QUDA_interface.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index e235645e..c4d373b5 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -382,22 +382,16 @@ std::vector QUDA_solver::solve(std::vector& std::vector in(rhs.size()); std::vector out(rhs.size()); - PLEGMA_printf("Prepare starts\n"); D->prepare(out,in,x,rhs,inv_param.solution_type); - PLEGMA_printf("Prepare ends\n"); - if (getVerbosity() >= 0) { - auto in_norm = blas::norm2(in); - auto out_norm = blas::norm2(out); - for (auto i = 0u; i < in.size(); i++) - PLEGMA_printf("Prepared: source = %g, solution = %g\n", in_norm[i], out_norm[i]); - } - printf("Maxiter %d\n",solverParam->maxiter); (*solver)(out, in); - - PLEGMA_printf("Solver done"); - if (inv_param.iter == solverParam->maxiter){ - PLEGMA_error("Max iteration reached in the inversion\n"); +#if 0 + for (int i=0;inum_src, solverParam->iter, solverParam->true_res[i]); + } +#endif + if (solverParam->iter == solverParam->maxiter){ + PLEGMA_error("Max iteration reached in the inversion %d\n",solverParam->iter); } D->reconstruct(x,rhs,inv_param.solution_type); profiler->TPSTOP(QUDA_PROFILE_TOTAL); From 0c586ac8e944880e245e84d7cb2bd6d9454d1866 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 16 Jan 2025 09:10:44 +0100 Subject: [PATCH 133/168] making it compatible with the current quda version --- lib/kernels/PLEGMA_kernel_tuner.cuh | 2 +- utils/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kernels/PLEGMA_kernel_tuner.cuh b/lib/kernels/PLEGMA_kernel_tuner.cuh index df11e3f3..420988b2 100644 --- a/lib/kernels/PLEGMA_kernel_tuner.cuh +++ b/lib/kernels/PLEGMA_kernel_tuner.cuh @@ -273,7 +273,7 @@ void PLEGMA_kernel_tuner::run(){ if(!ps.tuned) tune(); launchKernel(ps.tp.grid,ps.tp.block,ps.tp.shared_bytes,0); #else - if(!ps.tuned) ps.tp = tuneLaunch(*this, QUDA_TUNE_NO, (QudaVerbosity) HGC_verbosity); + if(!ps.tuned) ps.tp = tuneLaunch(*this, getTuning(), (QudaVerbosity) HGC_verbosity); launchKernel(ps.tp,device::get_stream(0)); #endif checkQudaError(); diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index df050f78..1a867ba1 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -4,5 +4,5 @@ file(GLOB PLEGMA_UTILS ) cuda_add_library(PLEGMAutils STATIC ${PLEGMA_UTILS}) -target_include_directories(PLEGMAutils SYSTEM PRIVATE ${QUDA_SRC}/lib ${QUDA_HOME}/_deps/eigen-src/ ) +target_include_directories(PLEGMAutils SYSTEM PRIVATE ${QUDA_SRC}/lib ${QUDA_SRC}/include/targets/cuda/ ${QUDA_HOME}/_deps/eigen-src/ ) add_dependencies(PLEGMAutils BoostPP) From 2b5098993dc63f06bcacca5254b0e0f0bc896764 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 16 Jan 2025 09:29:57 +0100 Subject: [PATCH 134/168] saving the stochastic source in float precision --- plegma/nucleon_3pt_n_npi_sigma.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plegma/nucleon_3pt_n_npi_sigma.cpp b/plegma/nucleon_3pt_n_npi_sigma.cpp index 928a9bcb..4cb1af07 100644 --- a/plegma/nucleon_3pt_n_npi_sigma.cpp +++ b/plegma/nucleon_3pt_n_npi_sigma.cpp @@ -326,8 +326,10 @@ int main(int argc, char **argv) { if (readStochSamples==0){ vectorSource_stochastic.stochastic_Z(nroots); - vectorSource_stochastic.unload(); - vectorSource_stochastic.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorSource_stochastic); + vectorAuxF.unload(); + vectorAuxF.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); #if 0 PLEGMA_Vector vectorRead(BOTH); vectorRead.readFile("stochastic_source.0000.00000_plegma_conventions.lime",LIME_FORMAT); @@ -337,13 +339,14 @@ int main(int argc, char **argv) { vectorRead.unload(); stochastic_sources[i]->copy(vectorRead,HOST); #endif + vectorSource_stochastic.unload(); stochastic_sources[i]->copy(vectorSource_stochastic,HOST); vectorSource_stochastic.load(); } else{ std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; PLEGMA_printf("Read stochastic source from: %s\n",inputfilename.c_str()); - PLEGMA_Vector vectorRead(BOTH); + PLEGMA_Vector vectorRead(BOTH); vectorRead.readFile(inputfilename,LIME_FORMAT); stochastic_sources[i]->copy(vectorRead,HOST); inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; From 57b36a24aae9aa2f5fdc84ce412e49c0a7a6f676 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 21 Jan 2025 13:47:35 +0100 Subject: [PATCH 135/168] reworking a bit the multi-rhs approach, defining a solver for PLEGMA_Propagator and PLEGMA_Vector separately and including the gaussian smearing for PLEGMA_Propagators from Simone --- include/PLEGMA_Propagator.h | 15 +++++ include/PLEGMA_Vector.h | 8 +-- include/utils/QUDA_interface.h | 14 ++--- lib/PLEGMA_Propagator.cu | 96 +++++++++++++++++++++++++++++ lib/PLEGMA_Vector.cu | 20 +++--- utils/QUDA_interface.cpp | 107 ++++++++++++++++++--------------- 6 files changed, 192 insertions(+), 68 deletions(-) diff --git a/include/PLEGMA_Propagator.h b/include/PLEGMA_Propagator.h index 0da42c9a..c7a9c582 100644 --- a/include/PLEGMA_Propagator.h +++ b/include/PLEGMA_Propagator.h @@ -17,6 +17,10 @@ namespace plegma { public: PLEGMA_Propagator(ALLOCATION_FLAG alloc_flag=BOTH, GHOST_FLAG ghost_flag=FIRST_SIDE); ~PLEGMA_Propagator(){;} + + void copyToQUDA( std::vector& cudaVector, bool isEv = false); + void copyFromQUDA( std::vector& cudaVector, bool isEv = false); + void apply_gamma(GAMMAS gMat, LEFTRIGHT LR = LEFT); void apply_gamma5(); @@ -54,6 +58,17 @@ namespace plegma { **/ void absorb(PLEGMA_Vector3D &vec, int global_it, int nu, int c2); +/** + @brief Applies N times Gaussian(Wuppertal) smearing operator on all time-slices of a vector. NOTE: works also for Vector3D + @param PLEGMA_Vector &vecIn, The 4D input vector (Exchange of boundaries happens inside the function) + @param PLEGMA_Gauge &gauge, The gauge field that will be used in the Gaussian smearing operator (Exchange of boundaries happens inside the function) + @param int nsmearGauss, The number of times to apply the operator (if zero copies inVec to outVec) + @param Float alphaGauss, alpha parameter of the Gaussian smearing + **/ + + void gaussianSmearing(PLEGMA_Propagator &propIn, PLEGMA_Gauge &gauge, int nsmearGauss, Float alphaGauss); + + /** @brief packing the sinktime slice in all other time slices @param the initial propagator to be broadcasted diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index 3d1a6768..30e6441e 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -25,8 +25,8 @@ namespace plegma { PLEGMA_Vector(ALLOCATION_FLAG alloc_flag=BOTH, GHOST_FLAG ghost_flag=FIRST_SIDE); ~PLEGMA_Vector(){;} - void copyToQUDA( std::vector& cudaVector, int src, bool isEv = false); - void copyFromQUDA( std::vector& cudaVector, int src, bool isEv = false); + void copyToQUDA( std::vector& cudaVector, bool isEv = false); + void copyFromQUDA( std::vector& cudaVector, bool isEv = false); /** @brief Applies N times Gaussian(Wuppertal) smearing operator on all time-slices of a vector. NOTE: works also for Vector3D @@ -105,8 +105,8 @@ namespace plegma { }; - template void copyToQUDA(std::vector& cudaVector, Float* delem, int src, bool isEv = false); // delem is a device pointer - template void copyFromQUDA(Float* delem, std::vector& cudaVector, int src, bool isEv = false); + template void copyToQUDA(std::vector& cudaVector, Float* delem, bool isEv = false); // delem is a device pointer + template void copyFromQUDA(Float* delem, std::vector& cudaVector, bool isEv = false); ///////////////////////////////////// // CLASS: PLEGMA_Vector3D /////////// diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index b441b330..be98e572 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -29,12 +29,12 @@ namespace quda { QUDA_solver(double mu, int nsrc); virtual ~QUDA_solver(); std::vector solve(std::vector& rhs); - template - std::vector solve(std::vector> &vectorIn); - template - void solve(std::vector> &out, std::vector> &in); - template - void runOneIter(std::vector> &out, std::vector> &in); + template + std::vector solve(typename std::conditional, PLEGMA_Propagator>::type &vectorIn); + template + void solve(typename std::conditional, PLEGMA_Propagator>::type &out, typename std::conditional, PLEGMA_Propagator>::type &in); + template + void runOneIter(typename std::conditional, PLEGMA_Propagator>::type &out, typename std::conditional, PLEGMA_Propagator>::type &in); }; enum APP_TYPE {M,Mdag,MdagM,MMdag}; @@ -52,7 +52,7 @@ namespace quda { void print(){dParam.print();} void switchMu(double mu); void switchKappa(double kappa); - template void apply(std::vector> &out, std::vector> &in, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default it is without any normalization + template void apply(typename std::conditional, PLEGMA_Propagator>::type &out, typename std::conditional, PLEGMA_Propagator>::type &in, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default it is without any normalization template void apply(Float *dout, Float *din, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default is without any normalization // Note that dout and din are device pointers }; } diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index f7cdfa69..3b401557 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -11,6 +11,82 @@ template PLEGMA_Propagator::PLEGMA_Propagator(ALLOCATION_FLAG alloc_flag, GHOST_FLAG ghost_flag): PLEGMA_Field(alloc_flag, PROPAGATOR, ghost_flag){;} + + +template +void PLEGMA_Propagator::gaussianSmearing(PLEGMA_Propagator &propIn, + PLEGMA_Gauge &gauge, + int nsmearGauss, Float alphaGauss){ + std::vector runtime; + double start=0, finish=0, core=0, ghost=0; +#define TIME(add,fnc) runtime.push_back(MPI_Wtime()); fnc; \ + add += MPI_Wtime()-runtime.back(); \ + runtime.pop_back() + + if(propIn.IsAllocHost()) { + propIn.unload(); // backing up the propIn + } else { + PLEGMA_warning("PropIn is not allocated on BOTH; gaussianSmearing will overwrite the device memory.\n"); + } + + assert(this->checkVolume(propIn, gauge)); + auto texGauge = toTexture(gauge); + auto texPropIn = toTexture(propIn); + auto texPropOut = toTexture(*this); + + for(int i = 0 ; i < nsmearGauss ; i++){ + if( (i%2) == 0){ + TIME(start, + for(int dir=0; dircommunicateSideGhost(dir, DIR_BOTH, START); + }); + TIME(core, + gaussian_smearing_prop_no_ghost(*texPropIn, *texPropOut, *texGauge, alphaGauss)); + TIME(finish, + for(int dir=0; dircommunicateSideGhost(dir, DIR_BOTH, FINISH); + }); + TIME(ghost, + gaussian_smearing_prop_only_ghost(*texPropIn, *texPropOut, *texGauge, alphaGauss); + cudaDeviceSynchronize()); + } + } + PLEGMA_printf("### GAUSSIAN SMEARING breakdown: comm-start %.2f, comm-finish %.2f, calc-core %.2f, calc-ghost %.2f\n", start, finish, core, ghost); + if( (nsmearGauss%2) == 0) + cudaMemcpy(this->D_elem(),propIn.D_elem(), + this->Bytes_total(),cudaMemcpyDeviceToDevice); + + checkCudaError(); + + if(propIn.IsAllocHost()) { + propIn.load(); // restoring propIn + } +} + + template void PLEGMA_Propagator:: absorbVectorToHost(PLEGMA_Vector &vec, int nu, int c2){ @@ -259,6 +335,26 @@ void PLEGMA_Propagator::PropmulVVdag(PLEGMA_Vector &vec1,PLEGMA_Ve prop_mul_V_Vdag(toField2(*this), *vectex1, *vectex2); checkQudaError(); } + +template +void PLEGMA_Propagator::copyToQUDA(std::vector &qudaVector, bool isEv){ + + for (int isc=0; isc<12; ++isc){ + PLEGMA_Vector temporary; + temporary.absorb(this, isc/3, isc%3); + copy_to_QUDA(temporary->d_elem, (qudaVector), isc, isEv); + } +} + +template +void PLEGMA_Propagator::copyFromQUDA( std::vector &qudaVector, bool isEv){ + for (int isc=0; isc<12; ++isc){ + PLEGMA_Vector temporary; + copy_from_QUDA(temporary, (qudaVector), isc, isEv); + this->absorb(temporary, isc/3, isc%3); + } +} + //----------------------------------// diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 1cbb1492..35753ef2 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -82,13 +82,13 @@ void PLEGMA_Vector::gaussianSmearing(PLEGMA_Vector &vecIn, template -void PLEGMA_Vector::copyToQUDA(std::vector& qudaVector, int src, bool isEv){ - copy_to_QUDA(this->d_elem, (qudaVector), src, isEv); +void PLEGMA_Vector::copyToQUDA(std::vector &qudaVector, bool isEv){ + copy_to_QUDA(this->d_elem, (qudaVector), 0, isEv); } template -void PLEGMA_Vector::copyFromQUDA( std::vector& qudaVector, int src, bool isEv){ - copy_from_QUDA(this->d_elem, (qudaVector), src, isEv); +void PLEGMA_Vector::copyFromQUDA( std::vector &qudaVector, bool isEv){ + copy_from_QUDA(this->d_elem, (qudaVector), 0, isEv); } template @@ -463,15 +463,15 @@ template class PLEGMA_Vector; namespace plegma{ template - void copyToQUDA(std::vector& qudaVector, Float* delem, int src, bool isEv){ - copy_to_QUDA(delem, qudaVector, src, isEv); + void copyToQUDA(std::vector& qudaVector, Float* delem, bool isEv){ + copy_to_QUDA(delem, qudaVector, isEv); } - template void copyToQUDA(std::vector&qudaVector, float* delem, int src, bool isEv); - template void copyToQUDA(std::vector&qudaVector, double* delem, int src, bool isEv); + template void copyToQUDA(std::vector&qudaVector, float* delem, bool isEv); + template void copyToQUDA(std::vector&qudaVector, double* delem, bool isEv); template - void copyFromQUDA(Float* delem, std::vector&qudaVector, int src, bool isEv){ - copy_from_QUDA(delem, qudaVector, src, isEv); + void copyFromQUDA(Float* delem, std::vector&qudaVector, bool isEv){ + copy_from_QUDA(delem, qudaVector, isEv); } template void copyFromQUDA(float* delem, std::vector& qudaVector, int src, bool isEv); diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index c4d373b5..097a89fe 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -401,52 +401,56 @@ std::vector QUDA_solver::solve(std::vector& } -template -std::vector QUDA_solver::solve(std::vector> &vectorIn){ +template +std::vector QUDA_solver::solve(typename std::conditional, PLEGMA_Propagator>::type &vectorIn){ bool flag_eo=false; if( inv_param.matpc_type == QUDA_MATPC_EVEN_EVEN ) flag_eo = true; - for (int i=0; i -void QUDA_solver::solve(std::vector> &vectorOut, std::vector> &vectorIn){ +template +void QUDA_solver::solve(typename std::conditional, PLEGMA_Propagator>::type &vectorOut, + typename std::conditional, PLEGMA_Propagator>::type &vectorIn){ bool flag_eo = false; if( inv_param.matpc_type == QUDA_MATPC_EVEN_EVEN ) flag_eo = true; - x = solve(vectorIn); - for (int i=0; i(vectorIn); + vectorOut.copyFromQUDA( x, flag_eo); if (inv_param.mass_normalization == QUDA_MASS_NORMALIZATION || inv_param.mass_normalization == QUDA_ASYMMETRIC_MASS_NORMALIZATION) { - for (int i=0; i> &vectorOut, std::vector> &vectorIn); -template void QUDA_solver::solve(std::vector> &vectorOut, std::vector> &vectorIn); +template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::solve(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); +template void QUDA_solver::solve(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); + +template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); -template std::vector QUDA_solver::solve(std::vector> &vectorIn); -template std::vector QUDA_solver::solve(std::vector> &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Propagator &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Propagator &vectorIn); -template -void QUDA_solver::runOneIter(std::vector> &vectorOut, std::vector> &vectorIn){ +template +void QUDA_solver::runOneIter(typename std::conditional, PLEGMA_Propagator>::type &vectorOut, + typename std::conditional, PLEGMA_Propagator>::type &vectorIn){ int maxiter = solverParam->maxiter; solverParam->maxiter = 1; - solve(vectorOut, vectorIn); + solve(vectorOut, vectorIn); solverParam->maxiter = maxiter; } -template void QUDA_solver::runOneIter(std::vector> &vectorOut, std::vector> &vectorIn); -template void QUDA_solver::runOneIter(std::vector> &vectorOut,std::vector>&vectorIn); +template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::runOneIter(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); +template void QUDA_solver::runOneIter(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); //######################### Quda Dirac operator class ################################ @@ -494,40 +498,49 @@ template void QUDA_dirac::apply(){ } } -template -void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType){ - for (int i=0; i +void QUDA_dirac::apply(typename std::conditional, PLEGMA_Propagator>::type &Pout, + typename std::conditional, PLEGMA_Propagator>::type &Pin, + QudaMassNormalization normType){ + Pin.copyToQUDA(in); apply(); - for (int i=0; i(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(std::vector> &Pout, std::vector> &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(std::vector> &Pout, std::vector>&Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); + +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); + +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); + +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); + -template +template void QUDA_dirac::apply(Float *dout, Float *din, QudaMassNormalization normType){ - for (int i=0; i(); - for (int i=0; i(inv_param.num_src*N_SPINS*N_COLS*HGC_localVolume, (Float) (1./(2*inv_param.kappa)), dout); + cuBLAS::scal(N_SPINS*N_COLS*HGC_localVolume, (Float) (1./(2*inv_param.kappa)), dout); } template void QUDA_dirac::apply(float *dout, float *din, QudaMassNormalization normType); From 44ea5418d019137b8582f164ca76ec8bce3f11ca Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 23 Jan 2025 11:47:45 +0100 Subject: [PATCH 136/168] working on the multiple right hand side implementation --- include/PLEGMA_Propagator.h | 5 +- include/PLEGMA_Vector.h | 2 + lib/PLEGMA_Propagator.cu | 15 ++- lib/PLEGMA_Vector.cu | 22 ++- lib/kernels/PLEGMA_gaussian_smearing.cuh | 165 ++++++++++++++++++++++- lib/kernels/PLEGMA_kernel_utils.cuh | 64 +++++++++ 6 files changed, 258 insertions(+), 15 deletions(-) diff --git a/include/PLEGMA_Propagator.h b/include/PLEGMA_Propagator.h index c7a9c582..b7ca3622 100644 --- a/include/PLEGMA_Propagator.h +++ b/include/PLEGMA_Propagator.h @@ -1,4 +1,5 @@ #include +#include #ifndef _PLEGMA_PROPAGATOR_H #define _PLEGMA_PROPAGATOR_H @@ -18,8 +19,8 @@ namespace plegma { PLEGMA_Propagator(ALLOCATION_FLAG alloc_flag=BOTH, GHOST_FLAG ghost_flag=FIRST_SIDE); ~PLEGMA_Propagator(){;} - void copyToQUDA( std::vector& cudaVector, bool isEv = false); - void copyFromQUDA( std::vector& cudaVector, bool isEv = false); + void copyToQUDA( std::vector& cudaVector, bool isEv = false); + void copyFromQUDA( std::vector& cudaVector, bool isEv = false); void apply_gamma(GAMMAS gMat, LEFTRIGHT LR = LEFT); diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index 30e6441e..b8149783 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -67,6 +67,8 @@ namespace plegma { @return void **/ void absorb(PLEGMA_Propagator &prop, int nu , int c2); + + void absorb(PLEGMA_Propagator *prop, int nu , int c2); void dilutespin(PLEGMA_Vector &vecIn, int spin); diff --git a/lib/PLEGMA_Propagator.cu b/lib/PLEGMA_Propagator.cu index 3b401557..e9058464 100644 --- a/lib/PLEGMA_Propagator.cu +++ b/lib/PLEGMA_Propagator.cu @@ -1,8 +1,13 @@ #include #include #include +#include +#include + using namespace plegma; +using namespace quda; + //-------------------------------// // class PLEGMA_Propagator // //-------------------------------// @@ -79,7 +84,7 @@ void PLEGMA_Propagator::gaussianSmearing(PLEGMA_Propagator &propIn cudaMemcpy(this->D_elem(),propIn.D_elem(), this->Bytes_total(),cudaMemcpyDeviceToDevice); - checkCudaError(); + //checkCudaError(); if(propIn.IsAllocHost()) { propIn.load(); // restoring propIn @@ -337,20 +342,20 @@ void PLEGMA_Propagator::PropmulVVdag(PLEGMA_Vector &vec1,PLEGMA_Ve } template -void PLEGMA_Propagator::copyToQUDA(std::vector &qudaVector, bool isEv){ +void PLEGMA_Propagator::copyToQUDA(std::vector &qudaVector, bool isEv){ for (int isc=0; isc<12; ++isc){ PLEGMA_Vector temporary; temporary.absorb(this, isc/3, isc%3); - copy_to_QUDA(temporary->d_elem, (qudaVector), isc, isEv); + copy_to_QUDA(temporary.D_elem(), (qudaVector), isc, isEv); } } template -void PLEGMA_Propagator::copyFromQUDA( std::vector &qudaVector, bool isEv){ +void PLEGMA_Propagator::copyFromQUDA( std::vector &qudaVector, bool isEv){ for (int isc=0; isc<12; ++isc){ PLEGMA_Vector temporary; - copy_from_QUDA(temporary, (qudaVector), isc, isEv); + copy_from_QUDA(temporary.D_elem(), (qudaVector), isc, isEv); this->absorb(temporary, isc/3, isc%3); } } diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 35753ef2..ae429d76 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -199,6 +199,20 @@ void PLEGMA_Vector::absorb(PLEGMA_Propagator &prop, int nu , int c } checkQudaError(); } +template +void PLEGMA_Vector::absorb(PLEGMA_Propagator *prop, int nu , int c2){ + Float *pointer_src = NULL; + Float *pointer_dst = NULL; + int V4 = HGC_localVolume; + for(int mu = 0 ; mu < N_SPINS ; mu++) + for(int c1 = 0 ; c1 < N_COLS ; c1++){ + pointer_dst = (this->d_elem + mu*N_COLS*V4*2 + c1*V4*2); + pointer_src = (prop->D_elem() + mu*N_SPINS*N_COLS*N_COLS*V4*2 + nu*N_COLS*N_COLS*V4*2 + c1*N_COLS*V4*2 + c2*V4*2); + qudaMemcpy(pointer_dst, pointer_src, V4*2 * sizeof(Float), qudaMemcpyDeviceToDevice); + } + checkQudaError(); +} + template void PLEGMA_Vector::dilutespin(PLEGMA_Vector &vecIn, int spin){ @@ -464,18 +478,18 @@ namespace plegma{ template void copyToQUDA(std::vector& qudaVector, Float* delem, bool isEv){ - copy_to_QUDA(delem, qudaVector, isEv); + copy_to_QUDA(delem, qudaVector, 0, isEv); } template void copyToQUDA(std::vector&qudaVector, float* delem, bool isEv); template void copyToQUDA(std::vector&qudaVector, double* delem, bool isEv); template void copyFromQUDA(Float* delem, std::vector&qudaVector, bool isEv){ - copy_from_QUDA(delem, qudaVector, isEv); + copy_from_QUDA(delem, qudaVector, 0, isEv); } - template void copyFromQUDA(float* delem, std::vector& qudaVector, int src, bool isEv); - template void copyFromQUDA(double* delem, std::vector& qudaVector, int src, bool isEv); + template void copyFromQUDA(float* delem, std::vector& qudaVector, bool isEv); + template void copyFromQUDA(double* delem, std::vector& qudaVector, bool isEv); //----------------------------------// // class PLEGMA_Vector3D // diff --git a/lib/kernels/PLEGMA_gaussian_smearing.cuh b/lib/kernels/PLEGMA_gaussian_smearing.cuh index 30c4c2eb..16a29c9c 100644 --- a/lib/kernels/PLEGMA_gaussian_smearing.cuh +++ b/lib/kernels/PLEGMA_gaussian_smearing.cuh @@ -48,7 +48,7 @@ template __global__ void gaussian_smearing_only_ghost_kernel(vectorTexout, vectorTex vecInTex, gaugeTex gaugeTex, - FloatOut alpha, short dir){ + FloatOut alpha, short dir, bool tuning=0){ size_t sid = blockIdx.x*blockDim.x + threadIdx.x; if (sid >= 2*out.sideGhostL(dir)) return; @@ -90,7 +90,7 @@ __global__ void gaussian_smearing_only_ghost_kernel(vectorTexout, } } - FloatOut normalize = alpha/(1 + 6 * alpha); + FloatOut normalize = tuning ? 0 : (alpha/(1 + 6 * alpha)); out.setSid(sid); if(isNotZeroV(tmp)) { @@ -125,8 +125,165 @@ static void gaussian_smearing_only_ghost(vectorTex& out, vectorTex, - out, vecInTex, gaugeTex, alpha, dir); + auto kernel = tuner(ps, "gaussian_smearing_only_ghost_kernel", gaussian_smearing_only_ghost_kernel, + out, vecInTex, gaugeTex, alpha, dir, 0); + if(not kernel->tuned()) { + tune(ps, "gaussian_smearing_only_ghost_kernel", gaussian_smearing_only_ghost_kernel, + out, vecInTex, gaugeTex, alpha, dir, 1); + } + if(not kernel->tuned()) { + PLEGMA_warning("ISSUE: Tuning again???!!!!"); + } + kernel->apply(); + delete kernel; + } + } +} + +template +__global__ void gaussian_smearing_prop_kernel(propTexout, + propTex propInTex, + gaugeTex gaugeTex, + FloatOut alpha){ + int sid = blockIdx.x*blockDim.x + threadIdx.x; + if (sid >= out.volume()) return; + + Float2 G[N_COLS][N_COLS]; + Float2 S[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 tmp[N_SPINS][N_SPINS][N_COLS][N_COLS]; + + #pragma unroll + for(int mu=0; mu N_DIMS-1 + #pragma unroll + for(int dir = 0; dir < N_DIMS-1; dir++) { + propInTex.get(S, sid, dir); + gaugeTex.get(G, dir, sid); + mul_G(tmp,G,S); + propInTex.get(S, sid, dir); + gaugeTex.get(G, dir, sid, dir); + mul_Gdag(tmp,G,S); + } + + FloatOut normalize = 1/(1 + 6 * alpha); + + out.setSid(sid); + propInTex.get(S,sid); + + #pragma unroll + for(int mu=0; mu +__global__ void gaussian_smearing_prop_only_ghost_kernel(propTexout, + propTex propInTex, + gaugeTex gaugeTex, + FloatOut alpha, short dir, bool tuning=0){ + size_t sid = blockIdx.x*blockDim.x + threadIdx.x; + if (sid >= 2*out.sideGhostL(dir)) return; + + ORIENTATION sign = sid>=out.sideGhostL(dir) ? DIR_MINUS : DIR_PLUS; + size_t id[4]; + sid = sid % out.sideGhostL(dir); + #pragma unroll + for(int i = 0 ; i G[N_COLS][N_COLS]; + Float2 S[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 tmp[N_SPINS][N_SPINS][N_COLS][N_COLS]; + + #pragma unroll + for(int mu=0; mu(S, sid, dir); + gaugeTex.get(G, dir, sid); + mul_G(tmp,G,S); + } else { + propInTex.get(S, sid, dir); + gaugeTex.get(G, dir, sid, dir); + mul_Gdag(tmp,G,S); + } + + FloatOut normalize = tuning ? 0:(alpha/(1 + 6 * alpha)); + + out.setSid(sid); + + #pragma unroll + for(int mu=0; mu +static void gaussian_smearing_prop(propTex& out, propTex& propInTex, + gaugeTex& gaugeTex, FloatOut alpha){ + ProfileStruct ps(out.volume()); + tuneAndRun(ps, "gaussian_smearing_prop_kernel", gaussian_smearing_prop_kernel, + out, propInTex, gaugeTex, alpha); +} + +template +static void gaussian_smearing_prop_no_ghost(propTex& out, propTex& propInTex, + gaugeTex& gaugeTex, FloatOut alpha){ + ProfileStruct ps(out.volume()); + tuneAndRun(ps, "gaussian_smearing_prop_no_ghost_kernel", gaussian_smearing_prop_kernel, + out, propInTex, gaugeTex, alpha); +} + +template +static void gaussian_smearing_prop_only_ghost(propTex& out, propTex& propInTex, + gaugeTex& gaugeTex, FloatOut alpha){ + for(int dir = 0; dir < N_DIMS-1; dir++) { + if(HGC_dimBreak[dir]) { + ProfileStruct ps(out.sideGhostL(dir)*2); + auto kernel = tuner(ps, "gaussian_smearing_prop_only_ghost_kernel", gaussian_smearing_prop_only_ghost_kernel, + out, propInTex, gaugeTex, alpha, dir, 0); + if(not kernel->tuned()) { + tune(ps, "gaussian_smearing_prop_only_ghost_kernel", gaussian_smearing_prop_only_ghost_kernel, + out, propInTex, gaugeTex, alpha, dir, 1); + } + if(not kernel->tuned()) { + PLEGMA_warning("ISSUE: Tuning again???!!!!"); + } + kernel->apply(); + delete kernel; } } } diff --git a/lib/kernels/PLEGMA_kernel_utils.cuh b/lib/kernels/PLEGMA_kernel_utils.cuh index eee39549..9f62b33b 100644 --- a/lib/kernels/PLEGMA_kernel_utils.cuh +++ b/lib/kernels/PLEGMA_kernel_utils.cuh @@ -368,6 +368,70 @@ namespace plegma { } return res; } + + template + __inline__ __device__ void mul_G(Float2 out[N_SPINS][N_SPINS][N_COLS][N_COLS], + Float2 G[N_COLS][N_COLS], + Float2 in[N_SPINS][N_SPINS][N_COLS][N_COLS]){ + if(accum==ACC_ZERO || accum == ZERO_PLUS || accum == ZERO_MINUS) + #pragma unroll + for(int mu=0; mu + __inline__ __device__ void mul_Gdag(Float2 out[N_SPINS][N_SPINS][N_COLS][N_COLS], + Float2 G[N_COLS][N_COLS], + Float2 in[N_SPINS][N_SPINS][N_COLS][N_COLS]){ + if(accum==ACC_ZERO || accum == ZERO_PLUS || accum == ZERO_MINUS) + #pragma unroll + for(int mu=0; mu __inline__ __device__ void mul_G_Gdag(Float2 a[N_COLS][N_COLS], Float2 b[N_COLS][N_COLS], Float2 c[N_COLS][N_COLS]){ From a3080afd19c906f6055674b9b62324abe297d796 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 4 Feb 2025 14:41:43 +0100 Subject: [PATCH 137/168] compiling multiple righthandside rewriting --- lib/kernels/PLEGMA_kernel_tuner.cuh | 5 +++++ utils/QUDA_interface.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/kernels/PLEGMA_kernel_tuner.cuh b/lib/kernels/PLEGMA_kernel_tuner.cuh index 420988b2..ff82174a 100644 --- a/lib/kernels/PLEGMA_kernel_tuner.cuh +++ b/lib/kernels/PLEGMA_kernel_tuner.cuh @@ -279,6 +279,11 @@ void PLEGMA_kernel_tuner::run(){ checkQudaError(); } +template +PLEGMA_kernel_tuner* tuner(ProfileStruct &ps, std::string kname, void (*kernel)(typesK...), types&&... kArgs){ + return new PLEGMA_kernel_tuner(ps, kname, kernel, kArgs...); +} + template void tune(ProfileStruct &ps, std::string kname, void (*kernel)(typesK...), types&&... kArgs){ PLEGMA_kernel_tuner tuner(ps, kname, kernel, kArgs...); diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index 097a89fe..8ad566c8 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -136,7 +136,7 @@ void plaqQuda() { } QUDA_solver::QUDA_solver(double mu, int nsrc) { - profiler = new TimeProfile(("Solver profiler mu="+to_string(mu)).c_str()); + profiler = new TimeProfile(("Solver profiler mu="+std::to_string(mu)).c_str()); profiler->TPSTART(QUDA_PROFILE_TOTAL); if(use_mg){ @@ -370,7 +370,7 @@ void QUDA_solver::UpdateSolver() solver = Solver::create(*solverParam, *M, *MSloppy, *MPre, *MPre ); - profiler->*get(Profiler_name()) = ((std::string)("Solver profiler mu=")+to_string(mu)).c_str(); + profiler->*get(Profiler_name()) = ((std::string)("Solver profiler mu=")+std::to_string(mu)).c_str(); profiler->TPSTOP(QUDA_PROFILE_TOTAL); profiler->Print(); profiler->TPRESET(); From cce7647fdbbc76266e0ee437be5925f54926b965 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 11 Feb 2025 09:41:55 +0100 Subject: [PATCH 138/168] working on multiple right hand side --- include/utils/QUDA_interface.h | 34 +++++++++++++ utils/QUDA_interface.cpp | 92 +++++++++++++++++++++++----------- 2 files changed, 98 insertions(+), 28 deletions(-) diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index be98e572..2a8678d2 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -29,6 +29,37 @@ namespace quda { QUDA_solver(double mu, int nsrc); virtual ~QUDA_solver(); std::vector solve(std::vector& rhs); + + template std::vector solve(PLEGMA_Vector &vectorIn); + template std::vector solve(PLEGMA_Propagator &vectorIn); + +/* + std::vector solve(PLEGMA_Vector &vectorIn); + std::vector solve(PLEGMA_Vector &vectorIn); + + std::vector solve(PLEGMA_Propagator &vectorIn); + std::vector solve(PLEGMA_Propagator &vectorIn);*/ + + + template void solve(PLEGMA_Propagator &out, PLEGMA_Propagator &in); + template void solve(PLEGMA_Vector &out, PLEGMA_Vector &in); +/* + void solve( PLEGMA_Vector &out, PLEGMA_Vector &in); + void solve( PLEGMA_Vector &out, PLEGMA_Vector &in); + + void solve( PLEGMA_Propagator &out, PLEGMA_Propagator &in); + void solve( PLEGMA_Propagator &out, PLEGMA_Propagator &in);*/ + + template void runOneIter( PLEGMA_Vector &out, PLEGMA_Vector &in); + template void runOneIter( PLEGMA_Propagator &out, PLEGMA_Propagator &in); + +/* + void runOneIter( PLEGMA_Vector &out, PLEGMA_Vector &in); + void runOneIter( PLEGMA_Vector &out, PLEGMA_Vector &in); + + void runOneIter( PLEGMA_Propagator &out, PLEGMA_Propagator &in); + void runOneIter( PLEGMA_Propagator &out, PLEGMA_Propagator &in);*/ + template std::vector solve(typename std::conditional, PLEGMA_Propagator>::type &vectorIn); template @@ -53,6 +84,9 @@ namespace quda { void switchMu(double mu); void switchKappa(double kappa); template void apply(typename std::conditional, PLEGMA_Propagator>::type &out, typename std::conditional, PLEGMA_Propagator>::type &in, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default it is without any normalization + template void apply(PLEGMA_Vector &out, PLEGMA_Vector &in, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default it is without any normalization + template void apply(PLEGMA_Propagator &out, PLEGMA_Propagator &in, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default it is without any normalization + template void apply(Float *dout, Float *din, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default is without any normalization // Note that dout and din are device pointers }; } diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index 8ad566c8..f654fbae 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -410,6 +410,16 @@ std::vector QUDA_solver::solve(typename std::conditional vectorIn.copyToQUDA(b, flag_eo); return solve(b); } +template +std::vector QUDA_solver::solve( PLEGMA_Vector &vectorIn){ + return solve(vectorIn); +} +template +std::vector QUDA_solver::solve( PLEGMA_Propagator &vectorIn){ + return solve(vectorIn); +} + + template void QUDA_solver::solve(typename std::conditional, PLEGMA_Propagator>::type &vectorOut, @@ -426,17 +436,24 @@ void QUDA_solver::solve(typename std::conditional } } +template void QUDA_solver::solve( PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn ){ + return solve(vectorOut, vectorIn); +} +template void QUDA_solver::solve( PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn ){ + return solve(vectorOut, vectorIn); +} -template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); -template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); -template void QUDA_solver::solve(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); -template void QUDA_solver::solve(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); -template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); -template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); +template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::solve(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::solve(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); +template void QUDA_solver::solve(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); -template std::vector QUDA_solver::solve(PLEGMA_Propagator &vectorIn); -template std::vector QUDA_solver::solve(PLEGMA_Propagator &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Vector &vectorIn); + +template std::vector QUDA_solver::solve(PLEGMA_Propagator &vectorIn); +template std::vector QUDA_solver::solve(PLEGMA_Propagator &vectorIn); template void QUDA_solver::runOneIter(typename std::conditional, PLEGMA_Propagator>::type &vectorOut, @@ -447,10 +464,22 @@ void QUDA_solver::runOneIter(typename std::conditionalmaxiter = maxiter; } -template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); -template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); -template void QUDA_solver::runOneIter(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); -template void QUDA_solver::runOneIter(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); +template +void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn){ + return runOneIter(vectorOut, vectorIn); +} + +template +void QUDA_solver::runOneIter(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn){ + return runOneIter(vectorOut, vectorIn); +} + + + +template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::runOneIter(PLEGMA_Vector &vectorOut, PLEGMA_Vector &vectorIn); +template void QUDA_solver::runOneIter(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); +template void QUDA_solver::runOneIter(PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn); //######################### Quda Dirac operator class ################################ @@ -509,26 +538,33 @@ void QUDA_dirac::apply(typename std::conditional, Pout.scale(1./(2*inv_param.kappa)); } } +templatevoid QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType){ + return apply( Pout, Pin, normType); +} +templatevoid QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType){ + return apply( Pout, Pin, normType); +} + -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); template From f0cd482b5536f65ec09b634d54da2e1fa05b33d3 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 11 Feb 2025 09:51:14 +0100 Subject: [PATCH 139/168] executable for computing 1/2 scattering length in the nucleon channel --- plegma/CMakeLists.txt | 4 + plegma/piN_scattering_length_12.cpp | 425 ++++++++++++++++++++++++++++ 2 files changed, 429 insertions(+) create mode 100644 plegma/piN_scattering_length_12.cpp diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 3bc3282e..283b9b75 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -157,6 +157,10 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) target_link_libraries(QuarkLoops_pi0_insertion ${PLEGMA_LIBS}) cuda_add_executable(testYan EXCLUDE_FROM_ALL testYan.cpp) target_link_libraries(testYan ${PLEGMA_LIBS}) + + cuda_add_executable(piN_scattering_length_12 EXCLUDE_FROM_ALL piN_scattering_length_12.cpp) + target_link_libraries(piN_scattering_length_12 ${PLEGMA_LIBS}) + endif(PLEGMA_SCATTERING_CONTRACTIONS) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp new file mode 100644 index 00000000..6e49c95b --- /dev/null +++ b/plegma/piN_scattering_length_12.cpp @@ -0,0 +1,425 @@ +#include +#include +#include +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) saveTuneCache(false); TIME(fnc) + +#define COMPUTEBACKWARD true + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss","momlist-filename","momlisttwopt-filename","momlistthreept-filename", + "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space", "tSinks","Projs", "threep-filename","confnumber", "nstochSamples"}; + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *attract_look_up_table){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + + +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_stochastic_samples, + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions_3pt( true, n_coherent_source, attract_look_up_table, source_sink_separation )); + TIME(source.normalize_nstoch(n_stochastic_samples)); + TIME(source.writeHDF5( outputFilename )); + +} + +void produceOutput( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true )); + TIME(source.writeHDF5( outputFilename )); +} + +void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *attract_look_up_table + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); + TIME(source.writeHDF5( outputFilename )); +} + + +void produceOutput_3pt( PLEGMA_ScattCorrelator source, + std::string outputFilename, + std::string diagram_name, + int n_coherent_source, + int *attract_look_up_table, + int source_sink_separation + ){ + TIME(source.apply_phase()); + TIME(source.apply_sign(diagram_name)); + TIME(source.applyBoundaryConditions_3pt( true,n_coherent_source, attract_look_up_table, source_sink_separation )); + TIME(source.writeHDF5( outputFilename )); +} + + +int main(int argc, char **argv) { + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + std::vector mu_s; + std::vector mu_c; + bool timedilution; + int rand_seed1=1234; + int rand_seed2=5678; + int confnumber_int; + std::string outfile_V=""; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i glist_source_nucleon={CG_5}; + std::vector glist_sink_nucleon={CG_5}; + + std::vector glist_source_meson={G_5}; + std::vector glist_sink_meson={G_5}; + + std::vector glist_source_nucleon_unpaired={ID}; + std::vector glist_sink_nucleon_unpaired={ID}; + + int n_stochastic_samples; + int max_source_sink_separations; + int dotwopoint; + int readstochastic; + //setVerbosity(QUDA_DEBUG_VERBOSE); + + HGC_options->set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + HGC_options->set("maxSourceSinkSeparations", "Maximal source sink separations", verbosity, max_source_sink_separations); + HGC_options->set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + HGC_options->set("nstochSamples", "Number of stochastic samples", verbosity, n_stochastic_samples); + HGC_options->set("seed1", "Seed for initialization of stochastic sources for the oet", verbosity, rand_seed1); + HGC_options->set("seed2", "Seed for intiialization of stochastic sources", verbosity, rand_seed2); + HGC_options->set("dotwopoint", "Doing also the twopoint functions", verbosity,dotwopoint); + HGC_options->set("readStochSamples", "Flag for switching read/building stochastic propagators", verbosity, readstochastic); + HGC_options->set("time-dilution", "Flag for switching time-dilution in stochastic propagators", verbosity, timedilution); + HGC_options->set("readStochSamples", "Flag for switching read/building stochastic propagators", verbosity, readstochastic); + + + + //=========================================================================================================// + initializePLEGMA(); + + + { + PLEGMA_Gauge smearedGauge(BOTH); + { + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + } + + updateOptions(LIGHT); + TIME(QUDA_solver solver_a(mu,1)); + + { + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, false); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + } + + updateOptions(LIGHT); + TIME(QUDA_solver solver_p(mu,1)); + + //Get the confnumber for latfile + char *ssource; + asprintf(&ssource,"%04d", confnumber_int); + std::string confnumber= ssource; + free(ssource); + + + std::string given_twop_filename = twop_filename; + + //Reading the momentum lists + momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); + //For the twopoint functions we have also three momentum + //first is pi2 + //second is pf1 + //third is pf2 + //and in this case the total momentum is defined as the sum of pf1 and pf2 + //to get pi1 we have to subtract pi2 from the total momentum + + + if(sourcemomentumList_twopt.empty()) + PLEGMA_error("twopt momentumList empty"); + + std::vector> mpi2_twopt = sourcemomentumList_twopt.uniq_p(0); + momList list_mpi2_twopt(1,{mpi2_twopt,},{0,}); + + std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); + momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); + + std::vector> mpf2_twopt = sourcemomentumList_twopt.uniq_p(2); + momList list_mpf2_twopt(1,{mpf2_twopt,},{0,}); + + + PLEGMA_Vector vectorSource_stochastic; + vectorSource_stochastic.randInit(rand_seed1); + + PLEGMA_Vector vectorStoc_source_oet; + vectorStoc_source_oet.randInit(rand_seed1); + + + //Computing with ubaru insertion + //Step (1) produce the stochastic sample + //Step (2) produce the stochastic propagators + //Step (3) produce standard point to all propagators + //Step (4) produce factors with point to all + //Step (5) produce sequential through the source with momenta pi2 + //Step (6) produce factors with the sequential + //Step (7) doing the recombination + //Step (8) doing the one end trick calculation for the Z diagrams + + std::vector*> stochastic_sources; + + std::vector*> stochastic_propagator_ppa; + std::vector*> stochastic_propagator_pma; + + for(int i=0; i< n_stochastic_samples; ++i) { + stochastic_sources.push_back(new PLEGMA_Vector(HOST)); + stochastic_propagator_ppa.push_back(new PLEGMA_Vector(HOST)); + stochastic_propagator_pma.push_back(new PLEGMA_Vector(HOST)); + } + + + + PLEGMA_Vector stochastic_oet_prop_zero_mom_p; + PLEGMA_Vector stochastic_oet_prop_zero_mom_a; + + + PLEGMA_Vector stochastic_oet_prop_fini_mom_a; + PLEGMA_Vector stochastic_oet_prop_fini_mom_p; + + if (readstochastic==0){ + + PLEGMA_Vector vectorAuxD1(BOTH);//For storing the source (rotated and smeared) + PLEGMA_Vector vectorAuxD2_ppa(BOTH);//For storing the propagotor for the time-slices + PLEGMA_Vector vectorAuxD2_pma(BOTH);//For storing the propagotor for the time-slices + PLEGMA_Vector vectorInOut_a; //temporary vector using in solve + PLEGMA_Vector vectorInOut_p; //temporary vector using in solve + PLEGMA_Vector vectorTmp; //temporary vector using in solve + + PLEGMA_Vector vectorSource(BOTH);//For storing the source + vectorSource.randInit(rand_seed2); + + for (int i=0; i vectorAuxF; + vectorAuxF.copy(vectorSource); + vectorAuxF.unload(); + vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); + } + + + vectorSource.unload(); + stochastic_sources[i]->copy(vectorSource,HOST); + vectorSource.load(); + + vectorAuxD1.copy(vectorSource); + + //Step(3) Smearing all the time slice + TIME(vectorTmp.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(4) We rotate the source to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorTmp,+1)); + + //In vectorAuxD2 we store the results for the inversion + + vectorAuxD2_ppa.scale(0.0); + vectorAuxD2_pma.scale(0.0); + + if (timedilution){ + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(5) pick out a particular timeslice from the source + vectorInOut_a.absorbTimeslice(vectorAuxD1, timeidx); + //Step(6) Solve + solver_a.solve(vectorInOut_a, vectorInOut_a); + + //Step(7) pick out a particular timeslice from the source + vectorInOut_p.absorbTimeslice(vectorAuxD1, timeidx); + //Step(8) Solve + solver_p.solve(vectorInOut_p, vectorInOut_p); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,1); + + //Step(7) absorbing the particular timeslice to a 4d vector + vectorAuxD2_ppa.absorbTimeslice(vectorTmp, timeidx, false); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,-1); + + //Step(7) absorbing the particular timeslice to a 4d vector + vectorAuxD2_pma.absorbTimeslice(vectorTmp, timeidx, false); + + } + } + else{ + PLEGMA_printf("#piN_scattering_length_12: No time dilution is used n stochastic propagators\n"); + vectorInOut_a.copy(vectorAuxD1); + solver_a.solve(vectorInOut_a, vectorInOut_a); + + vectorInOut_p.copy(vectorAuxD1); + solver_p.solve(vectorInOut_p, vectorInOut_p); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,1); + + vectorAuxD2_ppa.copy(vectorTmp); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,-1); + + vectorAuxD2_pma.copy(vectorTmp); + + } + + //Step(6) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2_ppa,+1)); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD2_ppa.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(8) Save the propagator to the disk + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD2_ppa); + vectorAuxF.unload(); + vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber); + } + + //Step(9) Save the propagator to the host memory + vectorAuxD2_ppa.unload(); + stochastic_propagator_ppa[i]->copy(vectorAuxD2_ppa,HOST); + vectorAuxD2_ppa.load(); + + //Step(10) We rotate back the propagator to the physical basis + TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2_pma,+1)); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD2_pma.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + + //Step(8) Save the propagator to the disk + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD2_pma); + vectorAuxF.unload(); + vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber); + } + + //Step(9) Save the propagator to the host memory + vectorAuxD2_pma.unload(); + stochastic_propagator_pma[i]->copy(vectorAuxD2_pma,HOST); + vectorAuxD2_pma.load(); + + + } //loop over the stochastic samples + + } + else{ + for (int i=0; i vectorRead(BOTH); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_sources[i]->copy(vectorRead,HOST); + inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_ppa[i]->copy(vectorRead,HOST); + inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_pma[i]->copy(vectorRead,HOST); + + } + } + + for(int i=0; i< n_stochastic_samples; ++i) { + stochastic_sources.pop_back(); + stochastic_propagator_ppa.pop_back(); + stochastic_propagator_pma.pop_back(); + } + + + + + }//loop in finalize + finalize(); + return 0; +} From 3b2a02e2d255ea72f0048ef53a16ae5299cb195d Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 11 Feb 2025 16:44:55 +0100 Subject: [PATCH 140/168] packing from P+A and P-A propagators --- include/PLEGMA_Vector.h | 1 + lib/PLEGMA_Vector.cu | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index b8149783..2f6782e2 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -98,6 +98,7 @@ namespace plegma { void rotate_uk_ch_etmc(); void covD(PLEGMA_Vector &vecIn, PLEGMA_Gauge &gauge, int dirOr); void mulGV(PLEGMA_Vector &vecIn, PLEGMA_Su3field &u); + void pack_propagator(PLEGMA_Vector &in_ppa, PLEGMA_Vector &in_pma, int t0, int deltat, bool initialize=true); void pack_fermion_to_sink(std::vector*> &stochastic_vector, int sinktime); void pack_propagator_from_source_to_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize); diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index ae429d76..6a0045f5 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -296,6 +296,31 @@ void PLEGMA_Vector::pack_fermion_to_sink(std::vector } +template::pack_propagator(PLEGMA_Vector &in_ppa, PLEGMA_Vector &in_pma, int t0, int deltat, bool initialize){ + PLEGMA_Vector stmp; + if (initialize==true){ + stmp.zero_where(DEVICE); + stmp.zero_where(HOST); + } + else{ + stmp.copy(*this); + } + + for ( int dt_tmp=-deltat+1; dt_tmp=0) && (t1copy(stmp); +} template void PLEGMA_Vector::pack_propagator_as_sink(PLEGMA_Vector &in, int sinktimeslice, int source_sink_separation, bool initialize){ From d5c4800c4606a070405139fa1f4368d06233d58e Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 13 Feb 2025 15:40:34 +0100 Subject: [PATCH 141/168] correcting absorb routine for p+a and p-a boundary conditions --- lib/PLEGMA_Vector.cu | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index 6a0045f5..f26e7a17 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -296,7 +296,8 @@ void PLEGMA_Vector::pack_fermion_to_sink(std::vector } -template::pack_propagator(PLEGMA_Vector &in_ppa, PLEGMA_Vector &in_pma, int t0, int deltat, bool initialize){ +template +void PLEGMA_Vector::pack_propagator(PLEGMA_Vector &in_ppa, PLEGMA_Vector &in_pma, int t0, int deltat, bool initialize){ PLEGMA_Vector stmp; if (initialize==true){ stmp.zero_where(DEVICE); @@ -311,12 +312,12 @@ template::pack_propagator(PLEGMA_Vector &in_ppa, PLEGMA_V if ((t1>=0) && (t1copy(stmp); From 05d78a2c70eaece02b9c269f5dfe7802e73ff5bf Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 13 Feb 2025 15:42:23 +0100 Subject: [PATCH 142/168] performing HEX smearing on the gauge field --- include/utils/QUDA_interface.h | 3 +++ utils/QUDA_interface.cpp | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index 2a8678d2..775b0865 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -33,6 +33,9 @@ namespace quda { template std::vector solve(PLEGMA_Vector &vectorIn); template std::vector solve(PLEGMA_Propagator &vectorIn); + template void gSmear_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge &gaugeIn, bool antiperiodic); + + /* std::vector solve(PLEGMA_Vector &vectorIn); std::vector solve(PLEGMA_Vector &vectorIn); diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index f654fbae..9d4fe8b4 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -90,6 +90,52 @@ void gFixingLandauOVR_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge & gaugeOut.calculatePlaq(); } +void gSmear_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge &gaugeIn, bool antiperiodic){ + + updateGaugeQuda(gaugeIn, antiperiodic); + + QudaGaugeParam gauge_param = newQudaGaugeParam(); + setGaugeParam(gauge_param); + gauge_param.type = QUDA_WILSON_LINKS; + gauge_param.make_resident_gauge = 0; + + double* new_gauge[N_DIMS]; + for(int i=0; i &gauge, bool antiperiodic, QudaLinkType type) { QudaGaugeParam gauge_param = newQudaGaugeParam(); setGaugeParam(gauge_param); From 583e5af66af6740f8d86045db7e11c6205fe2b00 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Sat, 15 Feb 2025 15:20:34 +0100 Subject: [PATCH 143/168] returning error when Propagator solve is called with num_src != 12 --- include/PLEGMA_utils.h | 28 ++++++++++++++++++++++++++++ include/utils/QUDA_interface.h | 29 ++++++----------------------- utils/QUDA_interface.cpp | 1 + 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/include/PLEGMA_utils.h b/include/PLEGMA_utils.h index b4abaf18..f8eb94bd 100644 --- a/include/PLEGMA_utils.h +++ b/include/PLEGMA_utils.h @@ -14,6 +14,32 @@ using namespace plegma; + /** + @brief Helper function for signalling that DD is not supported + @param[in] a Input field + @return true if all fields are supported + */ + template + inline bool Nrhs_(const char *func, const char *file, int line, const T1 &a_) + { + const unwrap_t &a(a_); + if (a->Nrhs() != 12) errorQuda("Propagator solve is not supported (%s:%d in %s())", file, line, func); + return true; + } + /** + @brief Helper function for signalling that DD is not supported + @param[in] a Input field + @param[in] args List of additional fields to check domain decomposition on + @return true if all fields match + */ + template + inline bool Nrhs_(const char *func, const char *file, int line, const T1 &a, const Args &...args) + { + // checking all possible pairs + return (Nrhs_(func, file, line, a) && Nrhs_(func, file, line, args...)); + } + #define assertNrhs(...) Nrhs_(__func__, __FILE__, __LINE__, __VA_ARGS__) + //============ QUDA_interface.cpp ===============================// void initComms(int argc, char **argv, const int *commDims); void finalizeComms(); @@ -23,6 +49,8 @@ void finalizeGaugeQuda(); void plaqQuda(); void gFixingLandauOVR_QUDA(PLEGMA_Gauge &gaugeOut, PLEGMA_Gauge &gaugeIn, int type, double overelaxPar=1.5, double tolerance=1e-12, int maxiter=10000,int verbosePerSteps=1, int reunit_interval=1, int stop_theta=0); +void gSmear_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge &gaugeIn, bool antiperiodic); + //============= QUDA_params.cpp ===================================// void infoQuda(); diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index 775b0865..df614267 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -14,7 +14,7 @@ namespace quda { void *mg_preconditioner; QudaInvertParam inv_param; QudaInvertParam mg_inv_param; - QudaMultigridParam mg_param; + QudaMultigridParam mg_param; Dirac *D, *DSloppy, *DPre; DiracMatrix *M, *MSloppy, *MPre; std::vector b, x; @@ -26,6 +26,11 @@ namespace quda { QudaInvertParam getInvParams() const{return inv_param;} SolverParam* getSolverParam() const{return solverParam;} void UpdateSolver(); + + + double Mu() const { return inv_param.mu;} + int Nrhs() const { return inv_param.num_src;} + QUDA_solver(double mu, int nsrc); virtual ~QUDA_solver(); std::vector solve(std::vector& rhs); @@ -33,35 +38,13 @@ namespace quda { template std::vector solve(PLEGMA_Vector &vectorIn); template std::vector solve(PLEGMA_Propagator &vectorIn); - template void gSmear_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge &gaugeIn, bool antiperiodic); - - -/* - std::vector solve(PLEGMA_Vector &vectorIn); - std::vector solve(PLEGMA_Vector &vectorIn); - - std::vector solve(PLEGMA_Propagator &vectorIn); - std::vector solve(PLEGMA_Propagator &vectorIn);*/ - template void solve(PLEGMA_Propagator &out, PLEGMA_Propagator &in); template void solve(PLEGMA_Vector &out, PLEGMA_Vector &in); -/* - void solve( PLEGMA_Vector &out, PLEGMA_Vector &in); - void solve( PLEGMA_Vector &out, PLEGMA_Vector &in); - - void solve( PLEGMA_Propagator &out, PLEGMA_Propagator &in); - void solve( PLEGMA_Propagator &out, PLEGMA_Propagator &in);*/ template void runOneIter( PLEGMA_Vector &out, PLEGMA_Vector &in); template void runOneIter( PLEGMA_Propagator &out, PLEGMA_Propagator &in); -/* - void runOneIter( PLEGMA_Vector &out, PLEGMA_Vector &in); - void runOneIter( PLEGMA_Vector &out, PLEGMA_Vector &in); - - void runOneIter( PLEGMA_Propagator &out, PLEGMA_Propagator &in); - void runOneIter( PLEGMA_Propagator &out, PLEGMA_Propagator &in);*/ template std::vector solve(typename std::conditional, PLEGMA_Propagator>::type &vectorIn); diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index 9d4fe8b4..a470a18f 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -486,6 +486,7 @@ template void QUDA_solver::solve( PLEGMA_Vector &vectorO return solve(vectorOut, vectorIn); } template void QUDA_solver::solve( PLEGMA_Propagator &vectorOut, PLEGMA_Propagator &vectorIn ){ + assertNrhs(this); return solve(vectorOut, vectorIn); } From 0ae05571cb220237ded4f73c4b5c9b0459cc6941 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 26 Feb 2025 13:21:18 +0100 Subject: [PATCH 144/168] implementing pion for p+a, p-a boundary conditions --- plegma/piN_scattering_length_12.cpp | 195 +++++++++++++++++++--------- 1 file changed, 134 insertions(+), 61 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 6e49c95b..479ce1aa 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -141,7 +141,6 @@ int main(int argc, char **argv) { HGC_options->set("dotwopoint", "Doing also the twopoint functions", verbosity,dotwopoint); HGC_options->set("readStochSamples", "Flag for switching read/building stochastic propagators", verbosity, readstochastic); HGC_options->set("time-dilution", "Flag for switching time-dilution in stochastic propagators", verbosity, timedilution); - HGC_options->set("readStochSamples", "Flag for switching read/building stochastic propagators", verbosity, readstochastic); @@ -151,42 +150,29 @@ int main(int argc, char **argv) { { PLEGMA_Gauge smearedGauge(BOTH); - { - // Reading from Lime file and loading to device - PLEGMA_Gauge gauge; - gauge.readFile(latfile, LIME_FORMAT); - gauge.calculatePlaq(); - // Loading to QUDA and computing plaquette also there - initGaugeQuda(gauge, true); - plaqQuda(); + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); - // Smearing - TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); - PLEGMA_printf("Plaquette after smearing:\n"); - smearedGauge.calculatePlaq(); - - } - + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + updateOptions(LIGHT); TIME(QUDA_solver solver_a(mu,1)); - { - // Reading from Lime file and loading to device - PLEGMA_Gauge gauge; - gauge.readFile(latfile, LIME_FORMAT); - gauge.calculatePlaq(); - - // Loading to QUDA and computing plaquette also there - initGaugeQuda(gauge, false); - plaqQuda(); - // Smearing - TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); - PLEGMA_printf("Plaquette after smearing:\n"); - smearedGauge.calculatePlaq(); - - } + // Loading to QUDA and computing plaquette also there + updateGaugeQuda(gauge, false); + plaqQuda(); updateOptions(LIGHT); TIME(QUDA_solver solver_p(mu,1)); @@ -197,10 +183,6 @@ int main(int argc, char **argv) { std::string confnumber= ssource; free(ssource); - - std::string given_twop_filename = twop_filename; - - //Reading the momentum lists momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); //For the twopoint functions we have also three momentum //first is pi2 @@ -208,6 +190,13 @@ int main(int argc, char **argv) { //third is pf2 //and in this case the total momentum is defined as the sum of pf1 and pf2 //to get pi1 we have to subtract pi2 from the total momentum + + + if(sourcemomentumList_twopt.empty()) + PLEGMA_error("twopt momentumList empty"); + + + std::string given_twop_filename = twop_filename; if(sourcemomentumList_twopt.empty()) @@ -253,12 +242,8 @@ int main(int argc, char **argv) { - PLEGMA_Vector stochastic_oet_prop_zero_mom_p; - PLEGMA_Vector stochastic_oet_prop_zero_mom_a; - - - PLEGMA_Vector stochastic_oet_prop_fini_mom_a; - PLEGMA_Vector stochastic_oet_prop_fini_mom_p; + PLEGMA_Vector stochastic_oet_prop_zero_mom_packed; + PLEGMA_Vector stochastic_oet_prop_fini_mom_packed; if (readstochastic==0){ @@ -308,11 +293,15 @@ int main(int argc, char **argv) { //Step(5) pick out a particular timeslice from the source vectorInOut_a.absorbTimeslice(vectorAuxD1, timeidx); //Step(6) Solve + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); solver_a.solve(vectorInOut_a, vectorInOut_a); //Step(7) pick out a particular timeslice from the source vectorInOut_p.absorbTimeslice(vectorAuxD1, timeidx); //Step(8) Solve + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); solver_p.solve(vectorInOut_p, vectorInOut_p); vectorTmp.copy(vectorInOut_p); @@ -332,9 +321,13 @@ int main(int argc, char **argv) { else{ PLEGMA_printf("#piN_scattering_length_12: No time dilution is used n stochastic propagators\n"); vectorInOut_a.copy(vectorAuxD1); + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); solver_a.solve(vectorInOut_a, vectorInOut_a); vectorInOut_p.copy(vectorAuxD1); + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); solver_p.solve(vectorInOut_p, vectorInOut_p); vectorTmp.copy(vectorInOut_p); @@ -390,35 +383,115 @@ int main(int argc, char **argv) { } //loop over the stochastic samples + } + else{ + for (int i=0; i vectorRead(BOTH); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_sources[i]->copy(vectorRead,HOST); + inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_ppa[i]->copy(vectorRead,HOST); + inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_pma[i]->copy(vectorRead,HOST); } - else{ - for (int i=0; i vectorRead(BOTH); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_sources[i]->copy(vectorRead,HOST); - inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber; - PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_propagator_ppa[i]->copy(vectorRead,HOST); - inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber; - PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_propagator_pma[i]->copy(vectorRead,HOST); + } + for(int isource = startSource; isource < numSourcePositions; isource++){ + + + site source = sourcePositions[isource]; + + site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); + + /****************************************************** + * + * Step 5: Computing OET propagators + * + * + ******************************************************/ + { + //Doing for +mu for the UP propagator spin dilution oet + + site source_local = sourcePositions[isource]; + + PLEGMA_Vector vectortmp1; + + PLEGMA_Vector vectorInOut_p; + PLEGMA_Vector vectorInOut_a; + + PLEGMA_Vector vectorInOut_ppa; + PLEGMA_Vector vectorInOut_pma; + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectorStoc_source_oet, source_local[DIM_T]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, source_local[DIM_T]); } + + vectorInOut_a.copy(vectortmp1); + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); + TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); + + vectorInOut_p.copy(vectortmp1); + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); + TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); + + vectorInOut_ppa.copy(vectorInOut_p); + vectorInOut_ppa.add(vectorInOut_a,1); + + vectorInOut_pma.copy(vectorInOut_p); + vectorInOut_pma.add(vectorInOut_a,-1); + + vectortmp1.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source_local[DIM_T], HGC_totalL[DIM_T]/2); + + + //Gaussian smearing of the propagator + TIME(vectorInOut_a.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + + stochastic_oet_prop_zero_mom_packed.copy(vectorInOut_a); + + }//end of do_stochastic_oet + //uu case + { + + //We first have a loop over all unique the source meson momentum p_i2 + for (int i_mpi2=0; i_mpi2 corrPION(source, filtered_sourcemomentumList); + + corrPION.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + + TIME(corrPION.P_diagrams( stochastic_oet_prop_zero_mom_packed, stochastic_oet_prop_fini_mom_packed, i_mpi2)); + } } - + } for(int i=0; i< n_stochastic_samples; ++i) { stochastic_sources.pop_back(); stochastic_propagator_ppa.pop_back(); stochastic_propagator_pma.pop_back(); } - - - - }//loop in finalize finalize(); return 0; From 19d8784f0daced909da5638c7459a0a591467670 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 27 Feb 2025 14:00:28 +0100 Subject: [PATCH 145/168] saving pion for p+a and p-a boundary conditions --- plegma/piN_scattering_length_12.cpp | 155 +++++++++++++++++++++++----- 1 file changed, 131 insertions(+), 24 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 479ce1aa..8b3df39e 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -245,6 +245,13 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_oet_prop_zero_mom_packed; PLEGMA_Vector stochastic_oet_prop_fini_mom_packed; + PLEGMA_Vector stochastic_oet_prop_zero_mom_ppa; + PLEGMA_Vector stochastic_oet_prop_fini_mom_ppa; + + PLEGMA_Vector stochastic_oet_prop_zero_mom_pma; + PLEGMA_Vector stochastic_oet_prop_fini_mom_pma; + + if (readstochastic==0){ PLEGMA_Vector vectorAuxD1(BOTH);//For storing the source (rotated and smeared) @@ -278,9 +285,7 @@ int main(int argc, char **argv) { //Step(3) Smearing all the time slice TIME(vectorTmp.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - - //Step(4) We rotate the source to the physical basis - TIME(vectorAuxD1.rotateToPhysicalBasis(vectorTmp,+1)); + vectorAuxD1.copy(vectorTmp); //In vectorAuxD2 we store the results for the inversion @@ -342,43 +347,37 @@ int main(int argc, char **argv) { } - //Step(6) We rotate back the propagator to the physical basis - TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2_ppa,+1)); - //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD2_ppa.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_ppa, smearedGauge, nsmearGauss, alphaGauss )); //Step(8) Save the propagator to the disk { PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorAuxD2_ppa); + vectorAuxF.copy(vectorAuxD1); vectorAuxF.unload(); vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber); } //Step(9) Save the propagator to the host memory - vectorAuxD2_ppa.unload(); - stochastic_propagator_ppa[i]->copy(vectorAuxD2_ppa,HOST); - vectorAuxD2_ppa.load(); - - //Step(10) We rotate back the propagator to the physical basis - TIME(vectorAuxD1.rotateToPhysicalBasis(vectorAuxD2_pma,+1)); + vectorAuxD1.unload(); + stochastic_propagator_ppa[i]->copy(vectorAuxD1,HOST); + vectorAuxD1.load(); //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD2_pma.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); + TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_pma, smearedGauge, nsmearGauss, alphaGauss )); //Step(8) Save the propagator to the disk { PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorAuxD2_pma); + vectorAuxF.copy(vectorAuxD1); vectorAuxF.unload(); vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber); } //Step(9) Save the propagator to the host memory - vectorAuxD2_pma.unload(); - stochastic_propagator_pma[i]->copy(vectorAuxD2_pma,HOST); - vectorAuxD2_pma.load(); + vectorAuxD1.unload(); + stochastic_propagator_pma[i]->copy(vectorAuxD1,HOST); + vectorAuxD1.load(); } //loop over the stochastic samples @@ -410,12 +409,19 @@ int main(int argc, char **argv) { PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n",isource, source[0], source[1], source[2], source[3]); + asprintf(&ssource,"sx%02dsy%02dsz%02dst%03d", sourcePositions[isource][0], sourcePositions[isource][1], sourcePositions[isource][2], sourcePositions[isource][3]); + std::string sourcepositiontext= (std::string)"_" + ssource; + free(ssource); + + /****************************************************** * * Step 5: Computing OET propagators * * ******************************************************/ + vectorStoc_source_oet.stochastic_Z(nroots); + { //Doing for +mu for the UP propagator spin dilution oet @@ -456,18 +462,40 @@ int main(int argc, char **argv) { vectorInOut_pma.copy(vectorInOut_p); vectorInOut_pma.add(vectorInOut_a,-1); + TIME(vectorInOut_a.gaussianSmearing(vectorInOut_ppa, smearedGauge, nsmearGauss, alphaGauss)); + vectorInOut_ppa.copy(vectorInOut_a); + + TIME(vectorInOut_a.gaussianSmearing(vectorInOut_pma, smearedGauge, nsmearGauss, alphaGauss)); + vectorInOut_pma.copy(vectorInOut_a); + + + vectortmp1.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source_local[DIM_T], HGC_totalL[DIM_T]/2); //Gaussian smearing of the propagator - TIME(vectorInOut_a.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + //TIME(vectorInOut_a.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); - stochastic_oet_prop_zero_mom_packed.copy(vectorInOut_a); + stochastic_oet_prop_zero_mom_ppa.copy(vectorInOut_ppa); + stochastic_oet_prop_zero_mom_pma.copy(vectorInOut_pma); + + stochastic_oet_prop_zero_mom_packed.copy(vectortmp1); }//end of do_stochastic_oet - //uu case { + PLEGMA_ScattCorrelator corrPION(source, list_mpi2_twopt); + + PLEGMA_ScattCorrelator corrPION_PPA(source, list_mpi2_twopt); + PLEGMA_ScattCorrelator corrPION_PMA(source, list_mpi2_twopt); + + + corrPION.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + + corrPION_PPA.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + corrPION_PMA.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + + //We first have a loop over all unique the source meson momentum p_i2 for (int i_mpi2=0; i_mpi2 corrPION(source, filtered_sourcemomentumList); + //Multiplying by the appropriate momentum phase finite momentum OET + { + + site source_local = sourcePositions[isource]; + + PLEGMA_Vector vectortmp1; + + PLEGMA_Vector vectorInOut_p; + PLEGMA_Vector vectorInOut_a; + + PLEGMA_Vector vectorInOut_ppa; + PLEGMA_Vector vectorInOut_pma; + + vectortmp1.copy(vectorStoc_source_oet); + + std::vector tmp_4Dmom= momentum_i2 ; + tmp_4Dmom.push_back(0); + vectortmp1.mulMomentumPhases(tmp_4Dmom,-1); + + { // Smearing the source + + PLEGMA_Vector3D vector1, vector2; + vector1.absorb(vectortmp1, source_local[DIM_T]); + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); + vectortmp1.absorb(vector2, source_local[DIM_T],true); + + } + + vectorInOut_a.copy(vectortmp1); + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); + TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); + + vectorInOut_p.copy(vectortmp1); + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); + TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); + + vectorInOut_ppa.copy(vectorInOut_p); + vectorInOut_ppa.add(vectorInOut_a,1); + + vectorInOut_pma.copy(vectorInOut_p); + vectorInOut_pma.add(vectorInOut_a,-1); + + TIME(vectortmp1.gaussianSmearing(vectorInOut_ppa, smearedGauge, nsmearGauss, alphaGauss)); + stochastic_oet_prop_fini_mom_ppa.copy(vectortmp1); + + TIME(vectortmp1.gaussianSmearing(vectorInOut_pma, smearedGauge, nsmearGauss, alphaGauss)); + stochastic_oet_prop_fini_mom_pma.copy(vectortmp1); + + vectortmp1.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source_local[DIM_T], HGC_totalL[DIM_T]/2); + + + //Gaussian smearing of the propagator + TIME(vectorInOut_a.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); - corrPION.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); + stochastic_oet_prop_fini_mom_packed.copy(vectorInOut_a); + + } + + TIME(corrPION_PMA.P_diagrams( stochastic_oet_prop_zero_mom_pma, stochastic_oet_prop_fini_mom_pma, i_mpi2)); + + TIME(corrPION_PPA.P_diagrams( stochastic_oet_prop_zero_mom_ppa, stochastic_oet_prop_fini_mom_ppa, i_mpi2)); TIME(corrPION.P_diagrams( stochastic_oet_prop_zero_mom_packed, stochastic_oet_prop_fini_mom_packed, i_mpi2)); + } + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; + + TIME(corrPION.apply_sign("P")); + TIME(corrPION.writeHDF5( outfilename )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_PPA_2pt"; + + TIME(corrPION_PPA.apply_sign("P")); + TIME(corrPION_PPA.writeHDF5( outfilename )); + + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_PMA_2pt"; + + TIME(corrPION_PMA.apply_sign("P")); + TIME(corrPION_PMA.writeHDF5( outfilename )); + + } } for(int i=0; i< n_stochastic_samples; ++i) { From 7c6abc4b281669450524b7361a8b55cbfcd91793 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 27 Feb 2025 16:18:00 +0100 Subject: [PATCH 146/168] implementing the nucleon --- plegma/piN_scattering_length_12.cpp | 126 ++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 8b3df39e..7d6070d3 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -413,6 +413,132 @@ int main(int argc, char **argv) { std::string sourcepositiontext= (std::string)"_" + ssource; free(ssource); + PLEGMA_Propagator prop_packed(BOTH); //To be saved for all the coherent sources. + PLEGMA_Propagator prop_PPA(BOTH); //To be saved for all the coherent sources. + PLEGMA_Propagator prop_PMA(BOTH); //To be saved for all the coherent sources. + + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source[DIM_T]); + + auto computePropagator = [&](PLEGMA_Propagator& prop_packed, + PLEGMA_Propagator& prop_PPA, + PLEGMA_Propagator& prop_PMA, + int nSmear) { + + for(int isc = 0 ; isc < 12 ; isc++){ + + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + + PLEGMA_Vector vectorInOut_a; + PLEGMA_Vector vectorInOut_p; + + PLEGMA_Vector vectorInOut_ppa; + PLEGMA_Vector vectorInOut_pma; + + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut_a.absorb(vector2,source[DIM_T]); + } + // Inverting + PLEGMA_printf("Going to invert for component %d\n", isc); + + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); + TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); + + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut_p.absorb(vector2,source[DIM_T]); + } + // Inverting + PLEGMA_printf("Going to invert for component %d\n", isc); + + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); + TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); + + vectorInOut_ppa.copy(vectorInOut_p); + vectorInOut_ppa.add(vectorInOut_a,1); + + TIME(vectorAuxD.gaussianSmearing(vectorInOut_ppa, smearedGauge, nSmear, alphaGauss)); + vectorInOut_ppa.copy(vectorAuxD); + vectorAuxF.copy(vectorAuxD); + prop_PPA.absorb(vectorAuxF, isc/3, isc%3); + + + vectorInOut_pma.copy(vectorInOut_p); + vectorInOut_pma.add(vectorInOut_a,-1); + + TIME(vectorAuxD.gaussianSmearing(vectorInOut_ppa, smearedGauge, nSmear, alphaGauss)); + vectorInOut_ppa.copy(vectorAuxD); + vectorAuxF.copy(vectorAuxD); + prop_PMA.absorb(vectorAuxF, isc/3, isc%3); + + vectorAuxD.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source[DIM_T], HGC_totalL[DIM_T]/2); + vectorAuxF.copy(vectorAuxD); + prop_packed.absorb(vectorAuxF, isc/3, isc%3); + + } + }; + TIME(computePropagator(prop_packed, prop_PPA, prop_PMA, nsmearGauss)); + + //N diagram + { + std::vector> mtot = sourcemomentumList_twopt.uniq_p(3); + momList list_mtot(1,{mtot,},{0,}); + PLEGMA_ScattCorrelator corrN(source,list_mtot); + PLEGMA_ScattCorrelator corrN_PPA(source,list_mtot); + PLEGMA_ScattCorrelator corrN_PMA(source,list_mtot); + + + //initialize diagram + corrN.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); + corrN_PPA.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); + corrN_PMA.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); + + + PLEGMA_ScattCorrelator reductionsT1(source_reduction, mtot); + PLEGMA_ScattCorrelator reductionsT2(source_reduction, mtot); + + TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, prop_packed, prop_packed, prop_packed)); + TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_packed, prop_packed, prop_packed)); + + //write N + outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_N"; + + TIME( corrN.N_diagrams( reductionsT1, reductionsT2 ) ); + TIME( corrN.apply_phase() ); + TIME( corrN.apply_sign("N")); + TIME( corrN.writeHDF5(outfilename)); + + TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); + TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); + + //write N + outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_N_PPA"; + + TIME( corrN_PPA.N_diagrams( reductionsT1, reductionsT2 ) ); + TIME( corrN_PPA.apply_phase() ); + TIME( corrN_PPA.apply_sign("N")); + TIME( corrN_PPA.writeHDF5(outfilename)); + + TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, prop_PMA, prop_PMA, prop_PMA)); + TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_PMA, prop_PMA, prop_PMA)); + + //write N + outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_N_PMA"; + + TIME( corrN_PMA.N_diagrams( reductionsT1, reductionsT2 ) ); + TIME( corrN_PMA.apply_phase() ); + TIME( corrN_PMA.apply_sign("N")); + TIME( corrN_PMA.writeHDF5(outfilename)); + + } /****************************************************** * From 4d18d448cf2393f32c4cc944dacf022be70d1221 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 3 Apr 2025 17:40:11 +0200 Subject: [PATCH 147/168] progressing with the piN 1/2 scattering wilson code --- plegma/piN_scattering_length_12.cpp | 281 ++++++++++++---------------- 1 file changed, 122 insertions(+), 159 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 7d6070d3..5425a304 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -99,8 +99,6 @@ void produceOutput_3pt( PLEGMA_ScattCorrelator source, int main(int argc, char **argv) { initializeOptions(argc, argv, true, listOpt); //================ Add your options in this between initializeOptions and initializePLEGMA ================// - std::vector mu_s; - std::vector mu_c; bool timedilution; int rand_seed1=1234; int rand_seed2=5678; @@ -229,16 +227,10 @@ int main(int argc, char **argv) { //Step (7) doing the recombination //Step (8) doing the one end trick calculation for the Z diagrams - std::vector*> stochastic_sources; + PLEGMA_Vector stochastic_sources; - std::vector*> stochastic_propagator_ppa; - std::vector*> stochastic_propagator_pma; - - for(int i=0; i< n_stochastic_samples; ++i) { - stochastic_sources.push_back(new PLEGMA_Vector(HOST)); - stochastic_propagator_ppa.push_back(new PLEGMA_Vector(HOST)); - stochastic_propagator_pma.push_back(new PLEGMA_Vector(HOST)); - } + PLEGMA_Vector stochastic_propagator_ppa; + PLEGMA_Vector stochastic_propagator_pma; @@ -252,154 +244,6 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_oet_prop_fini_mom_pma; - if (readstochastic==0){ - - PLEGMA_Vector vectorAuxD1(BOTH);//For storing the source (rotated and smeared) - PLEGMA_Vector vectorAuxD2_ppa(BOTH);//For storing the propagotor for the time-slices - PLEGMA_Vector vectorAuxD2_pma(BOTH);//For storing the propagotor for the time-slices - PLEGMA_Vector vectorInOut_a; //temporary vector using in solve - PLEGMA_Vector vectorInOut_p; //temporary vector using in solve - PLEGMA_Vector vectorTmp; //temporary vector using in solve - - PLEGMA_Vector vectorSource(BOTH);//For storing the source - vectorSource.randInit(rand_seed2); - - for (int i=0; i vectorAuxF; - vectorAuxF.copy(vectorSource); - vectorAuxF.unload(); - vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); - } - - - vectorSource.unload(); - stochastic_sources[i]->copy(vectorSource,HOST); - vectorSource.load(); - - vectorAuxD1.copy(vectorSource); - - //Step(3) Smearing all the time slice - TIME(vectorTmp.gaussianSmearing(vectorAuxD1, smearedGauge, nsmearGauss, alphaGauss )); - vectorAuxD1.copy(vectorTmp); - - //In vectorAuxD2 we store the results for the inversion - - vectorAuxD2_ppa.scale(0.0); - vectorAuxD2_pma.scale(0.0); - - if (timedilution){ - PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); - for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - //Step(5) pick out a particular timeslice from the source - vectorInOut_a.absorbTimeslice(vectorAuxD1, timeidx); - //Step(6) Solve - updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); - solver_a.solve(vectorInOut_a, vectorInOut_a); - - //Step(7) pick out a particular timeslice from the source - vectorInOut_p.absorbTimeslice(vectorAuxD1, timeidx); - //Step(8) Solve - updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); - solver_p.solve(vectorInOut_p, vectorInOut_p); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,1); - - //Step(7) absorbing the particular timeslice to a 4d vector - vectorAuxD2_ppa.absorbTimeslice(vectorTmp, timeidx, false); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,-1); - - //Step(7) absorbing the particular timeslice to a 4d vector - vectorAuxD2_pma.absorbTimeslice(vectorTmp, timeidx, false); - - } - } - else{ - PLEGMA_printf("#piN_scattering_length_12: No time dilution is used n stochastic propagators\n"); - vectorInOut_a.copy(vectorAuxD1); - updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); - solver_a.solve(vectorInOut_a, vectorInOut_a); - - vectorInOut_p.copy(vectorAuxD1); - updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); - solver_p.solve(vectorInOut_p, vectorInOut_p); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,1); - - vectorAuxD2_ppa.copy(vectorTmp); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,-1); - - vectorAuxD2_pma.copy(vectorTmp); - - } - - //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_ppa, smearedGauge, nsmearGauss, alphaGauss )); - - //Step(8) Save the propagator to the disk - { - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorAuxD1); - vectorAuxF.unload(); - vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber); - } - - //Step(9) Save the propagator to the host memory - vectorAuxD1.unload(); - stochastic_propagator_ppa[i]->copy(vectorAuxD1,HOST); - vectorAuxD1.load(); - - //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_pma, smearedGauge, nsmearGauss, alphaGauss )); - - //Step(8) Save the propagator to the disk - { - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorAuxD1); - vectorAuxF.unload(); - vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber); - } - - //Step(9) Save the propagator to the host memory - vectorAuxD1.unload(); - stochastic_propagator_pma[i]->copy(vectorAuxD1,HOST); - vectorAuxD1.load(); - - - } //loop over the stochastic samples - - } - else{ - for (int i=0; i vectorRead(BOTH); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_sources[i]->copy(vectorRead,HOST); - inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber; - PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_propagator_ppa[i]->copy(vectorRead,HOST); - inputfilename=outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber; - PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_propagator_pma[i]->copy(vectorRead,HOST); - } - } for(int isource = startSource; isource < numSourcePositions; isource++){ @@ -540,6 +384,125 @@ int main(int argc, char **argv) { } + + for (int i=0; i vectorAuxF; + vectorAuxF.copy(vectorSource_stochastic); + vectorAuxF.unload(); + vectorAuxF.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); + //In vectorAuxD2 we store the results for the inversion + + vectorAuxD2_ppa.scale(0.0); + vectorAuxD2_pma.scale(0.0); + + if (timedilution){ + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(5) pick out a particular timeslice from the source + vectorInOut_a.absorbTimeslice(vectorSource_stochastic, timeidx); + //Step(6) Solve + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); + solver_a.solve(vectorInOut_a, vectorInOut_a); + + //Step(7) pick out a particular timeslice from the source + vectorInOut_p.absorbTimeslice(vectorSource_stochastic, timeidx); + //Step(8) Solve + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); + solver_p.solve(vectorInOut_p, vectorInOut_p); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,1); + + //Step(7) absorbing the particular timeslice to a 4d vector + vectorAuxD2_ppa.absorbTimeslice(vectorTmp, timeidx, false); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,-1); + + //Step(7) absorbing the particular timeslice to a 4d vector + vectorAuxD2_pma.absorbTimeslice(vectorTmp, timeidx, false); + + } + } + else{ + PLEGMA_printf("#piN_scattering_length_12: No time dilution is used n stochastic propagators\n"); + vectorInOut_a.copy(vectorSource_stochastic); + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); + solver_a.solve(vectorInOut_a, vectorInOut_a); + + vectorInOut_p.copy(vectorSource_stochastic,); + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); + solver_p.solve(vectorInOut_p, vectorInOut_p); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,1); + + vectorAuxD2_ppa.copy(vectorTmp); + + vectorTmp.copy(vectorInOut_p); + vectorTmp.add(vectorInOut_a,-1); + + vectorAuxD2_pma.copy(vectorTmp); + + } + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_ppa, smearedGauge, nsmearGauss, alphaGauss )); + + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD1); + vectorAuxF.unload(); + vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber); + } + + stochastic_propagator_ppa.copy(vectorAuxD1); + + //Step(7) Smearing all the time slice in the propagator + TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_pma, smearedGauge, nsmearGauss, alphaGauss )); + + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorAuxD1); + vectorAuxF.unload(); + vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber); + } + + stochastic_propagator_pma.copy(vectorAuxD1); + + } + else{ + std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read stochastic source from: %s\n",inputfilename.c_str()); + PLEGMA_Vector vectorRead(BOTH); + vectorRead.readFile(inputfilename,LIME_FORMAT); + vectorRead.load(); + vectorSource_stochastic.copy(vectorRead); + inputfilename="globalTfulltimedilution_propagator_ppa_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_2pt_SS_ppa.copy(vectorFloat,HOST); + stochastic_propagator_2pt_SS_ppa.load(); + inputfilename="globalTfulltimedilution_propagator_pma_nstoch"+std::to_string(i)+"_"+confnumber; + PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); + vectorRead.readFile(inputfilename,LIME_FORMAT); + stochastic_propagator_2pt_SS_pma.copy(vectorFloat,HOST); + stochastic_propagator_2pt_SS_pma.load(); + + } + + } + + readStochSamples=1; + /****************************************************** * * Step 5: Computing OET propagators From cde902dd63c5f4d4f7b248ce3e1a49e9871bb1a3 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 9 Apr 2025 10:44:04 +0200 Subject: [PATCH 148/168] working on the 1/2 scattering code --- plegma/piN_scattering_length_12.cpp | 152 ++++++++++++++++++++++++---- 1 file changed, 135 insertions(+), 17 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 5425a304..de72525d 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -264,6 +264,60 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source[DIM_T]); + auto solve1 = [&](plegma::PLEGMA_Vector &out, + plegma::PLEGMA_Vector3D &in + site source){ + PLEGMA_Vector vectorInOut_a; + PLEGMA_Vector vectorInOut_p; + PLEGMA_Vector vectorInOut_ppa; + PLEGMA_Vector vectorInOut_pma; + + { // Smearing the source + PLEGMA_Vector3D vector1; + TIME(vector1.gaussianSmearing(in, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut_a.absorb(vector1,source[DIM_T]); + } + vectorInOut_p.copy(vectorInOut_a); + // Inverting + PLEGMA_printf("Going to invert for antiperiodic case\n" ); + updateGaugeQuda(gauge, true); + solver_a.UpdateSolver(); + TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); + PLEGMA_printf("Going to invert for periodic case \n"); + updateGaugeQuda(gauge, false); + solver_p.UpdateSolver(); + TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); + + vectorInOut_ppa.copy(vectorInOut_p); + vectorInOut_ppa.add(vectorInOut_a,1); + + vectorInOut_ppa.copy(vectorAuxD); + + vectorInOut_pma.copy(vectorInOut_p); + vectorInOut_pma.add(vectorInOut_a,-1); + + vectorAuxD.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source[DIM_T], HGC_totalL[DIM_T]/2); + + TIME(out.gaussianSmearing(vectorAuxD, smearedGauge, nSmear, alphaGauss)); + out.copy(vectorAuxD); + } + auto computePropagator = [&](PLEGMA_Propagator& prop_packed + ) { + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorInOut; + PLEGMA_Vector vectorAuxF; + PLEGMA_Vector3D vector1; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + solve1(vecrorInOut, vector1, source); + vectorAuxF.copy(vectorAuxD); + prop_packed.absorb(vectorAuxF, isc/3, isc%3); + }; + + } + TIME(computePropagator(prop_packed)); + + +#if 0 auto computePropagator = [&](PLEGMA_Propagator& prop_packed, PLEGMA_Propagator& prop_PPA, PLEGMA_Propagator& prop_PMA, @@ -318,8 +372,8 @@ int main(int argc, char **argv) { vectorInOut_pma.copy(vectorInOut_p); vectorInOut_pma.add(vectorInOut_a,-1); - TIME(vectorAuxD.gaussianSmearing(vectorInOut_ppa, smearedGauge, nSmear, alphaGauss)); - vectorInOut_ppa.copy(vectorAuxD); + TIME(vectorAuxD.gaussianSmearing(vectorInOut_pma, smearedGauge, nSmear, alphaGauss)); + vectorInOut_pma.copy(vectorAuxD); vectorAuxF.copy(vectorAuxD); prop_PMA.absorb(vectorAuxF, isc/3, isc%3); @@ -330,20 +384,21 @@ int main(int argc, char **argv) { } }; TIME(computePropagator(prop_packed, prop_PPA, prop_PMA, nsmearGauss)); +#endif //N diagram { std::vector> mtot = sourcemomentumList_twopt.uniq_p(3); momList list_mtot(1,{mtot,},{0,}); PLEGMA_ScattCorrelator corrN(source,list_mtot); - PLEGMA_ScattCorrelator corrN_PPA(source,list_mtot); - PLEGMA_ScattCorrelator corrN_PMA(source,list_mtot); + //PLEGMA_ScattCorrelator corrN_PPA(source,list_mtot); + //PLEGMA_ScattCorrelator corrN_PMA(source,list_mtot); //initialize diagram corrN.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); - corrN_PPA.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); - corrN_PMA.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); + //corrN_PPA.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); + //corrN_PMA.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired,glist_source_nucleon, glist_sink_nucleon,"N"); PLEGMA_ScattCorrelator reductionsT1(source_reduction, mtot); @@ -364,6 +419,7 @@ int main(int argc, char **argv) { TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); //write N +#if 0 outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_N_PPA"; TIME( corrN_PPA.N_diagrams( reductionsT1, reductionsT2 ) ); @@ -381,14 +437,39 @@ int main(int argc, char **argv) { TIME( corrN_PMA.apply_phase() ); TIME( corrN_PMA.apply_sign("N")); TIME( corrN_PMA.writeHDF5(outfilename)); - +#endif } for (int i=0; i vectorPropagator_stochastic; if (readStochSamples==0){ + vectorSource_stochastic.stochastic_Z(nroots); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorSource_stochastic); + vectorAuxF.unload(); + vectorAuxF.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); + vectorPropagator_stochastic.scale(0.0); + if (timedilution){ + PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + PLEGMA_Vector3D vectorIn; + vectorIn.absorb(vectorSource_stochastic,timeidx); + solve1(vecrorInOut, vectorIn, timeidx); + vectorPropagator_stochastic.absorbTimeslice(vectorInOut, timeidx, false); + } + } + + + + + //In vectorAuxD2 we store the results for the inversion + + //vectorAuxD2_ppa.scale(0.0); + //vectorAuxD2_pma.scale(0.0); + +#if 0 vectorSource_stochastic.stochastic_Z(nroots); PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectorSource_stochastic); @@ -402,6 +483,7 @@ int main(int argc, char **argv) { if (timedilution){ PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + //Step(5) pick out a particular timeslice from the source vectorInOut_a.absorbTimeslice(vectorSource_stochastic, timeidx); //Step(6) Solve @@ -410,7 +492,7 @@ int main(int argc, char **argv) { solver_a.solve(vectorInOut_a, vectorInOut_a); //Step(7) pick out a particular timeslice from the source - vectorInOut_p.absorbTimeslice(vectorSource_stochastic, timeidx); + vectorInOut_p.absorbTimeslice(vectorSource_stochastic, timeidx);1 //Step(8) Solve updateGaugeQuda(gauge, false); solver_p.UpdateSolver(); @@ -478,6 +560,8 @@ int main(int argc, char **argv) { stochastic_propagator_pma.copy(vectorAuxD1); +#endif + } else{ std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; @@ -486,16 +570,11 @@ int main(int argc, char **argv) { vectorRead.readFile(inputfilename,LIME_FORMAT); vectorRead.load(); vectorSource_stochastic.copy(vectorRead); - inputfilename="globalTfulltimedilution_propagator_ppa_nstoch"+std::to_string(i)+"_"+confnumber; - PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); - vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_propagator_2pt_SS_ppa.copy(vectorFloat,HOST); - stochastic_propagator_2pt_SS_ppa.load(); - inputfilename="globalTfulltimedilution_propagator_pma_nstoch"+std::to_string(i)+"_"+confnumber; + inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); vectorRead.readFile(inputfilename,LIME_FORMAT); - stochastic_propagator_2pt_SS_pma.copy(vectorFloat,HOST); - stochastic_propagator_2pt_SS_pma.load(); + vectorPropagator_stochastic.copy(vectorFloat,HOST); + vectorPropagator_stochastic.load(); } @@ -503,6 +582,45 @@ int main(int argc, char **argv) { readStochSamples=1; + //We first have a loop over all unique the source meson momentum p_i2 + for (int i_mpi2=0; i_mpi2> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); + + std::vector> mpi2_filt ; + mpi2_filt.assign(mptot_filt.size(),momentum_i2); + //PLEGMA_printf("mptot_filt.size() %d\n",mptot_filt.size()); + momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); + + PLEGMA_Propagator propTS; + + + + //pi plus at the source + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + //Performing the smearing + PLEGMA_Vector3D vector1; + vectorAuxF.absorb(prop_packed, isc/3, isc%3); + vectorAuxD.copy(vectorAuxF); + vector1.absorb( vectorAuxD, source[3]); + vector1.mulMomentumPhases(momentum_i2,1); + vector1.apply_gamma_scatt(glist_source_meson[0]); + solve1(vectorAuxD, vector1, source); + vectorAuxF.copy(vectorAuxD); + propTS.absorb(vectorAuxF, isc/3, isc%3); + } + + } + + /****************************************************** * * Step 5: Computing OET propagators From 070c7d5f5e11393ba3887930a07dc07e13eb65ba Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 9 Apr 2025 15:54:03 +0200 Subject: [PATCH 149/168] adding factors for the stochastic propagator part and including sequential --- plegma/piN_scattering_length_12.cpp | 57 ++++++++++++++++++----------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index de72525d..32d05a6d 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -246,6 +246,8 @@ int main(int argc, char **argv) { for(int isource = startSource; isource < numSourcePositions; isource++){ + std::vector*> reductions_V3_GAMMAF2_U;//implemented + std::vector*> reductions_V3_GAMMAF2GAMMA5_U;//implemented site source = sourcePositions[isource]; @@ -265,16 +267,17 @@ int main(int argc, char **argv) { smearedGauge3D.absorb(smearedGauge, source[DIM_T]); auto solve1 = [&](plegma::PLEGMA_Vector &out, - plegma::PLEGMA_Vector3D &in + plegma::PLEGMA_Vector3D &in, site source){ PLEGMA_Vector vectorInOut_a; PLEGMA_Vector vectorInOut_p; PLEGMA_Vector vectorInOut_ppa; PLEGMA_Vector vectorInOut_pma; + PLEGMA_Vector vectorAuxD; { // Smearing the source PLEGMA_Vector3D vector1; - TIME(vector1.gaussianSmearing(in, smearedGauge3D, nSmear, alphaGauss)); + TIME(vector1.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss)); vectorInOut_a.absorb(vector1,source[DIM_T]); } vectorInOut_p.copy(vectorInOut_a); @@ -298,9 +301,9 @@ int main(int argc, char **argv) { vectorAuxD.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source[DIM_T], HGC_totalL[DIM_T]/2); - TIME(out.gaussianSmearing(vectorAuxD, smearedGauge, nSmear, alphaGauss)); + TIME(out.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss)); out.copy(vectorAuxD); - } + }; auto computePropagator = [&](PLEGMA_Propagator& prop_packed ) { for(int isc = 0 ; isc < 12 ; isc++){ @@ -308,12 +311,12 @@ int main(int argc, char **argv) { PLEGMA_Vector vectorAuxF; PLEGMA_Vector3D vector1; vector1.pointSource(source, isc/3, isc%3, DEVICE); - solve1(vecrorInOut, vector1, source); - vectorAuxF.copy(vectorAuxD); + solve1(vectorInOut, vector1, source); + vectorAuxF.copy(vectorInOut); prop_packed.absorb(vectorAuxF, isc/3, isc%3); }; - } + }; TIME(computePropagator(prop_packed)); @@ -415,8 +418,8 @@ int main(int argc, char **argv) { TIME( corrN.apply_sign("N")); TIME( corrN.writeHDF5(outfilename)); - TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); - TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); + //TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); + //TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); //write N #if 0 @@ -442,8 +445,13 @@ int main(int argc, char **argv) { for (int i=0; i(source_reduction, sourcemomentumList_twopt.uniq_p(2))); + reductions_V3_GAMMAF2GAMMA5_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(2))); + PLEGMA_Vector vectorPropagator_stochastic; - if (readStochSamples==0){ + PLEGMA_Vector vectorInOut; + if (readstochastic==0){ vectorSource_stochastic.stochastic_Z(nroots); PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectorSource_stochastic); @@ -455,7 +463,8 @@ int main(int argc, char **argv) { for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ PLEGMA_Vector3D vectorIn; vectorIn.absorb(vectorSource_stochastic,timeidx); - solve1(vecrorInOut, vectorIn, timeidx); + site source_in=site({0,0,0,timeidx}); + solve1(vectorInOut, vectorIn, source_in); vectorPropagator_stochastic.absorbTimeslice(vectorInOut, timeidx, false); } } @@ -573,21 +582,32 @@ int main(int argc, char **argv) { inputfilename="globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber; PLEGMA_printf("Read propagator from: %s\n",inputfilename.c_str()); vectorRead.readFile(inputfilename,LIME_FORMAT); - vectorPropagator_stochastic.copy(vectorFloat,HOST); + vectorPropagator_stochastic.copy(vectorRead,HOST); vectorPropagator_stochastic.load(); } + + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorPropagator_stochastic); + TIME(reductions_V3_GAMMAF2_U[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); + + vectorAuxF.apply_gamma5(); + + TIME(reductions_V3_GAMMAF2GAMMA5_U[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); + } } - readStochSamples=1; + readstochastic=1; + //We first have a loop over all unique the source meson momentum p_i2 - for (int i_mpi2=0; i_mpi2 Date: Wed, 9 Apr 2025 16:57:31 +0200 Subject: [PATCH 150/168] including first B diagrams --- plegma/piN_scattering_length_12.cpp | 80 ++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 12 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 32d05a6d..b7393c99 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -211,7 +211,6 @@ int main(int argc, char **argv) { PLEGMA_Vector vectorSource_stochastic; - vectorSource_stochastic.randInit(rand_seed1); PLEGMA_Vector vectorStoc_source_oet; vectorStoc_source_oet.randInit(rand_seed1); @@ -227,12 +226,6 @@ int main(int argc, char **argv) { //Step (7) doing the recombination //Step (8) doing the one end trick calculation for the Z diagrams - PLEGMA_Vector stochastic_sources; - - PLEGMA_Vector stochastic_propagator_ppa; - PLEGMA_Vector stochastic_propagator_pma; - - PLEGMA_Vector stochastic_oet_prop_zero_mom_packed; PLEGMA_Vector stochastic_oet_prop_fini_mom_packed; @@ -248,7 +241,7 @@ int main(int argc, char **argv) { std::vector*> reductions_V3_GAMMAF2_U;//implemented std::vector*> reductions_V3_GAMMAF2GAMMA5_U;//implemented - + std::vector*> reductions_V4_GAMMAF1_U_U; site source = sourcePositions[isource]; site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); @@ -260,8 +253,6 @@ int main(int argc, char **argv) { free(ssource); PLEGMA_Propagator prop_packed(BOTH); //To be saved for all the coherent sources. - PLEGMA_Propagator prop_PPA(BOTH); //To be saved for all the coherent sources. - PLEGMA_Propagator prop_PMA(BOTH); //To be saved for all the coherent sources. PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source[DIM_T]); @@ -443,9 +434,12 @@ int main(int argc, char **argv) { #endif } - + vectorSource_stochastic.randInit(rand_seed1); + for (int i=0; i(source_reduction, sourcemomentumList_twopt.uniq_p(1))); + reductions_V3_GAMMAF2_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(2))); reductions_V3_GAMMAF2GAMMA5_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(2))); @@ -590,11 +584,14 @@ int main(int argc, char **argv) { { PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectorPropagator_stochastic); - TIME(reductions_V3_GAMMAF2_U[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); + TIME(reductions_V3_GAMMAF2_U[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); vectorAuxF.apply_gamma5(); TIME(reductions_V3_GAMMAF2GAMMA5_U[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); + + vectorAuxF.copy(vectorSource_stochastic); + TIME(reductions_V4_GAMMAF1_U_U[i]->V4( vectorAuxF, glist_sink_meson, prop_packed, prop_packed, false)); } } @@ -620,6 +617,16 @@ int main(int argc, char **argv) { PLEGMA_Propagator propTS; + PLEGMA_ScattCorrelator corrB13_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB14_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB15_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB16_2pt(source, filtered_sourcemomentumList); + + + corrB13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B13"); + corrB14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B14"); + corrB15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B15"); + corrB16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B16"); //pi plus at the source @@ -638,6 +645,55 @@ int main(int argc, char **argv) { propTS.absorb(vectorAuxF, isc/3, isc%3); } + vectorSource_stochastic.randInit(rand_seed1); + + for (int i=0; i reductions_V3_GAMMAF2_SEQ(source_reduction, sourcemomentumList_twopt.uniq_p(2));//implemented + + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorSource_stochastic); + + TIME(reductions_V3_GAMMAF2_SEQ.V3(vectorAuxF, glist_sink_meson, propTS, true)); + + + TIME(corrB13_2pt.Recombination(reductions_V3_GAMMAF2_SEQ, + *reductions_V4_GAMMAF1_U_U[i], + false, + 1, + false, + 0, + true, + false, + false, + false, + true)); + + } + + + + PLEGMA_ScattCorrelator reductions_V4_GAMMAF1_1(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductions_V4_GAMMAF1_2(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + + { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorSource_stochastic); + + TIME(reductions_V4_GAMMAF1_1.V4( vectorAuxF, glist_sink_nucleon, prop_packed, propTS, false)); + TIME(reductions_V4_GAMMAF1_2.V4( vectorAuxF, glist_sink_nucleon, propTS, prop_packed, false)); + + } + + + + + } + + } From 1d8f80588556402a1de45328c9e439ad3ccb3569 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 24 Apr 2025 10:00:45 +0200 Subject: [PATCH 151/168] Calc2pt reproduces results from commit -m 3b7b9235b09a1c9ccbd463b6ab7c3be1f2825e10 --- plegma/Calc_2pt.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/plegma/Calc_2pt.cpp b/plegma/Calc_2pt.cpp index 271ee2f8..e9f7c8e6 100644 --- a/plegma/Calc_2pt.cpp +++ b/plegma/Calc_2pt.cpp @@ -66,7 +66,7 @@ int main(int argc, char **argv) updateOptions(CHARM); mu = mu_c[0]; } - TIME(QUDA_solver solver(mu,12)); + TIME(QUDA_solver solver(mu,1)); std::vector threads; @@ -89,26 +89,25 @@ int main(int argc, char **argv) mu = run_mu; solver.UpdateSolver(); } - - std::vector> vectorInOut(12); for(int isc = 0 ; isc < 12 ; isc++){ + + PLEGMA_Vector vectorInOut; + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; // Smearing the source PLEGMA_Vector3D vector1, vector2; vector1.pointSource(source, isc/3, isc%3, DEVICE); TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); - (vectorInOut[isc]).absorb(vector2,source[DIM_T]); - } - // Inverting - PLEGMA_printf("Going to invert %s for all component\n", + (vectorInOut).absorb(vector2,source[DIM_T]); + + // Inverting + PLEGMA_printf("Going to invert %s for all component\n", fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM")); - TIME(solver.solve(vectorInOut, vectorInOut)); - for(int isc = 0 ; isc < 12 ; isc++) - { // Smearing the solution - PLEGMA_Vector vectorAuxD; - PLEGMA_Vector vectorAuxF; - TIME(vectorAuxD.gaussianSmearing(vectorInOut[isc], smearedGauge, nSmear, alphaGauss)); - vectorAuxF.copy(vectorAuxD); - prop.absorb(vectorAuxF, isc/3, isc%3); + TIME(solver.solve(vectorInOut, vectorInOut)); + // Smearing the solution + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop.absorb(vectorAuxF, isc/3, isc%3); } prop.rotateToPhysicalBase_device(run_mu/abs(run_mu)); prop.applyBoundaries_device(source[DIM_T]); From 416a5f2d55f2dfeabfced5e9f0d078d6ab404941 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 28 Apr 2025 17:29:59 +0200 Subject: [PATCH 152/168] all the B diagrams ready for the I=1/2 Wilson code --- plegma/piN_scattering_length_12.cpp | 398 +++++++++++----------------- 1 file changed, 149 insertions(+), 249 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index b7393c99..4ff843e9 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -236,12 +236,19 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_oet_prop_zero_mom_pma; PLEGMA_Vector stochastic_oet_prop_fini_mom_pma; +/* PART I: Computing point to all propagators: + a; nucleon correlation function + b; factors using stochastic source + boundary conditions + c; +*/ + for(int isource = startSource; isource < numSourcePositions; isource++){ - std::vector*> reductions_V3_GAMMAF2_U;//implemented - std::vector*> reductions_V3_GAMMAF2GAMMA5_U;//implemented - std::vector*> reductions_V4_GAMMAF1_U_U; + std::vector*> reductions_V4_B; + std::vector*> reductions_V2_B; + std::vector*> reductions_V3_W; + site source = sourcePositions[isource]; site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); @@ -257,13 +264,12 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source[DIM_T]); - auto solve1 = [&](plegma::PLEGMA_Vector &out, + auto solve1 = [&](plegma::PLEGMA_Vector &ppa, + plegma::PLEGMA_Vector &pma, plegma::PLEGMA_Vector3D &in, site source){ PLEGMA_Vector vectorInOut_a; PLEGMA_Vector vectorInOut_p; - PLEGMA_Vector vectorInOut_ppa; - PLEGMA_Vector vectorInOut_pma; PLEGMA_Vector vectorAuxD; { // Smearing the source @@ -275,35 +281,40 @@ int main(int argc, char **argv) { // Inverting PLEGMA_printf("Going to invert for antiperiodic case\n" ); updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); + TIME(solver_a.UpdateSolver()); TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); PLEGMA_printf("Going to invert for periodic case \n"); updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); + TIME(solver_p.UpdateSolver()); TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); - vectorInOut_ppa.copy(vectorInOut_p); - vectorInOut_ppa.add(vectorInOut_a,1); - - vectorInOut_ppa.copy(vectorAuxD); + ppa.copy(vectorInOut_p); + ppa.add(vectorInOut_a,1); - vectorInOut_pma.copy(vectorInOut_p); - vectorInOut_pma.add(vectorInOut_a,-1); + pma.copy(vectorInOut_p); + pma.add(vectorInOut_a,-1); + + vectorAuxD.copy(ppa); + TIME(ppa.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss)); - vectorAuxD.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source[DIM_T], HGC_totalL[DIM_T]/2); + vectorAuxD.copy(pma); + TIME(pma.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss)); - TIME(out.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss)); - out.copy(vectorAuxD); }; auto computePropagator = [&](PLEGMA_Propagator& prop_packed ) { for(int isc = 0 ; isc < 12 ; isc++){ - PLEGMA_Vector vectorInOut; + PLEGMA_Vector vectorInOut_ppa,vectorInOut_pma; PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxD; PLEGMA_Vector3D vector1; vector1.pointSource(source, isc/3, isc%3, DEVICE); - solve1(vectorInOut, vector1, source); - vectorAuxF.copy(vectorInOut); + solve1(vectorInOut_ppa, vectorInOut_pma, vector1, source); + vectorAuxD.pack_propagator(vectorInOut_ppa, + vectorInOut_pma, + source[DIM_T], + HGC_totalL[DIM_T]/2); + vectorAuxF.copy(vectorAuxD); prop_packed.absorb(vectorAuxF, isc/3, isc%3); }; @@ -311,76 +322,7 @@ int main(int argc, char **argv) { TIME(computePropagator(prop_packed)); -#if 0 - auto computePropagator = [&](PLEGMA_Propagator& prop_packed, - PLEGMA_Propagator& prop_PPA, - PLEGMA_Propagator& prop_PMA, - int nSmear) { - - for(int isc = 0 ; isc < 12 ; isc++){ - - PLEGMA_Vector vectorAuxD; - PLEGMA_Vector vectorAuxF; - - PLEGMA_Vector vectorInOut_a; - PLEGMA_Vector vectorInOut_p; - - PLEGMA_Vector vectorInOut_ppa; - PLEGMA_Vector vectorInOut_pma; - - { // Smearing the source - PLEGMA_Vector3D vector1, vector2; - vector1.pointSource(source, isc/3, isc%3, DEVICE); - TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); - vectorInOut_a.absorb(vector2,source[DIM_T]); - } - // Inverting - PLEGMA_printf("Going to invert for component %d\n", isc); - - updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); - TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); - - { // Smearing the source - PLEGMA_Vector3D vector1, vector2; - vector1.pointSource(source, isc/3, isc%3, DEVICE); - TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); - vectorInOut_p.absorb(vector2,source[DIM_T]); - } - // Inverting - PLEGMA_printf("Going to invert for component %d\n", isc); - - updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); - TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); - - vectorInOut_ppa.copy(vectorInOut_p); - vectorInOut_ppa.add(vectorInOut_a,1); - - TIME(vectorAuxD.gaussianSmearing(vectorInOut_ppa, smearedGauge, nSmear, alphaGauss)); - vectorInOut_ppa.copy(vectorAuxD); - vectorAuxF.copy(vectorAuxD); - prop_PPA.absorb(vectorAuxF, isc/3, isc%3); - - - vectorInOut_pma.copy(vectorInOut_p); - vectorInOut_pma.add(vectorInOut_a,-1); - - TIME(vectorAuxD.gaussianSmearing(vectorInOut_pma, smearedGauge, nSmear, alphaGauss)); - vectorInOut_pma.copy(vectorAuxD); - vectorAuxF.copy(vectorAuxD); - prop_PMA.absorb(vectorAuxF, isc/3, isc%3); - - vectorAuxD.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source[DIM_T], HGC_totalL[DIM_T]/2); - vectorAuxF.copy(vectorAuxD); - prop_packed.absorb(vectorAuxF, isc/3, isc%3); - - } - }; - TIME(computePropagator(prop_packed, prop_PPA, prop_PMA, nsmearGauss)); -#endif - - //N diagram + //N diagram { std::vector> mtot = sourcemomentumList_twopt.uniq_p(3); momList list_mtot(1,{mtot,},{0,}); @@ -413,38 +355,22 @@ int main(int argc, char **argv) { //TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_PPA, prop_PPA, prop_PPA)); //write N -#if 0 - outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_N_PPA"; - - TIME( corrN_PPA.N_diagrams( reductionsT1, reductionsT2 ) ); - TIME( corrN_PPA.apply_phase() ); - TIME( corrN_PPA.apply_sign("N")); - TIME( corrN_PPA.writeHDF5(outfilename)); - - TIME(reductionsT1.T1(glist_source_nucleon, glist_sink_nucleon, prop_PMA, prop_PMA, prop_PMA)); - TIME(reductionsT2.T2(glist_source_nucleon, glist_sink_nucleon, prop_PMA, prop_PMA, prop_PMA)); - - //write N - outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_N_PMA"; - - TIME( corrN_PMA.N_diagrams( reductionsT1, reductionsT2 ) ); - TIME( corrN_PMA.apply_phase() ); - TIME( corrN_PMA.apply_sign("N")); - TIME( corrN_PMA.writeHDF5(outfilename)); -#endif } vectorSource_stochastic.randInit(rand_seed1); for (int i=0; i(source_reduction, sourcemomentumList_twopt.uniq_p(1))); + reductions_V4_B.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(1))); + + reductions_V2_B.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(1))); + + reductions_V3_W.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(2))); - reductions_V3_GAMMAF2_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(2))); - reductions_V3_GAMMAF2GAMMA5_U.push_back(new PLEGMA_ScattCorrelator(source_reduction, sourcemomentumList_twopt.uniq_p(2))); PLEGMA_Vector vectorPropagator_stochastic; - PLEGMA_Vector vectorInOut; + PLEGMA_Vector vectorPropagator_stochastic_ppa; + PLEGMA_Vector vectorPropagator_stochastic_pma; if (readstochastic==0){ vectorSource_stochastic.stochastic_Z(nroots); PLEGMA_Vector vectorAuxF; @@ -452,119 +378,33 @@ int main(int argc, char **argv) { vectorAuxF.unload(); vectorAuxF.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); vectorPropagator_stochastic.scale(0.0); + if (timedilution){ PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - PLEGMA_Vector3D vectorIn; - vectorIn.absorb(vectorSource_stochastic,timeidx); - site source_in=site({0,0,0,timeidx}); - solve1(vectorInOut, vectorIn, source_in); - vectorPropagator_stochastic.absorbTimeslice(vectorInOut, timeidx, false); - } - } - + PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; + PLEGMA_Vector3D vectorIn; + vectorIn.absorb(vectorSource_stochastic,timeidx); + site source_in=site({0,0,0,timeidx}); - //In vectorAuxD2 we store the results for the inversion + solve1(vectorInOut_ppa, vectorInOut_pma, vectorIn, source_in); - //vectorAuxD2_ppa.scale(0.0); - //vectorAuxD2_pma.scale(0.0); + vectorPropagator_stochastic_ppa.absorbTimeslice(vectorInOut_ppa, timeidx, false); + vectorPropagator_stochastic_pma.absorbTimeslice(vectorInOut_pma, timeidx, false); -#if 0 - vectorSource_stochastic.stochastic_Z(nroots); - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorSource_stochastic); + } + } + vectorPropagator_stochastic.pack_propagator(vectorPropagator_stochastic_ppa, + vectorPropagator_stochastic_pma, + source[DIM_T], + HGC_totalL[DIM_T]/2); + vectorAuxF.copy(vectorPropagator_stochastic); vectorAuxF.unload(); - vectorAuxF.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); - //In vectorAuxD2 we store the results for the inversion - - vectorAuxD2_ppa.scale(0.0); - vectorAuxD2_pma.scale(0.0); - - if (timedilution){ - PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); - for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ - - //Step(5) pick out a particular timeslice from the source - vectorInOut_a.absorbTimeslice(vectorSource_stochastic, timeidx); - //Step(6) Solve - updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); - solver_a.solve(vectorInOut_a, vectorInOut_a); - - //Step(7) pick out a particular timeslice from the source - vectorInOut_p.absorbTimeslice(vectorSource_stochastic, timeidx);1 - //Step(8) Solve - updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); - solver_p.solve(vectorInOut_p, vectorInOut_p); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,1); - - //Step(7) absorbing the particular timeslice to a 4d vector - vectorAuxD2_ppa.absorbTimeslice(vectorTmp, timeidx, false); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,-1); - - //Step(7) absorbing the particular timeslice to a 4d vector - vectorAuxD2_pma.absorbTimeslice(vectorTmp, timeidx, false); - - } - } - else{ - PLEGMA_printf("#piN_scattering_length_12: No time dilution is used n stochastic propagators\n"); - vectorInOut_a.copy(vectorSource_stochastic); - updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); - solver_a.solve(vectorInOut_a, vectorInOut_a); - - vectorInOut_p.copy(vectorSource_stochastic,); - updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); - solver_p.solve(vectorInOut_p, vectorInOut_p); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,1); - - vectorAuxD2_ppa.copy(vectorTmp); - - vectorTmp.copy(vectorInOut_p); - vectorTmp.add(vectorInOut_a,-1); - - vectorAuxD2_pma.copy(vectorTmp); - - } - - //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_ppa, smearedGauge, nsmearGauss, alphaGauss )); - - { - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorAuxD1); - vectorAuxF.unload(); - vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_ppa"+std::to_string(i)+"_"+confnumber); - } - - stochastic_propagator_ppa.copy(vectorAuxD1); - - //Step(7) Smearing all the time slice in the propagator - TIME(vectorAuxD1.gaussianSmearing(vectorAuxD2_pma, smearedGauge, nsmearGauss, alphaGauss )); - - { - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorAuxD1); - vectorAuxF.unload(); - vectorAuxF.writeLIME(outfile_V+"globalTfulltimedilution_propagator_nstoch_pma"+std::to_string(i)+"_"+confnumber); - } - - stochastic_propagator_pma.copy(vectorAuxD1); - -#endif - + vectorAuxF.writeLIME("globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber); + vectorAuxF.load(); } else{ std::string inputfilename="globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber; @@ -584,14 +424,16 @@ int main(int argc, char **argv) { { PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectorPropagator_stochastic); - TIME(reductions_V3_GAMMAF2_U[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); - vectorAuxF.apply_gamma5(); - TIME(reductions_V3_GAMMAF2GAMMA5_U[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); + TIME(reductions_V2_B[i]->V2(vectorAuxF, glist_sink_nucleon, prop_packed, prop_packed, false)); + + TIME(reductions_V4_B[i]->V4(vectorAuxF, glist_sink_nucleon, prop_packed, prop_packed, false)); + + vectorAuxF.apply_gamma5(); + TIME(reductions_V3_W[i]->V3(vectorAuxF, glist_sink_meson, prop_packed, true)); + - vectorAuxF.copy(vectorSource_stochastic); - TIME(reductions_V4_GAMMAF1_U_U[i]->V4( vectorAuxF, glist_sink_meson, prop_packed, prop_packed, false)); } } @@ -617,21 +459,30 @@ int main(int argc, char **argv) { PLEGMA_Propagator propTS; - PLEGMA_ScattCorrelator corrB13_2pt(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrB14_2pt(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrB15_2pt(source, filtered_sourcemomentumList); - PLEGMA_ScattCorrelator corrB16_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB1_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB2_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB3_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB4_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrB5_2pt(source, filtered_sourcemomentumList); + + + + + corrB1_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B1"); + corrB2_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); - corrB13_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B13"); - corrB14_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B14"); - corrB15_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B15"); - corrB16_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B16"); + corrB3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); + + corrB4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); + + corrB5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); //pi plus at the source for(int isc = 0 ; isc < 12 ; isc++){ PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; PLEGMA_Vector vectorAuxF; //Performing the smearing PLEGMA_Vector3D vector1; @@ -640,7 +491,12 @@ int main(int argc, char **argv) { vector1.absorb( vectorAuxD, source[3]); vector1.mulMomentumPhases(momentum_i2,1); vector1.apply_gamma_scatt(glist_source_meson[0]); - solve1(vectorAuxD, vector1, source); + solve1(vectorInOut_ppa, vectorInOut_pma, vector1, source); + vectorAuxD.pack_propagator(vectorInOut_ppa, + vectorInOut_pma, + source[DIM_T], + HGC_totalL[DIM_T]/2); + vectorAuxF.copy(vectorAuxD); propTS.absorb(vectorAuxF, isc/3, isc%3); } @@ -651,17 +507,17 @@ int main(int argc, char **argv) { vectorSource_stochastic.stochastic_Z(nroots); - PLEGMA_ScattCorrelator reductions_V3_GAMMAF2_SEQ(source_reduction, sourcemomentumList_twopt.uniq_p(2));//implemented + PLEGMA_ScattCorrelator reductions_V3_B(source_reduction, sourcemomentumList_twopt.uniq_p(2));//implemented { PLEGMA_Vector vectorAuxF; vectorAuxF.copy(vectorSource_stochastic); - TIME(reductions_V3_GAMMAF2_SEQ.V3(vectorAuxF, glist_sink_meson, propTS, true)); + TIME(reductions_V3_B.V3(vectorAuxF, glist_sink_meson, propTS, true)); - TIME(corrB13_2pt.Recombination(reductions_V3_GAMMAF2_SEQ, - *reductions_V4_GAMMAF1_U_U[i], + TIME(corrB1_2pt.Recombination(reductions_V3_B, + *reductions_V4_B[i], false, 1, false, @@ -671,25 +527,69 @@ int main(int argc, char **argv) { false, false, true)); +/*template +void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator &srcV3, + PLEGMA_ScattCorrelator &srcV2, + bool matrix, + int index_abs, + bool transp_source_sink, + int ig_i2, + bool transpgamma_i1, + bool transpgamma_f1, + bool oet, + bool threept, + bool accum){*/ + TIME(corrB2_2pt.Recombination(reductions_V3_B, + *reductions_V4_B[i], + true, + 0, + false, + 0, + true, + false, + false, + false, + true)); + + TIME(corrB3_2pt.Recombination(reductions_V3_B, + *reductions_V2_B[i], + false, + 0, + false, + 0, + true, + false, + false, + false, + true)); + + TIME(corrB4_2pt.Recombination(reductions_V3_B, + *reductions_V2_B[i], + true, + 1, + false, + 0, + true, + false, + false, + false, + true)); + + TIME(corrB5_2pt.Recombination(reductions_V3_B, + *reductions_V2_B[i], + true, + 2, + true, + 0, + true, + false, + false, + false, + true)); - } - - - - PLEGMA_ScattCorrelator reductions_V4_GAMMAF1_1(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - PLEGMA_ScattCorrelator reductions_V4_GAMMAF1_2(source_reduction, sourcemomentumList_twopt.uniq_p(1)); - - { - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorSource_stochastic); - - TIME(reductions_V4_GAMMAF1_1.V4( vectorAuxF, glist_sink_nucleon, prop_packed, propTS, false)); - TIME(reductions_V4_GAMMAF1_2.V4( vectorAuxF, glist_sink_nucleon, propTS, prop_packed, false)); } - - } From f15960f484052947fca9099b7d88292e5f548d7e Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 5 May 2025 10:31:50 +0200 Subject: [PATCH 153/168] including W,Z diagrams in the N=1/2 code --- plegma/piN_scattering_length_12.cpp | 457 ++++++++++++++++------------ 1 file changed, 261 insertions(+), 196 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 4ff843e9..5de48bfd 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -23,37 +23,6 @@ void produceOutput( PLEGMA_ScattCorrelator source, int n_stochastic_samples){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions( true )); - TIME(source.normalize_nstoch(n_stochastic_samples)); - TIME(source.writeHDF5( outputFilename )); - -} - -void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, - std::string outputFilename, - std::string diagram_name, - int n_stochastic_samples, - int n_coherent_source, - int *attract_look_up_table){ - TIME(source.apply_phase()); - TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); - TIME(source.normalize_nstoch(n_stochastic_samples)); - TIME(source.writeHDF5( outputFilename )); - -} - - -void produceOutput_3pt( PLEGMA_ScattCorrelator source, - std::string outputFilename, - std::string diagram_name, - int n_stochastic_samples, - int n_coherent_source, - int *attract_look_up_table, - int source_sink_separation){ - TIME(source.apply_phase()); - TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions_3pt( true, n_coherent_source, attract_look_up_table, source_sink_separation )); TIME(source.normalize_nstoch(n_stochastic_samples)); TIME(source.writeHDF5( outputFilename )); @@ -65,19 +34,6 @@ void produceOutput( PLEGMA_ScattCorrelator source, ){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions( true )); - TIME(source.writeHDF5( outputFilename )); -} - -void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, - std::string outputFilename, - std::string diagram_name, - int n_coherent_source, - int *attract_look_up_table - ){ - TIME(source.apply_phase()); - TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); TIME(source.writeHDF5( outputFilename )); } @@ -230,12 +186,6 @@ int main(int argc, char **argv) { PLEGMA_Vector stochastic_oet_prop_zero_mom_packed; PLEGMA_Vector stochastic_oet_prop_fini_mom_packed; - PLEGMA_Vector stochastic_oet_prop_zero_mom_ppa; - PLEGMA_Vector stochastic_oet_prop_fini_mom_ppa; - - PLEGMA_Vector stochastic_oet_prop_zero_mom_pma; - PLEGMA_Vector stochastic_oet_prop_fini_mom_pma; - /* PART I: Computing point to all propagators: a; nucleon correlation function b; factors using stochastic source + boundary conditions @@ -466,18 +416,44 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrB5_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW1_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW2_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW3_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW4_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW5_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW6_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW7_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW8_2pt(source, filtered_sourcemomentumList); + PLEGMA_ScattCorrelator corrW9_2pt(source, filtered_sourcemomentumList); corrB1_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B1"); corrB2_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); - corrB3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); + corrB3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B3"); + + corrB4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B4"); + + corrB5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B5"); - corrB4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); + corrW1_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W1"); - corrB5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "B2"); + corrW2_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W2"); + corrW3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W3"); + + corrW4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W4"); + + corrW5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W5"); + + corrW6_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W6"); + + corrW7_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W7"); + + corrW8_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W8"); + + corrW9_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson,"12", "W9"); //pi plus at the source for(int isc = 0 ; isc < 12 ; isc++){ @@ -509,49 +485,52 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductions_V3_B(source_reduction, sourcemomentumList_twopt.uniq_p(2));//implemented - { - PLEGMA_Vector vectorAuxF; - vectorAuxF.copy(vectorSource_stochastic); - - TIME(reductions_V3_B.V3(vectorAuxF, glist_sink_meson, propTS, true)); - - - TIME(corrB1_2pt.Recombination(reductions_V3_B, - *reductions_V4_B[i], - false, - 1, - false, - 0, - true, - false, - false, - false, - true)); -/*template -void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator &srcV3, - PLEGMA_ScattCorrelator &srcV2, - bool matrix, - int index_abs, - bool transp_source_sink, - int ig_i2, - bool transpgamma_i1, - bool transpgamma_f1, - bool oet, - bool threept, - bool accum){*/ - TIME(corrB2_2pt.Recombination(reductions_V3_B, + PLEGMA_ScattCorrelator reductions_V4_W(source_reduction, sourcemomentumList_twopt.uniq_p(1));//implemented + + PLEGMA_ScattCorrelator reductions_V2_W1(source_reduction, sourcemomentumList_twopt.uniq_p(1));//implemented + + PLEGMA_ScattCorrelator reductions_V2_W2(source_reduction, sourcemomentumList_twopt.uniq_p(1));//implemented + + + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorSource_stochastic); + + TIME(reductions_V3_B.V3(vectorAuxF, glist_sink_meson, propTS, true)); + + vectorAuxF.apply_gamma5(); + + TIME(reductions_V4_W.V4(vectorAuxF, glist_sink_nucleon, prop_packed, propTS, true)); + + TIME(reductions_V2_W1.V2(vectorAuxF, glist_sink_nucleon, prop_packed, propTS, true)); + + TIME(reductions_V2_W2.V2(vectorAuxF, glist_sink_nucleon, propTS, prop_packed, true)); + + + TIME(corrB1_2pt.Recombination(reductions_V3_B, + *reductions_V4_B[i], + false, + 1, + false, + 0, + true,//checked + false, + false, + false, + true)); + + TIME(corrB2_2pt.Recombination(reductions_V3_B, *reductions_V4_B[i], true, 0, false, 0, - true, + true,//checked false, false, false, true)); - TIME(corrB3_2pt.Recombination(reductions_V3_B, + TIME(corrB3_2pt.Recombination(reductions_V3_B, *reductions_V2_B[i], false, 0, @@ -563,7 +542,7 @@ void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator false, true)); - TIME(corrB4_2pt.Recombination(reductions_V3_B, + TIME(corrB4_2pt.Recombination(reductions_V3_B, *reductions_V2_B[i], true, 1, @@ -575,7 +554,7 @@ void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator false, true)); - TIME(corrB5_2pt.Recombination(reductions_V3_B, + TIME(corrB5_2pt.Recombination(reductions_V3_B, *reductions_V2_B[i], true, 2, @@ -587,12 +566,135 @@ void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator false, true)); + TIME(corrW1_2pt.Recombination(*reductions_V3_W[i], + reductions_V4_W, + false, + 1, + false, + 0, + true, + false, + false, + false, + true)); - } + TIME(corrW2_2pt.Recombination(*reductions_V3_W[i], + reductions_V4_W, + false, + 2, + false, + 0, + true, + false, + false, + false, + true)); + + TIME(corrW3_2pt.Recombination(*reductions_V3_W[i], + reductions_V2_W1, + false, + 0, + false, + 0, + false, + false, + false, + false, + true)); + + TIME(corrW4_2pt.Recombination(*reductions_V3_W[i], + reductions_V2_W1, + false, + 2, + true, + 0, + false, + false, + false, + false, + true)); + + TIME(corrW5_2pt.Recombination(*reductions_V3_W[i], + reductions_V4_W, + true, + 0, + false, + 0, + false, + false, + false, + false, + true)); + + TIME(corrW6_2pt.Recombination(*reductions_V3_W[i], + reductions_V2_W1, + true, + 1, + false, + 0, + false, + false, + false, + false, + true)); + + TIME(corrW7_2pt.Recombination(*reductions_V3_W[i], + reductions_V2_W2, + false, + 2, + true, + 0, + true, + false, + false, + false, + true)); + + TIME(corrW8_2pt.Recombination(*reductions_V3_W[i], + reductions_V2_W2, + true, + 1, + false, + 0, + false, + false, + false, + false, + true)); + + TIME(corrW9_2pt.Recombination(*reductions_V3_W[i], + reductions_V2_W2, + false, + 0, + false, + 0, + false, + false, + false, + false, + true)); + + } + TIME(produceOutput(corrB1_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB2_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB3_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB4_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrB5_2pt, outfilename, "4pt", n_stochastic_samples)); + + TIME(produceOutput(corrW1_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW2_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW3_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW4_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW5_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW6_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW7_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW8_2pt, outfilename, "4pt", n_stochastic_samples)); + TIME(produceOutput(corrW9_2pt, outfilename, "4pt", n_stochastic_samples)); + } @@ -609,65 +711,38 @@ void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator //Doing for +mu for the UP propagator spin dilution oet site source_local = sourcePositions[isource]; - - PLEGMA_Vector vectortmp1; - - PLEGMA_Vector vectorInOut_p; - PLEGMA_Vector vectorInOut_a; + PLEGMA_Vector3D vectorIn1; + vectorIn1.absorb(vectorSource_stochastic,source_local[DIM_T]); - PLEGMA_Vector vectorInOut_ppa; - PLEGMA_Vector vectorInOut_pma; + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; - { // Smearing the source + solve1(vectorInOut_ppa, vectorInOut_pma, vectorIn1, source_local); + vectorAuxD.pack_propagator(vectorInOut_ppa, + vectorInOut_pma, + source_local[DIM_T], + HGC_totalL[DIM_T]/2); - PLEGMA_Vector3D vector1, vector2; - vector1.absorb(vectorStoc_source_oet, source_local[DIM_T]); - PLEGMA_Gauge3D smearedGauge3D; - smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); - TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vectortmp1.absorb(vector2, source_local[DIM_T]); - } - - vectorInOut_a.copy(vectortmp1); - updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); - TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); - - vectorInOut_p.copy(vectortmp1); - updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); - TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); + stochastic_oet_prop_zero_mom_packed.copy(vectorAuxD); - vectorInOut_ppa.copy(vectorInOut_p); - vectorInOut_ppa.add(vectorInOut_a,1); - - vectorInOut_pma.copy(vectorInOut_p); - vectorInOut_pma.add(vectorInOut_a,-1); - - TIME(vectorInOut_a.gaussianSmearing(vectorInOut_ppa, smearedGauge, nsmearGauss, alphaGauss)); - vectorInOut_ppa.copy(vectorInOut_a); + }//end of do_stochastic_oet - TIME(vectorInOut_a.gaussianSmearing(vectorInOut_pma, smearedGauge, nsmearGauss, alphaGauss)); - vectorInOut_pma.copy(vectorInOut_a); + PLEGMA_ScattCorrelator reductionsV2_Z(source_reduction, list_mpf1_twopt); + PLEGMA_ScattCorrelator reductionsV4_Z(source_reduction, list_mpf1_twopt); + TIME(reductionsV2_Z.V2( stochastic_oet_prop_zero_mom_packed, glist_sink_nucleon, prop_packed, prop_packed, true)); + TIME(reductionsV4_Z.V4( stochastic_oet_prop_zero_mom_packed, glist_sink_nucleon, prop_packed, prop_packed, true)); - vectortmp1.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source_local[DIM_T], HGC_totalL[DIM_T]/2); + { - - //Gaussian smearing of the propagator - //TIME(vectorInOut_a.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + PLEGMA_ScattCorrelator reductionsV3_Z(source_reduction, list_mpf2_twopt); - stochastic_oet_prop_zero_mom_ppa.copy(vectorInOut_ppa); - stochastic_oet_prop_zero_mom_pma.copy(vectorInOut_pma); - stochastic_oet_prop_zero_mom_packed.copy(vectortmp1); + PLEGMA_ScattCorrelator corrPION(source, list_mpi2_twopt); - }//end of do_stochastic_oet - { - PLEGMA_ScattCorrelator corrPION(source, list_mpi2_twopt); PLEGMA_ScattCorrelator corrPION_PPA(source, list_mpi2_twopt); PLEGMA_ScattCorrelator corrPION_PMA(source, list_mpi2_twopt); @@ -675,16 +750,31 @@ void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator corrPION.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); - corrPION_PPA.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); - corrPION_PMA.initialize_diagram(glist_source_meson, glist_sink_meson, "PPUP"); - //We first have a loop over all unique the source meson momentum p_i2 for (int i_mpi2=0; i_mpi2 corrZ1_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ2_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ3_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ4_2pt(source, filtered_sourcemomentumList_2pt); + PLEGMA_ScattCorrelator corrZ5_2pt(source, filtered_sourcemomentumList_2pt); + + + corrZ1_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z1"); + + corrZ2_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z2"); + + corrZ3_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z3"); + + corrZ4_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z4"); + + corrZ5_2pt.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_meson, glist_sink_nucleon, glist_sink_meson, "12", "Z5"); std::string pi2x=std::to_string(momentum_i2[0]); std::string pi2y=std::to_string(momentum_i2[1]); @@ -694,87 +784,62 @@ void PLEGMA_ScattCorrelator::Recombination(PLEGMA_ScattCorrelator { site source_local = sourcePositions[isource]; + PLEGMA_Vector3D vectorIn1; + vectorIn1.absorb(vectorSource_stochastic,source_local[DIM_T]); + vectorIn1.mulMomentumPhases(momentum_i2,-1); - PLEGMA_Vector vectortmp1; - - PLEGMA_Vector vectorInOut_p; - PLEGMA_Vector vectorInOut_a; - - PLEGMA_Vector vectorInOut_ppa; - PLEGMA_Vector vectorInOut_pma; - - vectortmp1.copy(vectorStoc_source_oet); - - std::vector tmp_4Dmom= momentum_i2 ; - tmp_4Dmom.push_back(0); - vectortmp1.mulMomentumPhases(tmp_4Dmom,-1); - { // Smearing the source - - PLEGMA_Vector3D vector1, vector2; - vector1.absorb(vectortmp1, source_local[DIM_T]); - PLEGMA_Gauge3D smearedGauge3D; - smearedGauge3D.absorb(smearedGauge, source_local[DIM_T]); - TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nsmearGauss, alphaGauss)); - vectortmp1.absorb(vector2, source_local[DIM_T],true); + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; + PLEGMA_Vector vectorAuxF; + + solve1(vectorInOut_ppa, vectorInOut_pma, vectorIn1, source_local); + vectorAuxD.pack_propagator(vectorInOut_ppa, + vectorInOut_pma, + source_local[DIM_T], + HGC_totalL[DIM_T]/2); - } - - vectorInOut_a.copy(vectortmp1); - updateGaugeQuda(gauge, true); - solver_a.UpdateSolver(); - TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); + + stochastic_oet_prop_fini_mom_packed.copy(vectorAuxD); + - vectorInOut_p.copy(vectortmp1); - updateGaugeQuda(gauge, false); - solver_p.UpdateSolver(); - TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); + } - vectorInOut_ppa.copy(vectorInOut_p); - vectorInOut_ppa.add(vectorInOut_a,1); + PLEGMA_Vector st_oet_fini; + st_oet_fini.copy(stochastic_oet_prop_fini_mom_packed); - vectorInOut_pma.copy(vectorInOut_p); - vectorInOut_pma.add(vectorInOut_a,-1); - - TIME(vectortmp1.gaussianSmearing(vectorInOut_ppa, smearedGauge, nsmearGauss, alphaGauss)); - stochastic_oet_prop_fini_mom_ppa.copy(vectortmp1); + st_oet_fini.apply_gamma5(); - TIME(vectortmp1.gaussianSmearing(vectorInOut_pma, smearedGauge, nsmearGauss, alphaGauss)); - stochastic_oet_prop_fini_mom_pma.copy(vectortmp1); + TIME(reductionsV3_Z.V3( st_oet_fini, glist_sink_meson, prop_packed, true)); - vectortmp1.pack_propagator(vectorInOut_ppa, vectorInOut_pma, source_local[DIM_T], HGC_totalL[DIM_T]/2); + + TIME(corrZ1_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, false, 0, false, 0, true, false, false, false, true )); + TIME(corrZ2_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, false, 2, true, 0, true, false, false, true, false )); - //Gaussian smearing of the propagator - TIME(vectorInOut_a.gaussianSmearing(vectortmp1, smearedGauge, nsmearGauss, alphaGauss)); + TIME(corrZ3_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, true, 1, false, 0, true, false, false, false, true )); - stochastic_oet_prop_fini_mom_packed.copy(vectorInOut_a); + TIME(corrZ4_2pt.Recombination( reductionsV3_Z, reductionsV4_Z, false, 2, false, 0, true, false, false, false, true )); + + TIME(corrZ5_2pt.Recombination( reductionsV3_Z, reductionsV4_Z, true, 0, false, 0, true, false, false, false, true )); - } + TIME(produceOutput(corrZ1_2pt, outfilename, "4pt")); + TIME(produceOutput(corrZ2_2pt, outfilename, "4pt")); + TIME(produceOutput(corrZ3_2pt, outfilename, "4pt")); + TIME(produceOutput(corrZ4_2pt, outfilename, "4pt")); + TIME(produceOutput(corrZ5_2pt, outfilename, "4pt")); - TIME(corrPION_PMA.P_diagrams( stochastic_oet_prop_zero_mom_pma, stochastic_oet_prop_fini_mom_pma, i_mpi2)); - TIME(corrPION_PPA.P_diagrams( stochastic_oet_prop_zero_mom_ppa, stochastic_oet_prop_fini_mom_ppa, i_mpi2)); TIME(corrPION.P_diagrams( stochastic_oet_prop_zero_mom_packed, stochastic_oet_prop_fini_mom_packed, i_mpi2)); + } outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_2pt"; TIME(corrPION.apply_sign("P")); TIME(corrPION.writeHDF5( outfilename )); - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_PPA_2pt"; - - TIME(corrPION_PPA.apply_sign("P")); - TIME(corrPION_PPA.writeHDF5( outfilename )); - - outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_P_PMA_2pt"; - - TIME(corrPION_PMA.apply_sign("P")); - TIME(corrPION_PMA.writeHDF5( outfilename )); - - } } }//loop in finalize From e2f58e71eccbcda8d75505b933f842a40bcd38e6 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Mon, 5 May 2025 13:35:42 +0200 Subject: [PATCH 154/168] correcting bug in piN_diagrams --- plegma/piN_scattering_length_12.cpp | 43 +++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 5de48bfd..81b7ab0e 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -37,20 +37,6 @@ void produceOutput( PLEGMA_ScattCorrelator source, TIME(source.writeHDF5( outputFilename )); } - -void produceOutput_3pt( PLEGMA_ScattCorrelator source, - std::string outputFilename, - std::string diagram_name, - int n_coherent_source, - int *attract_look_up_table, - int source_sink_separation - ){ - TIME(source.apply_phase()); - TIME(source.apply_sign(diagram_name)); - TIME(source.applyBoundaryConditions_3pt( true,n_coherent_source, attract_look_up_table, source_sink_separation )); - TIME(source.writeHDF5( outputFilename )); -} - int main(int argc, char **argv) { initializeOptions(argc, argv, true, listOpt); @@ -211,8 +197,6 @@ int main(int argc, char **argv) { PLEGMA_Propagator prop_packed(BOTH); //To be saved for all the coherent sources. - PLEGMA_Gauge3D smearedGauge3D; - smearedGauge3D.absorb(smearedGauge, source[DIM_T]); auto solve1 = [&](plegma::PLEGMA_Vector &ppa, plegma::PLEGMA_Vector &pma, @@ -224,6 +208,8 @@ int main(int argc, char **argv) { { // Smearing the source PLEGMA_Vector3D vector1; + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source[DIM_T]); TIME(vector1.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss)); vectorInOut_a.absorb(vector1,source[DIM_T]); } @@ -237,7 +223,7 @@ int main(int argc, char **argv) { updateGaugeQuda(gauge, false); TIME(solver_p.UpdateSolver()); TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); - + ppa.copy(vectorInOut_p); ppa.add(vectorInOut_a,1); @@ -328,10 +314,13 @@ int main(int argc, char **argv) { vectorAuxF.unload(); vectorAuxF.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); vectorPropagator_stochastic.scale(0.0); + vectorPropagator_stochastic_ppa.scale(0.0); + vectorPropagator_stochastic_pma.scale(0.0); if (timedilution){ PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + PLEGMA_printf("Inversion for timeslice %d\n", timeidx); PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; PLEGMA_Vector3D vectorIn; @@ -339,8 +328,20 @@ int main(int argc, char **argv) { vectorIn.absorb(vectorSource_stochastic,timeidx); site source_in=site({0,0,0,timeidx}); + double norm; + norm=vectorIn.norm(); + PLEGMA_printf("Norm2 %e\n", norm); + solve1(vectorInOut_ppa, vectorInOut_pma, vectorIn, source_in); + norm=vectorInOut_ppa.norm(); + PLEGMA_printf("PPA Norm2 %e\n", norm); + norm=vectorInOut_pma.norm(); + PLEGMA_printf("PMA Norm2 %e\n", norm); + + + PLEGMA_printf("Inversion done for timeslice %d\n", timeidx); + vectorPropagator_stochastic_ppa.absorbTimeslice(vectorInOut_ppa, timeidx, false); vectorPropagator_stochastic_pma.absorbTimeslice(vectorInOut_pma, timeidx, false); @@ -695,10 +696,18 @@ int main(int argc, char **argv) { TIME(produceOutput(corrW8_2pt, outfilename, "4pt", n_stochastic_samples)); TIME(produceOutput(corrW9_2pt, outfilename, "4pt", n_stochastic_samples)); + for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ + reductions_V4_B.pop_back(); + reductions_V2_B.pop_back(); + reductions_V3_W.pop_back(); + } + + } + /****************************************************** * * Step 5: Computing OET propagators From 5e7cd13b43a682c3bcd35825d8681703281fbb84 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 20 Nov 2025 14:54:56 +0100 Subject: [PATCH 155/168] including sm factors for Grace Hopper cards --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c46547f..454beccc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,8 +122,8 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS DEVEL RELEASE STRICT DEBUG string(REPLACE ":" ";" LIBRARY_DIRS $ENV{LD_LIBRARY_PATH}) set(DEFAULT_GPU_ARCH sm_60) -set(GPU_ARCH ${DEFAULT_GPU_ARCH} CACHE STRING "set the GPU architecture (sm_20, sm_21, sm_30, sm_35, sm_37, sm_50, sm_52, sm_60, sm_70, sm_80)") -set_property(CACHE GPU_ARCH PROPERTY STRINGS sm_20 sm_21 sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_70 sm_80) +set(GPU_ARCH ${DEFAULT_GPU_ARCH} CACHE STRING "set the GPU architecture (sm_20, sm_21, sm_30, sm_35, sm_37, sm_50, sm_52, sm_60, sm_70, sm_80, sm_90)") +set_property(CACHE GPU_ARCH PROPERTY STRINGS sm_20 sm_21 sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_70 sm_80 sm_90) # max threads set(PLEGMA_MAX_THREADS 256 CACHE INT "maximum number of threads per block in tuner") From 26d3ffd208cfe78d104f25691dfcc076d594b5c3 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 20 Nov 2025 15:02:04 +0100 Subject: [PATCH 156/168] adding wflow and solving bug for interface to multiplication of the Dirac operator --- include/utils/QUDA_interface.h | 24 ++++- utils/QUDA_interface.cpp | 185 ++++++++++++++++++++++++++------- 2 files changed, 171 insertions(+), 38 deletions(-) diff --git a/include/utils/QUDA_interface.h b/include/utils/QUDA_interface.h index df614267..a6fa6300 100644 --- a/include/utils/QUDA_interface.h +++ b/include/utils/QUDA_interface.h @@ -14,7 +14,7 @@ namespace quda { void *mg_preconditioner; QudaInvertParam inv_param; QudaInvertParam mg_inv_param; - QudaMultigridParam mg_param; + QudaMultigridParam mg_param; Dirac *D, *DSloppy, *DPre; DiracMatrix *M, *MSloppy, *MPre; std::vector b, x; @@ -26,7 +26,7 @@ namespace quda { QudaInvertParam getInvParams() const{return inv_param;} SolverParam* getSolverParam() const{return solverParam;} void UpdateSolver(); - + void UpdateGaugeSolver(); double Mu() const { return inv_param.mu;} int Nrhs() const { return inv_param.num_src;} @@ -75,4 +75,24 @@ namespace quda { template void apply(Float *dout, Float *din, QudaMassNormalization normType = QUDA_KAPPA_NORMALIZATION); // Default is without any normalization // Note that dout and din are device pointers }; + + // Forwarding overloads for PLEGMA_Vector + template + void quda::QUDA_dirac::apply(PLEGMA_Vector &Pout, + PLEGMA_Vector &Pin, + QudaMassNormalization normType) + { + // Forward to the generic bl=true template + return apply(Pout, Pin, normType); + } + + // Forwarding overloads for PLEGMA_Propagator + template + void quda::QUDA_dirac::apply(PLEGMA_Propagator &Pout, + PLEGMA_Propagator &Pin, + QudaMassNormalization normType) + { + // Forward to the generic bl=false template + return apply(Pout, Pin, normType); + } } diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index a470a18f..23a1e264 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -96,34 +96,37 @@ void gSmear_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge &gaugeIn, b QudaGaugeParam gauge_param = newQudaGaugeParam(); setGaugeParam(gauge_param); - gauge_param.type = QUDA_WILSON_LINKS; - gauge_param.make_resident_gauge = 0; + gauge_param.type = QUDA_SMEARED_LINKS; + gauge_param.reconstruct=QUDA_RECONSTRUCT_NO; + gauge_param.make_resident_gauge =0; double* new_gauge[N_DIMS]; for(int i=0; i &gaugeOut,PLEGMA_Gauge &gaugeIn, b } +void wilsonFlow_QUDA(PLEGMA_Gauge &gaugeOut, + PLEGMA_Gauge &gaugeIn, + int n_steps, double epsilon, double t0_start, + bool compute_plaquette, bool compute_qcharge) { + if (n_steps < 0) n_steps = 0; + + // Upload input as QUDA resident (precise) + // updateGaugeQuda(gaugeIn, false); + + // Host↔device metadata for saves + QudaGaugeParam gauge_param = newQudaGaugeParam(); + setGaugeParam(gauge_param); + gauge_param.make_resident_gauge = 0; + gauge_param.t_boundary = QUDA_PERIODIC_T; + + auto do_one_step = [&](double t0, bool restart_flag) { + QudaGaugeSmearParam sp = newQudaGaugeSmearParam(); + sp.smear_type = QUDA_GAUGE_SMEAR_WILSON_FLOW; + sp.n_steps = 1; // advance exactly one step per call + sp.epsilon = epsilon; + sp.t0 = t0; + sp.restart = restart_flag ? QUDA_BOOLEAN_TRUE : QUDA_BOOLEAN_FALSE; + sp.meas_interval = 2; // n_steps(=1) + 1 + + QudaGaugeObservableParam op = newQudaGaugeObservableParam(); + op.compute_plaquette = compute_plaquette ? QUDA_BOOLEAN_TRUE : + QUDA_BOOLEAN_FALSE; op.compute_qcharge = compute_qcharge ? QUDA_BOOLEAN_TRUE : QUDA_BOOLEAN_FALSE; + + performWFlowQuda(&sp, &op); + }; + + // Step 0 + do_one_step(t0_start, false); + + // Steps 1..n_steps-1 + for (int step = 1; step < n_steps; ++step) { + const double t0 = t0_start + step * epsilon; + do_one_step(t0, true); + + // Save smeared gauge right before the final step (to mirror PyQUDA) + if (step == n_steps - 1) { + QudaLinkType old_type = gauge_param.type; + QudaReconstructType old_recon = gauge_param.reconstruct; + + double *new_gauge[N_DIMS]; + // PLEGMA_printf(N_DIMS); + PLEGMA_printf("DIM to invert %d for all component\n",N_DIMS); + for (int mu = 0; mu < N_DIMS; ++mu) + hostMalloc(new_gauge[mu], gaugeIn.Bytes_total() / N_DIMS); + + gauge_param.type = QUDA_SMEARED_LINKS; + gauge_param.reconstruct = QUDA_RECONSTRUCT_NO; + saveGaugeQuda(new_gauge, &gauge_param); + gauge_param.type = QUDA_WILSON_LINKS; + + packGaugeToNormal(gaugeOut, new_gauge); + gaugeOut.load(); + gaugeOut.calculatePlaq(); + // initGaugeQuda(gaugeOut, false); + // plaqQuda(); + // gaugeOut.load(); + + for (int mu = 0; mu < N_DIMS; ++mu) + hostFree(new_gauge[mu], gaugeIn.Bytes_total() / N_DIMS); + + } + } +} void initGaugeQuda(PLEGMA_Gauge &gauge, bool antiperiodic, QudaLinkType type) { QudaGaugeParam gauge_param = newQudaGaugeParam(); @@ -366,6 +437,44 @@ static void updateMultigridParam(MG* mg, MGParam* current, QudaMultigridParam* p } } +void QUDA_solver::UpdateGaugeSolver() +{ + profiler->TPSTART(QUDA_PROFILE_TOTAL); + delete solver; + delete solverParam; + delete M; + delete MSloppy; + delete MPre; + + + delete D; D = NULL; + delete DSloppy; DSloppy = NULL; + delete DPre; DPre = NULL; + + loadCloverQuda(NULL, NULL, &inv_param); + + bool pc_solve = true; + createDirac(D, DSloppy, DPre, inv_param, pc_solve); + + // Create Operators + M = (inv_param.inv_type == QUDA_CG_INVERTER || inv_param.inv_type == QUDA_CA_CG_INVERTER) ? static_cast(new DiracMdagM(*D)) : static_cast(new DiracM(*D)); + MSloppy = (inv_param.inv_type == QUDA_CG_INVERTER || inv_param.inv_type == QUDA_CA_CG_INVERTER) ? static_cast(new DiracMdagM(*DSloppy)) : static_cast(new DiracM(*DSloppy)); + MPre = (inv_param.inv_type == QUDA_CG_INVERTER || inv_param.inv_type == QUDA_CA_CG_INVERTER) ? static_cast(new DiracMdagM(*DPre)) : static_cast(new DiracM(*DPre)); + + // Create Solvers + solverParam = new SolverParam(inv_param); + + solver = Solver::create(*solverParam, *M, *MSloppy, + *MPre, *MPre ); + + profiler->*get(Profiler_name()) = ((std::string)("Solver profiler mu=")+std::to_string(mu)).c_str(); + profiler->TPSTOP(QUDA_PROFILE_TOTAL); + profiler->Print(); + profiler->TPRESET(); + + +} + void QUDA_solver::UpdateSolver() { profiler->TPSTART(QUDA_PROFILE_TOTAL); @@ -585,33 +694,37 @@ void QUDA_dirac::apply(typename std::conditional, Pout.scale(1./(2*inv_param.kappa)); } } -templatevoid QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType){ - return apply( Pout, Pin, normType); -} -templatevoid QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType){ - return apply( Pout, Pin, normType); -} +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); + +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); + +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); + +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); + +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); + +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); + +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); + +template void QUDA_dirac::apply( + PLEGMA_Vector&, PLEGMA_Vector&, QudaMassNormalization_s); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); +// For PLEGMA_Propagator +template void quda::QUDA_dirac::apply(PLEGMA_Propagator&, PLEGMA_Propagator&, QudaMassNormalization_s); +template void quda::QUDA_dirac::apply(PLEGMA_Propagator&, PLEGMA_Propagator&, QudaMassNormalization_s); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Vector &Pout, PLEGMA_Vector &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); -template void QUDA_dirac::apply(PLEGMA_Propagator &Pout, PLEGMA_Propagator &Pin, QudaMassNormalization normType); template @@ -623,7 +736,7 @@ void QUDA_dirac::apply(Float *dout, Float *din, QudaMassNormalization normType){ plegma::copyFromQUDA((Float *)dout,out); if (normType == QUDA_MASS_NORMALIZATION || normType == QUDA_ASYMMETRIC_MASS_NORMALIZATION) - cuBLAS::scal(N_SPINS*N_COLS*HGC_localVolume, (Float) (1./(2*inv_param.kappa)), dout); + cuBLAS::scal(N_SPINS*N_COLS*HGC_localVolume, (Float) (1./(2*inv_param.kappa)), dout); } template void QUDA_dirac::apply(float *dout, float *din, QudaMassNormalization normType); From c611f364f70046bf44d5080eecfd3224da7517a5 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 20 Nov 2025 15:02:55 +0100 Subject: [PATCH 157/168] include forgetted header --- include/PLEGMA_utils.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/PLEGMA_utils.h b/include/PLEGMA_utils.h index f8eb94bd..d352d4b1 100644 --- a/include/PLEGMA_utils.h +++ b/include/PLEGMA_utils.h @@ -51,6 +51,12 @@ void gFixingLandauOVR_QUDA(PLEGMA_Gauge &gaugeOut, PLEGMA_Gauge int maxiter=10000,int verbosePerSteps=1, int reunit_interval=1, int stop_theta=0); void gSmear_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge &gaugeIn, bool antiperiodic); +void wilsonFlow_QUDA(PLEGMA_Gauge &gaugeOut, + PLEGMA_Gauge &gaugeIn, int n_steps, double epsilon, + double t0_start, bool compute_plaquette, + bool compute_qcharge); + + //============= QUDA_params.cpp ===================================// void infoQuda(); From 3ff487f4a1982c006159bb105a62dde57c2b8700 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 3 Feb 2026 10:11:24 +0100 Subject: [PATCH 158/168] adding LIBE stuff to my branch --- include/PLEGMA_Correlator.h | 68 ++- include/PLEGMA_Gauge.h | 3 + include/PLEGMA_GaugeU1.h | 40 ++ lib/PLEGMA_Correlator.cu | 111 ++++- lib/PLEGMA_Gauge.cu | 4 + lib/PLEGMA_GaugeU1.cu | 280 +++++++++++ lib/kernels/PLEGMA_baryons_EEE.cuh | 286 +++++++++++ lib/kernels/PLEGMA_gammas_scatt.cuh | 2 +- lib/kernels/PLEGMA_gauge_utils.cuh | 52 ++ lib/kernels/PLEGMA_kernel_getSet.cuh | 84 ++++ lib/kernels/PLEGMA_mesonsOpen.cuh | 6 +- lib/kernels/PLEGMA_mesonsOpen_LIBE.cuh | 150 ++++++ lib/kernels/PLEGMA_mesonsOpen_SIB.cuh | 153 ++++++ lib/kernels/PLEGMA_mesonsOpen_SIR.cuh | 152 ++++++ lib/kernels/PLEGMA_mesonsOpen_defl.cuh | 150 ++++++ lib/kernels/PLEGMA_mesons_LIBE.cuh | 154 ++++++ lib/kernels/PLEGMA_mesons_SIB.cuh | 157 ++++++ lib/kernels/PLEGMA_mesons_SIR.cuh | 156 ++++++ lib/kernels/PLEGMA_mesons_exact_exact.cuh | 217 +++++++++ lib/kernels/PLEGMA_mesons_loop.cuh | 159 ++++++ lib/kernels/PLEGMA_mesons_loop_SIB.cuh | 159 ++++++ lib/kernels/PLEGMA_mesons_stoch_exact.cuh | 189 ++++++++ .../PLEGMA_mesons_stoch_exact_closed.cuh | 197 ++++++++ plegma/Calc_2pt_LIBE copy.cpp | 441 +++++++++++++++++ plegma/Calc_2pt_LIBE.cpp | 452 ++++++++++++++++++ 25 files changed, 3810 insertions(+), 12 deletions(-) create mode 100644 include/PLEGMA_GaugeU1.h create mode 100644 lib/PLEGMA_GaugeU1.cu create mode 100644 lib/kernels/PLEGMA_baryons_EEE.cuh create mode 100644 lib/kernels/PLEGMA_mesonsOpen_LIBE.cuh create mode 100644 lib/kernels/PLEGMA_mesonsOpen_SIB.cuh create mode 100644 lib/kernels/PLEGMA_mesonsOpen_SIR.cuh create mode 100644 lib/kernels/PLEGMA_mesonsOpen_defl.cuh create mode 100644 lib/kernels/PLEGMA_mesons_LIBE.cuh create mode 100644 lib/kernels/PLEGMA_mesons_SIB.cuh create mode 100644 lib/kernels/PLEGMA_mesons_SIR.cuh create mode 100644 lib/kernels/PLEGMA_mesons_exact_exact.cuh create mode 100644 lib/kernels/PLEGMA_mesons_loop.cuh create mode 100644 lib/kernels/PLEGMA_mesons_loop_SIB.cuh create mode 100644 lib/kernels/PLEGMA_mesons_stoch_exact.cuh create mode 100644 lib/kernels/PLEGMA_mesons_stoch_exact_closed.cuh create mode 100644 plegma/Calc_2pt_LIBE copy.cpp create mode 100644 plegma/Calc_2pt_LIBE.cpp diff --git a/include/PLEGMA_Correlator.h b/include/PLEGMA_Correlator.h index c83090c8..a951b7db 100644 --- a/include/PLEGMA_Correlator.h +++ b/include/PLEGMA_Correlator.h @@ -8,6 +8,7 @@ namespace plegma { // forward declaration template class PLEGMA_Vector; + template class PLEGMA_Vector3D; template class PLEGMA_Propagator; template class PLEGMA_Propagator3D; template class PLEGMA_Fmunu; @@ -191,6 +192,21 @@ namespace plegma { std::vector d = {s}; setGroups(d); } + void contractEigVecs(Float *ptr, int nvecs, size_t vec_size, bool dev_ptr); + + void contractPropEigVecs(PLEGMA_Propagator &prop1, Float *spinVals, + Float *ptr, int nvecs, size_t vec_size, bool dev_ptr); + + void contractPropEigVecsClosed(PLEGMA_Propagator &prop1, Float *spinVals, + Float *ptr, int nvecs, size_t vec_size, bool dev_ptr); + + void contractLoop(PLEGMA_Vector3D &vec, + PLEGMA_Propagator3D &prop); + + void contractLoopSIB(PLEGMA_Vector3D &vec, + PLEGMA_Propagator3D &prop); + + void contractMesons(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2); @@ -205,6 +221,42 @@ namespace plegma { void contractMesonsOpen(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2, bool all_cols=true); + + void contractMesons1ps(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + PLEGMA_Gauge &gauge, + bool all_cols=true); + + void contractMesonsSIB(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2); + + void contractMesonsOpenSIB(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2); + + void contractMesonsSIR(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2); + + void contractMesonsOpenSIR(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2); + + void contractMesonsOpenDefl(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2); + + void contractMesons1psSIB(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + PLEGMA_Gauge &gauge); + + void contractMesonsLIBE(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2); + + void contractMesonsOpenLIBE(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2); + + void contractMesons1psLIBE(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + PLEGMA_Gauge &gauge); + + void contractMesonsAll(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2); @@ -216,13 +268,17 @@ namespace plegma { PLEGMA_Propagator &prop2, PLEGMA_Propagator &prop3, PLEGMA_Propagator &prop4); - + + void contractBaryonsEEE(Float *ptr, Float* evs, int nvecs, size_t vec_size, bool dev_ptr); + + void contractBaryonsUDSC(PLEGMA_Propagator &propUP, - PLEGMA_Propagator &propDN, - PLEGMA_Propagator &propST, - PLEGMA_Propagator &propCH, - bool only_st=false, bool only_ch=false); - + PLEGMA_Propagator &propDN, + PLEGMA_Propagator &propST, + PLEGMA_Propagator &propCH, + bool only_up = false, bool only_dn = false, + bool only_st = false, bool only_ch = false, bool excludeHeavyOnly = false); + template void contractTetraquarks(PLEGMA_Propagator &propLT, PLEGMA_Propagator &propST, diff --git a/include/PLEGMA_Gauge.h b/include/PLEGMA_Gauge.h index c8a8ae05..10e6a603 100644 --- a/include/PLEGMA_Gauge.h +++ b/include/PLEGMA_Gauge.h @@ -1,4 +1,5 @@ #include +#include #include "complex" #ifndef _PLEGMA_GAUGE_H @@ -120,6 +121,8 @@ namespace plegma { **/ void gluonField(PLEGMA_Gauge &uIn); void U3xU1(PLEGMA_Gauge &u3, PLEGMA_U1Gauge &u1); + void mul_dag(PLEGMA_Gauge &uIn); + void qedPhase(PLEGMA_GaugeU1 &uIn, Float phase); }; ///////////////////////////////////// diff --git a/include/PLEGMA_GaugeU1.h b/include/PLEGMA_GaugeU1.h new file mode 100644 index 00000000..49e86a81 --- /dev/null +++ b/include/PLEGMA_GaugeU1.h @@ -0,0 +1,40 @@ +#include +#include "complex" + +#ifndef _PLEGMA_GAUGEU1_H +#define _PLEGMA_GAUGEU1_H + +namespace plegma { + template class PLEGMA_Su3field; + //////////////////////// + // CLASS: PLEGMA_GaugeU1 // + //////////////////////// + + template + class PLEGMA_GaugeU1 : virtual public PLEGMA_Field { + public: + PLEGMA_GaugeU1(ALLOCATION_FLAG alloc_flag=BOTH, GHOST_FLAG ghost_flag=FIRST_CORNER); + ~PLEGMA_GaugeU1(){;} + Float calculatePlaq(Float phase); + /* + void absorbDir_device(PLEGMA_Su3field &su,int dir); + void absorbDir_host(PLEGMA_Su3field &su,int dir); + + + //PLEGMA_topocharge.cuh + Float calculateTopo(TOPO_CHARGE_DEF charge_def); + + //PLEGMA_WFlow.cuh + void GFlow_step( PLEGMA_GaugeU1 &Z, double eps ); + void applyGradientFlow( PLEGMA_GaugeU1 &Z, int N, double eps); + void unitarize(); + + void scaleDirWise(std::complex scale[N_DIMS]); + void momPhase(Float phase[N_DIMS],int mom[N_DIMS]); + void gFixingLandau(PLEGMA_GaugeU1 &uIn,Float overelaxPar=0.2,Float tolerance=1.0e-12,int maxIter=10000, int seedOverRelax=123456); + void gluonField(PLEGMA_GaugeU1 &uIn); + */ + }; +} + +#endif diff --git a/lib/PLEGMA_Correlator.cu b/lib/PLEGMA_Correlator.cu index 8d553818..3c4b7ecb 100644 --- a/lib/PLEGMA_Correlator.cu +++ b/lib/PLEGMA_Correlator.cu @@ -4,14 +4,27 @@ #include #include #include +#include +#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include +#include #include #include +#include +#include +#include #ifdef PLEGMA_UDSC_BARYONS #include #include @@ -42,6 +55,29 @@ initialize() { } } +template +void PLEGMA_Correlator:: +contractEigVecs(Float* ptr, int nvecs, size_t vec_size, bool dev_ptr){ +} +template +void PLEGMA_Correlator:: +contractPropEigVecs(PLEGMA_Propagator &prop1, Float *spinVals, Float* ptr, int nvecs, size_t vec_size, bool dev_ptr){ +} +template +void PLEGMA_Correlator:: +contractPropEigVecsClosed(PLEGMA_Propagator &prop1, Float *spinVals, Float* ptr, int nvecs, size_t vec_size, bool dev_ptr){ +} +template +void PLEGMA_Correlator:: +contractLoop(PLEGMA_Vector3D &vect, + PLEGMA_Propagator3D &prop){ +} +template +void PLEGMA_Correlator:: +contractLoopSIB(PLEGMA_Vector3D &vect, + PLEGMA_Propagator3D &prop){ +} + template void PLEGMA_Correlator:: contractMesons(PLEGMA_Propagator &prop1, @@ -73,6 +109,24 @@ contractMesonsNew(PLEGMA_Propagator &prop1, contract_mesons_new(prop1,prop2,*this); } +template +void PLEGMA_Correlator:: +contractMesonsSIR(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2){ +} +template +void PLEGMA_Correlator:: +contractMesonsSIB(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2){ +} + +template +void PLEGMA_Correlator:: +contractMesonsLIBE(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2){ +} + + template void PLEGMA_Correlator:: contractMesonsOpen(PLEGMA_Propagator &prop1, @@ -88,6 +142,54 @@ contractMesonsOpen(PLEGMA_Propagator &prop1, contract_mesons_open(prop1,prop2,*this,all_cols); } +template +void PLEGMA_Correlator:: +contractMesonsOpenSIR(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2){ +} + +template +void PLEGMA_Correlator:: +contractMesonsOpenSIB(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2){ +} +template +void PLEGMA_Correlator:: +contractMesonsOpenDefl(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2){ +} + +template +void PLEGMA_Correlator:: +contractMesonsOpenLIBE(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2){ +} + + + +template +void PLEGMA_Correlator:: +contractMesons1ps(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + PLEGMA_Gauge &gauge, + bool all_cols){ +} + +template +void PLEGMA_Correlator:: +contractMesons1psSIB(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + PLEGMA_Gauge &gauge){ +} + + +template +void PLEGMA_Correlator:: +contractMesons1psLIBE(PLEGMA_Propagator &prop1, + PLEGMA_Propagator &prop2, + PLEGMA_Gauge &gauge){ +} + template void PLEGMA_Correlator:: contractMesonsAll(PLEGMA_Propagator &prop1, @@ -130,6 +232,10 @@ contractTMDWFMesons(PLEGMA_Propagator &prop1, contract_TMDWF_mesons(prop1,prop2,*this, staple); } +template +void PLEGMA_Correlator:: +contractBaryonsEEE(Float* ptr, Float* evs, int nvecs, size_t vec_size, bool dev_ptr){ +} template void PLEGMA_Correlator:: @@ -179,8 +285,9 @@ void PLEGMA_Correlator:: contractBaryonsUDSC(PLEGMA_Propagator &propUP, PLEGMA_Propagator &propDN, PLEGMA_Propagator &propST, - PLEGMA_Propagator &propCH, - bool only_st, bool only_ch){ + PLEGMA_Propagator &propCH, + bool only_up, bool only_dn, + bool only_st, bool only_ch, bool excludeHeavyOnly){ #ifdef PLEGMA_UDSC_BARYONS shape = {}; diff --git a/lib/PLEGMA_Gauge.cu b/lib/PLEGMA_Gauge.cu index 46fb2d4e..233c14d4 100644 --- a/lib/PLEGMA_Gauge.cu +++ b/lib/PLEGMA_Gauge.cu @@ -277,6 +277,10 @@ void PLEGMA_Gauge::gluonField(PLEGMA_Gauge &uIn){ gluonField_k( toField2(*this), toField2(uIn)); } +template +void PLEGMA_Gauge::qedPhase(PLEGMA_GaugeU1 &uIn, Float phase){ + qedPhase_k(toField2(*this), toField2(uIn), phase); +} template void PLEGMA_Gauge::U3xU1(PLEGMA_Gauge &u3, PLEGMA_U1Gauge &u1){ U3xU1_k(*this,u3,u1); diff --git a/lib/PLEGMA_GaugeU1.cu b/lib/PLEGMA_GaugeU1.cu new file mode 100644 index 00000000..28231eab --- /dev/null +++ b/lib/PLEGMA_GaugeU1.cu @@ -0,0 +1,280 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace plegma; + +//--------------------------// +// class PLEGMA_GaugeU1 // +//--------------------------// + +template +PLEGMA_GaugeU1::PLEGMA_GaugeU1(ALLOCATION_FLAG alloc_flag, GHOST_FLAG ghost_flag): + PLEGMA_Field(alloc_flag, GAUGEU1, ghost_flag){ ; } + +template +Float PLEGMA_GaugeU1::calculatePlaq(Float phase){ + this->communicateGhost(-1,DIR_BOTH,FIRST_SIDE); + auto tex = toTexture(*this); + Float plaq = calculatePlaquetteU1(*tex, phase); + if(HGC_verbosity>0) PLEGMA_printf("Calculated plaquette U1 with phase %f is %.14f\n",phase,plaq); + return plaq; +} + +/* +template +Float PLEGMA_GaugeU1::calculateTopo( TOPO_CHARGE_DEF charge_def ){ + this->communicateGhost(-1,DIR_BOTH,FIRST_CORNER); + auto tex = toTexture(*this); + Float Q = calcTopoCharge(*tex, charge_def); + if(HGC_verbosity>0) PLEGMA_printf("Calculated topological charge is %.14f\n",Q); + return Q; +} + +template +Float PLEGMA_GaugeU1::calculatePlaqClover(){ + this->communicateGhost(-1,DIR_BOTH,FIRST_CORNER); + auto tex = toTexture(*this); + Float plaqClover = calcPlaqClovDef(*tex); + Float plaq = calculatePlaquette(*tex); + if(HGC_verbosity>0) PLEGMA_printf("TEST: Calculated plaquette with clover is %f; diff with reference: %e\n",plaqClover, plaqClover-plaq); + return plaqClover; +} + +template +Float PLEGMA_GaugeU1::calculatePlaqShifts(){ + PLEGMA_Su3field res(BOTH); + PLEGMA_Su3field tmp(BOTH); + PLEGMA_Su3field *u_s[4]; + for(int idir = 0; idir < 4 ; idir++){ + u_s[idir] = new PLEGMA_Su3field(BOTH); + u_s[idir]->absorbDir_device(*this,idir); + } + + Float resV=0; + for(int dir1 = 0; dir1 < 4; dir1++) + for(int dir2 = dir1+1; dir2 < 4; dir2++){ + int spath[] = {dir1,dir2,4+dir1,4+dir2}; + std::vector vspath(spath,spath+4); + res.path(vspath, u_s, tmp); + resV += res.sumRtraceU(); + } + Float plaqShifts = resV/(HGC_totalVolume*N_COLS*6); + + this->communicateGhost(-1,DIR_BOTH,FIRST_SIDE); + auto tex = toTexture(*this); + Float plaqRef = calculatePlaquette(*tex); + PLEGMA_printf("TEST: Calculated plaquette with shifts is %f; diff with reference: %e\n", plaqShifts, plaqShifts-plaqRef); + + for(int idir = 0; idir < 4 ; idir++) + delete u_s[idir]; + + return plaqShifts; +} + +template +Float PLEGMA_GaugeU1::calculatePlaqStaples(){ + + this->communicateGhost(-1,DIR_BOTH,FIRST_CORNER); + + Float plaqStaples = calcPlaqStaplesDef( toField2(*this) ); + + auto tex = toTexture(*this); + Float plaq = calculatePlaquette(*tex); + + if(HGC_verbosity>0) PLEGMA_printf("TEST: Calculated plaquette using staples is %f; diff with reference: %e\n", plaqStaples, plaqStaples-plaq); + return plaqStaples; +} + +template +Float PLEGMA_GaugeU1::calculatePlaqCorners(){ + this->communicateGhost(-1,DIR_BOTH,FIRST_CORNER); + auto tex = toTexture(*this); + Float plaqCorners = calculatePlaquetteCorners(*tex); + Float plaqRef = calculatePlaquette(*tex); + PLEGMA_printf("TEST: Calculated plaquette with corners is %f; diff with reference: %e\n",plaqCorners, plaqCorners-plaqRef); + return plaqCorners; +} + +template +void PLEGMA_GaugeU1::absorbDir_device(PLEGMA_Su3field &su,int dir){ + cudaMemcpy(this->d_elem + dir*(su.Field_length())*(su.Total_length())*2 , su.D_elem(), + su.Bytes_total(), cudaMemcpyDeviceToDevice); + checkCudaError(); +} + +template +void PLEGMA_GaugeU1::absorbDir_host(PLEGMA_Su3field &su,int dir){ + memcpy(this->h_elem + dir*(su.Field_length())*(su.Total_length())*2, su.H_elem(), + su.Bytes_total()); +} + + +template +void PLEGMA_GaugeU1::stoutSmearing(PLEGMA_GaugeU1 &uin, int nSmear, double rho, int D3D4){ + if(nSmear < 1){ + cudaMemcpy(this->D_elem(), uin.D_elem(), this->Bytes_total(), cudaMemcpyDeviceToDevice); + checkCudaError(); + return; + } + PLEGMA_Su3field tmp1(BOTH); + PLEGMA_Su3field tmp2(BOTH); + PLEGMA_Su3field *u_s1[D3D4]; + PLEGMA_Su3field *u_s2[D3D4]; + + PLEGMA_Su3field *ref; + + for(int idir = 0; idir < D3D4 ; idir++){ + u_s1[idir] = new PLEGMA_Su3field(BOTH); + u_s1[idir]->absorbDir_device(uin,idir); + u_s2[idir] = new PLEGMA_Su3field(BOTH); + } + + for(int i = 0; i < nSmear; i++){ + for(int idir = 0 ; idir < D3D4; idir++){ + u_s2[idir]->staples(u_s1, idir, tmp1, tmp2, rho, D3D4); + tmp1.UxUdag(*(u_s2[idir]), *(u_s1[idir])); + tmp2.traceHerExpMap(tmp1); + u_s2[idir]->UxU(tmp2, *(u_s1[idir])); + } + for(int idir = 0 ; idir < D3D4; idir++){ + ref=u_s2[idir]; + u_s2[idir]=u_s1[idir]; + u_s1[idir]=ref; + } + } + + for(int idir = 0 ; idir < D3D4; idir++) this->absorbDir_device(*(u_s1[idir]), idir); + if(D3D4 == 3){ + int offset = 3*(tmp1.Field_length())*(tmp1.Total_length())*2; + cudaMemcpy(this->D_elem() + offset, uin.D_elem() + offset, tmp1.Bytes_total(), cudaMemcpyDeviceToDevice ); + checkCudaError(); + } + for(int idir = 0; idir < D3D4 ; idir++){ + delete u_s1[idir]; + delete u_s2[idir]; + } +} + +template +void PLEGMA_GaugeU1::scaleDirWise(std::complex scale[N_DIMS]){ + scale_dir_wise(toField2(*this), (Float*) scale); + this->communicateGhost(); +} + +template +void PLEGMA_GaugeU1::momPhase(Float phase[N_DIMS],int mom[N_DIMS]){ + std::complex scale[N_DIMS]; + for(int d=0; d +void PLEGMA_GaugeU1::APEsmearing(PLEGMA_GaugeU1 &uin, int nSmear, double alpha, int D3D4){ + if(nSmear < 1){ + cudaMemcpy(this->D_elem(), uin.D_elem(), this->Bytes_total(), cudaMemcpyDeviceToDevice); + checkCudaError(); + return; + } + PLEGMA_Su3field tmp1(BOTH); + PLEGMA_Su3field tmp2(BOTH); + + PLEGMA_Su3field *u_s1[D3D4]; + PLEGMA_Su3field *u_s2[D3D4]; + + PLEGMA_Su3field *ref; + + for(int idir = 0; idir < D3D4 ; idir++){ + u_s1[idir] = new PLEGMA_Su3field(BOTH); + u_s1[idir]->absorbDir_device(uin,idir); + u_s2[idir] = new PLEGMA_Su3field(BOTH); + } + + for(int i = 0; i < nSmear; i++){ + for(int idir = 0 ; idir < D3D4; idir++){ + u_s2[idir]->staples(u_s1, idir, tmp1, tmp2, alpha, D3D4); + u_s2[idir]->add(*(u_s1[idir]), (Float) 1.); + u_s2[idir]->su3Projection(); + } + for(int idir = 0 ; idir < D3D4; idir++){ + ref=u_s2[idir]; + u_s2[idir]=u_s1[idir]; + u_s1[idir]=ref; + } + } + + for(int idir = 0 ; idir < D3D4; idir++) this->absorbDir_device(*(u_s1[idir]), idir); + if(D3D4 == 3){ + int offset = 3*(tmp1.Field_length())*(tmp1.Total_length())*2; + cudaMemcpy(this->D_elem() + offset, uin.D_elem() + offset, tmp1.Bytes_total(), cudaMemcpyDeviceToDevice ); + checkCudaError(); + } + + for(int idir = 0; idir < D3D4 ; idir++){ + delete u_s1[idir]; + delete u_s2[idir]; + } +} + +template +void PLEGMA_GaugeU1::GFlow_step( PLEGMA_GaugeU1 &Z, double eps ) +{ + + //1step RK + GFlow_substep( toField2(*this), toField2(Z), eps/(4.0), 0.0 );// 1/4epsZ_0, W1 + //communicate ghost W1 + this->communicateGhost(); + + //2step RK + GFlow_substep( toField2(*this), toField2(Z), eps*(8.0/9.0), -(17.0/9.0) );// 8/9epsZ_1-17/36epsZ_0, W2 + //communicate ghost W2 + this->communicateGhost(); + + //3step RK + GFlow_substep( toField2(*this), toField2(Z), eps*(3.0/4.0), (-1.0) );// Z_2=8/9epsZ_1-17/36epsZ_0, W3 + //communicate ghost W3 + this->communicateGhost(); + +} + +template +void PLEGMA_GaugeU1::applyGradientFlow( PLEGMA_GaugeU1 &Z, int N, double eps ){ + this->communicateGhost(); + for(int i=0; iGFlow_step( Z, eps ); + } + this->unload(); +} + +template +void PLEGMA_GaugeU1::unitarize(){ + unitarize_dev( toField2(*this) ); + this->communicateGhost(); +} + +template +void PLEGMA_GaugeU1::gFixingLandau(PLEGMA_GaugeU1 &uIn,Float overelaxPar,Float tolerance,int maxIter,int seedOverRelax){ + gFixingLandau_k(*this,uIn,overelaxPar,tolerance,maxIter,seedOverRelax); + PLEGMA_printf("Landau GaugeU1 Fixed plaquette is: "); + calculatePlaq(); +} + +template +void PLEGMA_GaugeU1::gluonField(PLEGMA_GaugeU1 &uIn){ + gluonField_k( toField2(*this), toField2(uIn)); +} +*/ +template class PLEGMA_GaugeU1; +template class PLEGMA_GaugeU1; + +//template class PLEGMA_GaugeU13D; +//template class PLEGMA_GaugeU13D; diff --git a/lib/kernels/PLEGMA_baryons_EEE.cuh b/lib/kernels/PLEGMA_baryons_EEE.cuh new file mode 100644 index 00000000..4f65979c --- /dev/null +++ b/lib/kernels/PLEGMA_baryons_EEE.cuh @@ -0,0 +1,286 @@ +#include +#include +#pragma once +using namespace plegma; +using namespace std; + +template +__global__ void baryons_EEE_device( vectorTex texVec1, + vectorTex texVec2, + vectorTex texVec3, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum = 0; + + const Float2 Cg5[4] = {{0,-1},{0,1},{0,-1},{0,1}}; + const short int Cg5idx[4][2] = {{0,1},{1,0},{2,3},{3,2}}; + + if (sid3D < DGC_localVolume3D){ + Float2 vec1[N_SPINS][N_COLS]; + Float2 vec2[N_SPINS][N_COLS]; + Float2 vec3[N_SPINS][N_COLS]; + texVec1.get(vec1,vid); + texVec2.get(vec2,vid); + texVec3.get(vec3,vid); + #pragma unroll + for(int nz = 0 ; nz < N_SPINS ; nz++){ + int mu = Cg5idx[nz][0]; + int nu = Cg5idx[nz][1]; + Float2 val = Cg5[nz]; +#pragma unroll + for(int ei = 0 ; ei < 6 ; ei++){ + int a = eps[ei][0]; + int b = eps[ei][1]; + int c = eps[ei][2]; + + accum = accum + sgn_eps[ei] * val * vec3[nu][b] * (vec2[mu][a] * vec1[is][c] - vec1[mu][a] * vec2[is][c]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, &accum, shared_cache, 1, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) + block2[tid*DGC_localVolume3D + sid3D] = accum; + } +} + +template +void baryons_EEE_host( ProfileStruct &ps, + PLEGMA_Vector& vec1, PLEGMA_Vector& vec2, PLEGMA_Vector& vec3, + PLEGMA_Correlator& corr, Float2 *result){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int full_site_size = corr.getSiteSize(); + const int site_size = N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/full_site_size * (ps.tp.grid.x/time_step)) : (size/full_site_size); + + Float2 *h_block[site_size]; + Float2 *d_block[site_size]; + qudaStream_t stream[site_size]; + for(int k=0; k)device_malloc(alloc_size*sizeof(Float2)); + hostMallocPinned(h_block[k], alloc_size*sizeof(Float2)); + //qudaStreamCreate(stream+k) ; + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + for(int i=0; i(vec1); + auto vectorTex2 = toTexture(vec2); + auto vectorTex3 = toTexture(vec3); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + //baryons_EEE_device + // <<>> + // (*vectorTex1, *vectorTex2, *vectorTex3, d_block[ip], it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + qudaLaunchKernel( + baryons_EEE_device, // kernel + grid, // dim3 grid + ps.tp.block, // dim3 block + ps.tp.shared_bytes, // shared memory + stream[ip], // qudaStream_t + *vectorTex1, *vectorTex2, *vectorTex3, + d_block[ip], it, + std::min(t_size-it, time_step), + maxT, source, runFT, *moms, ip + ); + cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + qudaMemcpyAsync(h_block[ip], d_block[ip], alloc_size*sizeof(Float2), qudaMemcpyDeviceToHost, stream[ip]); + } + cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + for(int ip=0; ip < site_size; ip++) { + qudaStreamSynchronize(stream[ip]); + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + result[(it*volume+v)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*site_size+ip] += h_block[ip][v*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume; v++) + result[(it*volume+v)*site_size+ip] = h_block[ip][v]; + } + } + } + for(int k=0; k +static void contract_baryons_EEE(Float* evecs, Float* evals, int nvecs, size_t vec_size, bool dev_ptr, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + assert(runFT); + int site_size = 16*2; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? sizeof(Float2) : 0; + + Float2 *result = NULL; + Float2 *finalE = NULL; + if(runFT){ + hostMalloc(result, corr.getTotalSize()/8*sizeof(Float2)); + hostMalloc(finalE, corr.getTotalSize()/8*HGC_nProc[DIM_T]*sizeof(Float2)); + } else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + + memset(corr.H_elem(),0,corr.getTotalSize()*2*sizeof(Float)); + + const int ils = dev_ptr ? 1 : 4; + PLEGMA_Vector vec1(dev_ptr ? NONE : DEVICE); + PLEGMA_Vector vec2(dev_ptr ? NONE : DEVICE); + std::vector*> vec3; + size_t vec_bytes = vec_size*sizeof(Float); + + qudaStream_t stream[ils]; + for(int k=0; k(dev_ptr ? NONE : DEVICE)); + //cudaStreamCreate(stream+k) ; + } + + for(int h=0; hD_elem(evecs+k*vec_size); + } else { + qudaMemcpyAsync(vec3[k]->D_elem(), evecs+k*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + + if(dev_ptr) { + vec2.D_elem(evecs+i*vec_size); + } else { + qudaMemcpy(vec2.D_elem(), evecs+i*vec_size, vec_bytes, qudaMemcpyHostToDevice); + auto error= qudaGetLastError(); + if(error != QUDA_SUCCESS) { + errorQuda("Failed to copy from host to device %s\n", qudaGetLastErrorString().c_str()); + return; + } + + } + + for(int j=0; j, + ps, vec1, vec2, *vec3[k], corr, result); + // Start copying next vector to use + if(j+ilsD_elem(evecs+(j+ils)*vec_size); + } else { + qudaMemcpyAsync(vec3[k]->D_elem(), evecs+(j+ils)*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + + if(runFT) { + MPI_Allreduce(MPI_IN_PLACE, result, corr.getTotalSize()/8*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + } + + // Convolute and average + // we got in result Eijk(lt,p,g) for local time (lt) + MPI_Allgather(result, corr.getTotalSize()/8*2, MPI_Type(), + finalE, corr.getTotalSize()/8*2, MPI_Type(), HGC_timeComm); + + std::complex* out = (complex*) corr.H_elem(); + std::complex* in = (complex*) finalE; + std::complex* evs = (complex*) evals; + int t_size = corr.localT(); + size_t volume = corr.getVolSize()/t_size; + size_t size = corr.getTotalSize()/2; + + std::complex eval = 1; + eval /= (evs[h]*evs[i]*conj(evs[j])); + // const int g5Idx[4] = {2,3,0,1}; // (is+2)%4 + for(int t0=0; t0 tmp = in[(t0*volume+v)*4+is/4]*conj(in[(t0pt*volume+v)*4+(is+2)%4]); + out[0*size+(t1*volume+v)*site_size/2+is] += eval * tmp; + out[1*size+(t1*volume+v)*site_size/2+is] += conj(eval) * tmp; + } + } + } + + } + } + } + + hostFree(result, corr.getTotalSize()/8*sizeof(Float2)); + hostFree(finalE, corr.getTotalSize()/8*HGC_nProc[DIM_T]*sizeof(Float2)); + for(int k=0; k static void apply_gamma_scatt_vector(LEFTRIGHT LR, vector2 inOut, GAMMAS_SCATT r){ dim3 blockDim( THREADS_PER_BLOCK , 1, 1); - dim3 gridDim( (HGC_localVolume + blockDim.x -1)/blockDim.x , 1 , 1); + dim3 gridDim( (inOut.volume() + blockDim.x -1)/blockDim.x , 1 , 1); switch(LR){ case(LEFT): apply_gamma_scatt_vector_kernel<<>>(inOut, r); diff --git a/lib/kernels/PLEGMA_gauge_utils.cuh b/lib/kernels/PLEGMA_gauge_utils.cuh index 02f23af7..d0f297e2 100644 --- a/lib/kernels/PLEGMA_gauge_utils.cuh +++ b/lib/kernels/PLEGMA_gauge_utils.cuh @@ -57,3 +57,55 @@ static void scale_dir_wise(gauge2 gauge, Float* scale){ cudaFree(d_scale); checkQudaError(); } + + +template< typename Float> +__global__ void qedPhase_kernel(gauge2 gauge, gaugeU12 gaugeU1, Float phase){ + + int sid = blockIdx.x*blockDim.x + threadIdx.x; + if (sid >= gauge.volume()) return; + +#pragma unroll + for(int dir = 0; dir < N_DIMS; dir++) { + Float theta = phase*gaugeU1.get(dir, sid).x; + Float2 scale = {cos(theta), sin(theta)}; +#pragma unroll + for(int c=0; c +static void qedPhase_k(gauge2 gauge, gaugeU12 gaugeU1, Float phase){ + ProfileStruct ps(gauge.volume()); + tuneAndRun(ps, "qedPhase_kernel", qedPhase_kernel, gauge, gaugeU1, phase); +} + + +template< typename Float> +__global__ void mul_dag_kernel(gauge2 gauge, gauge2 gaugeIn){ + + int sid = blockIdx.x*blockDim.x + threadIdx.x; + if (sid >= gauge.volume()) return; + + Float2 G1[N_COLS][N_COLS], G2[N_COLS][N_COLS], G3[N_COLS][N_COLS]; + +#pragma unroll + for(int dir = 0; dir < N_DIMS; dir++) { + gauge.get(G1,dir,sid); + gaugeIn.get(G2,dir,sid); + mul_G_Gdag(G3,G1,G2); + gauge.set(G3, dir, sid); + } +} + + +template +static void mul_dag_k(gauge2 gauge, gauge2 gaugeIn){ + ProfileStruct ps(gauge.volume()); + tuneAndRun(ps, "mul_dag_kernel", mul_dag_kernel, gauge, gaugeIn); +} + diff --git a/lib/kernels/PLEGMA_kernel_getSet.cuh b/lib/kernels/PLEGMA_kernel_getSet.cuh index fee5dfb2..ebf524a4 100644 --- a/lib/kernels/PLEGMA_kernel_getSet.cuh +++ b/lib/kernels/PLEGMA_kernel_getSet.cuh @@ -553,6 +553,54 @@ namespace plegma { template using generic2 = generic, Float>; + template + struct genericGaugeU1 : generic { + using generic::generic; + inline __device__ void set(const short& mu, const Float2& v) { + T::set(mu, v); + } + inline __device__ void set(const short& mu, const size_t& sid, const Float2& v) { + sidStride::setSid(sid); + set(mu, v); + } + inline __device__ void set(Float2 G, const short& mu, const size_t& sid) { + sidStride::setSid(sid); + set(mu, G); + } + inline __device__ Float2 get(const short& mu) const { + return T::get(mu); + } + inline __device__ Float2 get(const short& mu, const size_t& sid) { + sidStride::setSid(sid); + return get(mu); + } + template + inline __device__ Float2 get(const short& mu, const size_t& sid, const dir_t&... dirs) { + sidStride::setSid(sid); + sidStride::shift(dirs ...); + return get(mu); + } + inline __device__ void get(Float2& G, const short& mu) const { + G = get(mu); + } + inline __device__ void get(Float2& G, const short& mu, const size_t& sid) { + sidStride::setSid(sid); + get(G, mu); + } + template + inline __device__ void get(Float2& G, const short& mu, const size_t& sid, const dir_t&... dirs) { + sidStride::setSid(sid); + sidStride::shift(dirs ...); + get(G, mu); + } + }; + + template + using gaugeU1Tex = genericGaugeU1, Float>; + + template + using gaugeU12 = genericGaugeU1, Float>; + template struct genericGauge : generic { @@ -868,6 +916,42 @@ namespace plegma { sidStride::setSid(sid); sidStride::shift(dirs ...); get(P); + } + inline __device__ Float2 getDag(const short& mu, const short& nu, const short& c1, const short& c2) const { + return conj(T::getDag(((nu*N_SPINS + mu)*N_COLS + c1)*N_COLS + c2)); + } + inline __device__ Float2 getDag(const short& mu, const short& nu, const short& c1, const short& c2, const size_t& sid) { + sidStride::setSid(sid); + return getDag(mu, nu, c1, c2); + } + template + inline __device__ Float2 getDag(const short& mu, const short& nu, const short& c1, const short& c2, const size_t& sid, const dir_t&... dirs) { + sidStride::setSid(sid); + sidStride::shift(dirs ...); + return getDag(mu,nu,c1,c2); + } + template + inline __device__ void getDag(Float2 P[N_SPINS][N_SPINS][N_COLS][COLS]) const { + #pragma unroll + for(short mu = 0 ; mu < N_SPINS ; mu++) + #pragma unroll + for(short nu = 0 ; nu < N_SPINS ; nu++) + #pragma unroll + for(short c1 = 0 ; c1 < N_COLS ; c1++) + #pragma unroll + for(short c2 = 0 ; c2 < COLS ; c2++) + P[mu][nu][c1][c2] = getDag(mu, nu, c1, c2); + } + template + inline __device__ void getDag(Float2 P[N_SPINS][N_SPINS][N_COLS][COLS], const size_t& sid) { + sidStride::setSid(sid); + getDag(P); + } + template + inline __device__ void getDag(Float2 P[N_SPINS][N_SPINS][N_COLS][COLS], const size_t& sid, const dir_t&... dirs) { + sidStride::setSid(sid); + sidStride::shift(dirs ...); + getDag(P); } }; diff --git a/lib/kernels/PLEGMA_mesonsOpen.cuh b/lib/kernels/PLEGMA_mesonsOpen.cuh index 1d43db31..59df43cd 100644 --- a/lib/kernels/PLEGMA_mesonsOpen.cuh +++ b/lib/kernels/PLEGMA_mesonsOpen.cuh @@ -21,8 +21,8 @@ __global__ void contract_mesons_open_device( propTex texProp1, if (sid3D < DGC_localVolume3D){ Float2 prop1[N_SPINS][N_SPINS][N_COLS][COLS]; Float2 prop2[N_SPINS][N_SPINS][N_COLS][COLS]; - texProp1.get(prop1,vid); - texProp2.get(prop2,vid); + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); short int alpha = (is/N_SPINS/N_SPINS/N_SPINS)%N_SPINS; short int beta = (is/N_SPINS/N_SPINS)%N_SPINS; short int gamma = (is/N_SPINS)%N_SPINS; @@ -53,7 +53,7 @@ void contract_mesons_open_host( ProfileStruct &ps, int t_size = corr.localT(); if(t_size==0) return; int maxT = corr.endT() - corr.startT(); - int time_step = ps.tp.grid.x*ps.tp.block.x/HGC_localVolume3D; + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); size_t size = corr.getTotalSize()/t_size*time_step; size_t volume = corr.getVolSize()/t_size; diff --git a/lib/kernels/PLEGMA_mesonsOpen_LIBE.cuh b/lib/kernels/PLEGMA_mesonsOpen_LIBE.cuh new file mode 100644 index 00000000..d998a536 --- /dev/null +++ b/lib/kernels/PLEGMA_mesonsOpen_LIBE.cuh @@ -0,0 +1,150 @@ +#include +using namespace plegma; + +template +__global__ void contract_mesons_open_LIBE_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[9]; + for(int a = 0 ; a < 9; a++) + accum[a] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][3]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][3]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); + short int alpha = (is/N_SPINS/N_SPINS/N_SPINS)%N_SPINS; + short int beta = (is/N_SPINS/N_SPINS)%N_SPINS; + short int gamma = (is/N_SPINS)%N_SPINS; + short int delta = is%N_SPINS; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++){ +#pragma unroll + for(int s = 0 ; s < 9; s++){ + accum[s] = accum[s] + prop1[alpha][beta][b][s/3] * conj(prop2[delta][gamma][b][s%3]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 9, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) +#pragma unroll + for(int s = 0 ; s < 9; s++) + block2[(tid*DGC_localVolume3D + sid3D)*9+s] = accum[s]; + } +} + +template +void contract_mesons_open_LIBE_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + contract_mesons_open_LIBE_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + for(int i = 0 ; i < 9; i++) { + result[((it*volume+v)*9 + i)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[((it*volume+v)*9 + i)*site_size+ip] += h_partial_block[(v*9+i)*accumX+j]; + } + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int i = 0 ; i < 9; i++) + result[((it*volume+v)*9 + i)*site_size+ip] = h_partial_block[(v*9+i)]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_open_LIBE(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 3*3*N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? 9*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_open_LIBE", contract_mesons_open_LIBE_host, + ps, prop1, prop2, corr, result); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesonsOpen_SIB.cuh b/lib/kernels/PLEGMA_mesonsOpen_SIB.cuh new file mode 100644 index 00000000..c981a4e5 --- /dev/null +++ b/lib/kernels/PLEGMA_mesonsOpen_SIB.cuh @@ -0,0 +1,153 @@ +#include +using namespace plegma; + +template +__global__ void contract_mesons_open_SIB_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[5]; + for(int a = 0 ; a < 5; a++) + accum[a] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][3]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][3]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); + short int alpha = (is/N_SPINS/N_SPINS/N_SPINS)%N_SPINS; + short int beta = (is/N_SPINS/N_SPINS)%N_SPINS; + short int gamma = (is/N_SPINS)%N_SPINS; + short int delta = is%N_SPINS; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++){ +#pragma unroll + for(int s = 0 ; s < 5; s++){ + int s3 = (s+1) / 2; // 0, 1, 1, 2, 2 + int s1 = s3 * ((s+1) % 2); // 0, 0, 1, 0, 2 + int s2 = s3 * ((s+0) % 2); // 0, 1, 0, 2, 0 + accum[s] = accum[s] + prop1[alpha][beta][b][s1] * conj(prop2[delta][gamma][b][s2]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 5, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) +#pragma unroll + for(int s = 0 ; s < 5; s++) + block2[(tid*DGC_localVolume3D + sid3D)*5+s] = accum[s]; + } +} + +template +void contract_mesons_open_SIB_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + contract_mesons_open_SIB_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + for(int i = 0 ; i < 5; i++) { + result[((it*volume+v)*5 + i)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[((it*volume+v)*5 + i)*site_size+ip] += h_partial_block[(v*5+i)*accumX+j]; + } + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int i = 0 ; i < 5; i++) + result[((it*volume+v)*5 + i)*site_size+ip] = h_partial_block[(v*5+i)]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_open_SIB(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 5*N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? 5*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_open_SIB", contract_mesons_open_SIB_host, + ps, prop1, prop2, corr, result); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesonsOpen_SIR.cuh b/lib/kernels/PLEGMA_mesonsOpen_SIR.cuh new file mode 100644 index 00000000..e7516fb3 --- /dev/null +++ b/lib/kernels/PLEGMA_mesonsOpen_SIR.cuh @@ -0,0 +1,152 @@ +#include +using namespace plegma; + +template +__global__ void contract_mesons_open_SIR_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[3]; + for(int a = 0 ; a < 3; a++) + accum[a] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][3]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][3]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); + short int alpha = (is/N_SPINS/N_SPINS/N_SPINS)%N_SPINS; + short int beta = (is/N_SPINS/N_SPINS)%N_SPINS; + short int gamma = (is/N_SPINS)%N_SPINS; + short int delta = is%N_SPINS; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++){ +#pragma unroll + for(int s = 0 ; s < 3; s++){ + int s1 = ((s+1) / 2); // 0, 1, 1 + int s2 = ((s+0) / 2); // 0, 0, 1 + accum[s] = accum[s] + prop1[alpha][beta][b][s1] * conj(prop2[delta][gamma][b][s2]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 3, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) +#pragma unroll + for(int s = 0 ; s < 3; s++) + block2[(tid*DGC_localVolume3D + sid3D)*3+s] = accum[s]; + } +} + +template +void contract_mesons_open_SIR_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + contract_mesons_open_SIR_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + for(int i = 0 ; i < 3; i++) { + result[((it*volume+v)*3 + i)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[((it*volume+v)*3 + i)*site_size+ip] += h_partial_block[(v*3+i)*accumX+j]; + } + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int i = 0 ; i < 3; i++) + result[((it*volume+v)*3 + i)*site_size+ip] = h_partial_block[(v*3+i)]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_open_SIR(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 3*N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? 3*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_open_SIR", contract_mesons_open_SIR_host, + ps, prop1, prop2, corr, result); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesonsOpen_defl.cuh b/lib/kernels/PLEGMA_mesonsOpen_defl.cuh new file mode 100644 index 00000000..a0729098 --- /dev/null +++ b/lib/kernels/PLEGMA_mesonsOpen_defl.cuh @@ -0,0 +1,150 @@ +#include +using namespace plegma; + +template +__global__ void contract_mesons_open_defl_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[2]; + for(int a = 0 ; a < 2; a++) + accum[a] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][3]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][3]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); + short int alpha = (is/N_SPINS/N_SPINS/N_SPINS)%N_SPINS; + short int beta = (is/N_SPINS/N_SPINS)%N_SPINS; + short int gamma = (is/N_SPINS)%N_SPINS; + short int delta = is%N_SPINS; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++){ +#pragma unroll + for(int s = 0 ; s < 2; s++){ + accum[s] = accum[s] + prop1[alpha][beta][b][s] * conj(prop2[delta][gamma][b][0]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 2, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) +#pragma unroll + for(int s = 0 ; s < 2; s++) + block2[(tid*DGC_localVolume3D + sid3D)*2+s] = accum[s]; + } +} + +template +void contract_mesons_open_defl_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + contract_mesons_open_defl_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + for(int i = 0 ; i < 2; i++) { + result[((it*volume+v)*2 + i)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[((it*volume+v)*2 + i)*site_size+ip] += h_partial_block[(v*2+i)*accumX+j]; + } + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int i = 0 ; i < 2; i++) + result[((it*volume+v)*2 + i)*site_size+ip] = h_partial_block[(v*2+i)]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_open_defl(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 2*N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? 2*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_open_defl", contract_mesons_open_defl_host, + ps, prop1, prop2, corr, result); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_LIBE.cuh b/lib/kernels/PLEGMA_mesons_LIBE.cuh new file mode 100644 index 00000000..c4d456f5 --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_LIBE.cuh @@ -0,0 +1,154 @@ +#include +#include +using namespace plegma; + +template +__global__ void contract_mesons_LIBE_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int ip){// + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[9]; + for(int a = 0 ; a < 9; a++) + accum[a] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); +#pragma unroll + for(int is = 0 ; is < N_SPINS*N_SPINS ; is++){ + short int beta = mesons_indices[ip][is][0]; + short int gamma = mesons_indices[ip][is][1]; + short int delta = mesons_indices[ip][is][2]; + short int alpha = mesons_indices[ip][is][3]; + FloatC value = mesons_values[ip][is]; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++) +#pragma unroll + for(int s = 0 ; s < 9; s++){ + accum[s] = accum[s] + value * prop1[alpha][beta][b][s/3] * conj(prop2[delta][gamma][b][s%3]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 9, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) +#pragma unroll + for(int s = 0 ; s < 9; s++) + block2[(tid*DGC_localVolume3D + sid3D)*9+s] = accum[s]; + } +} + +template +void contract_mesons_LIBE_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result){ // + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_MESONS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < N_MESONS; ip++) { + contract_mesons_LIBE_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++){ + for(int i = 0 ; i < 9; i++) { + result[((it*volume+v)*9 + i)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[((it*volume+v)*9 + i)*site_size+ip] += h_partial_block[(v*9+i)*accumX+j]; + } + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int i = 0 ; i < 9; i++) + result[((it*volume+v)*9 + i)*site_size+ip] = h_partial_block[(v*9+i)]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_LIBE(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 3*3*N_MESONS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? 9*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_LIBE", contract_mesons_LIBE_host, + ps, prop1, prop2, corr, result); // + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_SIB.cuh b/lib/kernels/PLEGMA_mesons_SIB.cuh new file mode 100644 index 00000000..8e22d588 --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_SIB.cuh @@ -0,0 +1,157 @@ +#include +#include +using namespace plegma; + +template +__global__ void contract_mesons_SIB_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int ip){// + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[5]; + for(int a = 0 ; a < 5; a++) + accum[a] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); +#pragma unroll + for(int is = 0 ; is < N_SPINS*N_SPINS ; is++){ + short int beta = mesons_indices[ip][is][0]; + short int gamma = mesons_indices[ip][is][1]; + short int delta = mesons_indices[ip][is][2]; + short int alpha = mesons_indices[ip][is][3]; + FloatC value = mesons_values[ip][is]; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++) +#pragma unroll + for(int s = 0 ; s < 5; s++){ + int s3 = (s+1) / 2; // 0, 1, 1, 2, 2 + int s1 = s3 * ((s+1) % 2); // 0, 0, 1, 0, 2 + int s2 = s3 * ((s+0) % 2); // 0, 1, 0, 2, 0 + accum[s] = accum[s] + value * prop1[alpha][beta][b][s1] * conj(prop2[delta][gamma][b][s2]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 5, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) +#pragma unroll + for(int s = 0 ; s < 5; s++) + block2[(tid*DGC_localVolume3D + sid3D)*5+s] = accum[s]; + } +} + +template +void contract_mesons_SIB_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result){ // + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_MESONS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < N_MESONS; ip++) { + contract_mesons_SIB_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++){ + for(int i = 0 ; i < 5; i++) { + result[((it*volume+v)*5 + i)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[((it*volume+v)*5 + i)*site_size+ip] += h_partial_block[(v*5+i)*accumX+j]; + } + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int i = 0 ; i < 5; i++) + result[((it*volume+v)*5 + i)*site_size+ip] = h_partial_block[(v*5+i)]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_SIB(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 5*N_MESONS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? 5*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_SIB", contract_mesons_SIB_host, + ps, prop1, prop2, corr, result); // + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_SIR.cuh b/lib/kernels/PLEGMA_mesons_SIR.cuh new file mode 100644 index 00000000..538fef6f --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_SIR.cuh @@ -0,0 +1,156 @@ +#include +#include +using namespace plegma; + +template +__global__ void contract_mesons_SIR_device( propTex texProp1, + propTex texProp2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int ip){// + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[3]; + for(int a = 0 ; a < 3; a++) + accum[a] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); +#pragma unroll + for(int is = 0 ; is < N_SPINS*N_SPINS ; is++){ + short int beta = mesons_indices[ip][is][0]; + short int gamma = mesons_indices[ip][is][1]; + short int delta = mesons_indices[ip][is][2]; + short int alpha = mesons_indices[ip][is][3]; + FloatC value = mesons_values[ip][is]; +#pragma unroll + for(int b = 0 ; b < N_COLS ; b++) +#pragma unroll + for(int s = 0 ; s < 3; s++){ + int s1 = (s+1) / 2; // 0, 1, 1 + int s2 = (s+0) / 2; // 0, 0, 1 + accum[s] = accum[s] + value * prop1[alpha][beta][b][s1] * conj(prop2[delta][gamma][b][s2]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 3, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) +#pragma unroll + for(int s = 0 ; s < 3; s++) + block2[(tid*DGC_localVolume3D + sid3D)*3+s] = accum[s]; + } +} + +template +void contract_mesons_SIR_host( ProfileStruct &ps, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr, Float2 *result){ // + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_MESONS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/site_size * (ps.tp.grid.x/time_step)) : size/site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < N_MESONS; ip++) { + contract_mesons_SIR_device + <<>> + (*propTex1, *propTex2, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++){ + for(int i = 0 ; i < 3; i++) { + result[((it*volume+v)*3 + i)*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[((it*volume+v)*3 + i)*site_size+ip] += h_partial_block[(v*3+i)*accumX+j]; + } + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int i = 0 ; i < 3; i++) + result[((it*volume+v)*3 + i)*site_size+ip] = h_partial_block[(v*3+i)]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +static void contract_mesons_SIR(PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 3*N_MESONS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? 3*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_mesons_SIR", contract_mesons_SIR_host, + ps, prop1, prop2, corr, result); // + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_exact_exact.cuh b/lib/kernels/PLEGMA_mesons_exact_exact.cuh new file mode 100644 index 00000000..dfca86bc --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_exact_exact.cuh @@ -0,0 +1,217 @@ +#include +#include +#pragma once +using namespace plegma; + +template +__global__ void contract_exact_exact_device( vectorTex texVec1, + vectorTex texVec2, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum = 0; + + const Float2 (*g)[4]; + g = (Float2 (*)[4]) plegma::gamma; + + if (sid3D < DGC_localVolume3D){ + Float2 vec1[N_SPINS][N_COLS]; + Float2 vec2[N_SPINS][N_COLS]; + texVec1.get(vec1,vid); + texVec2.get(vec2,vid); + #pragma unroll + for(int nz = 0 ; nz < N_SPINS ; nz++){ + int mu = gammaInd[is][nz][0]; + int nu = gammaInd[is][nz][1]; + Float2 val = g[is][nz]; + #pragma unroll + for(int a = 0 ; a < N_COLS ; a++){ + accum = accum + val * conj(vec1[mu][a]) * vec2[nu][a]; + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, &accum, shared_cache, 1, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) + block2[tid*DGC_localVolume3D + sid3D] = accum; + } +} + +template +void contract_exact_exact_host( ProfileStruct &ps, + PLEGMA_Vector& vec1, PLEGMA_Vector& vec2, + PLEGMA_Correlator& corr, Float2 *result, int veci){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int full_site_size = corr.getSiteSize(); + const int site_size = N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/full_site_size * (ps.tp.grid.x/time_step)) : (size/full_site_size); + + Float2 *h_block[site_size]; + Float2 *d_block[site_size]; + cudaStream_t stream[site_size]; + for(int k=0; k)); + hostMallocPinned(h_block[k], alloc_size*sizeof(Float2)); + cudaStreamCreate(stream+k) ; + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + for(int i=0; i(vec1); + auto vectorTex2 = toTexture(vec2); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + contract_exact_exact_device + <<>> + (*vectorTex1, *vectorTex2, d_block[ip], it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + cudaMemcpyAsync(h_block[ip], d_block[ip], alloc_size*sizeof(Float2), cudaMemcpyDeviceToHost, stream[ip]); + } + cudaError_t error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + for(int ip=0; ip < site_size; ip++) { + cudaStreamSynchronize(stream[ip]); + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + result[(it*volume+v)*full_site_size+veci*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*full_site_size+veci*site_size+ip] += h_block[ip][v*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume; v++) + result[(it*volume+v)*full_site_size+veci*site_size+ip] = h_block[ip][v]; + } + } + } + for(int k=0; k +static void contract_exact_exact(Float* ptr, int nvecs, size_t vec_size, bool dev_ptr, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = (nvecs*(nvecs+1)*N_SPINS*N_SPINS)/2; + std::vector runtime; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + const int ils = dev_ptr ? 1 : 4; + PLEGMA_Vector vec1(dev_ptr ? NONE : DEVICE); + std::vector*> vec2; + size_t vec_bytes = vec_size*sizeof(Float); + int veci = 0; + qudaStream_t stream[ils]; + for(int k=0; k(dev_ptr ? NONE : DEVICE)); + //cudaStreamCreate(stream+k) ; + } + + for(int i=0; iD_elem(ptr+(i+k+1)*vec_size); + } else { + qudaMemcpyAsync(vec2[k]->D_elem(), ptr+(i+k+1)*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + + if(dev_ptr) { + vec1.D_elem(ptr+i*vec_size); + } else { + qudaMemcpy(vec1.D_elem(), ptr+i*vec_size, vec_bytes, qudaMemcpyHostToDevice); + //checkCudaError(); + } + + for(int j=i; j, + ps, vec1, vec1, corr, result, veci); + } else { + int k=(j-i-1)%ils; + if(not dev_ptr) { + qudaStreamSynchronize(stream[k]); + //checkCudaError(); + } + tuneAndRun( ps, "contract_exact_exact", contract_exact_exact_host, + ps, vec1, *vec2[k], corr, result, veci); + // Start copying next vector to use + if(j+ilsD_elem(ptr+(j+ils)*vec_size); + } else { + qudaMemcpyAsync(vec2[k]->D_elem(), ptr+(j+ils)*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + } + veci++; + } + } + + for(int k=0; k(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_loop.cuh b/lib/kernels/PLEGMA_mesons_loop.cuh new file mode 100644 index 00000000..42cd2db4 --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_loop.cuh @@ -0,0 +1,159 @@ +#include +#include +#pragma once +using namespace plegma; + +template +__global__ void contract_loop_device( vectorTex vect, + propTex prop, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + //int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int t=0; // here we use prop3D and vect 3D + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[N_SPINS*N_SPINS]; + for(int i = 0 ; i < N_SPINS*N_SPINS; i++){ + accum[i] = 0.; + } + + const Float2 (*g)[4]; + g = (Float2 (*)[4]) plegma::gamma; + + if (sid3D < DGC_localVolume3D){ + Float2 vect1[N_SPINS][N_COLS]; + Float2 prop1[N_SPINS][N_SPINS][N_COLS][1]; + + vect.get(vect1,vid); + prop.get<1>(prop1,vid); +#pragma unroll + for(int is = 0 ; is < N_SPINS*N_SPINS ; is++){ + #pragma unroll + for(int nz = 0 ; nz < N_SPINS ; nz++){ + int mu = gammaInd[is][nz][0]; + int nu = gammaInd[is][nz][1]; + Float2 val = g[is][nz]; +#pragma unroll + for(int a = 0 ; a < N_COLS ; a++){ + accum[is] = accum[is] + val * conj(vect1[nu][a]) * prop1[mu][nu][a][0]; + } + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, N_SPINS*N_SPINS, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) + for(int ip = 0 ; ip < N_SPINS*N_SPINS ; ip++){ + block2[(tid*DGC_localVolume3D + sid3D)*N_SPINS*N_SPINS + ip] = accum[ip]; + } + } +} + +template +void contract_loop_host( ProfileStruct &ps, + PLEGMA_Vector3D& vect, PLEGMA_Propagator3D& prop, + PLEGMA_Correlator& corr, Float2 *result){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size * (ps.tp.grid.x/time_step)) : size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto vectTex1 = toTexture(vect); + auto propTex1 = toTexture(prop); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + contract_loop_device + <<>> + (*vectTex1, *propTex1, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) + for(int f = 0 ; f < site_size; f++) { + result[(f*t_size + it)*volume+v] = 0; + for(int j = 0 ; j < accumX; j++) + result[(f*t_size + it)*volume+v] += h_partial_block[(v*site_size+f)*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int f = 0 ; f < site_size; f++) { + result[(f*t_size + it)*volume+v] = h_partial_block[v*site_size+f]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(Float)); + cudaFree(d_partial_block); +} + + +template +static void contract_loop(PLEGMA_Vector3D& vect, PLEGMA_Propagator3D& prop, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = N_SPINS*N_SPINS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? site_size*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_loop", contract_loop_host, + ps, vect, prop, corr, result); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_loop_SIB.cuh b/lib/kernels/PLEGMA_mesons_loop_SIB.cuh new file mode 100644 index 00000000..9321a0fb --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_loop_SIB.cuh @@ -0,0 +1,159 @@ +#include +#include +#pragma once +using namespace plegma; + +template +__global__ void contract_loop_SIB_device( vectorTex vect, + propTex prop, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + //int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int t=0; // here we use prop3D and vect 3D + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum[3*N_SPINS*N_SPINS]; + for(int i = 0 ; i < 3*N_SPINS*N_SPINS; i++){ + accum[i] = 0.; + } + + const Float2 (*g)[4]; + g = (Float2 (*)[4]) plegma::gamma; + + if (sid3D < DGC_localVolume3D){ + Float2 vect1[N_SPINS][N_COLS]; + Float2 prop1[N_SPINS][N_SPINS][N_COLS][N_COLS]; + + vect.get(vect1,vid); + prop.get(prop1,vid); +#pragma unroll + for(int is = 0 ; is < 3*N_SPINS*N_SPINS ; is++){ + #pragma unroll + for(int nz = 0 ; nz < N_SPINS ; nz++){ + int mu = gammaInd[is%(N_SPINS*N_SPINS)][nz][0]; + int nu = gammaInd[is%(N_SPINS*N_SPINS)][nz][1]; + Float2 val = g[is%(N_SPINS*N_SPINS)][nz]; +#pragma unroll + for(int a = 0 ; a < N_COLS ; a++){ + accum[is] = accum[is] + val * conj(vect1[nu][a]) * prop1[mu][nu][a][is/(N_SPINS*N_SPINS)]; + } + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, accum, shared_cache, 3*N_SPINS*N_SPINS, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) + for(int ip = 0 ; ip < 3*N_SPINS*N_SPINS ; ip++){ + block2[(tid*DGC_localVolume3D + sid3D)*3*N_SPINS*N_SPINS + ip] = accum[ip]; + } + } +} + +template +void contract_loop_SIB_host( ProfileStruct &ps, + PLEGMA_Vector3D& vect, PLEGMA_Propagator3D& prop, + PLEGMA_Correlator& corr, Float2 *result){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int site_size = 3*N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size * (ps.tp.grid.x/time_step)) : size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto vectTex1 = toTexture(vect); + auto propTex1 = toTexture(prop); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + contract_loop_SIB_device + <<>> + (*vectTex1, *propTex1, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) + for(int f = 0 ; f < site_size; f++) { + result[(f*t_size + it)*volume+v] = 0; + for(int j = 0 ; j < accumX; j++) + result[(f*t_size + it)*volume+v] += h_partial_block[(v*site_size+f)*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume; v++) + for(int f = 0 ; f < site_size; f++) { + result[(f*t_size + it)*volume+v] = h_partial_block[v*site_size+f]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(Float)); + cudaFree(d_partial_block); +} + + +template +static void contract_loop_SIB(PLEGMA_Vector3D& vect, PLEGMA_Propagator3D& prop, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = 3*N_SPINS*N_SPINS; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? site_size*sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + tuneAndRun( ps, "contract_loop_SIB", contract_loop_SIB_host, + ps, vect, prop, corr, result); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_stoch_exact.cuh b/lib/kernels/PLEGMA_mesons_stoch_exact.cuh new file mode 100644 index 00000000..6afe6fcd --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_stoch_exact.cuh @@ -0,0 +1,189 @@ +#include +#pragma once +using namespace plegma; + +template +struct Spin { Float2 vals[N_SPINS]; }; + +template +__global__ void contract_stoch_exact_device( propTex texProp, + vectorTex texVec, + Spin spin, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop[N_SPINS][N_SPINS][N_COLS][1]; + Float2 vec[N_SPINS][N_COLS]; + texProp.get<1>(prop,vid); + texVec.get(vec,vid); + short int alpha = (is/N_SPINS/N_SPINS/N_SPINS)%N_SPINS; + short int beta = (is/N_SPINS/N_SPINS)%N_SPINS; + short int gamma = (is/N_SPINS)%N_SPINS; + short int delta = is%N_SPINS; + #pragma unroll + for(int b = 0 ; b < N_COLS ; b++) + accum = accum + vec[alpha][b] * spin.vals[beta] * conj(prop[delta][gamma][b][0]); + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, &accum, shared_cache, 1, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) + block2[tid*DGC_localVolume3D + sid3D] = accum; + } +} + +template +void contract_stoch_exact_host( ProfileStruct &ps, + PLEGMA_Propagator &prop, PLEGMA_Vector& vec, + Spin& spin, + PLEGMA_Correlator& corr, Float2 *result, int veci){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int full_site_size = corr.getSiteSize(); + int site_size = N_SPINS*N_SPINS*N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/full_site_size * (ps.tp.grid.x/time_step)) : size/full_site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propT = toTexture(prop); + auto vecT = toTexture(vec); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + contract_stoch_exact_device + <<>> + (*propT, *vecT, spin, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + result[(it*volume+v)*full_site_size+veci*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*full_site_size+veci*site_size+ip] += h_partial_block[v*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume; v++) + result[(it*volume+v)*full_site_size+veci*site_size+ip] = h_partial_block[v]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(Float)); + cudaFree(d_partial_block); +} + + +template +static void contract_stoch_exact(PLEGMA_Propagator &prop, Float *spinVals, + Float* ptr, int nvecs, size_t vec_size, bool dev_ptr, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = corr.getSiteSize(); + std::vector runtime; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + const int ils = dev_ptr ? 1 : 4; + std::vector*> vec; + size_t vec_bytes = vec_size*sizeof(Float); + qudaStream_t stream[ils]; + for(int k=0; k(dev_ptr ? NONE : DEVICE)); + //cudaStreamCreate(stream+k) ; + if(dev_ptr) { + vec[k]->D_elem(ptr+k*vec_size); + } else { + qudaMemcpyAsync(vec[k]->D_elem(), ptr+k*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + + Spin spin; + + for(int i=0; i, + ps, prop, *vec[k], spin, corr, result, i); + + // Start copying next vector to use + if(i+ilsD_elem(ptr+(i+ils)*vec_size); + } else { + qudaMemcpyAsync(vec[k]->D_elem(), ptr+(i+ils)*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + } + + for(int k=0; k(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/lib/kernels/PLEGMA_mesons_stoch_exact_closed.cuh b/lib/kernels/PLEGMA_mesons_stoch_exact_closed.cuh new file mode 100644 index 00000000..3cfe04cd --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_stoch_exact_closed.cuh @@ -0,0 +1,197 @@ +#include +#pragma once +using namespace plegma; + +template +__global__ void contract_stoch_exact_closed_device( propTex texProp, + vectorTex texVec, + Spin spin, + Float2 *block2, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms, int is){ + + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + register Float2 accum = 0; + + const Float2 (*g)[4]; + g = (Float2 (*)[4]) plegma::gamma; + + if (sid3D < DGC_localVolume3D){ + Float2 prop[N_SPINS][N_SPINS][N_COLS][1]; + Float2 vec[N_SPINS][N_COLS]; + texProp.get<1>(prop,vid); + texVec.get(vec,vid); + #pragma unroll + for(int nz1 = 0 ; nz1 < N_SPINS ; nz1++){ + int beta = gammaInd[is][nz1][0]; + int gamma = gammaInd[is][nz1][1]; + Float2 val1 = g[is][nz1]; + #pragma unroll + for(int nz2 = 0 ; nz2 < N_SPINS ; nz2++){ + int delta = gammaInd[is][nz2][0]; + int alpha = gammaInd[is][nz2][1]; + Float2 val2 = g[is][nz2]; + #pragma unroll + for(int b = 0 ; b < N_COLS ; b++) + accum = accum + val1*val2*vec[alpha][b] * spin.vals[beta] * conj(prop[delta][gamma][b][0]); + } + } + } + if(runFT) { + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, &accum, shared_cache, 1, sid3D, source_pos, moms, 0, -1, time_step, tid); + } else { + if (sid3D < DGC_localVolume3D) + block2[tid*DGC_localVolume3D + sid3D] = accum; + } +} + +template +void contract_stoch_exact_closed_host( ProfileStruct &ps, + PLEGMA_Propagator &prop, PLEGMA_Vector& vec, + Spin& spin, + PLEGMA_Correlator& corr, Float2 *result, int veci){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + size_t size = corr.getTotalSize()/t_size*time_step; + size_t volume = corr.getVolSize()/t_size; + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + int full_site_size = corr.getSiteSize(); + int site_size = N_SPINS*N_SPINS; + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("t_size = %d, maxT = %d, source.w = %d, time_step = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", t_size, maxT, source.w, time_step, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true) ? (size/full_site_size * (ps.tp.grid.x/time_step)) : size/full_site_size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size*sizeof(Float2)); + // Checking for allocation error. In case we return and let the tuner handle the error. + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess) { + cudaFree(d_partial_block); + return; + } + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propT = toTexture(prop); + auto vecT = toTexture(vec); + for(int it=0; it < t_size; it+=time_step) { + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*std::min(t_size-it, time_step); + for(int ip=0; ip < site_size; ip++) { + contract_stoch_exact_closed_device + <<>> + (*propT, *vecT, spin, d_partial_block, it, std::min(t_size-it, time_step), maxT, source, runFT, *moms, ip); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + cudaMemcpy(h_partial_block, d_partial_block, (alloc_size/time_step)*std::min(t_size-it, time_step)*sizeof(Float2), cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) break; + + if(runFT==true) { + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*std::min(t_size-it, time_step); v++) { + result[(it*volume+v)*full_site_size+veci*site_size+ip] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*full_site_size+veci*site_size+ip] += h_partial_block[v*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume; v++) + result[(it*volume+v)*full_site_size+veci*site_size+ip] = h_partial_block[v]; + } + } + } + hostFree(h_partial_block, alloc_size*sizeof(Float)); + cudaFree(d_partial_block); +} + + +template +static void contract_stoch_exact_closed(PLEGMA_Propagator &prop, Float *spinVals, + Float* ptr, int nvecs, size_t vec_size, bool dev_ptr, + PLEGMA_Correlator& corr){ + bool runFT = (corr.getCorrSpace()==MOMENTUM_SPACE); + int site_size = corr.getSiteSize(); + std::vector runtime; + + if(corr.getSiteSize() != site_size) + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + + int shared_size = (runFT==true) ? sizeof(Float2) : 0; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + ProfileStruct ps(HGC_localVolume3D, shared_size); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + const int ils = dev_ptr ? 1 : 4; + std::vector*> vec; + size_t vec_bytes = vec_size*sizeof(Float); + qudaStream_t stream[ils]; + for(int k=0; k(dev_ptr ? NONE : DEVICE)); + //qudaStreamCreate(stream+k) ; + if(dev_ptr) { + vec[k]->D_elem(ptr+k*vec_size); + } else { + qudaMemcpyAsync(vec[k]->D_elem(), ptr+k*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + + Spin spin; + + for(int i=0; i, + ps, prop, *vec[k], spin, corr, result, i); + + // Start copying next vector to use + if(i+ilsD_elem(ptr+(i+ils)*vec_size); + } else { + qudaMemcpyAsync(vec[k]->D_elem(), ptr+(i+ils)*vec_size, vec_bytes, qudaMemcpyHostToDevice, stream[k]); + } + } + } + + for(int k=0; k(), MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +} diff --git a/plegma/Calc_2pt_LIBE copy.cpp b/plegma/Calc_2pt_LIBE copy.cpp new file mode 100644 index 00000000..936e903e --- /dev/null +++ b/plegma/Calc_2pt_LIBE copy.cpp @@ -0,0 +1,441 @@ +#include +#include +#include + +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) TIME(fnc) + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", + "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space"}; + +#define sign(a) (((a)>=0) ? +1:-1) + +int main(int argc, char **argv) +{ + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + double des; + HGC_options->set("dqed", "dqed used for LIBE", verbosity, des); + double deltamu; + HGC_options->set("deltamu", "deltamu used for SIB", verbosity, deltamu); + std::string qedfile; + HGC_options->set("qed-filename", "The path to the QED field", verbosity, qedfile); + std::vector mul; + HGC_options->set("mul-factors", "List of factors for additional mu to run", verbosity, mul); + double dks; + HGC_options->set("dkappa", "dkappa used for LIBE", verbosity, dks); + + std::vector mu_s; + std::vector mu_c; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i 1){ + PLEGMA_error("More than one m_s passed.\n"); + } + if (mu_c.size() > 1){ + PLEGMA_error("More than one m_c passed.\n"); + } + + if(link_recon!=QUDA_RECONSTRUCT_NO or link_recon_sloppy!=QUDA_RECONSTRUCT_NO) { + PLEGMA_error("QED requires QUDA_RECONSTRUCT_NO\n"); + } + + int nmus = mul.size(); + double kappa0 = kappa; + double mass0 = mass; + bool excludeHeavyOnly = false; + + std::vector mus; + for(int i=0; i smearedGauge(BOTH); + PLEGMA_GaugeU1 gaugeU1; + + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + PLEGMA_printf("\n ### Running setup for mu=%.4e ###\n\n",mu_ud); + mu = mu_ud; + TIME(QUDA_solver solver(mu)); + + + PLEGMA_Gauge3D smearedGauge3D; + std::vector>>> propsUp(nmus); + std::vector>>> propsDown(nmus); + std::vector>> propsStrange; + std::vector>> propsCharm; + PLEGMA_Propagator propSIB; + + for(int nprop=0; nprop<3; nprop++) { + for (int imu = 0; imu < nmus; imu++) { + propsUp[imu].push_back(std::make_shared>(run_ud ? BOTH : NONE)); + propsDown[imu].push_back(std::make_shared>(run_ud ? BOTH : NONE)); + } + } + for(int nprop=0; nprop<4; nprop++) { + if (mu_s.size() > 0) { + propsStrange.push_back(std::make_shared>(BOTH)); + } + if (mu_c.size() > 0) { + propsCharm.push_back(std::make_shared>(BOTH)); + } + } + for(int isource = 0; isource < numSourcePositions; isource++){ + + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n", + isource, sourcePositions[isource][0], sourcePositions[isource][1], + sourcePositions[isource][2], sourcePositions[isource][3]); + site& source = sourcePositions[isource]; + + char *src_string; + asprintf(&src_string, "_sx%02dsy%02dsz%02dst%03d", source[0], source[1], source[2], source[3]); + twop_filename = given_twop_filename + std::string("_") + ((nsmearGauss>0) ? "SS" : "LL") + + "_gN" + std::to_string(nsmearGauss) + "a" + convNumToStr(alphaGauss) + + "_aN" + std::to_string(nsmearAPE) + "a" + convNumToStr(alphaAPE) + src_string + ".h5"; + free(src_string); + + if(access( twop_filename.c_str(), F_OK ) != -1){ + PLEGMA_printf("\n ### Skipping source-position, %s already exists ###\n\n", twop_filename.c_str()); + continue; + } + + if(des!=0) { + asprintf(&src_string, "%04d", isource); + std::string U1_conf = qedfile + src_string; + PLEGMA_printf("\n ### Going to read %s ###\n\n", U1_conf.c_str()); + gaugeU1.readFile(U1_conf, LIME_FORMAT); + free(src_string); + } + + smearedGauge3D.absorb(smearedGauge, source[DIM_T]); + PLEGMA_Correlator corr(corr_space, source, maxQsq); + + for(int isgn=0; isgn<3; isgn++) { + if(kappa0 == -1.0) { + mass = mass0; + } else { + kappa = kappa0; + } + + double phase = (isgn-1)*des; + if(isgn!=1){ + PLEGMA_Gauge gauge2; + gauge2.copy(gauge); + gaugeU1.calculatePlaq(phase); + gauge2.qedPhase(gaugeU1, phase); + gauge2.calculatePlaq(); + updateGaugeQuda(gauge2, true); + plaqQuda(); + solver.UpdateSolver(); + //applyBoundaryConditions(gauge2,true); + } else { + updateGaugeQuda(gauge, true); + plaqQuda(); + solver.UpdateSolver(); + } + + + std::vector threads; + + // Function to compute the propagator for a given run_mu value. + auto computePropagator = [&](PLEGMA_Propagator& prop, const double run_mu, WHICHFLAVOR fl, int nSmear) { + // Update the options and solver if the mass is changed. + if(mu != run_mu) { + // updateOptions(fl); + mu = run_mu; + solver.UpdateSolver(); + } + for(int isc = 0; isc < 12; isc++){ + PLEGMA_Vector vectorInOut; + { // Smear the source vector. + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut.absorb(vector2, source[DIM_T]); + } + PLEGMA_printf("Going to invert %s for component %d\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); + TIME(solver.solve(vectorInOut, vectorInOut)); + { // Smear the solution and absorb it into the propagator. + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop.absorb(vectorAuxF, isc/3, isc%3); + } + } + prop.rotateToPhysicalBase_device(run_mu / abs(run_mu)); + prop.applyBoundaries_device(source[DIM_T]); + }; + + if (run_ud) { + + for (int imu = 0; imu < nmus; imu++) { + mu_ud = mus [imu]; + + TIME(computePropagator(*propsUp[imu][isgn], mu_ud, LIGHT, nsmearGauss)); + TIME(computePropagator(*propsDown[imu][isgn], -mu_ud, LIGHT, nsmearGauss)); + } + } + + TIME(computePropagator(*propsStrange[isgn], mu_s[0], STRANGE, nsmearGauss_s)); + TIME(computePropagator(*propsCharm[isgn], mu_c[0], CHARM, nsmearGauss_c)); + + if(isgn==1){ + TIME(computePropagator(*propsStrange[3], mu_s[0] + deltamu*mu_s[0], STRANGE, nsmearGauss_s)); + TIME(computePropagator(*propsCharm[3], mu_c[0] + deltamu*mu_c[0], CHARM, nsmearGauss_c)); + for (int imu = 0; imu < nmus; imu++) { + mu_ud = mus [imu]; + if (imu!=0){ + excludeHeavyOnly = true; + } + else if (imu==0) + { + excludeHeavyOnly = false; + } + + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1],*propsStrange[1], *propsCharm[1],false,false,false,false,excludeHeavyOnly )); + char * group; + + asprintf(&group, "baryons/u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]", mu_ud , -1*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + double delta = deltamu*mu_ud; + + { + TIME(computePropagator(propSIB, mu_ud + delta, LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC(propSIB, *propsDown[imu][1],*propsStrange[1], *propsCharm[1], true, false,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/upSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud + deltamu*mu_ud, -1*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(computePropagator(propSIB, -mu_ud - delta, LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC( *propsUp[imu][1],propSIB,*propsStrange[1], *propsCharm[1], false, true,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/downSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud - deltamu*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1],*propsStrange[3], *propsCharm[1], false, false,true,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/strangeSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0] + deltamu*mu_s[0], mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1], *propsStrange[1], *propsCharm[3] ,false,false, false, true,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/charmSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0], mu_c[0] + deltamu*mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + } + } + if(kappa0 == -1.0) { + mass = mass0+mass0*dks; + } else { + kappa = kappa0+kappa0*dks; + } + PLEGMA_printf("\n ### Updating solver ###\n\n"); + TIME(solver.UpdateSolver()); + TIME(computePropagator(*propsStrange[3], mu_s[0], STRANGE, nsmearGauss_s)); + TIME(computePropagator(*propsCharm[3], mu_c[0] , CHARM, nsmearGauss_c)); + for (int imu = 0; imu < nmus; imu++) { + mu_ud = mus [imu]; + if (imu!=0){ + excludeHeavyOnly = true; + } + else if (imu==0) + { + excludeHeavyOnly = false; + } + { // Critical mass diagrams + { + TIME(computePropagator(propSIB, mu_ud , LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC(propSIB, *propsDown[imu][1],*propsStrange[1], *propsCharm[1], true, false,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/upSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud , -1*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(computePropagator(propSIB, -mu_ud , LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC( *propsUp[imu][1],propSIB,*propsStrange[1], *propsCharm[1], false, true,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/downSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud , mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1],*propsStrange[3], *propsCharm[1], false, false,true,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/strangeSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0], mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1], *propsStrange[1], *propsCharm[3] ,false,false, false, true,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/charmSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0], mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + } + } + } + } + } + + + PLEGMA_printf("Computing QED diagrams for source-position %d - %02d.%02d.%02d.%02d\n", + isource, source[0], source[1], source[2], source[3]); + + auto contractAndWrite = [&](PLEGMA_Propagator& propUP, + PLEGMA_Propagator& propDN, + PLEGMA_Propagator& propST, + PLEGMA_Propagator& propCH, + bool only_up, bool only_dn, + bool only_st, bool only_ch, + int up_q, int dn_q, int st_q, int ch_q, bool excludeHeavyOnly, + double mud) { + + // collect only the non‐zero charges + std::vector> flav; + if (up_q != 0) flav.emplace_back('u', up_q); + if (dn_q != 0) flav.emplace_back('d', dn_q); + if (st_q != 0) flav.emplace_back('s', st_q); + if (ch_q != 0) flav.emplace_back('c', ch_q); + + // build “top” = concatenation of flavors in order + std::string top; + top.reserve(flav.size()); + for (auto &p : flav) top.push_back(p.first); + + // build suffix = e.g. “u+1d-1…” + std::string suffix; + for (auto &p : flav) { + suffix += p.first; + if (p.second > 0) suffix += '+'; + suffix += std::to_string(p.second); + } + + char mud_str[64]; + snprintf(mud_str, sizeof(mud_str), "mu_ud[%+1.3e]/", mud); + + std::string group = "baryons_QED/"; + group += std::string(mud_str); + if (top.empty()) { + group += "none"; + } else { + group += top + "/" + suffix; + } + + TIME(corr.contractBaryonsUDSC( + propUP, propDN, propST, propCH, + only_up, only_dn, only_st, only_ch, excludeHeavyOnly)); + corr.setGroups(group.c_str()); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + }; + + + + int idx2[2] = { 0, 2 }; + int charges[2] = { -1, +1 }; + + for (int imu = 0; imu < nmus; imu++) { + if (imu!=0){ + excludeHeavyOnly = true; + } + else if (imu==0) + { + excludeHeavyOnly = false; + } + + for (int i= 0; i< 2; i++) { + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][1],*propsStrange[1],*propsCharm[1],true,false,false,false,charges[i],0,0,0,excludeHeavyOnly,mus[imu]); //u + contractAndWrite(*propsUp[imu][1],*propsDown[imu][idx2[i]],*propsStrange[1],*propsCharm[1],false,true,false,false,0,charges[i],0,0,excludeHeavyOnly,mus[imu]); //d + contractAndWrite(*propsUp[imu][1],*propsDown[imu][1],*propsStrange[idx2[i]],*propsCharm[1],false,false,true,false,0,0,charges[i],0,excludeHeavyOnly,mus[imu]); //s + contractAndWrite(*propsUp[imu][1],*propsDown[imu][1],*propsStrange[1],*propsCharm[idx2[i]],false,false,false,true,0,0,0,charges[i],excludeHeavyOnly,mus[imu]); //c + } + + + for (int i=0; i<2; i++){ + for(int j=0; j<2; j++){ + + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][idx2[j]],*propsStrange[1],*propsCharm[1],true,true,false,false,charges[i],charges[j],0,0,excludeHeavyOnly,mus[imu]); //ud + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][1],*propsStrange[idx2[j]],*propsCharm[1],true,false,true,false,charges[i],0,charges[j],0,excludeHeavyOnly,mus[imu]); //us + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][1],*propsStrange[1],*propsCharm[idx2[j]],true,false,false,true,charges[i],0,0,charges[j],excludeHeavyOnly,mus[imu]); //uc + + contractAndWrite(*propsUp[imu][1],*propsDown[imu][idx2[i]],*propsStrange[idx2[j]],*propsCharm[1],false,true,true,false,0,charges[i],charges[j],0,excludeHeavyOnly,mus[imu]); //ds + contractAndWrite(*propsUp[imu][1],*propsDown[imu][idx2[i]],*propsStrange[1],*propsCharm[idx2[j]],false,true,false,true,0,charges[i],0,charges[j],excludeHeavyOnly,mus[imu]); //dc + + + contractAndWrite(*propsUp[0][1],*propsDown[0][1],*propsStrange[idx2[i]],*propsCharm[idx2[j]],false,false,true,true,0,0,charges[i],charges[j],excludeHeavyOnly,mus[imu]); //sc + } + } + } +} +//finalize(); +return 0; +} \ No newline at end of file diff --git a/plegma/Calc_2pt_LIBE.cpp b/plegma/Calc_2pt_LIBE.cpp new file mode 100644 index 00000000..635edf9e --- /dev/null +++ b/plegma/Calc_2pt_LIBE.cpp @@ -0,0 +1,452 @@ +#include +#include +#include + +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) TIME(fnc) + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", "alpha-gauss", + "nsrc", "src-filename", "maxQsq", "twop-filename", "corr-file-format", "corr-space"}; + +#define sign(a) (((a)>=0) ? +1:-1) + +int main(int argc, char **argv) +{ + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + double des; + HGC_options->set("dqed", "dqed used for LIBE", verbosity, des); + double deltamu; + HGC_options->set("deltamu", "deltamu used for SIB", verbosity, deltamu); + std::string qedfile; + HGC_options->set("qed-filename", "The path to the QED field", verbosity, qedfile); + std::vector mul; + HGC_options->set("mul-factors", "List of factors for additional mu to run", verbosity, mul); + double dks; + HGC_options->set("dkappa", "dkappa used for LIBE", verbosity, dks); + + std::vector mu_s; + std::vector mu_c; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i 1){ + PLEGMA_error("More than one m_s passed.\n"); + } + if (mu_c.size() > 1){ + PLEGMA_error("More than one m_c passed.\n"); + } + + if(link_recon!=QUDA_RECONSTRUCT_NO or link_recon_sloppy!=QUDA_RECONSTRUCT_NO) { + PLEGMA_error("QED requires QUDA_RECONSTRUCT_NO\n"); + } + + int nmus = mul.size(); + double kappa0 = kappa; + double mass0 = mass; + bool excludeHeavyOnly = false; + + std::vector mus; + for(int i=0; i smearedGauge(BOTH); + PLEGMA_GaugeU1 gaugeU1; + + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + PLEGMA_printf("\n ### Running setup for mu=%.4e ###\n\n",mu_ud); + mu = mu_ud; + TIME(QUDA_solver solver(mu,1)); + + + PLEGMA_Gauge3D smearedGauge3D; + std::vector>>> propsUp(nmus); + std::vector>>> propsDown(nmus); + std::vector>> propsStrange; + std::vector>> propsCharm; + PLEGMA_Propagator propSIB; + + for(int nprop=0; nprop<3; nprop++) { + for (int imu = 0; imu < nmus; imu++) { + propsUp[imu].push_back(std::make_shared>(run_ud ? BOTH : NONE)); + propsDown[imu].push_back(std::make_shared>(run_ud ? BOTH : NONE)); + } + } + for(int nprop=0; nprop<4; nprop++) { + if (mu_s.size() > 0) { + propsStrange.push_back(std::make_shared>(BOTH)); + } + if (mu_c.size() > 0) { + propsCharm.push_back(std::make_shared>(BOTH)); + } + } + for(int isource = 0; isource < numSourcePositions; isource++){ + + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n", + isource, sourcePositions[isource][0], sourcePositions[isource][1], + sourcePositions[isource][2], sourcePositions[isource][3]); + site& source = sourcePositions[isource]; + + char *src_string; + asprintf(&src_string, "_sx%02dsy%02dsz%02dst%03d", source[0], source[1], source[2], source[3]); + twop_filename = given_twop_filename + std::string("_") + ((nsmearGauss>0) ? "SS" : "LL") + + "_gN" + std::to_string(nsmearGauss) + "a" + convNumToStr(alphaGauss) + + "_aN" + std::to_string(nsmearAPE) + "a" + convNumToStr(alphaAPE) + src_string + ".h5"; + free(src_string); + + if(access( twop_filename.c_str(), F_OK ) != -1){ + PLEGMA_printf("\n ### Skipping source-position, %s already exists ###\n\n", twop_filename.c_str()); + continue; + } + + if(des!=0) { + asprintf(&src_string, "%04d", isource); + std::string U1_conf = qedfile + src_string; + PLEGMA_printf("\n ### Going to read %s ###\n\n", U1_conf.c_str()); + gaugeU1.readFile(U1_conf, LIME_FORMAT); + free(src_string); + } + + smearedGauge3D.absorb(smearedGauge, source[DIM_T]); + PLEGMA_Correlator corr(corr_space, source, maxQsq); + + for(int isgn=0; isgn<3; isgn++) { + if(kappa0 == -1.0) { + mass = mass0; + } else { + kappa = kappa0; + } + + double phase = (isgn-1)*des; + if(isgn!=1){ + PLEGMA_Gauge gauge2; + gauge2.copy(gauge); + gaugeU1.calculatePlaq(phase); + gauge2.qedPhase(gaugeU1, phase); + gauge2.calculatePlaq(); + updateGaugeQuda(gauge2, true); + plaqQuda(); + solver.UpdateSolver(); + //applyBoundaryConditions(gauge2,true); + } else { + updateGaugeQuda(gauge, true); + plaqQuda(); + solver.UpdateSolver(); + } + + + std::vector threads; + + // Function to compute the propagator for a given run_mu value. + auto computePropagator = [&](PLEGMA_Propagator& prop, const double run_mu, WHICHFLAVOR fl, int nSmear) { + // Update the options and solver if the mass is changed. + if(mu != run_mu) { + // updateOptions(fl); + mu = run_mu; + solver.UpdateSolver(); + } + for(int isc = 0; isc < 12; isc++){ + PLEGMA_Vector vectorInOut; + { // Smear the source vector. + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut.absorb(vector2, source[DIM_T]); + } + PLEGMA_printf("Going to invert %s for component %d\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); + TIME(solver.solve(vectorInOut, vectorInOut)); + { // Smear the solution and absorb it into the propagator. + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop.absorb(vectorAuxF, isc/3, isc%3); + } + } + prop.rotateToPhysicalBase_device(run_mu / abs(run_mu)); + prop.applyBoundaries_device(source[DIM_T]); + }; + + for (int imu = 0; imu < nmus; imu++) { + mu_ud = mus [imu]; + TIME(computePropagator(*propsDown[imu][isgn], -mu_ud, LIGHT, nsmearGauss)); + } + TIME(computePropagator(*propsStrange[isgn], mu_s[0], STRANGE, nsmearGauss_s)); + + phase = (isgn-1)*2*des; + if(isgn!=1){ + PLEGMA_Gauge gauge2; + gauge2.copy(gauge); + gaugeU1.calculatePlaq(phase); + gauge2.qedPhase(gaugeU1, phase); + gauge2.calculatePlaq(); + updateGaugeQuda(gauge2, true); + plaqQuda(); + solver.UpdateSolver(); + //applyBoundaryConditions(gauge2,true); + } + for (int imu = 0; imu < nmus; imu++) { + mu_ud = mus [imu]; + TIME(computePropagator(*propsUp[imu][isgn], mu_ud, LIGHT, nsmearGauss)); + } + TIME(computePropagator(*propsCharm[isgn], mu_c[0], CHARM, nsmearGauss_c)); + + if(isgn==1){ + TIME(computePropagator(*propsStrange[3], mu_s[0] + deltamu*mu_s[0], STRANGE, nsmearGauss_s)); + TIME(computePropagator(*propsCharm[3], mu_c[0] + deltamu*mu_c[0], CHARM, nsmearGauss_c)); + for (int imu = 0; imu < nmus; imu++) { + mu_ud = mus [imu]; + if (imu!=0){ + excludeHeavyOnly = true; + } + else if (imu==0) + { + excludeHeavyOnly = false; + } + + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1],*propsStrange[1], *propsCharm[1],false,false,false,false,excludeHeavyOnly )); + char * group; + + asprintf(&group, "baryons/u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]", mu_ud , -1*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + double delta = deltamu*mu_ud; + + { + TIME(computePropagator(propSIB, mu_ud + delta, LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC(propSIB, *propsDown[imu][1],*propsStrange[1], *propsCharm[1], true, false,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/upSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud + deltamu*mu_ud, -1*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(computePropagator(propSIB, -mu_ud - delta, LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC( *propsUp[imu][1],propSIB,*propsStrange[1], *propsCharm[1], false, true,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/downSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud - deltamu*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1],*propsStrange[3], *propsCharm[1], false, false,true,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/strangeSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0] + deltamu*mu_s[0], mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1], *propsStrange[1], *propsCharm[3] ,false,false, false, true,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIB/mu_ud[%+1.3e]/charmSIB_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0], mu_c[0] + deltamu*mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + } + } + if(kappa0 == -1.0) { + mass = mass0+mass0*dks; + } else { + kappa = kappa0+kappa0*dks; + } + PLEGMA_printf("\n ### Updating solver ###\n\n"); + TIME(solver.UpdateSolver()); + TIME(computePropagator(*propsStrange[3], mu_s[0], STRANGE, nsmearGauss_s)); + TIME(computePropagator(*propsCharm[3], mu_c[0] , CHARM, nsmearGauss_c)); + for (int imu = 0; imu < nmus; imu++) { + mu_ud = mus [imu]; + if (imu!=0){ + excludeHeavyOnly = true; + } + else if (imu==0) + { + excludeHeavyOnly = false; + } + { // Critical mass diagrams + { + TIME(computePropagator(propSIB, mu_ud , LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC(propSIB, *propsDown[imu][1],*propsStrange[1], *propsCharm[1], true, false,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/upSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud , -1*mu_ud, mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(computePropagator(propSIB, -mu_ud , LIGHT, nsmearGauss)); + TIME(corr.contractBaryonsUDSC( *propsUp[imu][1],propSIB,*propsStrange[1], *propsCharm[1], false, true,false,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/downSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud , mu_s[0] , mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1],*propsStrange[3], *propsCharm[1], false, false,true,false,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/strangeSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0], mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + { + TIME(corr.contractBaryonsUDSC(*propsUp[imu][1], *propsDown[imu][1], *propsStrange[1], *propsCharm[3] ,false,false, false, true,excludeHeavyOnly)); + char * group; + + asprintf(&group, "baryons_SIBc/mu_ud[%+1.3e]/charmSIBc_u[%+1.3e]d[%+1.3e]s[%+1.3e]c[%+1.3e]",mu_ud, mu_ud, -1*mu_ud, mu_s[0], mu_c[0]); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + } + } + } + } + } + + + PLEGMA_printf("Computing QED diagrams for source-position %d - %02d.%02d.%02d.%02d\n", + isource, source[0], source[1], source[2], source[3]); + + auto contractAndWrite = [&](PLEGMA_Propagator& propUP, + PLEGMA_Propagator& propDN, + PLEGMA_Propagator& propST, + PLEGMA_Propagator& propCH, + bool only_up, bool only_dn, + bool only_st, bool only_ch, + int up_q, int dn_q, int st_q, int ch_q, bool excludeHeavyOnly, + double mud) { + + // collect only the non‐zero charges + std::vector> flav; + if (up_q != 0) flav.emplace_back('u', up_q); + if (dn_q != 0) flav.emplace_back('d', dn_q); + if (st_q != 0) flav.emplace_back('s', st_q); + if (ch_q != 0) flav.emplace_back('c', ch_q); + + // build “top” = concatenation of flavors in order + std::string top; + top.reserve(flav.size()); + for (auto &p : flav) top.push_back(p.first); + + // build suffix = e.g. “u+1d-1…” + std::string suffix; + for (auto &p : flav) { + suffix += p.first; + if (p.second > 0) suffix += '+'; + suffix += std::to_string(p.second); + } + + char mud_str[64]; + snprintf(mud_str, sizeof(mud_str), "mu_ud[%+1.3e]/", mud); + + std::string group = "baryons_QED/"; + group += std::string(mud_str); + if (top.empty()) { + group += "none"; + } else { + group += top + "/" + suffix; + } + + TIME(corr.contractBaryonsUDSC( + propUP, propDN, propST, propCH, + only_up, only_dn, only_st, only_ch, excludeHeavyOnly)); + corr.setGroups(group.c_str()); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + }; + + + + int idx2[2] = { 0, 2 }; + int charges[2] = { -1, +1 }; + + for (int imu = 0; imu < nmus; imu++) { + if (imu!=0){ + excludeHeavyOnly = true; + } + else if (imu==0) + { + excludeHeavyOnly = false; + } + + for (int i= 0; i< 2; i++) { + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][1],*propsStrange[1],*propsCharm[1],true,false,false,false,charges[i],0,0,0,excludeHeavyOnly,mus[imu]); //u + contractAndWrite(*propsUp[imu][1],*propsDown[imu][idx2[i]],*propsStrange[1],*propsCharm[1],false,true,false,false,0,charges[i],0,0,excludeHeavyOnly,mus[imu]); //d + contractAndWrite(*propsUp[imu][1],*propsDown[imu][1],*propsStrange[idx2[i]],*propsCharm[1],false,false,true,false,0,0,charges[i],0,excludeHeavyOnly,mus[imu]); //s + contractAndWrite(*propsUp[imu][1],*propsDown[imu][1],*propsStrange[1],*propsCharm[idx2[i]],false,false,false,true,0,0,0,charges[i],excludeHeavyOnly,mus[imu]); //c + } + + + for (int i=0; i<2; i++){ + for(int j=0; j<2; j++){ + + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][idx2[j]],*propsStrange[1],*propsCharm[1],true,true,false,false,charges[i],charges[j],0,0,excludeHeavyOnly,mus[imu]); //ud + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][1],*propsStrange[idx2[j]],*propsCharm[1],true,false,true,false,charges[i],0,charges[j],0,excludeHeavyOnly,mus[imu]); //us + contractAndWrite(*propsUp[imu][idx2[i]],*propsDown[imu][1],*propsStrange[1],*propsCharm[idx2[j]],true,false,false,true,charges[i],0,0,charges[j],excludeHeavyOnly,mus[imu]); //uc + + contractAndWrite(*propsUp[imu][1],*propsDown[imu][idx2[i]],*propsStrange[idx2[j]],*propsCharm[1],false,true,true,false,0,charges[i],charges[j],0,excludeHeavyOnly,mus[imu]); //ds + contractAndWrite(*propsUp[imu][1],*propsDown[imu][idx2[i]],*propsStrange[1],*propsCharm[idx2[j]],false,true,false,true,0,charges[i],0,charges[j],excludeHeavyOnly,mus[imu]); //dc + + + contractAndWrite(*propsUp[0][1],*propsDown[0][1],*propsStrange[idx2[i]],*propsCharm[idx2[j]],false,false,true,true,0,0,charges[i],charges[j],excludeHeavyOnly,mus[imu]); //sc + } + } + } +} +//finalize(); +return 0; +} From 60d1a3abff8c5c29bd4ea6b008e4b5dd4851fc96 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 3 Feb 2026 13:27:53 +0100 Subject: [PATCH 159/168] removing Tetraquarks --- lib/CMakeLists.txt | 18 +++++++++--------- lib/PLEGMA_Correlator.cu | 19 ++++++++++++++----- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f232ac3c..825b3921 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -30,15 +30,15 @@ if(PLEGMA_UDSC_BARYONS) LIST(APPEND PLEGMA_OBJS kernels/PLEGMA_baryons_udsc.cu kernels/PLEGMA_baryons_udsc_arrays.cu - kernels/PLEGMA_heavy_light_tetraquarks.cu - kernels/PLEGMA_heavy_light_tetraquarks_stochastic.cu - kernels/PLEGMA_heavy_light_tetraquarks_open_contractions.cu - kernels/PLEGMA_heavy_light_tetraquarks_arrays.cu - kernels/PLEGMA_heavy_light_tetraquarks_arrays_stoch.cu - kernels/PLEGMA_bcud_tetraquarks.cu - kernels/PLEGMA_bcud_tetraquarks_stochastic.cu - kernels/PLEGMA_bcud_tetraquarks_arrays.cu - kernels/PLEGMA_bcud_tetraquarks_arrays_stoch.cu + # kernels/PLEGMA_heavy_light_tetraquarks.cu + #kernels/PLEGMA_heavy_light_tetraquarks_stochastic.cu + #kernels/PLEGMA_heavy_light_tetraquarks_open_contractions.cu + #kernels/PLEGMA_heavy_light_tetraquarks_arrays.cu + #kernels/PLEGMA_heavy_light_tetraquarks_arrays_stoch.cu + #kernels/PLEGMA_bcud_tetraquarks.cu + #kernels/PLEGMA_bcud_tetraquarks_stochastic.cu + #kernels/PLEGMA_bcud_tetraquarks_arrays.cu + #kernels/PLEGMA_bcud_tetraquarks_arrays_stoch.cu ) endif() if(PLEGMA_SCATTERING_CONTRACTIONS) diff --git a/lib/PLEGMA_Correlator.cu b/lib/PLEGMA_Correlator.cu index 3c4b7ecb..cb038c28 100644 --- a/lib/PLEGMA_Correlator.cu +++ b/lib/PLEGMA_Correlator.cu @@ -27,8 +27,8 @@ #include #ifdef PLEGMA_UDSC_BARYONS #include -#include -#include +//#include +//#include #endif using namespace plegma; @@ -344,6 +344,7 @@ contractTetraquarks(PLEGMA_Propagator &propLT, PLEGMA_Propagator &propBT, bool only_st, bool only_ch){ #ifdef PLEGMA_UDSC_BARYONS +#if 0 shape = {}; description = ""; datasets = {}; @@ -391,6 +392,7 @@ contractTetraquarks(PLEGMA_Propagator &propLT, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks(propLT, propST, propCH, propBT, *this, todo); +#endif #else PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); #endif @@ -410,7 +412,7 @@ contractTetraquarksBCUD(PLEGMA_Propagator &propLT, description = ""; datasets = {}; groups = {}; - +#if 0 bool not_lt = propLT.getAllocation() == NONE; bool not_st = propST.getAllocation() == NONE; bool not_ch = propCH.getAllocation() == NONE; @@ -453,6 +455,7 @@ contractTetraquarksBCUD(PLEGMA_Propagator &propLT, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks_bcud(propLT, propST, propCH, propBT, *this, todo); +#endif #else PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); #endif @@ -476,6 +479,7 @@ contractTetraquarksStochastic(PLEGMA_Propagator &propLT1, description = ""; datasets = {}; groups = {}; +#if 0 bool not_lt = propLT1.getAllocation() == NONE; bool not_st = propST1.getAllocation() == NONE; @@ -512,6 +516,7 @@ contractTetraquarksStochastic(PLEGMA_Propagator &propLT1, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks_stochastic(propLT1, propLT2,propST1, propST2, propBT1, propBT2, *this, todo); +#endif #else PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); #endif @@ -536,7 +541,7 @@ contractTetraquarksStochasticBCUD(PLEGMA_Propagator &propLT1, description = ""; datasets = {}; groups = {}; - +#if 0 bool not_lt = propLT1.getAllocation() == NONE; bool not_st = propST1.getAllocation() == NONE; bool not_ch = propCH1.getAllocation() == NONE; @@ -575,6 +580,7 @@ contractTetraquarksStochasticBCUD(PLEGMA_Propagator &propLT1, PLEGMA_printf("%s, ", name.c_str()); PLEGMA_printf("\n"); contract_tetraquarks_bcud_stochastic(propLT1, propLT2,propST1, propST2, propCH1, propCH2, propBT1, propBT2, *this, todo); +#endif #else PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); #endif @@ -588,6 +594,7 @@ void PLEGMA_Correlator:: contractTetraquarkScatteringOpenIndex(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2, std::vector gammas, int s1, std::string Quarks){ #ifdef PLEGMA_UDSC_BARYONS +#if 0 if(gammas.size() == 0) PLEGMA_error("List of gammas provided is empty"); @@ -617,6 +624,7 @@ contractTetraquarkScatteringOpenIndex(PLEGMA_Propagator &prop1, initialize(); contract_tetraquark_scattering_open_index(*this,prop1,prop2,gammas, s1); +#endif #else PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); #endif @@ -630,7 +638,7 @@ void PLEGMA_Correlator:: contractTetraquarkScatteringOpenIndexStochastic(PLEGMA_Propagator &prop1, PLEGMA_Propagator &prop2, std::vector gammas, int randInd1, int randInd2, int s1, std::string Quarks){ #ifdef PLEGMA_UDSC_BARYONS - +#if 0 if(gammas.size() == 0) PLEGMA_error("List of gammas provided is empty"); std::string GammaString = getGammasString(gammas); @@ -656,6 +664,7 @@ contractTetraquarkScatteringOpenIndexStochastic(PLEGMA_Propagator &prop1 // PLEGMA_printf("contractTetraquarkScatteringOpenIndexStochastic is going to run:"); contract_tetraquark_scattering_open_index(*this,prop1,prop2,gammas, s1); +#endif #else PLEGMA_error("Flag PLEGMA_UDSC_BARYONS not defined"); #endif From 3332676586fdb8f780721dfe549a23f835fb3071 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 4 Feb 2026 11:48:39 +0100 Subject: [PATCH 160/168] finish adding LIBE stuff --- include/global/PLEGMA_enums.h | 2 +- lib/CMakeLists.txt | 6 +- lib/PLEGMA_Field.cu | 10 +-- lib/kernels/PLEGMA_kernel_utils.cuh | 104 ++++++++++++++++++++++++++++ plegma/CMakeLists.txt | 3 + plegma/Calc_2pt_LIBE.cpp | 8 +-- 6 files changed, 122 insertions(+), 11 deletions(-) diff --git a/include/global/PLEGMA_enums.h b/include/global/PLEGMA_enums.h index b9b5bf1b..24c68fbc 100644 --- a/include/global/PLEGMA_enums.h +++ b/include/global/PLEGMA_enums.h @@ -9,7 +9,7 @@ enum FILE_FORMAT{ASCII_FORMAT, HDF5_FORMAT, LIME_FORMAT, DEFAULT_FORMAT}; enum ALLOCATION_FLAG{EVERY=-1,NONE=0,HOST,DEVICE,BOTH}; -enum CLASS_ENUM{CUSTOM,SCALAR,SU3FIELD,GAUGE,GAUGE3D,VECTOR,VECTOR3D,PROPAGATOR,PROPAGATOR3D,QLOOPS,FMUNU,U1GAUGE}; +enum CLASS_ENUM{CUSTOM,SCALAR,SU3FIELD,GAUGE,GAUGE3D,GAUGEU1,VECTOR,VECTOR3D,PROPAGATOR,PROPAGATOR3D,QLOOPS,FMUNU,U1GAUGE}; enum GHOST_FLAG{ALL_GHOSTS=-1,NO_GHOSTS,FIRST_SIDE,FIRST_CORNER,FIRST_VERTEX}; enum WHICHPARTICLE{PROTON,NEUTRON}; enum WHICHPROJECTOR{P4_P,P4G5G1_P,P4G5G2_P,P4G5G3_P,P4_M,P4G5G1_M,P4G5G2_M,P4G5G3_M,P_00,P_01,P_02,P_03,P_10, P_11, P_12, P_13, P_20, P_21, P_22, P_23, P_30, P_31, P_32, P_33, N_PROJS}; // Do not change this order and keep N_PROJS last diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 825b3921..8d806ec0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -4,13 +4,18 @@ set (PLEGMA_OBJS PLEGMA_Propagator.cu PLEGMA_Vector.cu PLEGMA_Gauge.cu + PLEGMA_GaugeU1.cu PLEGMA_Field.cu PLEGMA_Su3field.cu PLEGMA_Random.cu kernels/PLEGMA_baryons_NtoN.cu + kernels/PLEGMA_baryons_NtoN_OS.cu kernels/PLEGMA_seqSourceNucleon.cu kernels/PLEGMA_threep_local.cu kernels/PLEGMA_threep_noe.cu + kernels/PLEGMA_mesons_noe.cu + kernels/PLEGMA_mesons_noe_SIB.cu + kernels/PLEGMA_mesons_noe_LIBE.cu kernels/PLEGMA_threep_oneD.cu kernels/PLEGMA_threep_twoD.cu kernels/PLEGMA_threep_threeD_part1.cu @@ -24,7 +29,6 @@ set (PLEGMA_OBJS PLEGMA_FT.cu PLEGMA_BLAS.cu PLEGMA_Fmunu.cu - PLEGMA_U1Gauge.cu ) if(PLEGMA_UDSC_BARYONS) LIST(APPEND PLEGMA_OBJS diff --git a/lib/PLEGMA_Field.cu b/lib/PLEGMA_Field.cu index e5070bc5..2d2633d4 100644 --- a/lib/PLEGMA_Field.cu +++ b/lib/PLEGMA_Field.cu @@ -132,16 +132,16 @@ PLEGMA_Field::PLEGMA_Field(ALLOCATION_FLAG alloc_flag, CLASS_ENUM classT, field_name = "PLEGMA_GAUGE"; setSiteShape({N_DIMS, N_COLS, N_COLS}); break; - case U1GAUGE: - initialize(alloc_flag, N_DIMS, HGC_localVolume); - field_name = "PLEGMA_U1GAUGE"; - setSiteShape({N_DIMS}); - break; case GAUGE3D: initialize(alloc_flag, N_DIMS * N_COLS * N_COLS, HGC_localVolume3D); field_name = "PLEGMA_GAUGE3D"; setSiteShape({N_DIMS, N_COLS, N_COLS}); break; + case GAUGEU1: + initialize(alloc_flag, N_DIMS, HGC_localVolume); + field_name = "PLEGMA_GAUGEU1"; + setSiteShape({N_DIMS}); + break; case VECTOR: initialize(alloc_flag, N_SPINS * N_COLS, HGC_localVolume); field_name = "PLEGMA_VECTOR"; diff --git a/lib/kernels/PLEGMA_kernel_utils.cuh b/lib/kernels/PLEGMA_kernel_utils.cuh index 9f62b33b..543278fd 100644 --- a/lib/kernels/PLEGMA_kernel_utils.cuh +++ b/lib/kernels/PLEGMA_kernel_utils.cuh @@ -671,6 +671,110 @@ namespace plegma { } if(isGdag) Gdag(D); } + template + __inline__ __device__ void partial_trace_mul_Prop_G_Prop_meson_LIBE(Float2 A[N_COLS][N_COLS][N_SPINS][N_SPINS], + Float2 B[N_SPINS][N_SPINS][N_COLS][N_COLS], + Float2 C[N_SPINS][N_SPINS][N_COLS][N_COLS], + Float2 D[N_COLS][N_COLS]){ + if(isGdag) Gdag(D); +#pragma unroll + for(int s1 = 0; s1 < N_COLS; s1++) +#pragma unroll + for(int s2 = 0; s2 < N_COLS; s2++) +#pragma unroll + for(int mu = 0 ; mu < N_SPINS; mu++) +#pragma unroll + for(int nu = 0 ; nu < N_SPINS; nu++){ + if(aty == ACC_ZERO || aty == ZERO_PLUS || aty == ZERO_MINUS){ + A[s1][s2][mu][nu].x=0.; A[s1][s2][mu][nu].y=0.; + } +#pragma unroll + for(int rho = 0 ; rho < N_SPINS; rho++) +#pragma unroll + for(int b = 0; b < N_COLS; b++) +#pragma unroll + for(int c = 0; c < N_COLS; c++) { + if(aty == ACC_ZERO || aty == ACC_PLUS || aty == ZERO_PLUS){ + A[s1][s2][mu][nu] += conj(C[mu][rho][b][s2]) * D[b][c] * B[nu][rho][c][s1]; + } + else{ + A[s1][s2][mu][nu] -= conj(C[mu][rho][b][s2]) * D[b][c] * B[nu][rho][c][s1]; + } + } + } + if(isGdag) Gdag(D); + } + + + template + __inline__ __device__ void partial_trace_mul_Prop_G_Prop_meson_SIB(Float2 A[5][N_SPINS][N_SPINS], + Float2 B[N_SPINS][N_SPINS][N_COLS][N_COLS], + Float2 C[N_SPINS][N_SPINS][N_COLS][N_COLS], + Float2 D[N_COLS][N_COLS]){ + if(isGdag) Gdag(D); +#pragma unroll + for(int s = 0; s < 5; s++){ + int s3 = (s+1) / 2; // 0, 1, 1, 2, 2 + int s1 = s3 * ((s+1) % 2); // 0, 0, 1, 0, 2 + int s2 = s3 * ((s+0) % 2); // 0, 1, 0, 2, 0 + +#pragma unroll + for(int mu = 0 ; mu < N_SPINS; mu++) +#pragma unroll + for(int nu = 0 ; nu < N_SPINS; nu++){ + if(aty == ACC_ZERO || aty == ZERO_PLUS || aty == ZERO_MINUS){ + A[s][mu][nu].x=0.; A[s][mu][nu].y=0.; + } +#pragma unroll + for(int rho = 0 ; rho < N_SPINS; rho++) +#pragma unroll + for(int b = 0; b < N_COLS; b++) +#pragma unroll + for(int c = 0; c < N_COLS; c++) { + if(aty == ACC_ZERO || aty == ACC_PLUS || aty == ZERO_PLUS){ + A[s][mu][nu] += conj(B[mu][rho][b][s2]) * D[b][c] * C[nu][rho][c][s1]; + } + else{ + A[s][mu][nu] -= conj(B[mu][rho][b][s2]) * D[b][c] * C[nu][rho][c][s1]; + } + } + } + } + if(isGdag) Gdag(D); + } + template + __inline__ __device__ void partial_trace_mul_Prop_G_Prop_meson(Float2 A[N_SPINS][N_SPINS], + Float2 B[N_SPINS][N_SPINS][N_COLS][COLS], + Float2 C[N_SPINS][N_SPINS][N_COLS][COLS], + Float2 D[N_COLS][N_COLS]){ + if(isGdag) Gdag(D); +#pragma unroll + for(int mu = 0 ; mu < N_SPINS; mu++) +#pragma unroll + for(int nu = 0 ; nu < N_SPINS; nu++){ + if(aty == ACC_ZERO || aty == ZERO_PLUS || aty == ZERO_MINUS){ + A[mu][nu].x=0.; A[mu][nu].y=0.; + } +#pragma unroll + for(int rho = 0 ; rho < N_SPINS; rho++) +#pragma unroll + for(int a = 0; a < COLS; a++) +#pragma unroll + for(int b = 0; b < N_COLS; b++) +#pragma unroll + for(int c = 0; c < N_COLS; c++){ + if(aty == ACC_ZERO || aty == ACC_PLUS || aty == ZERO_PLUS){ + A[mu][nu] += conj(B[mu][rho][b][a]) * D[b][c] * C[nu][rho][c][a]; + } + else{ + A[mu][nu] -= conj(B[mu][rho][b][a]) * D[b][c] * C[nu][rho][c][a]; + } + } + + } + if(isGdag) Gdag(D); + } + template __inline__ __device__ void partial_trace_mul_Vec_G_Vec(Float2 A[N_SPINS][N_SPINS], diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 283b9b75..159fdbcc 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -45,6 +45,9 @@ target_link_libraries(Topo ${PLEGMA_LIBS}) cuda_add_executable(Calc_2pt Calc_2pt.cpp) target_link_libraries(Calc_2pt ${PLEGMA_LIBS}) +cuda_add_executable(Calc_2pt_LIBE Calc_2pt_LIBE.cpp) +target_link_libraries(Calc_2pt_LIBE ${PLEGMA_LIBS}) + cuda_add_executable(Calc_2pt_wilson Calc_2pt_wilson.cpp) target_link_libraries(Calc_2pt_wilson ${PLEGMA_LIBS}) diff --git a/plegma/Calc_2pt_LIBE.cpp b/plegma/Calc_2pt_LIBE.cpp index 635edf9e..b0491241 100644 --- a/plegma/Calc_2pt_LIBE.cpp +++ b/plegma/Calc_2pt_LIBE.cpp @@ -161,9 +161,9 @@ int main(int argc, char **argv) if(isgn!=1){ PLEGMA_Gauge gauge2; gauge2.copy(gauge); - gaugeU1.calculatePlaq(phase); + //gaugeU1.calculatePlaq(phase); gauge2.qedPhase(gaugeU1, phase); - gauge2.calculatePlaq(); + //gauge2.calculatePlaq(); updateGaugeQuda(gauge2, true); plaqQuda(); solver.UpdateSolver(); @@ -218,9 +218,9 @@ int main(int argc, char **argv) if(isgn!=1){ PLEGMA_Gauge gauge2; gauge2.copy(gauge); - gaugeU1.calculatePlaq(phase); + //gaugeU1.calculatePlaq(phase); gauge2.qedPhase(gaugeU1, phase); - gauge2.calculatePlaq(); + //gauge2.calculatePlaq(); updateGaugeQuda(gauge2, true); plaqQuda(); solver.UpdateSolver(); From 51631f4a5ea12877826b07a75dd61aba9af9716c Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 18 Mar 2026 13:54:55 +0100 Subject: [PATCH 161/168] including Christians Kummers code, and the LIBE stuff --- include/PLEGMA_Field.h | 18 + include/PLEGMA_Vector.h | 4 + include/global/PLEGMA_enums.h | 29 +- include/global/PLEGMA_structs.h | 22 + include/utils/PLEGMA_params.h | 1 + include/utils/PLEGMA_readList.h | 17 + lib/CMakeLists.txt | 2 + lib/PLEGMA_Correlator.cu | 23 +- lib/PLEGMA_Field.cu | 701 +++++++++++++++++++++---- lib/PLEGMA_Vector.cu | 21 + lib/kernels/PLEGMA_baryons_NtoN_OS.cu | 51 ++ lib/kernels/PLEGMA_field_utils.cuh | 164 +++++- lib/kernels/PLEGMA_kernel_getSet.cuh | 48 +- lib/kernels/PLEGMA_mesons_noe.cu | 182 +++++++ lib/kernels/PLEGMA_mesons_noe_LIBE.cu | 187 +++++++ lib/kernels/PLEGMA_mesons_noe_SIB.cu | 186 +++++++ lib/kernels/PLEGMA_plaquetteU1.cuh | 73 +++ lib/kernels/PLEGMA_projectors.cuh | 31 +- lib/kernels/PLEGMA_seqSourceNucleon.cu | 19 +- lib/kernels/PLEGMA_threep_local.cu | 15 +- lib/kernels/PLEGMA_threep_oneD.cu | 18 +- plegma/CMakeLists.txt | 25 + plegma/Calc_2pt.cpp | 32 +- plegma/Calc_2pt_marconi.cpp | 4 +- plegma/Plaquette.cpp | 76 ++- plegma/nucleon_2pt_3pt.cpp | 9 +- plegma/nucleon_3pt_n_npi_sigma.cpp | 16 +- plegma/piN_scattering_length_12.cpp | 206 ++++---- plegma/qLoops.cpp | 67 ++- python/check_baryons.py | 6 + utils/QUDA_interface.cpp | 2 +- 31 files changed, 1968 insertions(+), 287 deletions(-) create mode 100644 lib/kernels/PLEGMA_baryons_NtoN_OS.cu create mode 100644 lib/kernels/PLEGMA_mesons_noe.cu create mode 100644 lib/kernels/PLEGMA_mesons_noe_LIBE.cu create mode 100644 lib/kernels/PLEGMA_mesons_noe_SIB.cu create mode 100644 lib/kernels/PLEGMA_plaquetteU1.cuh diff --git a/include/PLEGMA_Field.h b/include/PLEGMA_Field.h index 0b041191..93e318c5 100644 --- a/include/PLEGMA_Field.h +++ b/include/PLEGMA_Field.h @@ -27,9 +27,12 @@ namespace plegma { size_t ghost_length; /*!< Member variable to hold the size of ghosts that involve in the communication (only side ghosts) */ size_t ghost_corner_length; /*!< Member variable to hold the size of ghosts that involve in the communication (ghosts which are on the corners) */ size_t ghost_vertex_length; + size_t single_ghost_length; + size_t single_corner_length; Float *h_elem; /*!< Member variable pointer to the elements of the field on CPU */ Float *d_elem; /*!< Member variable pointer to the elements of the field on GPU */ + Float *d_ext_ghost; Float *h_ext_ghost_r; /*!< Member variable pointer to the side ghost elements of the field on CPU (receive version)*/ Float *h_ext_ghost_s; /*!< Member variable pointer to the side ghost elements of the field on CPU (send version)*/ Float *h_ext_ghost_corner_r; /*!< Member variable pointer to the corner ghost elements of the field on CPU (receive version)*/ @@ -72,6 +75,7 @@ namespace plegma { @param field_l: see "field_length" @param vol_l: see "total_length" */ + void initialize(ALLOCATION_FLAG alloc_flag, int field_l, size_t vol_l); public: /** @@ -126,6 +130,8 @@ namespace plegma { * @return a pointer to access device elements of the field */ Float* D_elem() const { return d_elem; } + void D_elem(Float* ptr) { d_elem = ptr; } + /** * @return a boolean if the host memory is allocated */ @@ -134,6 +140,7 @@ namespace plegma { * @return a boolean if the device memory is allocated */ bool IsAllocDevice() const { return isAllocDevice;} + /** * @return the kind of allocation we have for the field */ @@ -151,8 +158,11 @@ namespace plegma { * @return the length of the ghost part of the field in lattice points (local) */ size_t Ghost_length() const { return ghost_length;} // the length of the ghost + size_t SingleGhost_length() const { return single_ghost_length;} // the length of a single ghost size_t GhostCorner_length() const { return ghost_corner_length;} // the length of the ghost for corners + size_t SingleCorner_length() const { return single_corner_length;} // the length of a single ghost for corners size_t GhostVertex_length() const { return ghost_vertex_length;} // the length of the ghost for vertex + size_t TotalGhost_length() const { return Ghost_length()+GhostCorner_length()+GhostVertex_length();} /** * @return the length of the field + ghost in lattice points (local) */ @@ -162,9 +172,12 @@ namespace plegma { * @return the bytes the length of the field including d.o.f */ size_t Bytes_total() const { return this->Total_length()*this->Field_length()*2*sizeof(Float); } + size_t Bytes_total_ghost() const { return this->TotalGhost_length()*this->Field_length()*2*sizeof(Float); } /** * @return the bytes the length of the ghost including d.o.f */ + size_t Bytes_singleghost() const { return this->SingleGhost_length()*this->Field_length()*2*sizeof(Float); } + size_t Bytes_singleCorner() const { return this->SingleCorner_length()*this->Field_length()*2*sizeof(Float); } size_t Bytes_ghost() const { return this->Ghost_length()*this->Field_length()*2*sizeof(Float); } size_t Bytes_ghostCorner() const { return this->GhostCorner_length()*this->Field_length()*2*sizeof(Float); } size_t Bytes_ghostVertex() const { return this->GhostVertex_length()*this->Field_length()*2*sizeof(Float); } @@ -207,11 +220,16 @@ namespace plegma { * @param dirOr: choose the dir,orien. If negative does all dir, orien. If >=0 then (0,1,2,3,4,5,6,7,8) -> (+x,+y,+z,+t,-x,-y,-z,-t) */ void communicateSideGhost(short dir=-1, ORIENTATION sign=DIR_BOTH, ACTION action=DO_ALL); + void communicateSecondSideGhost(short dir=-1, ORIENTATION sign=DIR_BOTH, ACTION action=DO_ALL); + void communicateThirdSideGhost(short dir=-1, ORIENTATION sign=DIR_BOTH, ACTION action=DO_ALL); + /** * @brief Communicates side+corner ghosts in chosen direction,orientation * @param dirOr: choose the dir,orien. If negative does all dir, orien. If >=0 then (0,1,2,3,4,5,6,7,8) -> (+x,+y,+z,+t,-x,-y,-z,-t) */ void communicateCornerGhost(short dir=-1, ORIENTATION sign=DIR_BOTH, ACTION action=DO_ALL); + void communicateSecondCornerGhost(short dir=-1, ORIENTATION sign=DIR_BOTH, ACTION action=DO_ALL); + void communicateVertexGhost(short dir=-1, ORIENTATION sign=DIR_BOTH, ACTION action=DO_ALL); /** * @brief Communicates side or side+corner ghosts in chosen direction,orientation give the ghost type diff --git a/include/PLEGMA_Vector.h b/include/PLEGMA_Vector.h index 2f6782e2..61154b44 100644 --- a/include/PLEGMA_Vector.h +++ b/include/PLEGMA_Vector.h @@ -162,6 +162,10 @@ namespace plegma { std::vector rms(std::vector listR2, const site& sourceposition) const; + void seqSourceNucleonDelta(PLEGMA_Propagator3D &prop, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); + void seqSourceNucleonDelta(PLEGMA_Propagator3D &prop, PLEGMA_Propagator3D &prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); + + void seqSourceNucleon(PLEGMA_Propagator3D &prop1, PLEGMA_Propagator3D &prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2); void seqSourceNucleon(PLEGMA_Propagator3D &prop, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2); }; diff --git a/include/global/PLEGMA_enums.h b/include/global/PLEGMA_enums.h index 24c68fbc..8cdda059 100644 --- a/include/global/PLEGMA_enums.h +++ b/include/global/PLEGMA_enums.h @@ -10,9 +10,34 @@ enum FILE_FORMAT{ASCII_FORMAT, HDF5_FORMAT, LIME_FORMAT, DEFAULT_FORMAT}; enum ALLOCATION_FLAG{EVERY=-1,NONE=0,HOST,DEVICE,BOTH}; enum CLASS_ENUM{CUSTOM,SCALAR,SU3FIELD,GAUGE,GAUGE3D,GAUGEU1,VECTOR,VECTOR3D,PROPAGATOR,PROPAGATOR3D,QLOOPS,FMUNU,U1GAUGE}; -enum GHOST_FLAG{ALL_GHOSTS=-1,NO_GHOSTS,FIRST_SIDE,FIRST_CORNER,FIRST_VERTEX}; +enum GHOST_FLAG{ALL_GHOSTS=-1,NO_GHOSTS,FIRST_SIDE,FIRST_CORNER,FIRST_VERTEX,SECOND_SIDE,SECOND_CORNER,THIRD_SIDE}; + enum WHICHPARTICLE{PROTON,NEUTRON}; -enum WHICHPROJECTOR{P4_P,P4G5G1_P,P4G5G2_P,P4G5G3_P,P4_M,P4G5G1_M,P4G5G2_M,P4G5G3_M,P_00,P_01,P_02,P_03,P_10, P_11, P_12, P_13, P_20, P_21, P_22, P_23, P_30, P_31, P_32, P_33, N_PROJS}; // Do not change this order and keep N_PROJS last +enum WHICHPROJECTOR{P4_P, + P4G5G1_P, + P4G5G2_P, + P4G5G3_P, + P4_M, + P4G5G1_M, + P4G5G2_M, + P4G5G3_M, + P_00, + P_01, + P_02, + P_03, + P_10, + P_11, + P_12, + P_13, + P_20, + P_21, + P_22, + P_23, + P_30, + P_31, + P_32, + P_33, + N_PROJS}; // Do not change this order and keep N_PROJS last enum WHICHFLAVOR{LIGHT,STRANGE,CHARM}; enum THRP_TYPE{THRP_LOCAL2,THRP_NOETHER2,THRP_ONED2}; diff --git a/include/global/PLEGMA_structs.h b/include/global/PLEGMA_structs.h index 6542c86c..006c85e7 100644 --- a/include/global/PLEGMA_structs.h +++ b/include/global/PLEGMA_structs.h @@ -27,6 +27,28 @@ inline std::istream& operator >> (std::istream &i, site &x){ } +struct momentum : std::array { + momentum() = default; + momentum(const std::array& val) : std::array(val) {} +}; +inline std::ostream& operator << (std::ostream &o, momentum &x){ + o<> (std::istream &i, momentum &x){ + for(int j=0; j<3; j++) { + bool check = static_cast (i >> x[j]); + if(!check) { + PLEGMA_warning("Not enough arguments to unpack momentum\n"); + break; + } + } + return i; +} + + + // Global variable for mom list struct tex_mom_list { size_t Nmoms; diff --git a/include/utils/PLEGMA_params.h b/include/utils/PLEGMA_params.h index 5239e9a4..8a1cb908 100644 --- a/include/utils/PLEGMA_params.h +++ b/include/utils/PLEGMA_params.h @@ -14,6 +14,7 @@ define(int dims[N_DIMS], {8,8,8,16}); define(int procs[N_DIMS], {1,1,1,1}); define(std::string latfile); define(int verbosity, 1); +define(std::vector momenta, {}); define(int nsmearAPE, 20); define(double alphaAPE, 0.5); diff --git a/include/utils/PLEGMA_readList.h b/include/utils/PLEGMA_readList.h index 5c7fde85..3543ea43 100644 --- a/include/utils/PLEGMA_readList.h +++ b/include/utils/PLEGMA_readList.h @@ -44,3 +44,20 @@ inline void readSourceList() { } } + +inline void readMomentaList() { + std::ifstream file(pathListMomenta.c_str(), std::ifstream::in); + if(file.fail()) PLEGMA_error("Cannot open file to read momenta list: %s\n", pathListMomenta.c_str()); + momentum mom; + while (file >> mom) { + momenta.push_back(mom); + } + file.close(); + PLEGMA_printf("Read %d momenta.\n", momenta.size()); + if(verbosity) { + PLEGMA_printf("\nList of read momenta:\n"); + for(int j=0; j &bwdProp, threep_twoD(*this,bwdProp,fwdProp,signProps,gauge,gammas,isZfac); } + template void PLEGMA_Correlator:: contractNucleonThrp_threeD(PLEGMA_Propagator &bwdProp, - PLEGMA_Propagator &fwdProp, - PLEGMA_Gauge &gauge, - int signProps, std::vector gammas, bool isZfac){ - if(isZfac) shape={N_SPINS,N_SPINS,N_COLS,N_COLS,N_DIMS*(N_DIMS-1)*(N_DIMS-2), (int) gammas.size()}; - else shape = {N_DIMS*(N_DIMS-1)*(N_DIMS-2), (int) gammas.size()}; + PLEGMA_Propagator &fwdProp, + PLEGMA_Gauge &gauge, + int signProps, std::vector gammas, bool isZfac){ + if(isZfac) shape={N_SPINS,N_SPINS,N_COLS,N_COLS,N_DIMS*N_DIMS*N_DIMS, (int) gammas.size()}; + else shape = {N_DIMS*N_DIMS*N_DIMS, (int) gammas.size()}; datasets = {"threep"}; groups = {"ThreeD"}; - description = "xyz,xyt,xzy,xzt,xty,xtz,yxz,yxt,yzx,yzt,ytx,ytz,zxy,zxt,zyx,zyt,ztx,zty,txy,txz,tyx,tyz,tzx,tzy / "+getGammasString(gammas); + description = "xxx,xxy,xxz,xxt,xyx,xyy,xyz,xyt,xzx,xzy,xzz,xzt,xtx,xty,xtz,xtt,yxx,yxy,yxz,yxt,yyx,yyy,yyz,yyt,yzx,yzy,yzz,yzt,ytx,yty,ytz,ytt,zxx,zxy,zxz,zxt,zyx,zyy,zyz,zyt,zzx,zzy,zzz,zzt,ztx,zty,ztz,ztt,txx,txy,txz,txt,tyx,tyy,tyz,tyt,tzx,tzy,tzz,tzt,ttx,tty,ttz,ttt / "+getGammasString(gammas); initialize(); if(gammas.size() == 0) PLEGMA_error("List of gammas provided is empty"); - - gauge.communicateGhost(-1,DIR_BOTH,FIRST_VERTEX); - bwdProp.communicateGhost(-1,DIR_BOTH,FIRST_VERTEX); - fwdProp.communicateGhost(-1,DIR_BOTH,FIRST_VERTEX); + + gauge.communicateGhost(-1,DIR_BOTH,THIRD_SIDE); + bwdProp.communicateGhost(-1,DIR_BOTH,THIRD_SIDE); + fwdProp.communicateGhost(-1,DIR_BOTH,THIRD_SIDE); threep_threeD_part1(*this,bwdProp,fwdProp,signProps,gauge,gammas,isZfac); threep_threeD_part2(*this,bwdProp,fwdProp,signProps,gauge,gammas,isZfac); threep_threeD_part3(*this,bwdProp,fwdProp,signProps,gauge,gammas,isZfac); threep_threeD_part4(*this,bwdProp,fwdProp,signProps,gauge,gammas,isZfac); -} +} template void PLEGMA_Correlator:: diff --git a/lib/PLEGMA_Field.cu b/lib/PLEGMA_Field.cu index 2d2633d4..62a4f1be 100644 --- a/lib/PLEGMA_Field.cu +++ b/lib/PLEGMA_Field.cu @@ -47,7 +47,9 @@ initialize(ALLOCATION_FLAG alloc_flag, int field_l, size_t vol_l) { site_shape = {field_l}; ghost_length = 0; + single_ghost_length = 0; ghost_corner_length = 0; + single_corner_length = 0; ghost_vertex_length = 0; if(ghost_flag>NO_GHOSTS) { @@ -56,6 +58,9 @@ initialize(ALLOCATION_FLAG alloc_flag, int field_l, size_t vol_l) { if(vol_l==HGC_localVolume) { for(int i = 0 ; i < N_DIMS ; i++){ if(ghost_flag >= FIRST_SIDE) ghost_length += 2*HGC_surface3D[i]; + if(ghost_flag >= SECOND_SIDE) ghost_length += 2*HGC_surface3D[i]; + if(ghost_flag >= THIRD_SIDE) ghost_length += 2*HGC_surface3D[i]; + for(int j = i+1; j < N_DIMS; j++){ if(ghost_flag >= FIRST_CORNER) ghost_corner_length += 4*HGC_surface2D[OFF2(i,j)]; for(int k = j+1; k < N_DIMS; k++){ @@ -63,23 +68,32 @@ initialize(ALLOCATION_FLAG alloc_flag, int field_l, size_t vol_l) { } } } - if(ghost_flag >= FIRST_SIDE) assert(ghost_length == HGC_sideGhostVolume); - if(ghost_flag >= FIRST_CORNER) assert(ghost_corner_length == HGC_cornerGhostVolume); + if(ghost_flag >= FIRST_SIDE) assert(ghost_length == (ghost_flag >= THIRD_SIDE ? 3 : ghost_flag >= SECOND_SIDE ? 2 : 1)*HGC_sideGhostVolume); + if(ghost_flag >= FIRST_CORNER) assert(ghost_corner_length == (ghost_flag >= SECOND_CORNER ? 3 : 1)*HGC_cornerGhostVolume); if(ghost_flag >= FIRST_VERTEX) assert(ghost_vertex_length == HGC_vertexGhostVolume); - } else if(vol_l==HGC_localVolume3D) { + } else if(vol_l==HGC_localVolume3D) { for(int i = 0 ; i < N_DIMS-1 ; i++){ - if(ghost_flag >= FIRST_SIDE) ghost_length += 2*HGC_surface3D[i]/HGC_localL[DIM_T]; + if(ghost_flag >= FIRST_SIDE) { + ghost_length += 2*HGC_surface3D[i]/HGC_localL[DIM_T]; + single_ghost_length += 2*HGC_surface3D[i]/HGC_localL[DIM_T]; + } + if(ghost_flag >= SECOND_SIDE) ghost_length += 2*HGC_surface3D[i]/HGC_localL[DIM_T]; + if(ghost_flag >= THIRD_SIDE) ghost_length += 2*HGC_surface3D[i]/HGC_localL[DIM_T]; for(int j = i+1; j < N_DIMS-1; j++){ - if(ghost_flag >= FIRST_CORNER) ghost_corner_length += 4*HGC_surface2D[OFF2(i,j)]/HGC_localL[DIM_T]; + if(ghost_flag >= FIRST_CORNER){ + ghost_corner_length += 4*HGC_surface2D[OFF2(i,j)]/HGC_localL[DIM_T]; + single_corner_length += 4*HGC_surface2D[OFF2(i,j)]/HGC_localL[DIM_T]; + } + if(ghost_flag >= SECOND_CORNER) ghost_corner_length += 8*HGC_surface2D[OFF2(i,j)]/HGC_localL[DIM_T]; for(int k = j+1; k < N_DIMS-1; k++){ if(ghost_flag >= FIRST_VERTEX) ghost_vertex_length += 8*HGC_surface1D[OFF3(i,j,k)]/HGC_localL[DIM_T]; } } } - if(ghost_flag >= FIRST_SIDE) assert(ghost_length == HGC_sideGhostVolume3D); - if(ghost_flag >= FIRST_CORNER) assert(ghost_corner_length == HGC_cornerGhostVolume3D); + if(ghost_flag >= FIRST_SIDE) assert(ghost_length == (ghost_flag >= THIRD_SIDE ? 3 : ghost_flag >= SECOND_SIDE ? 2 : 1)*HGC_sideGhostVolume3D); + if(ghost_flag >= FIRST_CORNER) assert(ghost_corner_length == (ghost_flag >= SECOND_CORNER ? 3 : 1)*HGC_cornerGhostVolume3D); if(ghost_flag >= FIRST_VERTEX) assert(ghost_vertex_length == HGC_vertexGhostVolume3D); - } + } } if( alloc_flag == BOTH ){ @@ -405,11 +419,12 @@ void PLEGMA_Field::printInfo(){ PLEGMA_printf("The flag for the device allocation is %d\n",(int) isAllocDevice); } + template void PLEGMA_Field::communicateSideGhost(short dir, ORIENTATION sign, ACTION action){ if(comm_size() == 1) return; assert(Total_length()==HGC_localVolume || Total_length()==HGC_localVolume3D); - + if(ghost_flag < FIRST_SIDE) PLEGMA_error("First side ghosts have not been allocated.\n"); if(dir<-1 || dir>=N_DIMS) @@ -421,30 +436,52 @@ void PLEGMA_Field::communicateSideGhost(short dir, ORIENTATION sign, ACTI bool runT = Total_length()==HGC_localVolume; size_t scaleT = runT ? 1 : HGC_localL[DIM_T]; - if(action==START || action==DO_ALL) - for(short i=0; i(*this), i, s); - - Float *pointer_receive = h_ext_ghost_r+HGC_sideGhost[i][s]/scaleT*field_length*2; - Float *pointer_send = h_ext_ghost_s+HGC_sideGhost[i][s]/scaleT*field_length*2; - Float *pointer_device = d_elem+(HGC_sideGhost[i][s]/scaleT+total_length)*field_length*2; - int disp; - size_t nbytes = HGC_surface3D[i]/scaleT*field_length*2*sizeof(Float); - - qudaMemcpy(pointer_send, pointer_device, nbytes, qudaMemcpyDeviceToHost); - if(checkErr) checkQudaError(); - - disp = (s==DIR_PLUS) ? +1 : -1; - messages.push_back(comm_declare_receive_relative(pointer_receive,i,disp,nbytes)); - comm_start(messages.back()); - disp *= -1; - messages.push_back(comm_declare_send_relative(pointer_send,i,disp,nbytes)); - comm_start(messages.back()); - } + if(action==START || action==DO_ALL) { + for(short i=0; i(*this), d_ext_ghost, i, s, FIRST_SIDE); + #else + copy_side_to_ghost(toField2(*this), i, s, FIRST_SIDE); + #endif + } + } + } + } + cudaDeviceSynchronize(); + if(checkErr) checkQudaError(); + for(short i=0; i::communicateSideGhost(short dir, ORIENTATION sign, ACTI comm_free(messages.back()); messages.pop_back(); } + #ifndef GPU_DIRECT //copying to device if(isAll && sign==DIR_BOTH) { Float *host = h_ext_ghost_r; Float *device = d_elem+total_length*field_length*2; - qudaMemcpy(device, host, Bytes_ghost(),qudaMemcpyHostToDevice); + cudaMemcpy(device, host, Bytes_singleghost(),cudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } else { - for(short i=0; i +void PLEGMA_Field::communicateSecondSideGhost(short dir, ORIENTATION sign, ACTION action){ + if(comm_size() == 1) return; + assert(Total_length()==HGC_localVolume || Total_length()==HGC_localVolume3D); + + if(ghost_flag < SECOND_SIDE) + PLEGMA_error("Second side ghosts have not been allocated.\n"); + if(dir<-1 || dir>=N_DIMS) + PLEGMA_error("Directions should be in [-1,%d] range with -1 all directions",N_DIMS); + if(sign<0 || sign>DIR_BOTH) + PLEGMA_error("Directions should be an orientation enum"); + + bool isAll = (dir<0) ? true:false; + bool runT = Total_length()==HGC_localVolume; + size_t scaleT = runT ? 1 : HGC_localL[DIM_T]; + + if(action==START || action==DO_ALL) { + for(short i=0; i(*this), d_ext_ghost, i, s, SECOND_SIDE); + #else + copy_side_to_ghost(toField2(*this), i, s, SECOND_SIDE); + #endif + } + } + } + } + cudaDeviceSynchronize(); + if(checkErr) checkQudaError(); + for(short i=0; i +void PLEGMA_Field::communicateThirdSideGhost(short dir, ORIENTATION sign, ACTION action){ + if(comm_size() == 1) return; + assert(Total_length()==HGC_localVolume || Total_length()==HGC_localVolume3D); + + if(ghost_flag < THIRD_SIDE) + PLEGMA_error("Third side ghosts have not been allocated.\n"); + if(dir<-1 || dir>=N_DIMS) + PLEGMA_error("Directions should be in [-1,%d] range with -1 all directions",N_DIMS); + if(sign<0 || sign>DIR_BOTH) + PLEGMA_error("Directions should be an orientation enum"); + + bool isAll = (dir<0) ? true:false; + bool runT = Total_length()==HGC_localVolume; + size_t scaleT = runT ? 1 : HGC_localL[DIM_T]; + + if(action==START || action==DO_ALL) { + for(short i=0; i(*this), d_ext_ghost, i, s, THIRD_SIDE); + #else + copy_side_to_ghost(toField2(*this), i, s, THIRD_SIDE); + #endif + } + } + } + } + cudaDeviceSynchronize(); + if(checkErr) checkQudaError(); + for(short i=0; i void PLEGMA_Field::communicateCornerGhost(short dir, ORIENTATION sign, ACTION action){ if(comm_size() == 1) return; assert(Total_length()==HGC_localVolume || Total_length()==HGC_localVolume3D); - + if(ghost_flag < FIRST_CORNER) PLEGMA_error("First corner ghosts have not been allocated.\n"); if(dir<-1 || dir>=N_DIMS) @@ -491,36 +726,65 @@ void PLEGMA_Field::communicateCornerGhost(short dir, ORIENTATION sign, AC std::vector messages; - if(action==START || action==DO_ALL) - for(short i=0; i(*this), i, j, s1, s2); - - Float *pointer_receive = h_ext_ghost_corner_r + HGC_cornerGhost[OFF2SIGN(i,j,s1,s2)]/scaleT*field_length*2; - Float *pointer_send = h_ext_ghost_corner_s + HGC_cornerGhost[OFF2SIGN(i,j,s1,s2)]/scaleT*field_length*2; - Float *pointer_device = d_elem + (HGC_cornerGhost[OFF2SIGN(i,j,s1,s2)]/scaleT+total_length+ghost_length)*field_length*2; - int disp[N_DIMS] = {0}; - size_t nbytes = HGC_surface2D[OFF2(i,j)]/scaleT*field_length*2*sizeof(Float); - - qudaMemcpy(pointer_send, pointer_device, nbytes, qudaMemcpyDeviceToHost); - if(checkErr) checkQudaError(); - - // communicating - disp[i] = (s1==DIR_PLUS) ? +1 : -1; - disp[j] = (s2==DIR_PLUS) ? +1 : -1; - messages.push_back(comm_declare_receive_displaced(pointer_receive,disp,nbytes)); - comm_start(messages.back()); - disp[i] *= -1; - disp[j] *= -1; - messages.push_back(comm_declare_send_displaced(pointer_send,disp,nbytes)); - disp[i] = 0; disp[j] = 0; - comm_start(messages.back()); - } + if(action==START || action==DO_ALL) { + for(short i=0; i(*this), d_ext_ghost, i, j, s1, s2, FIRST_CORNER); + #else + copy_corner_to_ghost(toField2(*this), i, j, s1, s2, FIRST_CORNER); + #endif + } + } + } + } + } + } + cudaDeviceSynchronize(); + if(checkErr) checkQudaError(); + for(short i=0; i::communicateCornerGhost(short dir, ORIENTATION sign, AC comm_free(messages.back()); messages.pop_back(); } + #ifndef GPU_DIRECT //copying to device if(isAll && sign==DIR_BOTH) { Float *hostCorner = h_ext_ghost_corner_r; - Float *device = d_elem+(total_length+ghost_length)*field_length*2; - qudaMemcpy(device,hostCorner,Bytes_ghostCorner(),qudaMemcpyHostToDevice); + Float *device = d_elem+(total_length+single_ghost_length)*field_length*2; + cudaMemcpy(device,hostCorner,Bytes_singleCorner(),cudaMemcpyHostToDevice); if(checkErr) checkQudaError(); } else { - for(short i=0; i +void PLEGMA_Field::communicateSecondCornerGhost(short dir, ORIENTATION sign, ACTION action){ + if(comm_size() == 1) return; + assert(Total_length()==HGC_localVolume || Total_length()==HGC_localVolume3D); + + if(ghost_flag < SECOND_CORNER) + PLEGMA_error("Second corner ghosts have not been allocated.\n"); + if(dir<-1 || dir>=N_DIMS) + PLEGMA_error("Directions should be in [-1,%d] range with -1 all directions",N_DIMS); + if(sign<0 || sign>DIR_BOTH) + PLEGMA_error("Directions should be an orientation enum"); + + bool isAll = (dir<0) ? true:false; + bool runT = Total_length()==HGC_localVolume; + size_t scaleT = runT ? 1 : HGC_localL[DIM_T]; + + std::vector messages; + + if(action==START || action==DO_ALL) { + for(short i=0; i(*this), d_ext_ghost, i, j, s1, s2, SECOND_CORNER); + #else + copy_corner_to_ghost(toField2(*this), i, j, s1, s2, SECOND_CORNER); + #endif + } + } + } + } + } + } + } + cudaDeviceSynchronize(); + if(checkErr) checkQudaError(); + for(short i=0; i +void PLEGMA_Field::communicateSecondCornerGhost(short dir, ORIENTATION sign, ACTION action){ + if(comm_size() == 1) return; + assert(Total_length()==HGC_localVolume || Total_length()==HGC_localVolume3D); + + if(ghost_flag < SECOND_CORNER) + PLEGMA_error("Second corner ghosts have not been allocated.\n"); + if(dir<-1 || dir>=N_DIMS) + PLEGMA_error("Directions should be in [-1,%d] range with -1 all directions",N_DIMS); + if(sign<0 || sign>DIR_BOTH) + PLEGMA_error("Directions should be an orientation enum"); + + bool isAll = (dir<0) ? true:false; + bool runT = Total_length()==HGC_localVolume; + size_t scaleT = runT ? 1 : HGC_localL[DIM_T]; + + std::vector messages; + + if(action==START || action==DO_ALL) { + for(short i=0; i(*this), d_ext_ghost, i, j, s1, s2, SECOND_CORNER); + #else + copy_corner_to_ghost(toField2(*this), i, j, s1, s2, SECOND_CORNER); + #endif + } + } + } + } + } + } + } + cudaDeviceSynchronize(); + if(checkErr) checkQudaError(); + for(short i=0; i void PLEGMA_Field::communicateVertexGhost(short dir, ORIENTATION sign, ACTION action){ if(comm_size() == 1) return; @@ -648,8 +1161,16 @@ void PLEGMA_Field::communicateGhost(short dir, ORIENTATION sign, GHOST_FL if(which_ghost >= FIRST_VERTEX){ communicateVertexGhost(dir, sign, action); } + if(which_ghost >= SECOND_SIDE){ + communicateSecondSideGhost(dir, sign, action); + } + if(which_ghost >= SECOND_CORNER){ + communicateSecondCornerGhost(dir, sign, action); + } + if(which_ghost >= THIRD_SIDE){ + communicateThirdSideGhost(dir, sign, action); + } } - template void PLEGMA_Field::conjugate(){ // we have to make sure that we have the ghost diff --git a/lib/PLEGMA_Vector.cu b/lib/PLEGMA_Vector.cu index f26e7a17..3893deee 100644 --- a/lib/PLEGMA_Vector.cu +++ b/lib/PLEGMA_Vector.cu @@ -6,6 +6,7 @@ #include #include #include +#include #include #ifdef PLEGMA_SCATTERING_CONTRACTIONS #include @@ -680,6 +681,26 @@ namespace plegma{ auto texProp2 = toTexture(prop2); contractNucleonSeqSource(toField2(*this), *texProp1, *texProp2, proj, particle, c_nu, c_c2); } + +template + void PLEGMA_Vector3D::seqSourceNucleonDelta(PLEGMA_Propagator3D &prop, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_sigma){ + this->activeTimeSlice = prop.activeTimeSlice; + this->zero_device(); + + auto texProp = toTexture(prop); + contractNucleonDeltaSeqSource(toField2(*this), *texProp, proj, particle, c_nu, c_c2, c_sigma); + } + + template + void PLEGMA_Vector3D::seqSourceNucleonDelta(PLEGMA_Propagator3D &prop1, PLEGMA_Propagator3D &prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_sigma){ + this->activeTimeSlice = prop1.activeTimeSlice; + this->zero_device(); + + auto texProp1 = toTexture(prop1); + auto texProp2 = toTexture(prop2); + contractNucleonDeltaSeqSource(toField2(*this), *texProp1, *texProp2, proj, particle, c_nu, c_c2, c_sigma); + } + template class PLEGMA_Vector3D; diff --git a/lib/kernels/PLEGMA_baryons_NtoN_OS.cu b/lib/kernels/PLEGMA_baryons_NtoN_OS.cu new file mode 100644 index 00000000..87ad1f31 --- /dev/null +++ b/lib/kernels/PLEGMA_baryons_NtoN_OS.cu @@ -0,0 +1,51 @@ +#include + +static const __device__ short int NtoN_OS_indices[16][4] = {0,1,0,1,0,1,1,0,0,1,2,3,0,1,3,2,1,0,0,1,1,0,1,0,1,0,2,3,1,0,3,2,2,3,0,1,2,3,1,0,2,3,2,3,2,3,3,2,3,2,0,1,3,2,1,0,3,2,2,3,3,2,3,2}; +static const __device__ float NtoN_OS_values[16] = {-1,1,-1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1}; + +template +__device__ void contract_NtoN_OS_kernel(propTex& texProp1, propTex& texProp2, Float2 accum[2*N_SPINS*N_SPINS], int vid) { + Float2 prop1[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + texProp1.get(prop1,vid); + texProp2.get(prop2,vid); +#pragma unroll + for(int mu = 0 ; mu < 4 ; mu++) +#pragma unroll + for(int mup = 0 ; mup < 4 ; mup++) { + Float2 tmp[2] = {0., 0.}; +#pragma unroll + for(int idx = 0 ; idx < 16 ; idx++){ + int nu = NtoN_OS_indices[idx][0]; + int lu = NtoN_OS_indices[idx][1]; + int lup = NtoN_OS_indices[idx][2]; + int nup = NtoN_OS_indices[idx][3]; +#pragma unroll + for(int cc1 = 0 ; cc1 < 6 ; cc1++){ + int a = eps[cc1][0]; + int b = eps[cc1][1]; + int c = eps[cc1][2]; +#pragma unroll + for(int cc2 = 0 ; cc2 < 6 ; cc2++){ + int a1 = eps[cc2][0]; + int b1 = eps[cc2][1]; + int c1 = eps[cc2][2]; + FloatC factor = sgn_eps[cc1] * sgn_eps[cc2] * NtoN_OS_values[idx]; + tmp[0] = tmp[0] + factor * prop1[lu][lup][b][b1] * + (prop1[nu][nup][a][a1] * prop1[mu][mup][c][c1] - prop1[nu][mup][a][c1] * prop1[mu][nup][c][a1]); + tmp[1] = tmp[1] + factor * prop2[lu][lup][b][b1] * + (prop2[nu][nup][a][a1] * prop2[mu][mup][c][c1] - prop2[nu][mup][a][c1] * prop2[mu][nup][c][a1]); + } + } + } +#pragma unroll + for(int i = 0 ; i < 2 ; i++){ + accum[(i*N_SPINS + mu)*N_SPINS+mup] = tmp[i]; + } + } +} + +template __device__ void contract_NtoN_OS_kernel(propTex& texProp1, propTex& texProp2, Float2 accum[2*N_SPINS*N_SPINS], int vid); +template __device__ void contract_NtoN_OS_kernel(propTex& texProp1, propTex& texProp2, Float2 accum[2*N_SPINS*N_SPINS], int vid); + + diff --git a/lib/kernels/PLEGMA_field_utils.cuh b/lib/kernels/PLEGMA_field_utils.cuh index 6f1b1c50..7228e89c 100644 --- a/lib/kernels/PLEGMA_field_utils.cuh +++ b/lib/kernels/PLEGMA_field_utils.cuh @@ -29,16 +29,17 @@ static void cudaCast(pFloat2 out, pFloat2 in){ } -template + +template static __global__ void copy_side_to_ghost_kernel(pFloat2 F, short dir, short sign){ size_t sid = blockIdx.x*blockDim.x + threadIdx.x; if (sid >= F.sideGhostL(dir)) return; - + size_t id[4], tmp_sid=sid; #pragma unroll for(int i = 0 ; i F, short di size_t vid = LEXIC_ID(id); F.setSid(vid); pFloat2 F_ghost=F; - F_ghost.accessSideGhost(LEXIC_3D(dir,id), dir, (ORIENTATION) sign); + if(side == 1) F_ghost.accessSideGhost(LEXIC_3D(dir,id), dir, (ORIENTATION) sign); + if(side == 2) F_ghost.accessSecondSideGhost(LEXIC_3D(dir,id), dir, (ORIENTATION) sign); + if(side == 3) F_ghost.accessThirdSideGhost(LEXIC_3D(dir,id), dir, (ORIENTATION) sign); for(int i = 0 ; i < F.site_size ; i++) F_ghost.set(i, F.get(i)); } template -static void copy_side_to_ghost(pFloat2 F, short dir, short sign){ +static void copy_side_to_ghost(pFloat2 F, short dir, short sign, GHOST_FLAG ghost_flag){ if( HGC_dimBreak[dir] ){ - ProfileStruct ps(F.sideGhostL(dir)); - tuneAndRun(ps, "copy_side_to_ghost_kernel_size_"+std::to_string(F.site_size), copy_side_to_ghost_kernel, F, dir, sign); + if(ghost_flag==FIRST_SIDE){ + ProfileStruct ps(F.sideGhostL(dir)); + tuneAndRun(ps, "copy_side_to_ghost_kernel_size_"+std::to_string(F.site_size), copy_side_to_ghost_kernel, F, dir, sign); + } + if(ghost_flag==SECOND_SIDE){ + ProfileStruct ps(F.sideGhostL(dir)); + tuneAndRun(ps, "copy_secondside_to_ghost_kernel_size_"+std::to_string(F.site_size), copy_side_to_ghost_kernel, F, dir, sign); + } + if(ghost_flag==THIRD_SIDE){ + ProfileStruct ps(F.sideGhostL(dir)); + tuneAndRun(ps, "copy_thirdside_to_ghost_kernel_size_"+std::to_string(F.site_size), copy_side_to_ghost_kernel, F, dir, sign); + } } } -template +template static __global__ void copy_corner_to_ghost_kernel(pFloat2 F, short dir1, short dir2, short sign1, short sign2){ size_t sid = blockIdx.x*blockDim.x + threadIdx.x; if (sid >= F.cornerGhostL(dir1,dir2)) return; size_t id[4], tmp_sid=sid; for(int i = 0 ; i F, short size_t vid = LEXIC_ID(id); F.setSid(vid); pFloat2 F_ghost=F; - F_ghost.accessCornerGhost(LEXIC_2D(dir1,dir2,id), dir1, dir2, (ORIENTATION) sign1, (ORIENTATION) sign2); + if(corner == 1) F_ghost.accessCornerGhost(LEXIC_2D(dir1,dir2,id), dir1, dir2, (ORIENTATION) sign1, (ORIENTATION) sign2); + if(corner == 2) F_ghost.accessSecondCornerGhost(LEXIC_2D(dir1,dir2,id), dir1, dir2, (ORIENTATION) sign1, (ORIENTATION) sign2); for(int i = 0 ; i < F.site_size ; i++) F_ghost.set(i, F.get(i)); } template -static void copy_corner_to_ghost(pFloat2 F, short dir1, short dir2, short sign1, short sign2){ +static void copy_corner_to_ghost(pFloat2 F, short dir1, short dir2, short sign1, short sign2, GHOST_FLAG ghost_flag){ if( (dir1 != dir2 ) && HGC_dimBreak[dir1] && HGC_dimBreak[dir2] ){ - ProfileStruct ps(F.cornerGhostL(dir1, dir2)); - tuneAndRun(ps, "copy_corner_to_ghost_kernel_size_"+std::to_string(F.site_size), copy_corner_to_ghost_kernel, F, dir1, dir2, sign1, sign2); + if(ghost_flag == FIRST_CORNER){ + ProfileStruct ps(F.cornerGhostL(dir1, dir2)); + tuneAndRun(ps, "copy_corner_to_ghost_kernel_size_"+std::to_string(F.site_size), copy_corner_to_ghost_kernel, F, dir1, dir2, sign1, sign2); + } + if(ghost_flag == SECOND_CORNER){ + ProfileStruct ps(F.cornerGhostL(dir1, dir2)); + tuneAndRun(ps, "copy_secondcorner_to_ghost_kernel_size_"+std::to_string(F.site_size), copy_corner_to_ghost_kernel, F, dir1, dir2, sign1, sign2); + } } } @@ -124,6 +144,124 @@ static void copy_vertex_to_ghost(pFloat2 F, short dir1, short dir2, short } } +template +static __global__ void copy_side_to_ghost_ext_kernel(pFloat2 F, Float* F_ext, short dir, short sign){ + size_t sid = blockIdx.x*blockDim.x + threadIdx.x; + if (sid >= F.sideGhostL(dir)) return; + + size_t id[4], tmp_sid=sid; + #pragma unroll + for(int i = 0 ; i F_ghost=F; + F_ghost.p = (Float2*) F_ext; + if(side == 1) F_ghost.accessSideGhost(LEXIC_3D(dir,id), dir, (ORIENTATION) sign, true); + if(side == 2) F_ghost.accessSecondSideGhost(LEXIC_3D(dir,id), dir, (ORIENTATION) sign, true); + if(side == 3) F_ghost.accessThirdSideGhost(LEXIC_3D(dir,id), dir, (ORIENTATION) sign, true); + for(int i = 0 ; i < F.site_size ; i++) + F_ghost.set(i, F.get(i)); +} + +template +static void copy_side_to_ghost_ext(pFloat2 F, Float* F_ext, short dir, short sign, GHOST_FLAG ghost_flag){ + if( HGC_dimBreak[dir] ){ + if(ghost_flag == FIRST_SIDE){ + ProfileStruct ps(F.sideGhostL(dir)); + tuneAndRun(ps, "copy_side_to_ghost_ext_kernel_size_"+std::to_string(F.site_size), copy_side_to_ghost_ext_kernel, F, F_ext, dir, sign); + } + if(ghost_flag == SECOND_SIDE){ + ProfileStruct ps(F.sideGhostL(dir)); + tuneAndRun(ps, "copy_secondside_to_ghost_ext_kernel_size_"+std::to_string(F.site_size), copy_side_to_ghost_ext_kernel, F, F_ext, dir, sign); + } + if(ghost_flag == THIRD_SIDE){ + ProfileStruct ps(F.sideGhostL(dir)); + tuneAndRun(ps, "copy_thirdside_to_ghost_ext_kernel_size_"+std::to_string(F.site_size), copy_side_to_ghost_ext_kernel, F, F_ext, dir, sign); + } + } +} + +template +static __global__ void copy_corner_to_ghost_ext_kernel(pFloat2 F, Float* F_ext, short dir1, short dir2, short sign1, short sign2){ + size_t sid = blockIdx.x*blockDim.x + threadIdx.x; + if (sid >= F.cornerGhostL(dir1,dir2)) return; + size_t id[4], tmp_sid=sid; + for(int i = 0 ; i F_ghost=F; + F_ghost.p = (Float2*) F_ext; + if(corner == 1) F_ghost.accessCornerGhost(LEXIC_2D(dir1,dir2,id), dir1, dir2, (ORIENTATION) sign1, (ORIENTATION) sign2, true); + if(corner == 2) F_ghost.accessSecondCornerGhost(LEXIC_2D(dir1,dir2,id), dir1, dir2, (ORIENTATION) sign1, (ORIENTATION) sign2, true); + for(int i = 0 ; i < F.site_size ; i++) + F_ghost.set(i, F.get(i)); +} + +template +static void copy_corner_to_ghost_ext(pFloat2 F, Float* F_ext, short dir1, short dir2, short sign1, short sign2, GHOST_FLAG ghost_flag){ + if( (dir1 != dir2 ) && HGC_dimBreak[dir1] && HGC_dimBreak[dir2] ){ + if(ghost_flag == FIRST_CORNER){ + ProfileStruct ps(F.cornerGhostL(dir1, dir2)); + tuneAndRun(ps, "copy_corner_to_ghost_ext_kernel_size_"+std::to_string(F.site_size), copy_corner_to_ghost_ext_kernel, F, F_ext, dir1, dir2, sign1, sign2); + } + if(ghost_flag == SECOND_CORNER){ + ProfileStruct ps(F.cornerGhostL(dir1, dir2)); + tuneAndRun(ps, "copy_secondcorner_to_ghost_ext_kernel_size_"+std::to_string(F.site_size), copy_corner_to_ghost_ext_kernel, F, F_ext, dir1, dir2, sign1, sign2); + } + } +} + +template +static __global__ void copy_vertex_to_ghost_ext_kernel(pFloat2 F, Float* F_ext, short dir1, short dir2, short dir3, short sign1, short sign2, short sign3){ + size_t sid = blockIdx.x*blockDim.x + threadIdx.x; + if (sid >= F.vertexGhostL(dir1,dir2,dir3)) return; + size_t id[4], tmp_sid=sid; + for(int i = 0 ; i F_ghost=F; + F_ghost.p = (Float2*) F_ext; + F_ghost.accessVertexGhost(LEXIC_1D(dir1,dir2,dir3,id), dir1, dir2, dir3, (ORIENTATION) sign1, (ORIENTATION) sign2, (ORIENTATION) sign3, true); + for(int i = 0 ; i < F.site_size ; i++) + F_ghost.set(i, F.get(i)); +} + +template +static void copy_vertex_to_ghost_ext(pFloat2 F, Float* F_ext, short dir1, short dir2, short dir3, short sign1, short sign2, short sign3){ + if( (dir1 != dir2 && dir1 != dir3 && dir3 != dir2 ) && HGC_dimBreak[dir1] && HGC_dimBreak[dir2] && HGC_dimBreak[dir3] ){ + ProfileStruct ps(F.vertexGhostL(dir1, dir2, dir3)); + tuneAndRun(ps, "copy_vertex_to_ghost_ext_kernel_size_"+std::to_string(F.site_size), copy_vertex_to_ghost_ext_kernel, F, F_ext, dir1, dir2, dir3, sign1, sign2, sign3); + } +} + + template static __global__ void conjugate_kernel(generic2 field){ diff --git a/lib/kernels/PLEGMA_kernel_getSet.cuh b/lib/kernels/PLEGMA_kernel_getSet.cuh index ebf524a4..dc436e20 100644 --- a/lib/kernels/PLEGMA_kernel_getSet.cuh +++ b/lib/kernels/PLEGMA_kernel_getSet.cuh @@ -64,7 +64,6 @@ #define IS_MINUS_GHOST(i,id) (DGC_dimBreak[i] == true && id[i] == 0) #define IS_PLUS_GHOST(i,id) (DGC_dimBreak[i] == true && id[i] == (DGC_localL[i]-1)) - namespace plegma { enum get_from { Me, Plus, Minus, @@ -130,6 +129,14 @@ namespace plegma { #endif } + inline __host__ __device__ size_t vertexGhostVolume() const { + #ifdef __CUDA_ARCH__ + return is4D ? DGC_vertexGhostVolume : DGC_vertexGhostVolume3D; + #else + return is4D ? HGC_vertexGhostVolume : HGC_vertexGhostVolume3D; + #endif + } + inline __host__ __device__ size_t vertexGhostL(const short& dir1, const short& dir2, const short& dir3) const { #ifdef __CUDA_ARCH__ return is4D ? DGC_surface1D[OFF3(dir1,dir2,dir3)] : (DGC_surface1D[OFF3(dir1,dir2,dir3)]/DGC_localL[DIM_T]); @@ -174,19 +181,34 @@ namespace plegma { template inline __device__ void shift(const short& dir1, const short& dir2, const short& dir3); - inline __host__ __device__ void accessSideGhost(const size_t& sid3D, const short& dir, const ORIENTATION& sign) { + inline __host__ __device__ void accessSideGhost(const size_t& sid3D, const short& dir, const ORIENTATION& sign, bool only_ghost=false) { + this->stride = sideGhostL(dir); + this->sid = ((only_ghost ? 0 : volume())+sideGhostShift(dir, sign))*site_size + sid3D; + } + + inline __host__ __device__ void accessSecondSideGhost(const size_t& sid3D, const short& dir, const ORIENTATION& sign, bool only_ghost=false) { + this->stride = sideGhostL(dir); + this->sid = ((only_ghost ? 0 : volume())+sideGhostVolume()+cornerGhostVolume()+vertexGhostVolume()+sideGhostShift(dir,sign))*site_size + sid3D; + } + inline __host__ __device__ void accessThirdSideGhost(const size_t& sid3D, const short& dir, const ORIENTATION& sign, bool only_ghost=false) { this->stride = sideGhostL(dir); - this->sid = (volume()+sideGhostShift(dir, sign))*site_size + sid3D; + this->sid = ((only_ghost ? 0 : volume())+2*sideGhostVolume()+3*cornerGhostVolume()+vertexGhostVolume()+sideGhostShift(dir,sign))*site_size + sid3D; + } + + inline __host__ __device__ void accessCornerGhost(const size_t& sid2D, const short& dir1, const short& dir2, const ORIENTATION& sign1, const ORIENTATION& sign2, bool only_ghost=false) { + this->stride = cornerGhostL(dir1, dir2); + this->sid = ((only_ghost ? 0 : volume())+sideGhostVolume()+cornerGhostShift(dir1,dir2,sign1,sign2))*site_size + sid2D; } - inline __host__ __device__ void accessCornerGhost(const size_t& sid2D, const short& dir1, const short& dir2, const ORIENTATION& sign1, const ORIENTATION& sign2) { + inline __host__ __device__ void accessSecondCornerGhost(const size_t& sid2D, const short& dir1, const short& dir2, const ORIENTATION& sign1, const ORIENTATION& sign2, bool only_ghost=false) { + //Assume 2 times first direction this->stride = cornerGhostL(dir1, dir2); - this->sid = (volume()+sideGhostVolume()+cornerGhostShift(dir1,dir2,sign1,sign2))*site_size + sid2D; + this->sid = ((only_ghost ? 0 : volume())+2*sideGhostVolume()+(dir1stride = vertexGhostL(dir1, dir2, dir3); - this->sid = (volume()+sideGhostVolume()+cornerGhostVolume()+vertexGhostShift(dir1,dir2,dir3,sign1,sign2,sign3))*site_size + sid1D; + this->sid = ((only_ghost ? 0 : volume())+sideGhostVolume()+cornerGhostVolume()+vertexGhostShift(dir1,dir2,dir3,sign1,sign2,sign3))*site_size + sid1D; } }; @@ -271,6 +293,18 @@ namespace plegma { template<> inline __device__ void sidStride::shift(const short& dirMinus1, const short& dirMinus2) { if(dirMinus1 == dirMinus2 && DGC_dimBreak[dirMinus1]) { + size_t id[4] = GET_ID(sid); + bool minus_ghost = IS_MINUS_GHOST(dirMinus1,id); + if(minus_ghost) this->accessSecondSideGhost(LEXIC_3D(dirMinus1,id), dirMinus1, DIR_MINUS); + else { + id[dirMinus1] = ID_MINUS(dirMinus1, id); + minus_ghost = IS_MINUS_GHOST(dirMinus1,id); + if(minus_ghost) this->accessSideGhost(LEXIC_3D(dirMinus1,id), dirMinus1, DIR_MINUS); + else { + id[dirMinus1] = ID_MINUS(dirMinus1, id); + this->sid = LEXIC_ID_3D4D(id,is4D); + } + } printf(" !!! ERROR: in MinusMinus we cannot access the second neighbour !!!"); } else { size_t id[4] = GET_ID(sid); diff --git a/lib/kernels/PLEGMA_mesons_noe.cu b/lib/kernels/PLEGMA_mesons_noe.cu new file mode 100644 index 00000000..7c347831 --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_noe.cu @@ -0,0 +1,182 @@ +#include +#include +#include +#include +#include +#include + +template +__global__ void mesons_noe_device(Float2* block2, + propTex prop1Tex, propTex prop2Tex, + gaugeTex gaugeTex, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms){ + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + Float2 noeV[N_DIMS]; + #pragma unroll + for(int i = 0; i < N_DIMS; i++) + noeV[i] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][COLS]; + Float2 R[N_SPINS][N_SPINS]; + Float2 su3[N_COLS][N_COLS]; + GAMMAS gamma_dir[4] = {G5G1, G5G2, G5G3, G5G4}; + #pragma unroll + for(int dir = 0; dir < N_DIMS; dir++) { + // term x, x, x+dir + prop1Tex.get(prop1,vid); gaugeTex.get(su3,dir,vid); prop2Tex.get(prop2,vid,dir); + partial_trace_mul_Prop_G_Prop_meson(R,prop1,prop2,su3); + noeV[dir] += trace_gamma_S(gamma_dir[dir],NOROT,R) - trace_gamma_S(G5,NOROT,R); + + //term x, x-dir, x-dir + gaugeTex.get(su3,dir,vid,dir); prop2Tex.get(prop2,vid,dir); + partial_trace_mul_Prop_G_Prop_meson(R,prop1,prop2,su3); + noeV[dir] += trace_gamma_S(gamma_dir[dir],NOROT,R) + trace_gamma_S(G5,NOROT,R); + + //term x+dir, x, x + prop1Tex.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid); prop2Tex.get(prop2,vid); + partial_trace_mul_Prop_G_Prop_meson(R,prop1,prop2,su3); + noeV[dir] += trace_gamma_S(gamma_dir[dir],NOROT,R) + trace_gamma_S(G5,NOROT,R); + + //term x-dir, x-dir, x + prop1Tex.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid,dir); + partial_trace_mul_Prop_G_Prop_meson(R,prop1,prop2,su3); + noeV[dir] += trace_gamma_S(gamma_dir[dir],NOROT,R) - trace_gamma_S(G5,NOROT,R); + } + } + + #pragma unroll + for(int i = 0; i < N_DIMS; i++) + noeV[i] *= 0.25; + + if(runFT){ + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, noeV, shared_cache, N_DIMS, sid3D, source_pos, moms, 0, +1, time_step, tid); + } else{ + if (sid3D < DGC_localVolume3D) + for(int i = 0; i < N_DIMS; i++) + block2[(tid*DGC_localVolume3D + sid3D)*N_DIMS+i] = noeV[i]; + } +} + +template +static void mesons_noe_host(ProfileStruct &ps, Float2 *result, PLEGMA_Correlator &corr, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Gauge& gauge, bool all_cols){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace() == MOMENTUM_SPACE); + size_t volume = corr.getVolSize()/t_size; + size_t size = corr.getTotalSize()/t_size*time_step; + int site_size = corr.getSiteSize(); + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("time_step = %d, t_size = %d, maxT = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", time_step, t_size, maxT, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true)? (size * (ps.tp.grid.x/time_step) ) : size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + auto gaugetex = toTexture(gauge); + + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess || h_partial_block==NULL) goto exit; + for(int it=0; it < t_size; it+=time_step) { + int t_step = std::min(t_size-it, time_step); + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*t_step; + if(all_cols) + mesons_noe_device + <<>> + (d_partial_block, *propTex1, *propTex2, *gaugetex, it, t_step, maxT, source, runFT, *moms); + else + mesons_noe_device + <<>> + (d_partial_block, *propTex1, *propTex2, *gaugetex, it, t_step, maxT, source, runFT, *moms); + + error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; + + cudaMemcpy(h_partial_block , d_partial_block , (alloc_size/time_step)*t_step*sizeof(Float2) , cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; + + if(runFT==true){ + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*t_step; v++) + for(int i = 0 ; i < site_size; i++) { + result[(it*volume+v)*site_size+i] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*site_size+i] += + h_partial_block[(v*site_size+i)*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume*t_step; v++) + for(int i = 0 ; i < site_size; i++) + result[(it*volume+v)*site_size+i] += + h_partial_block[v*site_size+i]; + } + } + + exit: + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +void mesons_noe(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge, bool all_cols) { +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + bool runFT = (corr.getCorrSpace() == MOMENTUM_SPACE); + int site_size = N_DIMS; + if(corr.getSiteSize() != site_size) { + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + } + + ProfileStruct ps(HGC_localVolume3D, (runFT==true) ? site_size*sizeof(Float2) : 0); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + tuneAndRun( ps, "mesons_noe", mesons_noe_host, + ps, result, corr, prop1, prop2, gauge, all_cols); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(corr.H_elem()), + MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +#else + PLEGMA_error("You must enable PLEGMA_NUCLEON_3PF_FIX_SINK\n"); +#endif +} + +template void mesons_noe(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge, bool all_cols); +template void mesons_noe(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge, bool all_cols); + diff --git a/lib/kernels/PLEGMA_mesons_noe_LIBE.cu b/lib/kernels/PLEGMA_mesons_noe_LIBE.cu new file mode 100644 index 00000000..eb8be76f --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_noe_LIBE.cu @@ -0,0 +1,187 @@ +#include +#include +#include +#include +#include +#include + +template +__global__ void mesons_noe_LIBE_device(Float2* block2, + propTex prop1Tex, propTex prop2Tex, + gaugeTex gaugeTex, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms){ + return; + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + const int site_size = 9*N_DIMS; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + Float2 noeV[site_size]; + #pragma unroll + for(int i = 0; i < site_size; i++) + noeV[i] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 R[N_COLS][N_COLS][N_SPINS][N_SPINS]; + Float2 su3[N_COLS][N_COLS]; + GAMMAS gamma_dir[4] = {G5G1, G5G2, G5G3, G5G4}; + + for(int dir = 0; dir < N_DIMS; dir++) { + // term x, x, x+dir + prop1Tex.get(prop1,vid); gaugeTex.get(su3,dir,vid); prop2Tex.get(prop2,vid,dir); + partial_trace_mul_Prop_G_Prop_meson_LIBE(R,prop1,prop2,su3); + for(int s=0; s<9; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s/3][s%3]) - trace_gamma_S(G5,NOROT,R[s/3][s%3]); + } + + //term x, x-dir, x-dir + gaugeTex.get(su3,dir,vid,dir); prop2Tex.get(prop2,vid,dir); + partial_trace_mul_Prop_G_Prop_meson_LIBE(R,prop1,prop2,su3); + for(int s=0; s<9; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s/3][s%3]) - trace_gamma_S(G5,NOROT,R[s/3][s%3]); + } + + //term x+dir, x, x + prop1Tex.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid); prop2Tex.get(prop2,vid); + partial_trace_mul_Prop_G_Prop_meson_LIBE(R,prop1,prop2,su3); + for(int s=0; s<9; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s/3][s%3]) - trace_gamma_S(G5,NOROT,R[s/3][s%3]); + } + + //term x-dir, x-dir, x + prop1Tex.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid,dir); + partial_trace_mul_Prop_G_Prop_meson_LIBE(R,prop1,prop2,su3); + for(int s=0; s<9; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s/3][s%3]) - trace_gamma_S(G5,NOROT,R[s/3][s%3]); + } + } + } + + #pragma unroll + for(int i = 0; i < site_size; i++) + noeV[i] *= 0.25; + + if(runFT){ + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, noeV, shared_cache, site_size, sid3D, source_pos, moms, 0, +1, time_step, tid); + } else{ + if (sid3D < DGC_localVolume3D) + for(int i = 0; i < site_size; i++) + block2[(tid*DGC_localVolume3D + sid3D)*site_size+i] = noeV[i]; + } +} + +template +static void mesons_noe_LIBE_host(ProfileStruct &ps, Float2 *result, PLEGMA_Correlator &corr, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Gauge& gauge){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace() == MOMENTUM_SPACE); + size_t volume = corr.getVolSize()/t_size; + size_t size = corr.getTotalSize()/t_size*time_step; + int site_size = corr.getSiteSize(); + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("time_step = %d, t_size = %d, maxT = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", time_step, t_size, maxT, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true)? (size * (ps.tp.grid.x/time_step) ) : size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + auto gaugetex = toTexture(gauge); + + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess || h_partial_block==NULL) goto exit; + for(int it=0; it < t_size; it+=time_step) { + int t_step = std::min(t_size-it, time_step); + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*t_step; + mesons_noe_LIBE_device + <<>> + (d_partial_block, *propTex1, *propTex2, *gaugetex, it, t_step, maxT, source, runFT, *moms); + + error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; + + cudaMemcpy(h_partial_block , d_partial_block , (alloc_size/time_step)*t_step*sizeof(Float2) , cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; + + if(runFT==true){ + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*t_step; v++) + for(int i = 0 ; i < site_size; i++) { + result[(it*volume+v)*site_size+i] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*site_size+i] += + h_partial_block[(v*site_size+i)*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume*t_step; v++) + for(int i = 0 ; i < site_size; i++) + result[(it*volume+v)*site_size+i] += + h_partial_block[v*site_size+i]; + } + } + + exit: + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +void mesons_noe_LIBE(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge) { +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + bool runFT = (corr.getCorrSpace() == MOMENTUM_SPACE); + int site_size = 9*N_DIMS; + if(corr.getSiteSize() != site_size) { + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + } + + ProfileStruct ps(HGC_localVolume3D, (runFT==true) ? site_size*sizeof(Float2) : 0); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + tuneAndRun( ps, "mesons_noe_LIBE", mesons_noe_LIBE_host, + ps, result, corr, prop1, prop2, gauge); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(corr.H_elem()), + MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +#else + PLEGMA_error("You must enable PLEGMA_NUCLEON_3PF_FIX_SINK\n"); +#endif +} + +template void mesons_noe_LIBE(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge); +template void mesons_noe_LIBE(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge); + diff --git a/lib/kernels/PLEGMA_mesons_noe_SIB.cu b/lib/kernels/PLEGMA_mesons_noe_SIB.cu new file mode 100644 index 00000000..1053bfe7 --- /dev/null +++ b/lib/kernels/PLEGMA_mesons_noe_SIB.cu @@ -0,0 +1,186 @@ +#include +#include +#include +#include +#include +#include + +template +__global__ void mesons_noe_SIB_device(Float2* block2, + propTex prop1Tex, propTex prop2Tex, + gaugeTex gaugeTex, + int it, int time_step, int maxT, int4 source, + bool runFT, tex_mom_list moms){ + int grid3D = gridDim.x/time_step; + int sid3D = (blockIdx.x % grid3D)*blockDim.x + threadIdx.x; + int tid = blockIdx.x/grid3D; + const int site_size = 5*N_DIMS; + // this takes into account the case where the source is in the local lattice + // and we need to start from it when we go over maxT + int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; + int vid = sid3D + t*DGC_localVolume3D; + + Float2 noeV[site_size]; + #pragma unroll + for(int i = 0; i < site_size; i++) + noeV[i] = 0; + + if (sid3D < DGC_localVolume3D){ + Float2 prop1[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 prop2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 R[5][N_SPINS][N_SPINS]; + Float2 su3[N_COLS][N_COLS]; + GAMMAS gamma_dir[4] = {G5G1, G5G2, G5G3, G5G4}; + #pragma unroll + for(int dir = 0; dir < N_DIMS; dir++) { + // term x, x, x+dir + prop1Tex.get(prop1,vid); gaugeTex.get(su3,dir,vid); prop2Tex.get(prop2,vid,dir); + partial_trace_mul_Prop_G_Prop_meson_SIB(R,prop1,prop2,su3); + for(int s=0; s<5; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s]) - trace_gamma_S(G5,NOROT,R[s]); + } + + //term x, x-dir, x-dir + gaugeTex.get(su3,dir,vid,dir); prop2Tex.get(prop2,vid,dir); + partial_trace_mul_Prop_G_Prop_meson_SIB(R,prop1,prop2,su3); + for(int s=0; s<5; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s]) - trace_gamma_S(G5,NOROT,R[s]); + } + + //term x+dir, x, x + prop1Tex.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid); prop2Tex.get(prop2,vid); + partial_trace_mul_Prop_G_Prop_meson_SIB(R,prop1,prop2,su3); + for(int s=0; s<5; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s]) - trace_gamma_S(G5,NOROT,R[s]); + } + + //term x-dir, x-dir, x + prop1Tex.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid,dir); + partial_trace_mul_Prop_G_Prop_meson_SIB(R,prop1,prop2,su3); + for(int s=0; s<5; s++){ + noeV[s*N_DIMS+dir] += trace_gamma_S(gamma_dir[dir],NOROT,R[s]) - trace_gamma_S(G5,NOROT,R[s]); + } + } + } + + #pragma unroll + for(int i = 0; i < site_size; i++) + noeV[i] *= 0.25; + + if(runFT){ + extern __shared__ int ext_shared_cache[]; + Float2 *shared_cache = (Float2 *) ext_shared_cache; + int source_pos[3] = {source.x, source.y, source.z}; + fourier_transform_3D(block2, noeV, shared_cache, site_size, sid3D, source_pos, moms, 0, +1, time_step, tid); + } else{ + if (sid3D < DGC_localVolume3D) + for(int i = 0; i < site_size; i++) + block2[(tid*DGC_localVolume3D + sid3D)*site_size+i] = noeV[i]; + } +} + +template +static void mesons_noe_SIB_host(ProfileStruct &ps, Float2 *result, PLEGMA_Correlator &corr, + PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, + PLEGMA_Gauge& gauge){ + + int t_size = corr.localT(); if(t_size==0) return; + int maxT = corr.endT() - corr.startT(); + int time_step = get_time_step(ps.tp.grid.x, ps.tp.block.x); + bool runFT = (corr.getCorrSpace() == MOMENTUM_SPACE); + size_t volume = corr.getVolSize()/t_size; + size_t size = corr.getTotalSize()/t_size*time_step; + int site_size = corr.getSiteSize(); + int4 source = corr.getSource(); + auto moms = corr.getTexMomList(); + + if(HGC_verbosity > 2) + if(corr.hasSource()) + printf("time_step = %d, t_size = %d, maxT = %d, ps.tp.grid.x = %d, ps.tp.block.x = %d, ps.tp.shared_bytes = %d\n", time_step, t_size, maxT, ps.tp.grid.x, ps.tp.block.x, ps.tp.shared_bytes); + + size_t alloc_size = (runFT==true)? (size * (ps.tp.grid.x/time_step) ) : size; + + Float2 *h_partial_block = NULL; + Float2 *d_partial_block = NULL; + cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); + + auto propTex1 = toTexture(prop1); + auto propTex2 = toTexture(prop2); + auto gaugetex = toTexture(gauge); + + cudaError_t error=cudaPeekAtLastError(); + if(error != cudaSuccess || h_partial_block==NULL) goto exit; + for(int it=0; it < t_size; it+=time_step) { + int t_step = std::min(t_size-it, time_step); + dim3 grid = ps.tp.grid; + grid.x = (grid.x/time_step)*t_step; + mesons_noe_SIB_device + <<>> + (d_partial_block, *propTex1, *propTex2, *gaugetex, it, t_step, maxT, source, runFT, *moms); + + error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; + + cudaMemcpy(h_partial_block , d_partial_block , (alloc_size/time_step)*t_step*sizeof(Float2) , cudaMemcpyDeviceToHost); + error=cudaPeekAtLastError(); if(error != cudaSuccess) goto exit; + + if(runFT==true){ + int accumX = ps.tp.grid.x/time_step; + for(size_t v = 0 ; v < volume*t_step; v++) + for(int i = 0 ; i < site_size; i++) { + result[(it*volume+v)*site_size+i] = 0; + for(int j = 0 ; j < accumX; j++) + result[(it*volume+v)*site_size+i] += + h_partial_block[(v*site_size+i)*accumX+j]; + } + } else { + for(size_t v = 0 ; v < volume*t_step; v++) + for(int i = 0 ; i < site_size; i++) + result[(it*volume+v)*site_size+i] += + h_partial_block[v*site_size+i]; + } + } + + exit: + hostFree(h_partial_block, alloc_size*sizeof(FloatC)); + cudaFree(d_partial_block); +} + +template +void mesons_noe_SIB(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge) { +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + bool runFT = (corr.getCorrSpace() == MOMENTUM_SPACE); + int site_size = 5*N_DIMS; + if(corr.getSiteSize() != site_size) { + PLEGMA_error("Correlator siteSize do not match: %d != %d\n", corr.getSiteSize(), site_size); + } + + ProfileStruct ps(HGC_localVolume3D, (runFT==true) ? site_size*sizeof(Float2) : 0); + int myLocalT = corr.localT(); + int maxLocalT = myLocalT; + MPI_Allreduce( &myLocalT, &maxLocalT, 1, MPI_Type(maxLocalT), MPI_MAX, HGC_fullComm); + ps.max_volume = HGC_localVolume3D*maxLocalT; + ps.tune_globally = true; + + Float2 *result = NULL; + if(runFT) + hostMalloc(result, corr.getTotalSize()*sizeof(Float2)); + else + result = (Float2 *) corr.H_elem(); + + tuneAndRun( ps, "mesons_noe_SIB", mesons_noe_SIB_host, + ps, result, corr, prop1, prop2, gauge); + + if(runFT) { + MPI_Allreduce(result, corr.H_elem(), corr.getTotalSize()*2, MPI_Type(corr.H_elem()), + MPI_SUM, HGC_spaceComm); + hostFree(result, corr.getTotalSize()*sizeof(Float2)); + } +#else + PLEGMA_error("You must enable PLEGMA_NUCLEON_3PF_FIX_SINK\n"); +#endif +} + +template void mesons_noe_SIB(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge); +template void mesons_noe_SIB(PLEGMA_Correlator &corr, PLEGMA_Propagator& prop1, PLEGMA_Propagator& prop2, PLEGMA_Gauge& gauge); + diff --git a/lib/kernels/PLEGMA_plaquetteU1.cuh b/lib/kernels/PLEGMA_plaquetteU1.cuh new file mode 100644 index 00000000..1279250e --- /dev/null +++ b/lib/kernels/PLEGMA_plaquetteU1.cuh @@ -0,0 +1,73 @@ +#include +#include +using namespace plegma; + +template +static __global__ void calculatePlaquetteU1_device(gaugeU1Tex gaugeU1Tex, Float *partial_plaq, float phase) { + extern __shared__ int ext_shared_cache[]; + Float *shared_cache = (Float*)ext_shared_cache; + int sid = blockIdx.x*blockDim.x + threadIdx.x; + int cacheIndex = threadIdx.x; + + if (sid < gaugeU1Tex.volume()) { + Float2 G1, G2, G3, G4; + Float trace = 0.; + + // Loop over xy, xz, xt, yz, yt, zt + #pragma unroll + for(int dir1=0; dir1(G2,dir2,sid,dir1); + gaugeU1Tex.get(G3,dir1,sid,dir2); + gaugeU1Tex.get(G4,dir2,sid); + + trace += cos(phase*(G1.x+G2.x-G3.x-G4.x)); + } + } + shared_cache[cacheIndex] = trace; + } else { + shared_cache[cacheIndex] = 0.; + } + reduce(shared_cache, 1); + + // now on the first element of the shared memory we have the reduction of block threads + if(cacheIndex == 0 && partial_plaq!=NULL) + partial_plaq[blockIdx.x] = shared_cache[0]; // write result back to global memory +} + +template +static void calculatePlaquetteU1_host(ProfileStruct& ps, gaugeU1Tex gaugeU1Tex, Float& plaquette, Float phase){ + + Float *d_partial_plaq = NULL; + int gridDimX = ps.tp.grid.x; + cudaMalloc((void**)&d_partial_plaq, gridDimX * sizeof(Float)); + calculatePlaquetteU1_device<<>>(gaugeU1Tex, d_partial_plaq, phase); + + Float *h_partial_plaq = NULL; + hostMalloc(h_partial_plaq, gridDimX * sizeof(Float) ); + if(h_partial_plaq == NULL) PLEGMA_error("Error allocate memory for host partial plaq"); + cudaMemcpy(h_partial_plaq, d_partial_plaq , gridDimX * sizeof(Float) , cudaMemcpyDeviceToHost); + cudaFree(d_partial_plaq); + //checkCudaError(); + + plaquette = 0.; + for(int i = 0 ; i < gridDimX ; i++) + plaquette += h_partial_plaq[i]; + hostFree(h_partial_plaq, gridDimX * sizeof(Float) ); +} + +template +static Float calculatePlaquetteU1(gaugeU1Tex gaugeU1Tex, Float phase){ + + assert(gaugeU1Tex.is4D); // TODO: For 3D we should not compute the plaquette in T + ProfileStruct ps(gaugeU1Tex.volume(),sizeof(Float)); + Float plaquette; + tuneAndRun(ps, "calculatePlaquetteU1", calculatePlaquetteU1_host, ps, gaugeU1Tex, plaquette, phase); + + Float globalPlaquetteU1 = 0.; + MPI_Allreduce(&plaquette , &globalPlaquetteU1 , 1 , MPI_Type(plaquette) , MPI_SUM , HGC_fullComm); + return globalPlaquetteU1/(HGC_totalVolume*6); +} diff --git a/lib/kernels/PLEGMA_projectors.cuh b/lib/kernels/PLEGMA_projectors.cuh index 6c74b61c..db1e0903 100644 --- a/lib/kernels/PLEGMA_projectors.cuh +++ b/lib/kernels/PLEGMA_projectors.cuh @@ -22,16 +22,17 @@ const __device__ short int projInd[8][2][2] = {{2,3},{3,2}}, {{2,2},{3,3}}, }; + const __device__ float projTmP[24][8][2] = - {{{0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{-0.25,0.00}}, - {{0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{-0.25,0.00}}, - {{0.00,-0.25},{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,-0.25}}, - {{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,-0.25},{0.00,0.25},{-0.25,0.00},{0.00,-0.25},{0.25,0.00}}, - {{-0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.25,0.00}}, - {{0.25,0.00},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{-0.25,0.00}}, - {{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,-0.25}}, - {{0.25,0.00},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00}}, - {{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00}},//0 + {{{0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{-0.25,0.00}},//1/2*(1+I*g5)* 0.25*(1+g4)*(1+I*g5) + {{0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{-0.25,0.00}},//1/2*(1+I*g5)* 0.25*(1+g4)*I*g5g1*(1+I*g5) + {{0.00,-0.25},{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,-0.25}},//1/2*(1+I*g5)* 0.25*(1+g4)*I*g5g2*(1+I*g5) + {{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,-0.25},{0.00,0.25},{-0.25,0.00},{0.00,-0.25},{0.25,0.00}},//1/2*(1+I*g5)* 0.25*(1+g4)*I*g5g3*(1+I*g5) + {{-0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.25,0.00}},//1/2*(1+I*g5)* 0.25*(1-g4)*(1+I*g5) + {{0.25,0.00},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{-0.25,0.00}},//1/2*(1+I*g5)* 0.25*(1-g4)*I*g5g1*(1+I*g5) + {{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,-0.25}},//1/2*(1+I*g5)* 0.25*(1-g4)*I*g5g2*(1+I*g5) + {{0.25,0.00},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00}},//1/2*(1+I*g5)* 0.25*(1-g4)*I*g5g3*(1+I*g5) + {{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00}},////1/2*(1+I*g5)* 0.25*(1-g4)*I*g5g4*(1+I*g5) {{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00}}, {{0.00,0.25},{0.25,0.00},{-0.25,0.00},{0.00,0.25},{0.00,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00}}, {{0.00,0.25},{0.25,0.00},{-0.25,0.00},{0.00,0.25},{0.00,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00}}, @@ -79,12 +80,12 @@ const __device__ short int projIndTmP[24][8][2] = {{1,1},{1,3},{3,1},{3,3},{2,0},{2,2},{3,1},{3,3}}//23 }; const __device__ float projTmM[24][8][2] = - {{{0.25,0.00},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{-0.25,0.00}}, - {{0.25,0.00},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{-0.25,0.00}}, - {{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,-0.25}}, - {{0.25,0.00},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00}}, - {{-0.25,0.00},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.25,0.00}}, - {{0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{-0.25,0.00}}, + {{{0.25,0.00},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{-0.25,0.00}}, //1/2*(1-I*g5)* 0.25*(1+g4)*(1-I*g5) + {{0.25,0.00},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{-0.25,0.00}}, //1/2*(1-I*g5)* 0.25*(1+g4)*I*g5g1*(1-I*g5) + {{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{-0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,-0.25}},//1/2*(1-I*g5)* 0.25*(1+g4)*I*g5g2*(1-I*g5) + {{0.25,0.00},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.00,-0.25},{-0.25,0.00},{0.00,0.25},{0.25,0.00}},//1/2*(1-I*g5)* 0.25*(1+g4)*I*g5g3*(1-I*g5) + {{-0.25,0.00},{0.00,-0.25},{-0.25,0.00},{0.00,-0.25},{0.00,-0.25},{0.25,0.00},{0.00,-0.25},{0.25,0.00}},//1/2*(1-I*g5)* 0.25*(1-g4)*(1-I*g5) + {{0.25,0.00},{0.00,0.25},{0.25,0.00},{0.00,0.25},{0.00,0.25},{-0.25,0.00},{0.00,0.25},{-0.25,0.00}},//1/2*(1-I*g5)* 0.25*(1-g4)*I*g5g1*(1-I*g5) {{0.00,-0.25},{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,-0.25}}, {{0.25,0.00},{0.00,0.25},{-0.25,0.00},{0.00,-0.25},{0.00,0.25},{-0.25,0.00},{0.00,-0.25},{0.25,0.00}}, {{0.25,0.00},{0.00,-0.25},{0.00,-0.25},{-0.25,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00},{0.00,0.00}},//0 diff --git a/lib/kernels/PLEGMA_seqSourceNucleon.cu b/lib/kernels/PLEGMA_seqSourceNucleon.cu index a47e7ec4..87216c21 100644 --- a/lib/kernels/PLEGMA_seqSourceNucleon.cu +++ b/lib/kernels/PLEGMA_seqSourceNucleon.cu @@ -4,7 +4,22 @@ #include #ifdef PLEGMA_NUCLEON_3PF_FIX_SINK -static const __device__ short int NtoN_indices[16][4] = {0,1,0,1,0,1,1,0,0,1,2,3,0,1,3,2,1,0,0,1,1,0,1,0,1,0,2,3,1,0,3,2,2,3,0,1,2,3,1,0,2,3,2,3,2,3,3,2,3,2,0,1,3,2,1,0,3,2,2,3,3,2,3,2}; +static const __device__ short int NtoN_indices[16][4] = {0,1,0,1, + 0,1,1,0, + 0,1,2,3, + 0,1,3,2, + 1,0,0,1, + 1,0,1,0, + 1,0,2,3, + 1,0,3,2, + 2,3,0,1, + 2,3,1,0, + 2,3,2,3, + 2,3,3,2, + 3,2,0,1, + 3,2,1,0, + 3,2,2,3, + 3,2,3,2}; static const __device__ float NtoN_values[16] = {-1,1,-1,1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1}; #endif @@ -46,7 +61,7 @@ __device__ void contractNucleonSeqSource(vector2& vec, propTex& prop1.get(P,sid); if(isTwoPropDiff) prop2.get(P2, sid); - //#pragma unroll + #pragma unroll for(short cc1 = 0 ; cc1 < 6 ; cc1++){ short c1 = eps[cc1][0]; short c2 = eps[cc1][1]; diff --git a/lib/kernels/PLEGMA_threep_local.cu b/lib/kernels/PLEGMA_threep_local.cu index f26f01d0..540dd85f 100644 --- a/lib/kernels/PLEGMA_threep_local.cu +++ b/lib/kernels/PLEGMA_threep_local.cu @@ -5,6 +5,15 @@ #include #include +#define CUDA_CHECK(call) \ +do { \ + cudaError_t err = call; \ + if (err != cudaSuccess) { \ + PLEGMA_error("CUDA error at %s : %s -> %s\n", __FILE__ , __LINE__ ,cudaGetErrorString(err)); \ + exit(EXIT_FAILURE); \ + } \ +} while (0) + using namespace plegma; template struct KernelArr {T* array; int size;}; @@ -102,8 +111,8 @@ static void threep_local_host(ProfileStruct &ps, Float2 *result, KernelArr listGammas; listGammas.size = gammas.size(); - cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS)); - cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice); + CUDA_CHECK(cudaMalloc((void**)&listGammas.array, gammas.size()*sizeof(GAMMAS))); + CUDA_CHECK(cudaMemcpy(listGammas.array, gammas.data(), gammas.size()*sizeof(GAMMAS), cudaMemcpyHostToDevice)); if(HGC_verbosity > 2) if(corr.hasSource()) @@ -113,7 +122,7 @@ static void threep_local_host(ProfileStruct &ps, Float2 *result, Float2 *h_partial_block = NULL; Float2 *d_partial_block = NULL; - cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) ); + CUDA_CHECK(cudaMalloc((void**)&d_partial_block, alloc_size * sizeof(Float2) )); hostMalloc(h_partial_block, alloc_size*sizeof(Float2)); auto propTex1 = toTexture>(prop1); diff --git a/lib/kernels/PLEGMA_threep_oneD.cu b/lib/kernels/PLEGMA_threep_oneD.cu index be4f9b04..74bde0e1 100644 --- a/lib/kernels/PLEGMA_threep_oneD.cu +++ b/lib/kernels/PLEGMA_threep_oneD.cu @@ -33,11 +33,11 @@ __global__ void threep_oneD_device(Float2* block2, int t=it+tid; if(t>=maxT) t=(source.w%DGC_localL[DIM_T])+t-maxT; int vid = sid3D + t*DGC_localVolume3D; bool notZfac = (mu<0) && (nu<0) && (c1<0) && (c2<0); - Float2 accum[N_DIMS*N_SPINS*N_SPINS]; #pragma unroll for(int i = 0; i < N_DIMS*N_SPINS*N_SPINS; i++) accum[i]=0; + if (sid3D < DGC_localVolume3D){ @@ -56,15 +56,15 @@ __global__ void threep_oneD_device(Float2* block2, partial_trace_mul_Prop_G_Prop(R,prop1,prop2,su3,mu,nu,c1,c2); // - term x, x-dir^, x-dir - /*texture1.get(prop1,vid);*/ gaugeTex.get(su3,dir,vid,dir); texture2.get(prop2,vid,dir); + /*texture1.get(prop1,vid);*/gaugeTex.get(su3,dir,vid,dir); texture2.get(prop2,vid,dir); partial_trace_mul_Prop_G_Prop(R,prop1,prop2,su3,mu,nu,c1,c2); // + term x-dir, x-dir, x - texture1.get(prop1,vid,dir); /*gaugeTex.get(su3,dir,vid,dir);*/ texture2.get(prop2,vid); + texture1.get(prop1,vid,dir);/*gaugeTex.get(su3,dir,vid,dir);*/texture2.get(prop2,vid); partial_trace_mul_Prop_G_Prop(R,prop1,prop2,su3,mu,nu,c1,c2); // - term x+dir, x^, x - texture1.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid); /*texture2.get(prop2,vid);*/ + texture1.get(prop1,vid,dir); gaugeTex.get(su3,dir,vid);/*texture2.get(prop2,vid);*/ partial_trace_mul_Prop_G_Prop(R,prop1,prop2,su3,mu,nu,c1,c2); // END REGION @@ -88,10 +88,16 @@ __global__ void threep_oneD_device(Float2* block2, } } } + if (blockIdx.x == 0 && threadIdx.x == 0) { + printf("accum[0]=(%e,%e), accum[last]=(%e,%e)\n", + (double)accum[0].x, (double)accum[0].y, + (double)accum[N_DIMS*listGammas.size - 1].x, + (double)accum[N_DIMS*listGammas.size - 1].y); +} int source_pos[3] = {source.x, source.y, source.z}; if(runFT){ - extern __shared__ int ext_shared_cache[]; - Float2 *shared_cache = (Float2 *) ext_shared_cache; + extern __shared__ unsigned char ext_shared_cache[]; + Float2 *shared_cache = reinterpret_cast*>(ext_shared_cache); fourier_transform_3D(block2, accum, shared_cache, N_DIMS*listGammas.size, sid3D, source_pos, moms, 0, +1, time_step, tid); } else{ if (sid3D < DGC_localVolume3D) diff --git a/plegma/CMakeLists.txt b/plegma/CMakeLists.txt index 159fdbcc..f555ae48 100644 --- a/plegma/CMakeLists.txt +++ b/plegma/CMakeLists.txt @@ -69,6 +69,12 @@ target_link_libraries(Calc_2pt_charmonium ${PLEGMA_LIBS}) cuda_add_executable(nucleon_2pt_3pt nucleon_2pt_3pt.cpp) target_link_libraries(nucleon_2pt_3pt ${PLEGMA_LIBS}) +cuda_add_executable(nucleon_2pt_3pt_delta nucleon_2pt_3pt_delta.cpp) +target_link_libraries(nucleon_2pt_3pt_delta ${PLEGMA_LIBS}) + +cuda_add_executable(nucleon_2pt_3pt_delta_check nucleon_2pt_3pt_delta_check.cpp) +target_link_libraries(nucleon_2pt_3pt_delta_check ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_2pt_3pt_npi nucleon_2pt_3pt_npi.cpp) target_link_libraries(nucleon_2pt_3pt_npi ${PLEGMA_LIBS}) @@ -93,9 +99,18 @@ target_link_libraries(testLinksSmearings ${PLEGMA_LIBS}) cuda_add_executable(testHDF5 EXCLUDE_FROM_ALL testHDF5.cpp) target_link_libraries(testHDF5 ${PLEGMA_LIBS}) +cuda_add_executable(GPDs_nucleon GPDs_nucleon.cpp) +target_link_libraries(GPDs_nucleon ${PLEGMA_LIBS}) + +cuda_add_executable(qLoops_gregoris qLoops_gregoris.cpp) +target_link_libraries(qLoops_gregoris ${PLEGMA_LIBS}) + cuda_add_executable(qLoops qLoops.cpp) target_link_libraries(qLoops ${PLEGMA_LIBS}) +cuda_add_executable(nucleon_2der_P111 nucleon_2der_P111.cpp) +target_link_libraries(nucleon_2der_P111 ${PLEGMA_LIBS}) + cuda_add_executable(qLoops_WilsonLine qLoops_WilsonLine.cpp) target_link_libraries(qLoops_WilsonLine ${PLEGMA_LIBS}) @@ -136,15 +151,22 @@ cuda_add_executable(new_TMDPDFs_mesons_Juwels new_TMDPDFs_mesons_Juwels.cpp) target_link_libraries(new_TMDPDFs_mesons_Juwels ${PLEGMA_LIBS}) if (PLEGMA_SCATTERING_CONTRACTIONS) + cuda_add_executable(pion_2pt EXCLUDE_FROM_ALL pion_2pt.cpp) + target_link_libraries(pion_2pt ${PLEGMA_LIBS}) + cuda_add_executable(testScattReductions EXCLUDE_FROM_ALL testScattReductions.cpp) target_link_libraries(testScattReductions ${PLEGMA_LIBS}) cuda_add_executable(piNdiagrams piNdiagrams.cpp) target_link_libraries(piNdiagrams ${PLEGMA_LIBS}) cuda_add_executable(nucleon_delta_test EXCLUDE_FROM_ALL nucleon_delta_test.cpp) target_link_libraries(nucleon_delta_test ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi EXCLUDE_FROM_ALL nucleon_3pt_n_npi.cpp) target_link_libraries(nucleon_3pt_n_npi ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi_delta EXCLUDE_FROM_ALL nucleon_3pt_n_npi_delta.cpp) + target_link_libraries(nucleon_3pt_n_npi_delta ${PLEGMA_LIBS}) + cuda_add_executable(nucleon_3pt_n_npi_wd1ii EXCLUDE_FROM_ALL nucleon_3pt_n_npi_wd1ii.cpp) target_link_libraries(nucleon_3pt_n_npi_wd1ii ${PLEGMA_LIBS}) @@ -164,6 +186,9 @@ if (PLEGMA_SCATTERING_CONTRACTIONS) cuda_add_executable(piN_scattering_length_12 EXCLUDE_FROM_ALL piN_scattering_length_12.cpp) target_link_libraries(piN_scattering_length_12 ${PLEGMA_LIBS}) + cuda_add_executable(Yan_NpiScattering_Wilson EXCLUDE_FROM_ALL Yan_NpiScattering_Wilson.cpp) + target_link_libraries(Yan_NpiScattering_Wilson ${PLEGMA_LIBS}) + endif(PLEGMA_SCATTERING_CONTRACTIONS) diff --git a/plegma/Calc_2pt.cpp b/plegma/Calc_2pt.cpp index e9f7c8e6..3b645b7a 100644 --- a/plegma/Calc_2pt.cpp +++ b/plegma/Calc_2pt.cpp @@ -76,13 +76,13 @@ int main(int argc, char **argv) sourcePositions[isource][2], sourcePositions[isource][3]); site& source = sourcePositions[isource]; - PLEGMA_Propagator propUP(run_ud ? BOTH : NONE); - PLEGMA_Propagator propDN(run_ud ? BOTH : NONE); + PLEGMA_Propagator propUP(run_ud ? BOTH : NONE); + PLEGMA_Propagator propDN(run_ud ? BOTH : NONE); PLEGMA_Gauge3D smearedGauge3D; smearedGauge3D.absorb(smearedGauge, source[DIM_T]); - auto computePropagator = [&](PLEGMA_Propagator& prop, const double run_mu, WHICHFLAVOR fl, int nSmear) { + auto computePropagator = [&](PLEGMA_Propagator& prop, const double run_mu, WHICHFLAVOR fl, int nSmear) { // ensuring mu value if(mu != run_mu) { updateOptions(fl); @@ -93,7 +93,7 @@ int main(int argc, char **argv) PLEGMA_Vector vectorInOut; PLEGMA_Vector vectorAuxD; - PLEGMA_Vector vectorAuxF; + PLEGMA_Vector vectorAuxF; // Smearing the source PLEGMA_Vector3D vector1, vector2; vector1.pointSource(source, isc/3, isc%3, DEVICE); @@ -118,7 +118,7 @@ int main(int argc, char **argv) TIME(computePropagator(propDN, -mu_ud, LIGHT, nsmearGauss)); - PLEGMA_Correlator corr(corr_space, source, maxQsq); + PLEGMA_Correlator corr(corr_space, source, maxQsq); TIME(corr.contractMesons(propUP, propDN)); char *dset1, *dset2; @@ -136,7 +136,7 @@ int main(int argc, char **argv) int nSmaller = std::min(mu_s.size(),mu_c.size()); char cSmaller = (nSmaller==(int)mu_s.size()) ? 's' : 'c'; - PLEGMA_Propagator propS[nSmaller]; + PLEGMA_Propagator propS[nSmaller]; for(int ismall=0; ismall < nSmaller; ismall++) { for(int i=0;i 0) { - PLEGMA_Propagator propL; + PLEGMA_Propagator propL; for(int ilarge=0; ilarge < nLarger; ilarge++) { double run_mu = (cSmaller!='s') ? mu_s[ilarge] : mu_c[ilarge]; int nsmear = (cSmaller!='s') ? nsmearGauss_s : nsmearGauss_c; @@ -155,9 +155,9 @@ int main(int argc, char **argv) if(nSmaller>0) { for(int ismall=0; ismall < nSmaller; ismall++) { - PLEGMA_Propagator &propST = (cSmaller=='s') ? propS[ismall] : propL; - PLEGMA_Propagator &propCH = (cSmaller=='c') ? propS[ismall] : propL; - PLEGMA_Correlator corr(corr_space, source, maxQsq); + PLEGMA_Propagator &propST = (cSmaller=='s') ? propS[ismall] : propL; + PLEGMA_Propagator &propCH = (cSmaller=='c') ? propS[ismall] : propL; + PLEGMA_Correlator corr(corr_space, source, maxQsq); bool only_st = (ismall>0 && cSmaller=='s') || (ilarge>0 && cSmaller!='s'); bool only_ch = (ismall>0 && cSmaller=='c') || (ilarge>0 && cSmaller!='c'); #ifdef PLEGMA_UDSC_BARYONS @@ -211,10 +211,10 @@ int main(int argc, char **argv) } } } else { - PLEGMA_Propagator none(NONE); - PLEGMA_Propagator &propST = (cSmaller=='s') ? none : propL; - PLEGMA_Propagator &propCH = (cSmaller=='c') ? none : propL; - PLEGMA_Correlator corr(corr_space, source, maxQsq); + PLEGMA_Propagator none(NONE); + PLEGMA_Propagator &propST = (cSmaller=='s') ? none : propL; + PLEGMA_Propagator &propCH = (cSmaller=='c') ? none : propL; + PLEGMA_Correlator corr(corr_space, source, maxQsq); bool only_st = (ilarge>0 && cSmaller!='s'); bool only_ch = (ilarge>0 && cSmaller!='c'); #ifdef PLEGMA_UDSC_BARYONS @@ -261,8 +261,8 @@ int main(int argc, char **argv) } } else if(run_ud) { #ifdef PLEGMA_UDSC_BARYONS - PLEGMA_Propagator none(NONE); - PLEGMA_Correlator corr(corr_space, source, maxQsq); + PLEGMA_Propagator none(NONE); + PLEGMA_Correlator corr(corr_space, source, maxQsq); TIME(corr.contractBaryonsUDSC(propUP, propDN, none, none)); char * group; diff --git a/plegma/Calc_2pt_marconi.cpp b/plegma/Calc_2pt_marconi.cpp index 8aa227b0..a1bf415c 100644 --- a/plegma/Calc_2pt_marconi.cpp +++ b/plegma/Calc_2pt_marconi.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) //=========================================================================================================// initializePLEGMA(); - std::vector sinkMom = {0,0,0}; + std::vector sinkMom = {4,0,0}; std::string given_twop_filename = twop_filename; { @@ -81,7 +81,7 @@ int main(int argc, char **argv) updateOptions(CHARM); mu = mu_c[0]; } - TIME(QUDA_solver solver(mu)); + TIME(QUDA_solver solver(mu,1)); std::vector threads; diff --git a/plegma/Plaquette.cpp b/plegma/Plaquette.cpp index 91f98519..9c544955 100644 --- a/plegma/Plaquette.cpp +++ b/plegma/Plaquette.cpp @@ -1,4 +1,7 @@ #include +//#include +//#include +//#include #include #include @@ -16,9 +19,12 @@ int main(int argc, char **argv) // Allocation done on BOTH, DEVICE and HOST { cudaProfilerStart(); - PLEGMA_Gauge gauge(BOTH); + PLEGMA_Gauge gauge(BOTH); // Reading from Lime file and loading to device gauge.readFile(latfile, LIME_FORMAT); + PLEGMA_Gauge gauged(BOTH); + PLEGMA_Gauge gaugedout(BOTH); + // Computing plaquette on device in three different way for crosschecking gauge.calculatePlaq(); @@ -26,11 +32,75 @@ int main(int argc, char **argv) gauge.calculatePlaqShifts(); gauge.calculatePlaqClover(); gauge.calculatePlaqStaples(); + + gauged.copy(gauge); // Loading to QUDA and computing plaquette also there - initGaugeQuda(gauge, false, QUDA_SU3_LINKS); + initGaugeQuda(gauged, true); plaqQuda(); - cudaProfilerStop(); + gSmear_QUDA( gaugedout, gauged, false); + gaugedout.calculatePlaq(); + gaugedout.unload(); + gaugedout.writeLIME("gaugetest_check3"); +// gauge.copy(gaugedout); +// gauge.unload(); +// gauge.writeLIME("gaugetest_check2"); +/* QudaGaugeSmearParam smear_param = newQudaGaugeSmearParam(); + smear_param.smear_type = QUDA_GAUGE_SMEAR_HYP; + PLEGMA_printf("smear type %d %d\n",smear_param.smear_type, QUDA_GAUGE_SMEAR_HYP); + fflush(stdout); + smear_param.alpha1 = 0.75; // typical HYP values + smear_param.alpha2 = 0.60; + smear_param.alpha3 = 0.30; + smear_param.n_steps = 1; // number of iterations + smear_param.meas_interval = 1; + + //smear_param.gauge_order = gauge_param.gauge_order; + //smear_param.precision = gauge_param.cuda_prec; + + int gauge_smear_step=1; + int measurement_interval=1; + bool su_project = false; + QudaGaugeObservableParam *obs_param = new QudaGaugeObservableParam[gauge_smear_step / measurement_interval + 1]; + for (int i = 0; i < gauge_smear_step / measurement_interval + 1; i++) { + obs_param[i] = newQudaGaugeObservableParam(); + obs_param[i].compute_plaquette = QUDA_BOOLEAN_TRUE; + obs_param[i].compute_qcharge = QUDA_BOOLEAN_TRUE; + obs_param[i].su_project = su_project ? QUDA_BOOLEAN_TRUE : QUDA_BOOLEAN_FALSE; + } + + // ------------------------------ + // Apply HYP smearing + // ------------------------------ + performGaugeSmearQuda(&smear_param, obs_param); + QudaGaugeParam gauge_param = newQudaGaugeParam(); + setGaugeParam(gauge_param); + gauge_param.type = QUDA_WILSON_LINKS; + gauge_param.make_resident_gauge = 0; + int volume = gauge_param.X[0] * gauge_param.X[1] * + gauge_param.X[2] * gauge_param.X[3]; + size_t bytes_per_dir = volume * gauge_param.site_size *((gauge_param.cpu_prec == QUDA_DOUBLE_PRECISION) ? sizeof(double) : sizeof(float)); + + PLEGMA_printf("Lattice %dx%dx%dx%d\n", gauge_param.X[0], gauge_param.X[1], gauge_param.X[2], gauge_param.X[3]); + PLEGMA_printf("site_size = %d, cpu_prec = %d\n", gauge_param.site_size, gauge_param.cpu_prec); + PLEGMA_printf("bytes_per_dir = %zu (%.3f MB)\n", bytes_per_dir, bytes_per_dir / (1024.0*1024.0)); + + + + +// size_t bytes_per_dir = gauge_param.gauge_site_size * gauge_param.volume * +// ((gauge_param.precision == QUDA_DOUBLE_PRECISION) ? sizeof(double) : sizeof(float)); + + double* buf[N_DIMS]; + for(int i=0; i propUP; PLEGMA_Propagator propDN; + { // Whithin this scope we keep track also of the propagator non smeared on the sink - PLEGMA_Propagator propUP_SL(tSinks.size()>0 ? BOTH:NONE); + PLEGMA_Propagator propUP_SL(tSinks.size()>0 ? BOTH:NONE); PLEGMA_Propagator propDN_SL(tSinks.size()>0 ? BOTH:NONE); - TIME(computePropagator(propUP, propUP_SL, mu_ud, LIGHT, nsmearGauss, false)); + TIME(computePropagator(propUP, propUP_SL, mu_ud, LIGHT, nsmearGauss, false)); TIME(computePropagator(propDN, propDN_SL, -mu_ud, LIGHT, nsmearGauss, false)); - #ifdef PLEGMA_NUCLEON_3PF_FIX_SINK for(size_t its = 0; its < tSinks.size(); its++){ int tsinkMtsource = tSinks[its]; @@ -388,4 +388,3 @@ int main(int argc, char **argv) { finalize(); return 0; } - diff --git a/plegma/nucleon_3pt_n_npi_sigma.cpp b/plegma/nucleon_3pt_n_npi_sigma.cpp index 4cb1af07..1d738ccf 100644 --- a/plegma/nucleon_3pt_n_npi_sigma.cpp +++ b/plegma/nucleon_3pt_n_npi_sigma.cpp @@ -33,8 +33,8 @@ void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, int n_stochastic_samples, - int n_coherent_source, - int *attract_look_up_table){ + int n_coherent_source, + int *attract_look_up_table){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); TIME(source.applyBoundaryConditions( true, n_coherent_source, attract_look_up_table )); @@ -48,9 +48,9 @@ void produceOutput_3pt( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, int n_stochastic_samples, - int n_coherent_source, + int n_coherent_source, int *attract_look_up_table, - int source_sink_separation){ + int source_sink_separation){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); TIME(source.applyBoundaryConditions_3pt( true, n_coherent_source, attract_look_up_table, source_sink_separation )); @@ -72,7 +72,7 @@ void produceOutput( PLEGMA_ScattCorrelator source, void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, - int n_coherent_source, + int n_coherent_source, int *attract_look_up_table ){ TIME(source.apply_phase()); @@ -85,9 +85,9 @@ void produceOutput_2pt_packed( PLEGMA_ScattCorrelator source, void produceOutput_3pt( PLEGMA_ScattCorrelator source, std::string outputFilename, std::string diagram_name, - int n_coherent_source, + int n_coherent_source, int *attract_look_up_table, - int source_sink_separation + int source_sink_separation ){ TIME(source.apply_phase()); TIME(source.apply_sign(diagram_name)); @@ -95,6 +95,8 @@ void produceOutput_3pt( PLEGMA_ScattCorrelator source, TIME(source.writeHDF5( outputFilename )); } + + int main(int argc, char **argv) { initializeOptions(argc, argv, true, listOpt); diff --git a/plegma/piN_scattering_length_12.cpp b/plegma/piN_scattering_length_12.cpp index 81b7ab0e..5e799fe5 100644 --- a/plegma/piN_scattering_length_12.cpp +++ b/plegma/piN_scattering_length_12.cpp @@ -111,11 +111,11 @@ int main(int argc, char **argv) { // Loading to QUDA and computing plaquette also there - updateGaugeQuda(gauge, false); - plaqQuda(); + // updateGaugeQuda(gauge, false); + // plaqQuda(); - updateOptions(LIGHT); - TIME(QUDA_solver solver_p(mu,1)); + //updateOptions(LIGHT); + //TIME(QUDA_solver solver_p(mu,1)); //Get the confnumber for latfile char *ssource; @@ -199,11 +199,11 @@ int main(int argc, char **argv) { auto solve1 = [&](plegma::PLEGMA_Vector &ppa, - plegma::PLEGMA_Vector &pma, + //plegma::PLEGMA_Vector &pma, plegma::PLEGMA_Vector3D &in, site source){ PLEGMA_Vector vectorInOut_a; - PLEGMA_Vector vectorInOut_p; + // PLEGMA_Vector vectorInOut_p; PLEGMA_Vector vectorAuxD; { // Smearing the source @@ -213,44 +213,44 @@ int main(int argc, char **argv) { TIME(vector1.gaussianSmearing(in, smearedGauge3D, nsmearGauss, alphaGauss)); vectorInOut_a.absorb(vector1,source[DIM_T]); } - vectorInOut_p.copy(vectorInOut_a); + //vectorInOut_p.copy(vectorInOut_a); // Inverting PLEGMA_printf("Going to invert for antiperiodic case\n" ); - updateGaugeQuda(gauge, true); - TIME(solver_a.UpdateSolver()); + //updateGaugeQuda(gauge, true); + //TIME(solver_a.UpdateSolver()); TIME(solver_a.solve(vectorInOut_a, vectorInOut_a)); - PLEGMA_printf("Going to invert for periodic case \n"); - updateGaugeQuda(gauge, false); - TIME(solver_p.UpdateSolver()); - TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); + //PLEGMA_printf("Going to invert for periodic case \n"); + //updateGaugeQuda(gauge, false); + //TIME(solver_p.UpdateSolver()); + //TIME(solver_p.solve(vectorInOut_p, vectorInOut_p)); - ppa.copy(vectorInOut_p); - ppa.add(vectorInOut_a,1); + //ppa.copy(vectorInOut_p); + //ppa.add(vectorInOut_a,1); - pma.copy(vectorInOut_p); - pma.add(vectorInOut_a,-1); + //pma.copy(vectorInOut_p); + //pma.add(vectorInOut_a,-1); - vectorAuxD.copy(ppa); + vectorAuxD.copy(vectorInOut_a); TIME(ppa.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss)); - vectorAuxD.copy(pma); - TIME(pma.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss)); + //vectorAuxD.copy(pma); + //TIME(pma.gaussianSmearing(vectorAuxD, smearedGauge, nsmearGauss, alphaGauss)); }; auto computePropagator = [&](PLEGMA_Propagator& prop_packed ) { for(int isc = 0 ; isc < 12 ; isc++){ - PLEGMA_Vector vectorInOut_ppa,vectorInOut_pma; + PLEGMA_Vector vectorInOut_ppa;//,vectorInOut_pma; PLEGMA_Vector vectorAuxF; PLEGMA_Vector vectorAuxD; PLEGMA_Vector3D vector1; vector1.pointSource(source, isc/3, isc%3, DEVICE); - solve1(vectorInOut_ppa, vectorInOut_pma, vector1, source); - vectorAuxD.pack_propagator(vectorInOut_ppa, - vectorInOut_pma, - source[DIM_T], - HGC_totalL[DIM_T]/2); - vectorAuxF.copy(vectorAuxD); + solve1(vectorInOut_ppa, vector1, source); + //vectorAuxD.pack_propagator(vectorInOut_ppa, + // vectorInOut_pma, + // source[DIM_T], + // HGC_totalL[DIM_T]/2); + vectorAuxF.copy(vectorInOut_ppa); prop_packed.absorb(vectorAuxF, isc/3, isc%3); }; @@ -306,7 +306,7 @@ int main(int argc, char **argv) { PLEGMA_Vector vectorPropagator_stochastic; PLEGMA_Vector vectorPropagator_stochastic_ppa; - PLEGMA_Vector vectorPropagator_stochastic_pma; + //PLEGMA_Vector vectorPropagator_stochastic_pma; if (readstochastic==0){ vectorSource_stochastic.stochastic_Z(nroots); PLEGMA_Vector vectorAuxF; @@ -315,43 +315,44 @@ int main(int argc, char **argv) { vectorAuxF.writeLIME("globalTfulltimedilution_source_nstoch"+std::to_string(i)+"_"+confnumber); vectorPropagator_stochastic.scale(0.0); vectorPropagator_stochastic_ppa.scale(0.0); - vectorPropagator_stochastic_pma.scale(0.0); + //vectorPropagator_stochastic_pma.scale(0.0); if (timedilution){ PLEGMA_printf("#piNdiagrams: Full time dilution is turned on\n"); for (int timeidx=0; timeidx< HGC_totalL[DIM_T]; ++timeidx){ PLEGMA_printf("Inversion for timeslice %d\n", timeidx); - PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; + PLEGMA_Vector vectorInOut_ppa;//, vectorInOut_pma; PLEGMA_Vector3D vectorIn; vectorIn.absorb(vectorSource_stochastic,timeidx); site source_in=site({0,0,0,timeidx}); - double norm; - norm=vectorIn.norm(); - PLEGMA_printf("Norm2 %e\n", norm); + //double norm; + //norm=vectorIn.norm(); + //PLEGMA_printf("Norm2 %e\n", norm); - solve1(vectorInOut_ppa, vectorInOut_pma, vectorIn, source_in); - norm=vectorInOut_ppa.norm(); - PLEGMA_printf("PPA Norm2 %e\n", norm); - norm=vectorInOut_pma.norm(); - PLEGMA_printf("PMA Norm2 %e\n", norm); + solve1(vectorInOut_ppa, vectorIn, source_in); + //norm=vectorInOut_ppa.norm(); + //PLEGMA_printf("PPA Norm2 %e\n", norm); + //norm=vectorInOut_pma.norm(); + //PLEGMA_printf("PMA Norm2 %e\n", norm); - PLEGMA_printf("Inversion done for timeslice %d\n", timeidx); + //PLEGMA_printf("Inversion done for timeslice %d\n", timeidx); vectorPropagator_stochastic_ppa.absorbTimeslice(vectorInOut_ppa, timeidx, false); - vectorPropagator_stochastic_pma.absorbTimeslice(vectorInOut_pma, timeidx, false); + //vectorPropagator_stochastic_pma.absorbTimeslice(vectorInOut_pma, timeidx, false); } } - vectorPropagator_stochastic.pack_propagator(vectorPropagator_stochastic_ppa, - vectorPropagator_stochastic_pma, - source[DIM_T], - HGC_totalL[DIM_T]/2); + //vectorPropagator_stochastic.pack_propagator(vectorPropagator_stochastic_ppa, + // vectorPropagator_stochastic_pma, + // source[DIM_T], + // HGC_totalL[DIM_T]/2); + vectorPropagator_stochastic.copy(vectorPropagator_stochastic_ppa); vectorAuxF.copy(vectorPropagator_stochastic); vectorAuxF.unload(); vectorAuxF.writeLIME("globalTfulltimedilution_propagator_nstoch"+std::to_string(i)+"_"+confnumber); @@ -459,7 +460,7 @@ int main(int argc, char **argv) { //pi plus at the source for(int isc = 0 ; isc < 12 ; isc++){ PLEGMA_Vector vectorAuxD; - PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; + PLEGMA_Vector vectorInOut_ppa;//, vectorInOut_pma; PLEGMA_Vector vectorAuxF; //Performing the smearing PLEGMA_Vector3D vector1; @@ -468,13 +469,13 @@ int main(int argc, char **argv) { vector1.absorb( vectorAuxD, source[3]); vector1.mulMomentumPhases(momentum_i2,1); vector1.apply_gamma_scatt(glist_source_meson[0]); - solve1(vectorInOut_ppa, vectorInOut_pma, vector1, source); - vectorAuxD.pack_propagator(vectorInOut_ppa, - vectorInOut_pma, - source[DIM_T], - HGC_totalL[DIM_T]/2); + solve1(vectorInOut_ppa, vector1, source); + //vectorAuxD.pack_propagator(vectorInOut_ppa, + // vectorInOut_pma, + // source[DIM_T], + // HGC_totalL[DIM_T]/2); - vectorAuxF.copy(vectorAuxD); + vectorAuxF.copy(vectorInOut_ppa); propTS.absorb(vectorAuxF, isc/3, isc%3); } @@ -514,7 +515,7 @@ int main(int argc, char **argv) { false, 0, true,//checked - false, + false,//checked false, false, true)); @@ -526,7 +527,7 @@ int main(int argc, char **argv) { false, 0, true,//checked - false, + false,//checked false, false, true)); @@ -537,8 +538,8 @@ int main(int argc, char **argv) { 0, false, 0, - true, - false, + true,//checked + false,//checked false, false, true)); @@ -549,20 +550,20 @@ int main(int argc, char **argv) { 1, false, 0, - true, - false, + true,//checked + false,//checked false, false, true)); TIME(corrB5_2pt.Recombination(reductions_V3_B, *reductions_V2_B[i], - true, + false, 2, true, 0, - true, - false, + true,//checked + false,//checked false, false, true)); @@ -573,8 +574,8 @@ int main(int argc, char **argv) { 1, false, 0, - true, - false, + true,//-1 sign from here + false,//-1 sign from here false, false, true)); @@ -585,8 +586,8 @@ int main(int argc, char **argv) { 2, false, 0, - true, - false, + true,//-1 sign from here + false,//-1 sign from here false, false, true)); @@ -597,8 +598,8 @@ int main(int argc, char **argv) { 0, false, 0, - false, - false, + false,//-1 sign from here + false,//checked false, false, true)); @@ -609,8 +610,8 @@ int main(int argc, char **argv) { 2, true, 0, - false, - false, + false,//-1 sign from here + false,//checked false, false, true)); @@ -621,8 +622,8 @@ int main(int argc, char **argv) { 0, false, 0, - false, - false, + false,//-1 sign from here + false,//-1 sign from here false, false, true)); @@ -633,8 +634,8 @@ int main(int argc, char **argv) { 1, false, 0, - false, - false, + false,//checked + false,//checked false, false, true)); @@ -645,8 +646,8 @@ int main(int argc, char **argv) { 2, true, 0, - true, - false, + true,//-1 sign from here + false,//checked false, false, true)); @@ -657,8 +658,8 @@ int main(int argc, char **argv) { 1, false, 0, - false, - false, + false,//checked + false,//checked false, false, true)); @@ -669,8 +670,8 @@ int main(int argc, char **argv) { 0, false, 0, - false, - false, + false,//checked + false,//checked false, false, true)); @@ -680,12 +681,16 @@ int main(int argc, char **argv) { } + outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_B"; + TIME(produceOutput(corrB1_2pt, outfilename, "4pt", n_stochastic_samples)); TIME(produceOutput(corrB2_2pt, outfilename, "4pt", n_stochastic_samples)); TIME(produceOutput(corrB3_2pt, outfilename, "4pt", n_stochastic_samples)); TIME(produceOutput(corrB4_2pt, outfilename, "4pt", n_stochastic_samples)); TIME(produceOutput(corrB5_2pt, outfilename, "4pt", n_stochastic_samples)); + outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_W"; + TIME(produceOutput(corrW1_2pt, outfilename, "4pt", n_stochastic_samples)); TIME(produceOutput(corrW2_2pt, outfilename, "4pt", n_stochastic_samples)); TIME(produceOutput(corrW3_2pt, outfilename, "4pt", n_stochastic_samples)); @@ -724,16 +729,16 @@ int main(int argc, char **argv) { vectorIn1.absorb(vectorSource_stochastic,source_local[DIM_T]); PLEGMA_Vector vectorAuxD; - PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; + PLEGMA_Vector vectorInOut_ppa;//, vectorInOut_pma; - solve1(vectorInOut_ppa, vectorInOut_pma, vectorIn1, source_local); - vectorAuxD.pack_propagator(vectorInOut_ppa, - vectorInOut_pma, - source_local[DIM_T], - HGC_totalL[DIM_T]/2); + solve1(vectorInOut_ppa, vectorIn1, source_local); + //vectorAuxD.pack_propagator(vectorInOut_ppa, + // vectorInOut_pma, + // source_local[DIM_T], + // HGC_totalL[DIM_T]/2); - stochastic_oet_prop_zero_mom_packed.copy(vectorAuxD); + stochastic_oet_prop_zero_mom_packed.copy(vectorInOut_ppa); }//end of do_stochastic_oet @@ -799,17 +804,17 @@ int main(int argc, char **argv) { PLEGMA_Vector vectorAuxD; - PLEGMA_Vector vectorInOut_ppa, vectorInOut_pma; + PLEGMA_Vector vectorInOut_ppa;//, vectorInOut_pma; PLEGMA_Vector vectorAuxF; - solve1(vectorInOut_ppa, vectorInOut_pma, vectorIn1, source_local); - vectorAuxD.pack_propagator(vectorInOut_ppa, - vectorInOut_pma, - source_local[DIM_T], - HGC_totalL[DIM_T]/2); + solve1(vectorInOut_ppa, vectorIn1, source_local); + //vectorAuxD.pack_propagator(vectorInOut_ppa, + // vectorInOut_pma, + // source_local[DIM_T], + // HGC_totalL[DIM_T]/2); - stochastic_oet_prop_fini_mom_packed.copy(vectorAuxD); + stochastic_oet_prop_fini_mom_packed.copy(vectorInOut_ppa); } @@ -822,15 +827,22 @@ int main(int argc, char **argv) { TIME(reductionsV3_Z.V3( st_oet_fini, glist_sink_meson, prop_packed, true)); - TIME(corrZ1_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, false, 0, false, 0, true, false, false, false, true )); + TIME(corrZ1_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, false, 0, false, 0, true, false, false, false, true ));//-1 factor from gamma_i1 + //-1 factor from gamma f1 - TIME(corrZ2_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, false, 2, true, 0, true, false, false, true, false )); + TIME(corrZ2_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, false, 2, true, 0, true, false, false, true, false ));//-1 factor from gamma_i1 + //-1 factor from gamma_f1 - TIME(corrZ3_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, true, 1, false, 0, true, false, false, false, true )); + TIME(corrZ3_2pt.Recombination( reductionsV3_Z, reductionsV2_Z, true, 1, false, 0, true, false, false, false, true ));//-1 factor from gamma_i1 + //checked from gamma_f1 - TIME(corrZ4_2pt.Recombination( reductionsV3_Z, reductionsV4_Z, false, 2, false, 0, true, false, false, false, true )); + TIME(corrZ4_2pt.Recombination( reductionsV3_Z, reductionsV4_Z, false, 2, false, 0, true, false, false, false, true ));//checked for gamma_i1 + //checked for gamma_f1 - TIME(corrZ5_2pt.Recombination( reductionsV3_Z, reductionsV4_Z, true, 0, false, 0, true, false, false, false, true )); + TIME(corrZ5_2pt.Recombination( reductionsV3_Z, reductionsV4_Z, true, 0, false, 0, true, false, false, false, true ));//-1 factor from gamma_i1 + //checked for gamma_f1 + + outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_Z"; TIME(produceOutput(corrZ1_2pt, outfilename, "4pt")); TIME(produceOutput(corrZ2_2pt, outfilename, "4pt")); diff --git a/plegma/qLoops.cpp b/plegma/qLoops.cpp index ef17a15a..0eb55144 100644 --- a/plegma/qLoops.cpp +++ b/plegma/qLoops.cpp @@ -150,6 +150,7 @@ int main(int argc, char **argv) // Reading from Lime file and loading to device PLEGMA_Gauge gauge; + PLEGMA_Gauge gauge_flowed; gauge.readFile(latfile, LIME_FORMAT); gauge.calculatePlaq(); @@ -204,7 +205,7 @@ int main(int argc, char **argv) // // ensuring mu negative if(mu>0) mu*=-1.; - QUDA_solver *solverDN = new QUDA_solver(mu); + QUDA_solver *solverDN = new QUDA_solver(mu,1); QudaInvertParam inv_params = solverDN->getInvParams(); QUDA_dirac *D = nullptr; @@ -230,8 +231,59 @@ int main(int argc, char **argv) if(!debugMode) source.randInit(rng_seed); PLEGMA_Vector *sourceDil = nullptr; if(k_probing>0 || spinColorDil) sourceDil = new PLEGMA_Vector(DEVICE); + + + //Flowing the gauge fields + wilsonFlow_QUDA(gauge_flowed, + gauge, + 3, + 0.0001, + 0, + true, + false); + + +/* + + QudaGaugeObservableParam *obs_param = new QudaGaugeObservableParam[3]; + + for (int i = 0; i < 3; i++) { + obs_param[i] = newQudaGaugeObservableParam(); + obs_param[i].compute_polyakov_loop = QUDA_BOOLEAN_TRUE; + obs_param[i].compute_plaquette = QUDA_BOOLEAN_TRUE; + obs_param[i].compute_qcharge = QUDA_BOOLEAN_FALSE; + obs_param[i].su_project = QUDA_BOOLEAN_FALSE; + } + + // We here set all the problem parameters for all possible smearing types. + QudaGaugeSmearParam smear_param = newQudaGaugeSmearParam(); + smear_param.smear_type = QUDA_GAUGE_SMEAR_WILSON_FLOW; + smear_param.n_steps = 3; + smear_param.meas_interval = 1; + smear_param.epsilon = 0.001; + + performWFlowQuda(&smear_param, obs_param); + + double* new_gauge[N_DIMS]; + for(int i=0; igetEigVecs() + iorder*eigSol->getSize_per_Vec()*2; qudaMemcpy(phi.D_elem(), eigVec, eigSol->getBytes_per_Vec(), qudaMemcpyHostToDevice); checkQudaError(); - if(oneDLoops || twoDLoops) qloops_std.oneEnd_trick(phi,phi,tmp,qLtmp,gauge,-1./eigVal,true); //standard one-end trick + if(oneDLoops || twoDLoops) qloops_std.oneEnd_trick(phi,phi,tmp,qLtmp,gauge_flowed,-1./eigVal,true); //standard one-end trick else qloops_std.oneEnd_trick(phi,phi,-1./eigVal,true); //standard one-end trick D->apply(phi_r,phi); phi_r.apply_gamma5(); - if(oneDLoops || twoDLoops) qloops_gen.oneEnd_trick(phi, phi_r, tmp,qLtmp, gauge, +1./eigVal, true); //generalized one-end trick + if(oneDLoops || twoDLoops) qloops_gen.oneEnd_trick(phi, phi_r, tmp,qLtmp, gauge_flowed, +1./eigVal, true); //generalized one-end trick else qloops_gen.oneEnd_trick(phi, phi_r, +1./eigVal, true); //generalized one-end trick } #endif @@ -294,12 +346,13 @@ int main(int argc, char **argv) if(lowModesRecon) eigSol->projectVector(phi); // In place application of deflation projector operator on solution vector #endif - if(oneDLoops || twoDLoops) qloops_std.oneEnd_trick(phi,phi,tmp,qLtmp,gauge,-1.,true); //standard one-end trick + if(oneDLoops || twoDLoops) qloops_std.oneEnd_trick(phi,phi,tmp,qLtmp,gauge_flowed,-1.,true); //standard one-end trick else qloops_std.oneEnd_trick(phi,phi,-1.,true); //standard one-end trick - + PLEGMA_printf("Here we are\n"); D->apply(phi_r,phi); + PLEGMA_printf("Here we were\n"); phi_r.apply_gamma5(); - if(oneDLoops || twoDLoops) qloops_gen.oneEnd_trick(phi, phi_r, tmp,qLtmp, gauge, +1., true); //generalized one-end trick + if(oneDLoops || twoDLoops) qloops_gen.oneEnd_trick(phi, phi_r, tmp,qLtmp, gauge_flowed, +1., true); //generalized one-end trick else qloops_gen.oneEnd_trick(phi, phi_r, +1., true); //generalized one-end trick double t2=MPI_Wtime(); PLEGMA_printf("Contraction time is %f\n",t2-t1); diff --git a/python/check_baryons.py b/python/check_baryons.py index f022c162..73093d3d 100644 --- a/python/check_baryons.py +++ b/python/check_baryons.py @@ -29,9 +29,15 @@ C = I*gy.dot(gt) + g5 = gx.dot(gy.dot(gz.dot(gt))) +Cgx = C.dot(gx) +Cgy = C.dot(gy) Cg5 = C.dot(g5) +print(Cg5) +print(Cgx) +stop("") igtCg5= I*gt.dot(Cg5) diff --git a/utils/QUDA_interface.cpp b/utils/QUDA_interface.cpp index 23a1e264..4f40de9a 100644 --- a/utils/QUDA_interface.cpp +++ b/utils/QUDA_interface.cpp @@ -115,7 +115,7 @@ void gSmear_QUDA(PLEGMA_Gauge &gaugeOut,PLEGMA_Gauge &gaugeIn, b // We here set all the problem parameters for all possible smearing types. QudaGaugeSmearParam smear_param = newQudaGaugeSmearParam(); smear_param.smear_type = QUDA_GAUGE_SMEAR_HYP; - smear_param.n_steps = 2; + smear_param.n_steps = 1; smear_param.meas_interval = 1; smear_param.alpha1 = 0.75; // typical HYP values smear_param.alpha2 = 0.60; From fdf7ba830abfd0e98c79e9d418f192fcb155c4d9 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 10 Apr 2026 09:30:11 +0200 Subject: [PATCH 162/168] uploading delta J N threepoint function --- lib/kernels/PLEGMA_seqSourceNucleonDelta.cu | 278 ++++++++++++++++++ .../PLEGMA_seqSourceNucleonDeltaSource.cu | 277 +++++++++++++++++ 2 files changed, 555 insertions(+) create mode 100644 lib/kernels/PLEGMA_seqSourceNucleonDelta.cu create mode 100644 lib/kernels/PLEGMA_seqSourceNucleonDeltaSource.cu diff --git a/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu new file mode 100644 index 00000000..81ff734b --- /dev/null +++ b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu @@ -0,0 +1,278 @@ +#include +#include +#include +#include + +//NtoN_indices should be the results of a multiplication of Cg5 at the source and Cg5 at the sink +//Pr result of the muliplication with the projector + +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK +static const __device__ short int NtoDelta_indices[4][16][4]={0,0,0,1,//Cgx*Cg5 + 0,0,1,0, + 0,0,2,3, + 0,0,3,2, + 1,1,0,1, + 1,1,1,0, + 1,1,2,3, + 1,1,3,2, + 2,2,0,1, + 2,2,1,0, + 2,2,2,3, + 2,2,3,2, + 3,3,0,1, + 3,3,1,0, + 3,3,2,3, + 3,3,3,2, + 0,0,0,1,//Cgy*Cg5 + 0,0,1,0, + 0,0,2,3, + 0,0,3,2, + 1,1,0,1, + 1,1,1,0, + 1,1,2,3, + 1,1,3,2, + 2,2,0,1, + 2,2,1,0, + 2,2,2,3, + 2,2,3,2, + 3,3,0,1, + 3,3,1,0, + 3,3,2,3, + 3,3,3,2, + 0,1,0,1,//Cgz*Cg5 + 0,1,1,0, + 0,1,2,3, + 0,1,3,2, + 1,0,0,1, + 1,0,1,0, + 1,0,2,3, + 1,0,3,2, + 2,3,0,1, + 2,3,1,0, + 2,3,2,3, + 2,3,3,2, + 3,2,0,1, + 3,2,1,0, + 3,2,2,3, + 3,2,3,2, + 0,3,0,1,//Cgz*Cg5 + 0,3,1,0, + 0,3,2,3, + 0,3,3,2, + 1,2,0,1, + 1,2,1,0, + 1,2,2,3, + 1,2,3,2, + 2,1,0,1, + 2,1,1,0, + 2,1,2,3, + 2,1,3,2, + 3,0,0,1, + 3,0,1,0, + 3,0,2,3, + 3,0,3,2}; + + + + + +static const __device__ float NtoDelta_values[4][16][2] = {{{0,1},{0,-1},{0,1},{0,-1},//Cgx*Cg5 + {0,-1},{0,1},{0,-1},{0,1}, + {0,-1},{0,1},{0,-1},{0,1}, + {0,1},{0,-1},{0,1},{0,-1}}, + {{-1,0},{1,0},{-1,0},{1,0},//Cgy*Cg5 + {-1,0},{1,0},{-1,0},{1,0}, + {1,0},{-1,0},{1,0},{-1,0}, + {1,0},{-1,0},{1,0},{-1,0}}, + {{0,-1},{0,1},{0,-1},{0,1},//Cgz*Cg5 + {0,-1},{0,1},{0,-1},{0,1}, + {0,1},{0,-1},{0,1},{0,-1}, + {0,1},{0,-1},{0,1},{0,-1}}, + {{0,-1},{0,1},{0,-1},{0,1},//Cgt*Cg5 + {0,-1},{0,1},{0,-1},{0,1}, + {0,1},{0,-1},{0,1},{0,-1}, + {0,1},{0,-1},{0,1},{0,-1}}}; + +#endif + +using namespace plegma; +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle){ +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + size_t sid = blockIdx.x*blockDim.x + threadIdx.x; + if(sid >= vec.volume()) return; + const Float2 (*pr)[8]; + const short int (*prInd)[8][2]; + if(particle == PROTON){ + pr = (Float2 (*)[8]) projTmP; + prInd = projIndTmP; + } + else if(particle == NEUTRON){ + pr = (Float2 (*)[8]) projTmM; + prInd = projIndTmM; + } + else{ + printf("Error: You can use only PROTON or NEUTRON\n"); + asm("trap;"); + } + +#ifdef PLEGMA_SCATTERING_CONTRACTIONS + const Float2 (*prscatt); + const short int (*prIndscatt)[2]; + prscatt = (Float2 (*))projScatt; + prIndscatt = projIndScatt; +#endif + + Float2 P[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 P2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 spinor[N_SPINS][N_COLS]; + for(short mu = 0; mu < N_SPINS; mu++) + for(short cc = 0; cc < N_COLS; cc++) + spinor[mu][cc] = 0.; + + prop1.get(P,sid); + if(isTwoPropDiff) prop2.get(P2, sid); + + #pragma unroll + for(short cc1 = 0 ; cc1 < 6 ; cc1++){ + short c1 = eps[cc1][0]; + short c2 = eps[cc1][1]; + short c3 = eps[cc1][2]; + #pragma unroll + for(short cc2 = 0 ; cc2 < 6 ; cc2++){ + short c1p = eps[cc2][0]; + short c2p = eps[cc2][1]; + short c3p = eps[cc2][2]; + if(c3p == c_c2) + #pragma unroll + for(short idx = 0 ; idx < 16 ; idx++){ + short mu = NtoDelta_indices[c_gamma][idx][0]; + short nu = NtoDelta_indices[c_gamma][idx][1]; + short ku = NtoDelta_indices[c_gamma][idx][2]; + short lu = NtoDelta_indices[c_gamma][idx][3]; + if (proj<8){ + #pragma unroll + for(short nz = 0; nz < 8; nz++){ + int b = prInd[proj][nz][0]; + int a = prInd[proj][nz][1]; + Float2 factor(-1*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0],-1*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][1]); + factor=factor*pr[proj][nz]; + if(!isTwoPropDiff){ + if(lu == c_nu){ + for(short gu = 0 ; gu < 4 ; gu++){ + if ( mu == gu ) spinor[gu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; + if ( mu == gu ) spinor[gu][c3] += factor * P[mu][ku][c1][c1p] * P[a][b][c2][c2p]; + if ( a == gu ) spinor[gu][c3] += factor * P[mu][ku][c1][c1p] * P[nu][b][c2][c2p]; + } + } + } + else{ +#pragma unroll + for(short gu = 0 ; gu < 4 ; gu++){ + if( mu == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][ku][c2][c2p]; + if( mu == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][b][c2][c2p]; + if( a == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][ku][c2][c2p]; + if( a == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][b][c2][c2p]; + + if( mu == gu && lu == c_nu ) spinor[gu][c3] += factor * P2[a][ku][c1][c1p] * P[nu][b][c2][c2p]; + if( mu == gu && b == c_nu ) spinor[gu][c3] += factor * P2[a][ku][c1][c1p] * P[nu][lu][c2][c2p]; + } + } + } + } + else{ +#ifdef PLEGMA_SCATTERING_CONTRACTIONS + int b = prIndscatt[proj][0]; + int a = prIndscatt[proj][1]; + Float2 factor ((-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0],(-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0]); + factor=factor*prscatt[proj]; + if(!isTwoPropDiff){ + if(lu == c_nu){ + spinor[nu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; + spinor[nu][c3] += factor * P[mu][ku][c1][c1p] * P[a][b][c2][c2p]; + spinor[nu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; + + } + } + else +#pragma unroll + for(short gu = 0 ; gu < 4 ; gu++){ + if( mu == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][ku][c2][c2p]; + if( mu == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][b][c2][c2p]; + if( a == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][ku][c2][c2p]; + if( a == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][b][c2][c2p]; + } +#endif + } + + }}} + vec.set(spinor, sid); +#endif +} + +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_gamma){ + switch(c_gamma){ + case(0):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + case(1):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + case(2):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + case(3):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + } +} +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_c2, int c_gamma){ + switch(c_c2){ + case(0):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_gamma);break; + case(1):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_gamma);break; + case(2):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_gamma);break; + } +} + +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma){ + switch(c_nu){ + case(0):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + case(1):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + case(2):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + case(3):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + } +} + +template +__global__ void contractNucleonDeltaSeqSource_kernel(vector2 vec, propTex prop1, propTex prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, bool isTwoPropDiff, int c_nu, int c_c2, int c_gamma){ + if(isTwoPropDiff) contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_nu,c_c2, c_gamma); + else contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_nu,c_c2, c_gamma); +} + +template +static void contractNucleonDeltaSeqSource(vector2 &vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, bool isTwoPropDiff, int c_nu, int c_c2, int c_gamma){ + ProfileStruct ps(vec.volume()); + tuneAndRun(ps,"contractNucleonDeltaSeqSource", contractNucleonDeltaSeqSource_kernel, vec, prop1, prop2, proj, particle, isTwoPropDiff, c_nu, c_c2, c_gamma); + checkQudaError(); +} + +template +void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma){ +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + propTex& prop2 = prop1; + contractNucleonDeltaSeqSource(vec, prop1,prop2, proj,particle, false, c_nu, c_c2, c_gamma); +#else + PLEGMA_error("You must enable PLEGMA_NUCLEON_3PF_FIX_SINK"); +#endif +} + +template +void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, propTex& prop2,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma){ +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + contractNucleonDeltaSeqSource(vec, prop1, prop2, proj,particle, true, c_nu, c_c2, c_gamma); +#else + PLEGMA_error("You must enable PLEGMA_NUCLEON_3PF_FIX_SINK"); +#endif +} + +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); + + +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, propTex& prop2,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, propTex& prop2,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); diff --git a/lib/kernels/PLEGMA_seqSourceNucleonDeltaSource.cu b/lib/kernels/PLEGMA_seqSourceNucleonDeltaSource.cu new file mode 100644 index 00000000..cc710ab0 --- /dev/null +++ b/lib/kernels/PLEGMA_seqSourceNucleonDeltaSource.cu @@ -0,0 +1,277 @@ +#include +#include +#include +#include + +//NtoN_indices should be the results of a multiplication of Cg5 at the source and Cg5 at the sink +//Pr result of the muliplication with the projector + +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK +static const __device__ short int NtoDelta_indices[4][16][4]={0,0,0,1,//Cgx*Cg5 + 0,0,1,0, + 0,0,2,3, + 0,0,3,2, + 1,1,0,1, + 1,1,1,0, + 1,1,2,3, + 1,1,3,2, + 2,2,0,1, + 2,2,1,0, + 2,2,2,3, + 2,2,3,2, + 3,3,0,1, + 3,3,1,0, + 3,3,2,3, + 3,3,3,2, + 0,0,0,1,//Cgy*Cg5 + 0,0,1,0, + 0,0,2,3, + 0,0,3,2, + 1,1,0,1, + 1,1,1,0, + 1,1,2,3, + 1,1,3,2, + 2,2,0,1, + 2,2,1,0, + 2,2,2,3, + 2,2,3,2, + 3,3,0,1, + 3,3,1,0, + 3,3,2,3, + 3,3,3,2, + 0,1,0,1,//Cgz*Cg5 + 0,1,1,0, + 0,1,2,3, + 0,1,3,2, + 1,0,0,1, + 1,0,1,0, + 1,0,2,3, + 1,0,3,2, + 2,3,0,1, + 2,3,1,0, + 2,3,2,3, + 2,3,3,2, + 3,2,0,1, + 3,2,1,0, + 3,2,2,3, + 3,2,3,2, + 0,3,0,1,//Cgz*Cg5 + 0,3,1,0, + 0,3,2,3, + 0,3,3,2, + 1,2,0,1, + 1,2,1,0, + 1,2,2,3, + 1,2,3,2, + 2,1,0,1, + 2,1,1,0, + 2,1,2,3, + 2,1,3,2, + 3,0,0,1, + 3,0,1,0, + 3,0,2,3, + 3,0,3,2}; + + + + + +static const __device__ float NtoDelta_values[4][16][2] = {{{0,1},{0,-1},{0,1},{0,-1},//Cgx*Cg5 + {0,-1},{0,1},{0,-1},{0,1}, + {0,-1},{0,1},{0,-1},{0,1}, + {0,1},{0,-1},{0,1},{0,-1}}, + {{-1,0},{1,0},{-1,0},{1,0},//Cgy*Cg5 + {-1,0},{1,0},{-1,0},{1,0}, + {1,0},{-1,0},{1,0},{-1,0}, + {1,0},{-1,0},{1,0},{-1,0}}, + {{0,-1},{0,1},{0,-1},{0,1},//Cgz*Cg5 + {0,-1},{0,1},{0,-1},{0,1}, + {0,1},{0,-1},{0,1},{0,-1}, + {0,1},{0,-1},{0,1},{0,-1}}, + {{0,-1},{0,1},{0,-1},{0,1},//Cgt*Cg5 + {0,-1},{0,1},{0,-1},{0,1}, + {0,1},{0,-1},{0,1},{0,-1}, + {0,1},{0,-1},{0,1},{0,-1}}}; + +#endif + +using namespace plegma; +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle){ +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + size_t sid = blockIdx.x*blockDim.x + threadIdx.x; + if(sid >= vec.volume()) return; + const Float2 (*pr)[8]; + const short int (*prInd)[8][2]; + if(particle == PROTON){ + pr = (Float2 (*)[8]) projTmP; + prInd = projIndTmP; + } + else if(particle == NEUTRON){ + pr = (Float2 (*)[8]) projTmM; + prInd = projIndTmM; + } + else{ + printf("Error: You can use only PROTON or NEUTRON\n"); + asm("trap;"); + } + +#ifdef PLEGMA_SCATTERING_CONTRACTIONS + const Float2 (*prscatt); + const short int (*prIndscatt)[2]; + prscatt = (Float2 (*))projScatt; + prIndscatt = projIndScatt; +#endif + + Float2 P[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 P2[N_SPINS][N_SPINS][N_COLS][N_COLS]; + Float2 spinor[N_SPINS][N_COLS]; + for(short mu = 0; mu < N_SPINS; mu++) + for(short cc = 0; cc < N_COLS; cc++) + spinor[mu][cc] = 0.; + + prop1.get(P,sid); + if(isTwoPropDiff) prop2.get(P2, sid); + + #pragma unroll + for(short cc1 = 0 ; cc1 < 6 ; cc1++){ + short c1 = eps[cc1][0]; + short c2 = eps[cc1][1]; + short c3 = eps[cc1][2]; + #pragma unroll + for(short cc2 = 0 ; cc2 < 6 ; cc2++){ + short c1p = eps[cc2][0]; + short c2p = eps[cc2][1]; + short c3p = eps[cc2][2]; + if(c3p == c_c2) + #pragma unroll + for(short idx = 0 ; idx < 16 ; idx++){ + short mu = NtoDelta_indices[c_gamma][idx][0]; + short nu = NtoDelta_indices[c_gamma][idx][1]; + short ku = NtoDelta_indices[c_gamma][idx][2]; + short lu = NtoDelta_indices[c_gamma][idx][3]; + if (proj<8){ + #pragma unroll + for(short nz = 0; nz < 8; nz++){ + int b = prInd[proj][nz][0]; + int a = prInd[proj][nz][1]; + Float2 factor(-1*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0],-1*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][1]); + factor=factor*pr[proj][nz]; + if(!isTwoPropDiff){ + for(short gu = 0 ; gu < 4 ; gu++){ + if ( mu == gu && lu == c_nu ) spinor[gu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; + if ( mu == gu && lu == c_nu ) spinor[gu][c3] += factor * P[mu][ku][c1][c1p] * P[a][b][c2][c2p]; + if ( nu == gu && b == c_nu ) spinor[gu][c3] += factor * P[a][ku][c1][c1p] * P[mu][lu][c2][c2p]; + } + } + else{ +#pragma unroll + for(short gu = 0 ; gu < 4 ; gu++){ + if( mu == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][ku][c2][c2p]; + if( mu == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][b][c2][c2p]; + if( a == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][ku][c2][c2p]; + if( a == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][b][c2][c2p]; + + + if( a == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][b][c1][c1p] * P[mu][lu][c2][c2p]; + if( mu == gu && lu == c_nu ) spinor[gu][c3] += factor * P2[nu][b][c1][c1p] * P[a][ku][c2][c2p]; + } + } + } + } + else{ +#ifdef PLEGMA_SCATTERING_CONTRACTIONS + int b = prIndscatt[proj][0]; + int a = prIndscatt[proj][1]; + Float2 factor ((-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0],(-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0]); + factor=factor*prscatt[proj]; + if(!isTwoPropDiff){ + if(lu == c_nu){ + spinor[nu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; + spinor[nu][c3] += factor * P[mu][ku][c1][c1p] * P[a][b][c2][c2p]; + spinor[nu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; + + } + } + else +#pragma unroll + for(short gu = 0 ; gu < 4 ; gu++){ + if( mu == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][ku][c2][c2p]; + if( mu == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][b][c2][c2p]; + if( a == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][ku][c2][c2p]; + if( a == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][b][c2][c2p]; + } +#endif + } + + }}} + vec.set(spinor, sid); +#endif +} + +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_gamma){ + switch(c_gamma){ + case(0):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + case(1):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + case(2):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + case(3):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle);break; + } +} +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_c2, int c_gamma){ + switch(c_c2){ + case(0):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_gamma);break; + case(1):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_gamma);break; + case(2):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_gamma);break; + } +} + +template +__device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma){ + switch(c_nu){ + case(0):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + case(1):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + case(2):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + case(3):contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_c2, c_gamma);break; + } +} + +template +__global__ void contractNucleonDeltaSeqSource_kernel(vector2 vec, propTex prop1, propTex prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, bool isTwoPropDiff, int c_nu, int c_c2, int c_gamma){ + if(isTwoPropDiff) contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_nu,c_c2, c_gamma); + else contractNucleonDeltaSeqSource(vec,prop1,prop2,proj,particle,c_nu,c_c2, c_gamma); +} + +template +static void contractNucleonDeltaSeqSource(vector2 &vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, bool isTwoPropDiff, int c_nu, int c_c2, int c_gamma){ + ProfileStruct ps(vec.volume()); + tuneAndRun(ps,"contractNucleonDeltaSeqSource", contractNucleonDeltaSeqSource_kernel, vec, prop1, prop2, proj, particle, isTwoPropDiff, c_nu, c_c2, c_gamma); + checkQudaError(); +} + +template +void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma){ +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + propTex& prop2 = prop1; + contractNucleonDeltaSeqSource(vec, prop1,prop2, proj,particle, false, c_nu, c_c2, c_gamma); +#else + PLEGMA_error("You must enable PLEGMA_NUCLEON_3PF_FIX_SINK"); +#endif +} + +template +void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, propTex& prop2,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma){ +#ifdef PLEGMA_NUCLEON_3PF_FIX_SINK + contractNucleonDeltaSeqSource(vec, prop1, prop2, proj,particle, true, c_nu, c_c2, c_gamma); +#else + PLEGMA_error("You must enable PLEGMA_NUCLEON_3PF_FIX_SINK"); +#endif +} + +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); + + +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, propTex& prop2,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); +template void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, propTex& prop2,WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_gamma); From 31632cb8c515c09d9f7518bce4e4d3833c052654 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 11 Jun 2026 09:06:13 +0200 Subject: [PATCH 163/168] Finalizing NJDeltamatrix element code --- lib/PLEGMA_ScattCorrelator.cu | 15 +- lib/kernels/PLEGMA_seqSourceNucleonDelta.cu | 16 +- plegma/nucleon_2pt_3pt_delta.cpp | 610 ++++++++++++++++++++ 3 files changed, 626 insertions(+), 15 deletions(-) create mode 100644 plegma/nucleon_2pt_3pt_delta.cpp diff --git a/lib/PLEGMA_ScattCorrelator.cu b/lib/PLEGMA_ScattCorrelator.cu index 8f3c36b4..e5a0e37a 100644 --- a/lib/PLEGMA_ScattCorrelator.cu +++ b/lib/PLEGMA_ScattCorrelator.cu @@ -3756,7 +3756,7 @@ void PLEGMA_ScattCorrelator::absorbEigIndex( PLEGMA_ScattCorrelator -void PLEGMA_ScattCorrelator::absorbSourceSinkSpinMom(PLEGMA_ScattCorrelator &srcCorr, int alpha, int beta, int pf1, bool forcetozero){ +void PLEGMA_ScattCorrelator::absorbSourceSinkSpinMom(PLEGMA_ScattCorrelator &srcCorr, int alpha, int beta, int gf1index, int pf1, bool forcetozero){ std::vector> moms_pinsertion_red = this->pList().uniq_p(3); //list of pf1 momenta needed here std::vector> moms_pinsertion = srcCorr.pList().uniq_p(0); //list of pf1 in Nucleons PLEGMA_SC @@ -3769,6 +3769,9 @@ void PLEGMA_ScattCorrelator::absorbSourceSinkSpinMom(PLEGMA_ScattCorrelat int n_gammas_c = this->GList[4].size(); int TIME = this->localT(); if (TIME==0) return; + if (gf1index>=n_gammas_f1){ + PLEGMA_error("Destination correlator has a different momentum list\n"); + } int Nmoms_c = srcCorr.Nmoms(); @@ -3785,12 +3788,10 @@ void PLEGMA_ScattCorrelator::absorbSourceSinkSpinMom(PLEGMA_ScattCorrelat for(int t=0; t < TIME; ++t){ for (int g1=0 ; g1 < n_gammas_i1 ; ++g1 ){//pi - for (int g2=0 ; g2 < n_gammas_f1 ; ++g2 ){//pf1 - for (int g3=0; g3 < n_gammas_c; ++g3 ){ - this->Corr(t,i_m,0,0,g1,g2,g3,alpha,beta)[0]=srcCorr.H_elem()[2*t*Nmoms_c*n_gammas_c+2*i_pc*n_gammas_c+2*g3+0]; - this->Corr(t,i_m,0,0,g1,g2,g3,alpha,beta)[1]=srcCorr.H_elem()[2*t*Nmoms_c*n_gammas_c+2*i_pc*n_gammas_c+2*g3+1];//srcCorr.H_elem(t, i_pc, g3)[1]; - } - } + for (int g3=0; g3 < n_gammas_c; ++g3 ){ + this->Corr(t,i_m,0,0,g1,gf1index,g3,alpha,beta)[0]=srcCorr.H_elem()[2*t*Nmoms_c*n_gammas_c+2*i_pc*n_gammas_c+2*g3+0]; + this->Corr(t,i_m,0,0,g1,gf1index,g3,alpha,beta)[1]=srcCorr.H_elem()[2*t*Nmoms_c*n_gammas_c+2*i_pc*n_gammas_c+2*g3+1];//srcCorr.H_elem(t, i_pc, g3)[1]; + } } } } diff --git a/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu index 81ff734b..e49f6e79 100644 --- a/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu +++ b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu @@ -88,10 +88,10 @@ static const __device__ float NtoDelta_values[4][16][2] = {{{0,1},{0,-1},{0, {0,-1},{0,1},{0,-1},{0,1}, {0,1},{0,-1},{0,1},{0,-1}, {0,1},{0,-1},{0,1},{0,-1}}, - {{0,-1},{0,1},{0,-1},{0,1},//Cgt*Cg5 - {0,-1},{0,1},{0,-1},{0,1}, - {0,1},{0,-1},{0,1},{0,-1}, - {0,1},{0,-1},{0,1},{0,-1}}}; + {{1,0},{-1,0},{1,0},{-1,0},//Cgt*Cg5 + {-1,0},{1,0},{-1,0},{1,0}, + {-1,0},{1,0},{-1,0},{1,0}, + {1,0},{-1,0},{1,0},{-1,0}}}; #endif @@ -160,8 +160,8 @@ __device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& vec, propTex +#include + +std::vector runtime; +#define TIME(fnc) runtime.push_back(MPI_Wtime()); fnc; \ + PLEGMA_printf("TIME for "#fnc" %f sec\n", MPI_Wtime()-runtime.back()); \ + runtime.pop_back() + +std::vector threads; +//#define THREAD(fnc) threads.push_back(std::thread([=]() { TIME(fnc); })) +#define THREAD(fnc) saveTuneCache(false); TIME(fnc) + +using namespace plegma; +using namespace quda; +static std::vector listOpt = { "verbosity", "load-gauge", "nsmear-APE", "alpha-APE", "nsmear-gauss", + "alpha-gauss","momlist-filename","momlisttwopt-filename", + "momlistthreept-filename","nsrc", "src-filename", "maxQsq", + "twop-filename", "corr-file-format", "corr-space", "tSinks", + "Projs", "threep-filename","confnumber"}; + + + +int main(int argc, char **argv) { + initializeOptions(argc, argv, true, listOpt); + //================ Add your options in this between initializeOptions and initializePLEGMA ================// + std::vector mu_s; + std::vector mu_c; + double mu_ud = mu; + double mu_ud_factor[QUDA_MAX_MG_LEVEL]; + for(int i=0;i glist_source_nucleon={CG_5}; + std::vector glist_sink_nucleon={CG_1,CG_2,CG_3}; + + std::vector glist_sink_meson={G_5}; + std::vector glist_source_meson={G_5}; + + std::vector glist_source_nucleon_unpaired={ID}; + std::vector glist_sink_nucleon_unpaired={ID}; + std::vector gammas_insertion = {ID,G_1,G_2,G_3,G_4,G_5,G_5_G_1,G_5_G_2,G_5_G_3,G_5_G_4,S_12,S_13,S_23,S_41,S_42,S_43}; + + std::vector gammas = {ONE,G1,G2,G3,G4,G5,G5G1,G5G2,G5G3,G5G4,S12,S13,S23,S41,S42,S43}; + + auto add_options = [&](Options& options) { + options.set("mu-s", "List of mu_s to run for the strange quark in baryons", verbosity, mu_s); + options.set("mu-c", "List of mu_c to run for the charm quark in baryons", verbosity, mu_c); + options.set("nsmear-gauss-s", "Number of Gaussian smearing step for the strange quark propagator", verbosity, nsmearGauss_s); + options.set("nsmear-gauss-c", "Number of Gaussian smearing step for the charm quark propagator", verbosity, nsmearGauss_c); + options.set("whichParticle", "Which particle we want to do the 3pf. Options (proton, neutron)", verbosity, prOrNt); + options.set("src-input-file", "Use the file to update option at every source. The file searched is [src-input-file]+str(n) where n is the source (0, 1, ...)", verbosity, srcInputFile); + options.set("start-src", "The index of the source position where to start the calculation", verbosity, startSource); + options.set("outdiagramPrefix", "Prefix of the resulting diagrams", verbosity, outdiagramPrefix); + options.set("confnumber", "Integer determining the index of the gauge configuration", verbosity, confnumber_int); + }; + add_options(*HGC_options); + if(prOrNt != "proton" && prOrNt != "neutron") PLEGMA_error("This exec is only for nucleon, %s is not allowed",prOrNt.c_str()); + //=========================================================================================================// + initializePLEGMA(); + + { + PLEGMA_Gauge smearedGauge(BOTH); + PLEGMA_Gauge contractGauge(BOTH); + { + // Reading from Lime file and loading to device + PLEGMA_Gauge gauge; + gauge.readFile(latfile, LIME_FORMAT); + gauge.calculatePlaq(); + + // Loading to QUDA and computing plaquette also there + initGaugeQuda(gauge, true); + plaqQuda(); + + // Smearing + TIME(smearedGauge.APEsmearing(gauge, nsmearAPE, alphaAPE, 3)); + PLEGMA_printf("Plaquette after smearing:\n"); + smearedGauge.calculatePlaq(); + + // Gauge for contractions + contractGauge.copy(gauge); + // apply boundary conditions since is needed for the covariant derivative + applyBoundaryConditions(contractGauge,true); + } + + updateOptions(LIGHT); + TIME(QUDA_solver solver(mu,1)); + + std::string given_twop_filename = twop_filename; + std::string given_threep_filename = threep_filename; + + //Get the confnumber for latfile + char *ssource; + asprintf(&ssource,"%04d", confnumber_int); + std::string confnumber= ssource; + free(ssource); + + //Reading the momentum lists + PLEGMA_printf("###Momentum list read from : %s", pathListMomenta_threept.c_str()); + momList sourcemomentumList_threept(4,pathListMomenta_threept,{1,2,3,}); + PLEGMA_printf("N momenta in sourcemomentumList: %d",sourcemomentumList_threept.size()); + //We have four types of momenta in the list here + //The first three entries are the pi2 pion source momentum + //The second three entries are the pf1 nucleon sink momentum + //The third three entries are the pf2 pion sink momentum (it is assumed that pf2 is the same as -pf1) + //The fourth three entries are the pc momentum at the insertion + //pf1 + pf2 = 0, momentum at the sink is zero , the the pion momentum + //at sink follows from the nucleon momentum + //In addition the following momentum conversations are imposed + //pi1 + pi2 = pc so the momentum phase factor is calculated as pc-pi2 + //We define the list of momenta such that the total momentum should be the [2] \ + //column, the pc, and of coarse it is understand that this refers to the source only. + //At the sink we have always zero momentum + + momList sourcemomentumList_twopt(3,pathListMomenta_twopt,{1,2,}); + //For the twopoint functions we have also three momentum + //first is pi2 + //second is pf1 + //third is pf2 + //and in this case the total momentum is defined as the sum of pf1 and pf2 + //to get pi1 we have to subtract pi2 from the total momentum + + + if(sourcemomentumList_twopt.empty()) + PLEGMA_error("twopt momentumList empty"); + if(sourcemomentumList_threept.empty()) + PLEGMA_error("threept momentumList empty"); + + + + + for(int isource = startSource; isource < numSourcePositions; isource++){ + + asprintf(&ssource,"sx%02dsy%02dsz%02dst%03d", sourcePositions[isource][0], sourcePositions[isource][1], sourcePositions[isource][2], sourcePositions[isource][3]); + std::string sourcepositiontext= (std::string)"_" + ssource; + free(ssource); + + std::vector> mpi2_twopt = sourcemomentumList_twopt.uniq_p(0); + momList list_mpi2_twopt(1,{mpi2_twopt,},{0,}); + + std::vector> mpf1_twopt = sourcemomentumList_twopt.uniq_p(1); + momList list_mpf1_twopt(1,{mpf1_twopt,},{0,}); + + std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); + momList list_mpi2_threept(1,{mpi2_threept,},{0,}); + + std::vector> mpf1_threept = sourcemomentumList_threept.uniq_p(1); + momList list_mpf1_threept(1,{mpf1_threept,},{0,}); + + site& source = sourcePositions[isource]; + site source_reduction=site({0,0,0,sourcePositions[isource][DIM_T]}); + + PLEGMA_printf("\n ### Calculations for source-position %d - %02d.%02d.%02d.%02d begin now ###\n\n", + isource, source[0], source[1], source[2], source[3]); + updateOptions(srcInputFile + std::to_string(isource), listOpt, add_options); + + PLEGMA_Gauge3D smearedGauge3D; + smearedGauge3D.absorb(smearedGauge, source[DIM_T]); + + auto computePropagator = [&](PLEGMA_Propagator& prop_SS, PLEGMA_Propagator& prop_SL, + double run_mu, WHICHFLAVOR fl, int nSmear, bool finalize) { + // ensuring mu value + if(mu != run_mu) { + updateOptions(fl); + mu = run_mu; + solver.UpdateSolver(); + } + for(int isc = 0 ; isc < 12 ; isc++){ + PLEGMA_Vector vectorInOut; + { // Smearing the source + PLEGMA_Vector3D vector1, vector2; + vector1.pointSource(source, isc/3, isc%3, DEVICE); + TIME(vector2.gaussianSmearing(vector1, smearedGauge3D, nSmear, alphaGauss)); + vectorInOut.absorb(vector2,source[DIM_T]); + } + // Inverting + PLEGMA_printf("Going to invert %s for component %d\n", + fl==LIGHT ? "LIGHT" : (fl == STRANGE ? "STRANGE" : "CHARM"), isc); + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + TIME(solver.solve(vectorInOut, vectorInOut)); + { + PLEGMA_Vector vectorAuxD; + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,run_mu/abs(run_mu))); + TIME(vectorInOut.copy(vectorAuxD)); + } + + if(prop_SL.getAllocation() != NONE) { + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorInOut); + prop_SL.absorb(vectorAuxF, isc/3, isc%3); + } + { // Smearing the solution + PLEGMA_Vector vectorAuxD; + PLEGMA_Vector vectorAuxF; + TIME(vectorAuxD.gaussianSmearing(vectorInOut, smearedGauge, nSmear, alphaGauss)); + vectorAuxF.copy(vectorAuxD); + prop_SS.absorb(vectorAuxF, isc/3, isc%3); + } + } + if(finalize) { + prop_SS.rotateToPhysicalBase_device(run_mu/abs(run_mu)); + prop_SS.applyBoundaries_device(source[DIM_T]); + } + }; + + char * src_string; + asprintf(&src_string, "_sx%02dsy%02dsz%02dst%03d", source[0], source[1], source[2], source[3]); + twop_filename = given_twop_filename + src_string; + threep_filename = given_threep_filename + src_string; + free(src_string); + + PLEGMA_Propagator propUP; + PLEGMA_Propagator propDN; + + PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1_twopt); + TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + + PLEGMA_ScattCorrelator corrN0(sourcePositions[isource], list_mpf1_twopt); + TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + + +#if 1 + { // Whithin this scope we keep track also of the propagator non smeared on the sink + + PLEGMA_Propagator propUP_SL(tSinks.size()>0 ? BOTH:NONE); + PLEGMA_Propagator propDN_SL(tSinks.size()>0 ? BOTH:NONE); + + bool computed_light = false; + // If twop_filename exists we hold the computation of the light props + if(access( twop_filename.c_str(), F_OK ) == -1) { + TIME(computePropagator(propUP, propUP_SL, mu_ud, LIGHT, nsmearGauss, false)); + TIME(computePropagator(propDN, propDN_SL, -mu_ud, LIGHT, nsmearGauss, false)); + computed_light = true; + } + + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + + } + + //Computing T reductions+recombination + { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); + //PLEGMA_printf("Nucleon T2 reduction\n"); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); + //PLEGMA_printf("Nucleon T2 reduction ready\n"); + TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); + //PLEGMA_printf("Nucleon diagram ready\n"); + + } + + std::vector filter={0,0,0}; + momList filtered_sourcemomentumList_pi20 = sourcemomentumList_threept.extract(filter, 0); + + + + for(size_t its = 0; its < tSinks.size(); its++){ + int tsinkMtsource = tSinks[its]; + if(tsinkMtsource >= HGC_totalL[3]) + PLEGMA_error("Provided tsink=%d is >= than temporal extent",tsinkMtsource); + int signPer = (tsinkMtsource+source[3]) >= HGC_totalL[3] ? -1 : +1; + int global_fixSinkTime = (tsinkMtsource + source[3])%HGC_totalL[3]; + + //Correlators for storing up and down insertion between the nucleon + + PLEGMA_ScattCorrelator corrUp(source, filtered_sourcemomentumList_pi20, tsinkMtsource+1 ); + PLEGMA_ScattCorrelator corrDn(source, filtered_sourcemomentumList_pi20, tsinkMtsource+1 ); + + corrUp.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon, gammas_insertion, "M"+prOrNt+"Up"); + + corrDn.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon, gammas_insertion, "M"+prOrNt+"Dn"); + + + + // 3D propagators at t_sink + PLEGMA_Propagator3D propUP3D; + PLEGMA_Propagator3D propDN3D; + PLEGMA_Gauge3D smearedGauge3D_sink; + propUP3D.absorb(propUP, global_fixSinkTime); + propDN3D.absorb(propDN, global_fixSinkTime); + propUP3D.absorb(propUP, global_fixSinkTime); + propDN3D.absorb(propDN, global_fixSinkTime); + + smearedGauge3D_sink.absorb(smearedGauge, global_fixSinkTime); + + WHICHPARTICLE nucleon = get_particle(prOrNt); + std::vector gammas = {ONE,G1,G2,G3,G4,G5,G5G1,G5G2,G5G3,G5G4,S12,S13,S23,S41,S42,S43}; + for (int alpha=0;alpha<2; ++alpha){ + for (int beta=0; beta<2; ++beta){ + + auto computeThreep = [&](double run_mu, PLEGMA_Propagator3D& prop1, PLEGMA_Propagator3D& prop2, int signProps, PLEGMA_Propagator &propF, std::string fl) { + if(not computed_light) { + TIME(computePropagator(propUP, propUP_SL, mu_ud, LIGHT, nsmearGauss, false)); + TIME(computePropagator(propDN, propDN_SL, -mu_ud, LIGHT, nsmearGauss, false)); + propUP3D.absorb(propUP, global_fixSinkTime); + propDN3D.absorb(propDN, global_fixSinkTime); + computed_light = true; + } + + PLEGMA_Propagator seqProp; + // ensuring mu positive + if(mu != run_mu) { + updateOptions(LIGHT); + mu = run_mu; + solver.UpdateSolver(); + } + + for(int i_pf1=0; i_pf1 vectorInOut; + { + PLEGMA_Vector3D vectorAuxD1,vectorAuxD2; + PLEGMA_Vector3D vectorAuxF; + if(&prop1 != &prop2){ + vectorAuxF.seqSourceNucleonDelta(prop1, prop2, get_projector(alpha, beta), nucleon, nu, c2, sigma); + } + else + { + vectorAuxF.seqSourceNucleonDelta(prop1, get_projector(alpha, beta), nucleon, nu, c2, sigma); + } + + // put a momentum in the sink + vectorAuxF.mulMomentumPhases(momentum_f1,-1);//At the sink the momenta should be - + //We have initially - + //The we have conjugation twice + //so eventually we have - + + vectorAuxF.conjugate(); + vectorAuxF.apply_gamma(G5); + vectorAuxD1.copy(vectorAuxF); + TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1,smearedGauge3D_sink, nsmearGauss, alphaGauss)); + vectorInOut.absorb(vectorAuxD2, global_fixSinkTime); + } + double norm = vectorInOut.norm(); + vectorInOut.scale(1/norm); + + if (get_projector(alpha,beta)>7) + { + PLEGMA_Vector vectorAuxD; + int sgn=run_mu/fabs(run_mu); + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,sgn)); + TIME(vectorInOut.copy(vectorAuxD)); + } + + + TIME(solver.solve(vectorInOut, vectorInOut)); + + if (get_projector(alpha,beta)>7){ + PLEGMA_Vector vectorAuxD; + int sgn=run_mu/(fabs(run_mu)); + TIME(vectorAuxD.rotateToPhysicalBasis(vectorInOut,sgn)); + TIME(vectorInOut.copy(vectorAuxD)); + } + + vectorInOut.scale(norm); + PLEGMA_Vector vectorAuxF; + vectorAuxF.copy(vectorInOut); + seqProp.absorb(vectorAuxF, nu, c2); + } + } + + seqProp.apply_gamma(G5); + seqProp.conjugate(); + + std::vector> mpc = filtered_sinkList.uniq_p(3); + momList list_mpc(1,{mpc,},{0,}); + + PLEGMA_ScattCorrelator corr( source, list_mpc, tsinkMtsource+1); + + // LOCAL contractions + if (get_projector(alpha,beta)<8){ + TIME(corr.contractNucleonThrp_local(seqProp, propF, signProps, gammas)); + } + else{ + TIME(corr.contractNucleonThrp_local(seqProp, propF, 0, gammas)); + } + if(signPer < 0) for(size_t iv = 0 ; iv < corr.getTotalSize()*2; iv++) corr.H_elem()[iv] *= signPer; + + if (fl=="up"){ + corrUp.absorbSourceSinkSpinMom(corr, alpha, beta, i_pf1, sigma ); + } + else{ + corrDn.absorbSourceSinkSpinMom(corr, alpha, beta, i_pf1, sigma ); + } + + } //isospin + + } //momentum + + }; + if(nucleon == PROTON) { + TIME(computeThreep(-mu_ud, propUP3D, propDN3D, +1, propUP_SL, "up")); + TIME(computeThreep( mu_ud, propUP3D, propUP3D, -1, propDN_SL, "dn")); + } else { + TIME(computeThreep( mu_ud, propDN3D, propUP3D, -1, propDN_SL, "dn")); + TIME(computeThreep(-mu_ud, propDN3D, propDN3D, +1, propUP_SL, "up")); + } + }//beta + }//alpha + }//tSink + }//smearing +#endif +#if 0 + propUP.rotateToPhysicalBase_device(+1); + propDN.rotateToPhysicalBase_device(-1); + propUP.applyBoundaries_device(source[3]); + propDN.applyBoundaries_device(source[3]); + + { + PLEGMA_Correlator corr(corr_space, source, maxQsq); + TIME(corr.contractMesons(propUP, propDN)); + + char *dset1, *dset2; + asprintf(&dset1, "twop_mesons_u[%+1.1e]d[%+1.1e]", mu_ud, -1*mu_ud); + asprintf(&dset2, "twop_mesons_d[%+1.1e]u[%+1.1e]", -1*mu_ud, mu_ud); + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + TIME(corr.contractBaryons(propUP, propDN)); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + + // Storing only the smaller and then computing on the fly the other + int nSmaller = std::min(mu_s.size(),mu_c.size()); + char cSmaller = (nSmaller==(int)mu_s.size()) ? 's' : 'c'; + + PLEGMA_Propagator none(NONE); + PLEGMA_Propagator propS[nSmaller]; + for(int ismall=0; ismall < nSmaller; ismall++) { + for(int i=0;i 0) { + PLEGMA_Propagator propL; + for(int ilarge=0; ilarge < nLarger; ilarge++) { + double run_mu = (cSmaller!='s') ? mu_s[ilarge] : mu_c[ilarge]; + int nsmear = (cSmaller!='s') ? nsmearGauss_s : nsmearGauss_c; + TIME(computePropagator(propL, none, run_mu, (cSmaller!='s') ? STRANGE : CHARM, nsmear, true)); + + if(nSmaller>0) { + for(int ismall=0; ismall < nSmaller; ismall++) { + PLEGMA_Propagator &propST = (cSmaller=='s') ? propS[ismall] : propL; + PLEGMA_Propagator &propCH = (cSmaller=='c') ? propS[ismall] : propL; + PLEGMA_Correlator corr(corr_space, source, maxQsq); + bool only_st = (ismall>0 && cSmaller=='s') || (ilarge>0 && cSmaller!='s'); + bool only_ch = (ismall>0 && cSmaller=='c') || (ilarge>0 && cSmaller!='c'); +#ifdef PLEGMA_UDSC_BARYONS + TIME(corr.contractBaryonsUDSC(propUP, propDN, propST, propCH, only_st, only_ch)); + char * group; + + asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]s[%+1.1e]c[%+1.1e]%s%s", mu_ud, -1*mu_ud, mu_s[cSmaller=='s'? ismall:ilarge], mu_c[cSmaller=='c'? ismall:ilarge], + only_st ? "_only-s" : "", only_ch ? "_only-c" : ""); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); +#endif + TIME(corr.contractMesons(propST, propCH)); + char *dset1, *dset2; + asprintf(&dset1, "twop_mesons_s[%+1.1e]c[%+1.1e]", mu_s[cSmaller=='s'? ismall:ilarge], mu_c[cSmaller=='c'? ismall:ilarge]); + asprintf(&dset2, "twop_mesons_c[%+1.1e]s[%+1.1e]", mu_c[cSmaller=='c'? ismall:ilarge], mu_s[cSmaller=='s'? ismall:ilarge]); + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + if(!only_ch) { + TIME(corr.contractMesons(propUP, propST)); + asprintf(&dset1, "twop_mesons_u[%+1.1e]s[%+1.1e]", mu_ud, mu_s[cSmaller=='s'? ismall:ilarge]); + asprintf(&dset2, "twop_mesons_s[%+1.1e]u[%+1.1e]", mu_s[cSmaller=='s'? ismall:ilarge], mu_ud); + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + TIME(corr.contractMesons(propDN, propST)); + asprintf(&dset1, "twop_mesons_d[%+1.1e]s[%+1.1e]", -1*mu_ud, mu_s[cSmaller=='s'? ismall:ilarge]); + asprintf(&dset2, "twop_mesons_s[%+1.1e]d[%+1.1e]", mu_s[cSmaller=='s'? ismall:ilarge], -1*mu_ud); + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + + if(!only_st) { + TIME(corr.contractMesons(propUP, propCH)); + asprintf(&dset1, "twop_mesons_u[%+1.1e]c[%+1.1e]", mu_ud, mu_c[cSmaller=='c'? ismall:ilarge]); + asprintf(&dset2, "twop_mesons_c[%+1.1e]u[%+1.1e]", mu_c[cSmaller=='c'? ismall:ilarge], mu_ud); + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + TIME(corr.contractMesons(propDN, propCH)); + asprintf(&dset1, "twop_mesons_d[%+1.1e]c[%+1.1e]", -1*mu_ud, mu_c[cSmaller=='c'? ismall:ilarge]); + asprintf(&dset2, "twop_mesons_c[%+1.1e]d[%+1.1e]", mu_c[cSmaller=='c'? ismall:ilarge], -1*mu_ud); + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + } + } else { + PLEGMA_Propagator none(NONE); + PLEGMA_Propagator &propST = (cSmaller=='s') ? none : propL; + PLEGMA_Propagator &propCH = (cSmaller=='c') ? none : propL; + PLEGMA_Correlator corr(corr_space, source, maxQsq); + bool only_st = (ilarge>0 && cSmaller!='s'); + bool only_ch = (ilarge>0 && cSmaller!='c'); +#ifdef PLEGMA_UDSC_BARYONS + TIME(corr.contractBaryonsUDSC(propUP, propDN, propST, propCH, only_st, only_ch)); + char * group; + + if(cSmaller=='s') { + asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]c[%+1.1e]%s", mu_ud, -1*mu_ud, mu_c[ilarge], only_ch ? "_only-c" : ""); + } else { + asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]s[%+1.1e]%s", mu_ud, -1*mu_ud, mu_s[ilarge], only_st ? "_only-s" : ""); + } + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); +#endif + if(!only_ch && !only_st) { + char *dset1, *dset2; + TIME(corr.contractMesons(propUP, (cSmaller=='s') ? propCH : propST)); + if(cSmaller=='s') { + asprintf(&dset1, "twop_mesons_u[%+1.1e]c[%+1.1e]", mu_ud, mu_c[ilarge]); + asprintf(&dset2, "twop_mesons_c[%+1.1e]u[%+1.1e]", mu_c[ilarge], mu_ud); + } else { + asprintf(&dset1, "twop_mesons_u[%+1.1e]s[%+1.1e]", mu_ud, mu_s[ilarge]); + asprintf(&dset2, "twop_mesons_s[%+1.1e]u[%+1.1e]", mu_s[ilarge], mu_ud); + } + + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + + TIME(corr.contractMesons(propDN, (cSmaller=='s') ? propCH : propST)); + if(cSmaller=='s') { + asprintf(&dset1, "twop_mesons_d[%+1.1e]c[%+1.1e]", -1*mu_ud, mu_c[ilarge]); + asprintf(&dset2, "twop_mesons_c[%+1.1e]d[%+1.1e]", mu_c[ilarge], -1*mu_ud); + } else { + asprintf(&dset1, "twop_mesons_d[%+1.1e]s[%+1.1e]", -1*mu_ud, mu_s[ilarge]); + asprintf(&dset2, "twop_mesons_s[%+1.1e]d[%+1.1e]", mu_s[ilarge], -1*mu_ud); + } + corr.setDatasets((std::vector) {dset1, dset2}); + free(dset1); free(dset2); + THREAD(corr.writeFile(twop_filename, corr_file_format)); + } + } + } + } else { +#ifdef PLEGMA_UDSC_BARYONS + PLEGMA_Propagator none(NONE); + PLEGMA_Correlator corr(corr_space, source, maxQsq); + TIME(corr.contractBaryonsUDSC(propUP, propDN, none, none)); + char * group; + + asprintf(&group, "baryons_u[%+1.1e]d[%+1.1e]", mu_ud, -1*mu_ud); + corr.setGroups(group); + free(group); + THREAD(corr.writeFile(twop_filename, corr_file_format)); +#endif + } +#endif + } + while(not threads.empty()) {threads.back().join(); threads.pop_back();} + } + + finalize(); + return 0; +} From 903241ae0550fec1a4d829ac240d03df4b1db739 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 12 Jun 2026 09:29:20 +0200 Subject: [PATCH 164/168] updating njdelta --- include/PLEGMA_ScattCorrelator.h | 2 +- lib/kernels/PLEGMA_seqSourceNucleonDelta.cu | 18 ++++++++----- plegma/nucleon_2pt_3pt_delta.cpp | 28 ++++++++++++++------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/include/PLEGMA_ScattCorrelator.h b/include/PLEGMA_ScattCorrelator.h index f75e9dd6..e1b1f5b8 100644 --- a/include/PLEGMA_ScattCorrelator.h +++ b/include/PLEGMA_ScattCorrelator.h @@ -227,7 +227,7 @@ namespace plegma { void absorbTimeslice(PLEGMA_ScattCorrelator &srcCorr, int global_it, bool forcetozero=false); //manipulation to construct N like diagram from NjN - void absorbSourceSinkSpinMom(PLEGMA_ScattCorrelator &srcCorr, int alpha, int beta, int pf1, bool forcetozero=false); + void absorbSourceSinkSpinMom(PLEGMA_ScattCorrelator &srcCorr, int alpha, int beta, int gf1index, int pf1, bool forcetozero=false); // manipulation constructing exact exact part of the deflated correlation function void absorbEigIndex( PLEGMA_ScattCorrelator &srcCorr, int eigindex, bool forcetozero=false); diff --git a/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu index e49f6e79..172bf877 100644 --- a/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu +++ b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cu @@ -159,6 +159,7 @@ __device__ void contractNucleonDeltaSeqSource(vector2& vec, propTex& vec, propTex factor ((-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0],(-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0]); + Float2 factor ((-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][0],(-1)*sgn_eps[cc1]*sgn_eps[cc2]*NtoDelta_values[c_gamma][idx][1]); factor=factor*prscatt[proj]; if(!isTwoPropDiff){ if(lu == c_nu){ - spinor[nu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; - spinor[nu][c3] += factor * P[mu][ku][c1][c1p] * P[a][b][c2][c2p]; - spinor[nu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; - + for(short gu = 0 ; gu < 4 ; gu++){ + if ( nu == gu ) spinor[gu][c3] += factor * P[mu][b][c1][c1p] * P[a][ku][c2][c2p]; + if ( nu == gu ) spinor[gu][c3] += factor * P[mu][ku][c1][c1p] * P[a][b][c2][c2p]; + if ( a == gu ) spinor[gu][c3] += factor * P[mu][ku][c1][c1p] * P[nu][b][c2][c2p]; + } } } else -#pragma unroll + #pragma unroll for(short gu = 0 ; gu < 4 ; gu++){ if( mu == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][ku][c2][c2p]; if( mu == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[a][b][c2][c2p]; if( a == gu && b == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][ku][c2][c2p]; if( a == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[nu][lu][c1][c1p] * P[mu][b][c2][c2p]; + + if( mu == gu && ku == c_nu ) spinor[gu][c3] += factor * P2[a][lu][c1][c1p] * P[nu][b][c2][c2p]; + if( mu == gu && b == c_nu ) spinor[gu][c3] += factor * P2[a][lu][c1][c1p] * P[nu][ku][c2][c2p]; + } #endif } diff --git a/plegma/nucleon_2pt_3pt_delta.cpp b/plegma/nucleon_2pt_3pt_delta.cpp index 891b945e..b599148f 100644 --- a/plegma/nucleon_2pt_3pt_delta.cpp +++ b/plegma/nucleon_2pt_3pt_delta.cpp @@ -225,10 +225,10 @@ int main(int argc, char **argv) { PLEGMA_Propagator propDN; PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1_twopt); - TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP")); + TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_nucleon,"NP")); PLEGMA_ScattCorrelator corrN0(sourcePositions[isource], list_mpf1_twopt); - TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0")); + TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_nucleon,"N0")); #if 1 @@ -250,9 +250,9 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); + TIME(reductionsT1N.T1(glist_source_nucleon, glist_source_nucleon, propUP, propDN, propUP)); //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_source_nucleon, propUP, propDN, propUP)); //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); @@ -264,9 +264,9 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); + TIME(reductionsT1N.T1(glist_source_nucleon, glist_source_nucleon, propDN, propUP, propDN)); //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propDN, propUP, propDN)); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_source_nucleon, propDN, propUP, propDN)); //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrN0.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); @@ -313,13 +313,13 @@ int main(int argc, char **argv) { for (int beta=0; beta<2; ++beta){ auto computeThreep = [&](double run_mu, PLEGMA_Propagator3D& prop1, PLEGMA_Propagator3D& prop2, int signProps, PLEGMA_Propagator &propF, std::string fl) { - if(not computed_light) { + /* if(not computed_light) { TIME(computePropagator(propUP, propUP_SL, mu_ud, LIGHT, nsmearGauss, false)); TIME(computePropagator(propDN, propDN_SL, -mu_ud, LIGHT, nsmearGauss, false)); propUP3D.absorb(propUP, global_fixSinkTime); propDN3D.absorb(propDN, global_fixSinkTime); computed_light = true; - } + }*/ PLEGMA_Propagator seqProp; // ensuring mu positive @@ -350,6 +350,10 @@ int main(int argc, char **argv) { { PLEGMA_Vector3D vectorAuxD1,vectorAuxD2; PLEGMA_Vector3D vectorAuxF; + double norm2=prop1.norm(); + PLEGMA_printf("Norm of propagator 1 %e\n", norm2); + norm2=prop2.norm(); + PLEGMA_printf("Norm of propagator 2 %e\n", norm2); if(&prop1 != &prop2){ vectorAuxF.seqSourceNucleonDelta(prop1, prop2, get_projector(alpha, beta), nucleon, nu, c2, sigma); } @@ -357,7 +361,9 @@ int main(int argc, char **argv) { { vectorAuxF.seqSourceNucleonDelta(prop1, get_projector(alpha, beta), nucleon, nu, c2, sigma); } - + + double norm=vectorAuxF.norm(); + PLEGMA_printf("Norm calculating %e\n",norm); // put a momentum in the sink vectorAuxF.mulMomentumPhases(momentum_f1,-1);//At the sink the momenta should be - //We have initially - @@ -369,6 +375,10 @@ int main(int argc, char **argv) { vectorAuxD1.copy(vectorAuxF); TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1,smearedGauge3D_sink, nsmearGauss, alphaGauss)); vectorInOut.absorb(vectorAuxD2, global_fixSinkTime); + norm=vectorInOut.norm(); + PLEGMA_printf("After Norm calculating %e\n",norm); + fflush(stdout); + } double norm = vectorInOut.norm(); vectorInOut.scale(1/norm); From ba510c5048821982673f6d2115c597e445dd7b82 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Fri, 12 Jun 2026 09:49:36 +0200 Subject: [PATCH 165/168] adding missing header --- lib/kernels/PLEGMA_seqSourceNucleonDelta.cuh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/kernels/PLEGMA_seqSourceNucleonDelta.cuh diff --git a/lib/kernels/PLEGMA_seqSourceNucleonDelta.cuh b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cuh new file mode 100644 index 00000000..d24e8cc2 --- /dev/null +++ b/lib/kernels/PLEGMA_seqSourceNucleonDelta.cuh @@ -0,0 +1,7 @@ +#pragma once + +template +void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_sigma); + +template +void contractNucleonDeltaSeqSource(vector2 vec, propTex& prop1, propTex& prop2, WHICHPROJECTOR proj, WHICHPARTICLE particle, int c_nu, int c_c2, int c_sigma); From fd8a389d1be4e5ffcd87c41da24bc11a6582f320 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Tue, 16 Jun 2026 08:54:06 +0200 Subject: [PATCH 166/168] adding delta 2pt functions --- plegma/nucleon_2pt_3pt_delta.cpp | 141 ++++++++++++++++++++++++++----- 1 file changed, 120 insertions(+), 21 deletions(-) diff --git a/plegma/nucleon_2pt_3pt_delta.cpp b/plegma/nucleon_2pt_3pt_delta.cpp index b599148f..2700276a 100644 --- a/plegma/nucleon_2pt_3pt_delta.cpp +++ b/plegma/nucleon_2pt_3pt_delta.cpp @@ -39,7 +39,10 @@ int main(int argc, char **argv) { std::vector glist_source_nucleon={CG_5}; - std::vector glist_sink_nucleon={CG_1,CG_2,CG_3}; + std::vector glist_sink_nucleon={CG_5}; + + std::vector glist_source_delta={CG_1,CG_2,CG_3}; + std::vector glist_sink_delta={CG_1,CG_2,CG_3}; std::vector glist_sink_meson={G_5}; std::vector glist_source_meson={G_5}; @@ -63,6 +66,8 @@ int main(int argc, char **argv) { }; add_options(*HGC_options); if(prOrNt != "proton" && prOrNt != "neutron") PLEGMA_error("This exec is only for nucleon, %s is not allowed",prOrNt.c_str()); + std::string outfilename; + //=========================================================================================================// initializePLEGMA(); @@ -225,10 +230,14 @@ int main(int argc, char **argv) { PLEGMA_Propagator propDN; PLEGMA_ScattCorrelator corrNP(sourcePositions[isource], list_mpf1_twopt); - TIME(corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_nucleon,"NP")); + corrNP.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"NP"); PLEGMA_ScattCorrelator corrN0(sourcePositions[isource], list_mpf1_twopt); - TIME(corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_source_nucleon,"N0")); + corrN0.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon,"N0"); + + + PLEGMA_ScattCorrelator corrD(sourcePositions[isource], list_mpf1_twopt); + corrD.initialize_diagram( glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_delta, glist_sink_delta,"D"); #if 1 @@ -247,12 +256,13 @@ int main(int argc, char **argv) { //Computing T reductions+recombination { + PLEGMA_ScattCorrelator reductionsT1N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); PLEGMA_ScattCorrelator reductionsT2N(source_reduction, sourcemomentumList_twopt.uniq_p(1)); //First we compute N+ (proton) (we need for M diagram (N+p+)) and for spin half (N+ pi_0) - TIME(reductionsT1N.T1(glist_source_nucleon, glist_source_nucleon, propUP, propDN, propUP)); + TIME(reductionsT1N.T1(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); //PLEGMA_printf("Nucleon T2 reduction\n"); - TIME(reductionsT2N.T2(glist_source_nucleon, glist_source_nucleon, propUP, propDN, propUP)); + TIME(reductionsT2N.T2(glist_source_nucleon, glist_sink_nucleon, propUP, propDN, propUP)); //PLEGMA_printf("Nucleon T2 reduction ready\n"); TIME(corrNP.N_diagrams( reductionsT1N, reductionsT2N )); //PLEGMA_printf("Nucleon diagram ready\n"); @@ -273,6 +283,87 @@ int main(int argc, char **argv) { } + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_N"; + TIME( corrN0.apply_phase()); + TIME( corrN0.apply_sign("N")); + TIME( corrN0.applyBoundaryConditions( true )); + TIME( corrN0.writeHDF5(outfilename)); + + TIME( corrNP.apply_phase() ); + TIME( corrNP.apply_sign("N") ); + TIME( corrNP.applyBoundaryConditions( true ) ); + TIME( corrNP.writeHDF5(outfilename) ); + + std::vector> mpi2_threept = sourcemomentumList_threept.uniq_p(0); + + auto &momentum_i2 = mpi2_threept[0]; + //List of momenta corresponding to a fix value of p_i2 + momList filtered_sourcemomentumList = sourcemomentumList_threept.extract(momentum_i2, 0); + momList filtered_sourcemomentumList_2pt = sourcemomentumList_twopt.extract(momentum_i2, 0); + std::vector> mptot_filt = filtered_sourcemomentumList_2pt.uniq_p(3); + std::vector> mpi2_filt ; + mpi2_filt.assign(mptot_filt.size(),momentum_i2); + + momList list_mpi2ptot(2,{mpi2_filt,mptot_filt},{1,}); + + PLEGMA_ScattCorrelator corrD1(sourcePositions[isource], list_mpi2ptot); + PLEGMA_ScattCorrelator corrD2(sourcePositions[isource], list_mpi2ptot); + PLEGMA_ScattCorrelator corrD3(sourcePositions[isource], list_mpi2ptot); + PLEGMA_ScattCorrelator corrD4(sourcePositions[isource], list_mpi2ptot); + PLEGMA_ScattCorrelator corrD5(sourcePositions[isource], list_mpi2ptot); + + corrD1.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_delta, glist_sink_delta, "D1"); + corrD2.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_delta, glist_sink_delta, "D2"); + corrD3.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_delta, glist_sink_delta, "D3"); + corrD4.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_delta, glist_sink_delta, "D4"); + corrD5.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_delta, glist_sink_delta, "D5"); + + { + + + PLEGMA_ScattCorrelator reductionsT1(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + PLEGMA_ScattCorrelator reductionsT2(source_reduction, sourcemomentumList_twopt.uniq_p(1)); + + + TIME(reductionsT1.T1(glist_source_delta, glist_sink_delta, propUP, propUP, propUP)); + TIME(reductionsT2.T2(glist_source_delta, glist_sink_delta, propUP, propUP, propUP)); + + TIME(corrD.D_diagrams( reductionsT1, reductionsT2 )); + + TIME(reductionsT1.T1(glist_source_delta, glist_sink_delta, propUP, propDN, propUP)); + TIME(corrD1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_delta, glist_sink_delta, propUP, propDN, propUP)); + TIME(corrD2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + + TIME(reductionsT2.T2(glist_source_delta, glist_sink_delta, propDN, propUP, propUP)); + TIME(corrD3.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + + TIME(reductionsT1.T1(glist_source_delta, glist_sink_delta, propUP, propUP, propDN)); + TIME(corrD4.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + TIME(reductionsT1.T1(glist_source_delta, glist_sink_delta, propDN, propUP, propUP)); + TIME(corrD5.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + + } + + //write D + outfilename=outdiagramPrefix+confnumber+ sourcepositiontext+"_D"; + + TIME( corrD.apply_phase() ); + TIME( corrD.apply_sign("D") ); + TIME( corrD.applyBoundaryConditions( true ) ); + TIME( corrD.writeHDF5(outfilename) ); + + TIME( corrD1.writeHDF5(outfilename) ); + TIME( corrD2.writeHDF5(outfilename) ); + TIME( corrD3.writeHDF5(outfilename) ); + TIME( corrD4.writeHDF5(outfilename) ); + TIME( corrD5.writeHDF5(outfilename) ); + + + + std::vector filter={0,0,0}; momList filtered_sourcemomentumList_pi20 = sourcemomentumList_threept.extract(filter, 0); @@ -290,9 +381,9 @@ int main(int argc, char **argv) { PLEGMA_ScattCorrelator corrUp(source, filtered_sourcemomentumList_pi20, tsinkMtsource+1 ); PLEGMA_ScattCorrelator corrDn(source, filtered_sourcemomentumList_pi20, tsinkMtsource+1 ); - corrUp.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon, gammas_insertion, "M"+prOrNt+"Up"); + corrUp.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_delta, gammas_insertion, "M"+prOrNt+"Up"); - corrDn.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_nucleon, gammas_insertion, "M"+prOrNt+"Dn"); + corrDn.initialize_diagram(glist_source_nucleon_unpaired, glist_sink_nucleon_unpaired, glist_source_nucleon, glist_sink_delta, gammas_insertion, "M"+prOrNt+"Dn"); @@ -302,8 +393,6 @@ int main(int argc, char **argv) { PLEGMA_Gauge3D smearedGauge3D_sink; propUP3D.absorb(propUP, global_fixSinkTime); propDN3D.absorb(propDN, global_fixSinkTime); - propUP3D.absorb(propUP, global_fixSinkTime); - propDN3D.absorb(propDN, global_fixSinkTime); smearedGauge3D_sink.absorb(smearedGauge, global_fixSinkTime); @@ -341,7 +430,7 @@ int main(int argc, char **argv) { momList filtered_sinkList = sourcemomentumList_threept.extract(momentum_f1, 1); - for (int sigma=0; sigma<2; sigma++){ + for (int sigma=0; sigma<3; sigma++){ for(int nu = 0 ; nu < 4 ; nu++){ @@ -350,10 +439,6 @@ int main(int argc, char **argv) { { PLEGMA_Vector3D vectorAuxD1,vectorAuxD2; PLEGMA_Vector3D vectorAuxF; - double norm2=prop1.norm(); - PLEGMA_printf("Norm of propagator 1 %e\n", norm2); - norm2=prop2.norm(); - PLEGMA_printf("Norm of propagator 2 %e\n", norm2); if(&prop1 != &prop2){ vectorAuxF.seqSourceNucleonDelta(prop1, prop2, get_projector(alpha, beta), nucleon, nu, c2, sigma); } @@ -362,8 +447,6 @@ int main(int argc, char **argv) { vectorAuxF.seqSourceNucleonDelta(prop1, get_projector(alpha, beta), nucleon, nu, c2, sigma); } - double norm=vectorAuxF.norm(); - PLEGMA_printf("Norm calculating %e\n",norm); // put a momentum in the sink vectorAuxF.mulMomentumPhases(momentum_f1,-1);//At the sink the momenta should be - //We have initially - @@ -375,9 +458,9 @@ int main(int argc, char **argv) { vectorAuxD1.copy(vectorAuxF); TIME(vectorAuxD2.gaussianSmearing(vectorAuxD1,smearedGauge3D_sink, nsmearGauss, alphaGauss)); vectorInOut.absorb(vectorAuxD2, global_fixSinkTime); - norm=vectorInOut.norm(); - PLEGMA_printf("After Norm calculating %e\n",norm); - fflush(stdout); + //norm=vectorInOut.norm(); + //PLEGMA_printf("After Norm calculating %e\n",norm); + //fflush(stdout); } double norm = vectorInOut.norm(); @@ -426,10 +509,10 @@ int main(int argc, char **argv) { if(signPer < 0) for(size_t iv = 0 ; iv < corr.getTotalSize()*2; iv++) corr.H_elem()[iv] *= signPer; if (fl=="up"){ - corrUp.absorbSourceSinkSpinMom(corr, alpha, beta, i_pf1, sigma ); + corrUp.absorbSourceSinkSpinMom(corr, alpha, beta, sigma, i_pf1 ); } else{ - corrDn.absorbSourceSinkSpinMom(corr, alpha, beta, i_pf1, sigma ); + corrDn.absorbSourceSinkSpinMom(corr, alpha, beta, sigma, i_pf1 ); } } //isospin @@ -446,6 +529,22 @@ int main(int argc, char **argv) { } }//beta }//alpha + if (nucleon==PROTON){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource)+"_protonup"; + } + else{ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource)+"_neutronup"; + } + TIME(corrUp.writeHDF5(outfilename)); + + if (nucleon==PROTON){ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource)+"_protondn"; + } + else{ + outfilename = outdiagramPrefix+confnumber+sourcepositiontext+"_dt" + std::to_string(tsinkMtsource) +"_neutrondn"; + } + TIME(corrDn.writeHDF5(outfilename)); + }//tSink }//smearing #endif From bb8f93b68dbe2300ac03017975d629bce9f7ab65 Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Wed, 1 Jul 2026 11:37:10 +0200 Subject: [PATCH 167/168] latest version of NJDelta --- plegma/nucleon_2pt_3pt_delta.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/plegma/nucleon_2pt_3pt_delta.cpp b/plegma/nucleon_2pt_3pt_delta.cpp index 2700276a..10dd2063 100644 --- a/plegma/nucleon_2pt_3pt_delta.cpp +++ b/plegma/nucleon_2pt_3pt_delta.cpp @@ -330,20 +330,23 @@ int main(int argc, char **argv) { TIME(corrD.D_diagrams( reductionsT1, reductionsT2 )); - TIME(reductionsT1.T1(glist_source_delta, glist_sink_delta, propUP, propDN, propUP)); - TIME(corrD1.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + PLEGMA_ScattCorrelator reductionsT1D(source_reduction, mptot_filt); + PLEGMA_ScattCorrelator reductionsT2D(source_reduction, mptot_filt); - TIME(reductionsT2.T2(glist_source_delta, glist_sink_delta, propUP, propDN, propUP)); - TIME(corrD2.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + TIME(reductionsT1D.T1(glist_source_delta, glist_sink_delta, propUP, propDN, propUP)); + TIME(corrD1.convertTreductiontoDiagram( reductionsT1D, -1, false, true, true )); - TIME(reductionsT2.T2(glist_source_delta, glist_sink_delta, propDN, propUP, propUP)); - TIME(corrD3.convertTreductiontoDiagram( reductionsT2, 0, false, true, true )); + TIME(reductionsT2D.T2(glist_source_delta, glist_sink_delta, propUP, propDN, propUP)); + TIME(corrD2.convertTreductiontoDiagram( reductionsT2D, -1, false, true, true )); - TIME(reductionsT1.T1(glist_source_delta, glist_sink_delta, propUP, propUP, propDN)); - TIME(corrD4.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + TIME(reductionsT2D.T2(glist_source_delta, glist_sink_delta, propDN, propUP, propUP)); + TIME(corrD3.convertTreductiontoDiagram( reductionsT2D, -1, false, true, true )); - TIME(reductionsT1.T1(glist_source_delta, glist_sink_delta, propDN, propUP, propUP)); - TIME(corrD5.convertTreductiontoDiagram( reductionsT1, 0, false, true, true )); + TIME(reductionsT1D.T1(glist_source_delta, glist_sink_delta, propUP, propUP, propDN)); + TIME(corrD4.convertTreductiontoDiagram( reductionsT1D, -1, false, true, true )); + + TIME(reductionsT1D.T1(glist_source_delta, glist_sink_delta, propDN, propUP, propUP)); + TIME(corrD5.convertTreductiontoDiagram( reductionsT1D, -1, false, true, true )); } @@ -410,7 +413,6 @@ int main(int argc, char **argv) { computed_light = true; }*/ - PLEGMA_Propagator seqProp; // ensuring mu positive if(mu != run_mu) { updateOptions(LIGHT); @@ -431,6 +433,8 @@ int main(int argc, char **argv) { momList filtered_sinkList = sourcemomentumList_threept.extract(momentum_f1, 1); for (int sigma=0; sigma<3; sigma++){ + + PLEGMA_Propagator seqProp; for(int nu = 0 ; nu < 4 ; nu++){ @@ -474,7 +478,6 @@ int main(int argc, char **argv) { TIME(vectorInOut.copy(vectorAuxD)); } - TIME(solver.solve(vectorInOut, vectorInOut)); if (get_projector(alpha,beta)>7){ From e9679a8bdd2136cb92fc244f4ad4ce0a73f64eaa Mon Sep 17 00:00:00 2001 From: Ferenc Pittler Date: Thu, 2 Jul 2026 09:25:48 +0200 Subject: [PATCH 168/168] correcting bug --- lib/kernels/PLEGMA_scattreductions.cuh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kernels/PLEGMA_scattreductions.cuh b/lib/kernels/PLEGMA_scattreductions.cuh index 7645ca51..f62bf1e1 100644 --- a/lib/kernels/PLEGMA_scattreductions.cuh +++ b/lib/kernels/PLEGMA_scattreductions.cuh @@ -397,7 +397,7 @@ static void T_reductions_host( ProfileStruct &ps, TRED T, PLEGMA_ScattCorrelator // listGammas_f.array=quda::device_malloc_(__func__, quda::file_name(__FILE__), __LINE__, gammas_f.size()*sizeof(GAMMAS_SCATT)); listGammas_i.array=(GAMMAS_SCATT*)device_malloc(gammas_i.size()*sizeof(GAMMAS_SCATT)); - listGammas_f.array=(GAMMAS_SCATT*)device_malloc(gammas_i.size()*sizeof(GAMMAS_SCATT)); + listGammas_f.array=(GAMMAS_SCATT*)device_malloc(gammas_f.size()*sizeof(GAMMAS_SCATT)); // cudaMalloc((void**)&listGammas_i.array, gammas_i.size()*sizeof(GAMMAS_SCATT)); // cudaMalloc((void**)&listGammas_f.array, gammas_f.size()*sizeof(GAMMAS_SCATT));