1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

PerambMultipleSolves.hpp compiles (not had time to test)

This commit is contained in:
Michael Marshall 2019-03-12 14:01:29 +00:00
parent c2a3231cdf
commit a0405c6d84
2 changed files with 16 additions and 28 deletions

View File

@ -109,7 +109,7 @@ std::vector<std::string> TPerambMultipleSolves<FImpl>::getOutput(void)
template <typename FImpl>
void TPerambMultipleSolves<FImpl>::setup(void)
{
/* Cleanup();
Cleanup();
const int nvec{par().nvec};
// auto &noise = envGet(std::vector<std::vector<std::vector<SpinVector>>>, par().noise);
@ -133,7 +133,8 @@ void TPerambMultipleSolves<FImpl>::setup(void)
envTmpLat(GaugeField, "Umu");
envTmpLat(LatticeSpinColourVector, "dist_source");
envTmp(std::vector<LatticeSpinColourVector>, "sources",nsolves);
envTmp(std::vector<LatticeSpinColourVector>, "sources", 1,
std::vector<LatticeSpinColourVector>( nsolves, grid4d ));
envTmpLat(LatticeSpinColourVector, "tmp2");
envTmpLat(LatticeSpinColourVector, "result");
//envTmpLat(LatticeSpinColourVector, "result_single_component");
@ -149,7 +150,6 @@ void TPerambMultipleSolves<FImpl>::setup(void)
envTmpLat(FermionField, "v4dtmp");
envTmpLat(FermionField, "v5dtmp", Ls_);
envTmpLat(FermionField, "v5dtmp_sol", Ls_);
*/
}
// clean up any temporaries created by setup (that aren't stored in the environment)
@ -167,7 +167,7 @@ void TPerambMultipleSolves<FImpl>::Cleanup(void)
template <typename FImpl>
void TPerambMultipleSolves<FImpl>::execute(void)
{
/* const int nsolves{par().nsolves};
const int nsolves{par().nsolves};
const int nvec{par().nvec};
std::vector<int> nvecs{par().nvecs};
const DistilParameters & Distil{par().Distil};
@ -199,7 +199,7 @@ void TPerambMultipleSolves<FImpl>::execute(void)
std::vector<std::vector<FermionField>> solves(nsolves);
for(int i=0;i<nsolves;i++){
auto &unsmeared_sink = envGet(std::vector<FermionField>, getName() +"_solve_"+std::to_string(nvecs[i]));
solves[i].resize(nnoise*nvecs[i]*Ns*Nt_inv);
solves[i].resize(nnoise*nvecs[i]*Ns*Nt_inv, grid4d);
solves[i]=unsmeared_sink;
}
@ -333,10 +333,7 @@ void TPerambMultipleSolves<FImpl>::execute(void)
}
}
}
}
*/
}
END_MODULE_NAMESPACE

View File

@ -30,6 +30,7 @@
#include <typeinfo>
#include <Hadrons/Application.hpp>
#include <Hadrons/Modules.hpp>
#include <Grid/util/EigenUtil.h>
using namespace Grid;
using namespace Hadrons;
@ -688,13 +689,10 @@ bool DebugEigenTest()
template <typename T>
void DebugGridTensorTest_print( int i )
{
std::cout << i << " : " << EigenIO::is_tensor<T>::value
<< ", rank " << EigenIO::Traits<T>::rank
<< ", rank_non_trivial " << EigenIO::Traits<T>::rank_non_trivial
<< ", count " << EigenIO::Traits<T>::count
<< ", scalar_size " << EigenIO::Traits<T>::scalar_size
<< ", size " << EigenIO::Traits<T>::size
<< std::endl;
// std::cout << i << " : " << EigenIO::is_tensor<T>::value
// << ", Rank " << EigenIO::Traits<T>::Rank
// << ", count " << EigenIO::Traits<T>::count
// << std::endl;
}
// begin() and end() are the minimum necessary to support range-for loops
@ -723,12 +721,12 @@ void EigenSliceExample()
a.setValues({{0, 100, 200}, {300, 400, 500},
{600, 700, 800}, {900, 1000, 1100}});
std::cout << "a\n" << a << std::endl;
DumpMemoryOrder( a, "a" );
dump_tensor( a, "a" );
Eigen::array<typename T2::Index, 2> offsets = {0, 1};
Eigen::array<typename T2::Index, 2> extents = {4, 2};
T2 slice = a.slice(offsets, extents);
std::cout << "slice\n" << slice << std::endl;
DumpMemoryOrder( slice, "slice" );
dump_tensor( slice, "slice" );
std::cout << "\n========================================" << std::endl;
}
@ -741,10 +739,7 @@ void EigenSliceExample2()
T3 a(2,3,4);
std::cout << "Initialising a:";
for_all( a, [&](TestScalar &c, float f, const std::array<size_t,T3::NumIndices> &Dims ){
c = TestScalar{f,-f};
std::cout << " a(" << Dims[0] << "," << Dims[1] << "," << Dims[2] << ")=" << c;
} );
SequentialInit( a );
std::cout << std::endl;
//std::cout << "Validating a:";
float z = 0;
@ -758,22 +753,18 @@ void EigenSliceExample2()
}
//std::cout << std::endl;
//std::cout << "a initialised to:\n" << a << std::endl;
DumpMemoryOrder( a, "a" );
std::cout << "for_all(a):";
for_all( a, [&](TestScalar c, typename T3::Index n, const std::array<size_t,T3::NumIndices> &Dims ){
std::cout << " (" << Dims[0] << "," << Dims[1] << "," << Dims[2] << ")<" << n << ">=" << c;
} );
dump_tensor( a, "a" );
std::cout << std::endl;
Eigen::array<typename T3::Index, 3> offsets = {0,1,1};
Eigen::array<typename T3::Index, 3> extents = {1,2,2};
T3 b;
b = a.slice( offsets, extents );//.reshape(NewExtents);
std::cout << "b = a.slice( offsets, extents ):\n" << b << std::endl;
DumpMemoryOrder( b, "b" );
dump_tensor( b, "b" );
T2 c(3,4);
c = a.chip(0,1);
std::cout << "c = a.chip(0,0):\n" << c << std::endl;
DumpMemoryOrder( c, "c" );
dump_tensor( c, "c" );
//T2 d = b.reshape(extents);
//std::cout << "b.reshape(extents) is:\n" << d << std::endl;
std::cout << "\n========================================" << std::endl;