mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
View locatoin and access mode
This commit is contained in:
parent
a7abda89e2
commit
f999408e92
@ -107,8 +107,8 @@ int main(int argc, char ** argv)
|
||||
// Implement a stencil code that should agree with cshift!
|
||||
for(int i=0;i<Check.Grid()->oSites();i++){
|
||||
auto SE = gStencil.GetEntry(0,i);
|
||||
auto check = Check.View();
|
||||
auto foo = Foo.View();
|
||||
auto check = Check.View(CpuWrite);
|
||||
auto foo = Foo.View(CpuRead);
|
||||
|
||||
// Encapsulate in a general wrapper
|
||||
check[i] = foo[SE->_offset]; auto tmp=check[i];
|
||||
@ -147,8 +147,8 @@ int main(int argc, char ** argv)
|
||||
}}}}
|
||||
|
||||
if (nrm > 1.0e-4) {
|
||||
auto check = Check.View();
|
||||
auto bar = Bar.View();
|
||||
auto check = Check.View(CpuRead);
|
||||
auto bar = Bar.View(CpuRead);
|
||||
for(int i=0;i<check.size();i++){
|
||||
std::cout << i<<" Check "<<check[i]<< "\n"<<i<<" Bar "<<bar[i]<<std::endl;
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ int main(int argc, char ** argv) {
|
||||
StencilEntry *SE;
|
||||
SE = myStencil.GetEntry(permute_type,0,i);
|
||||
|
||||
auto check = Check.View();
|
||||
auto foo = Foo.View();
|
||||
auto check = Check.View(CpuWrite);
|
||||
auto foo = Foo.View(CpuRead);
|
||||
if ( SE->_is_local && SE->_permute )
|
||||
permute(check[i],foo[SE->_offset],permute_type);
|
||||
else if (SE->_is_local)
|
||||
@ -151,8 +151,8 @@ int main(int argc, char ** argv) {
|
||||
}}}}
|
||||
|
||||
if (nrm > 1.0e-4) {
|
||||
auto check = Check.View();
|
||||
auto bar = Bar.View();
|
||||
auto check = Check.View(CpuRead);
|
||||
auto bar = Bar.View(CpuRead);
|
||||
for(int i=0;i<check.size();i++){
|
||||
std::cout << i<<" Check "<<check[i]<< "\n"<<i<<" Bar "<<bar[i]<<std::endl;
|
||||
}
|
||||
@ -210,8 +210,8 @@ int main(int argc, char ** argv) {
|
||||
SE = EStencil.GetEntry(permute_type,0,i);
|
||||
// std::cout << "Even source "<< i<<" -> " <<SE->_offset << " "<< SE->_is_local<<std::endl;
|
||||
|
||||
auto ocheck = OCheck.View();
|
||||
auto efoo = EFoo.View();
|
||||
auto ocheck = OCheck.View(CpuWrite);
|
||||
auto efoo = EFoo.View(CpuRead);
|
||||
if ( SE->_is_local && SE->_permute )
|
||||
permute(ocheck[i],efoo[SE->_offset],permute_type);
|
||||
else if (SE->_is_local)
|
||||
@ -226,8 +226,8 @@ int main(int argc, char ** argv) {
|
||||
SE = OStencil.GetEntry(permute_type,0,i);
|
||||
// std::cout << "ODD source "<< i<<" -> " <<SE->_offset << " "<< SE->_is_local<<std::endl;
|
||||
|
||||
auto echeck = ECheck.View();
|
||||
auto ofoo = OFoo.View();
|
||||
auto echeck = ECheck.View(CpuWrite);
|
||||
auto ofoo = OFoo.View(CpuRead);
|
||||
if ( SE->_is_local && SE->_permute )
|
||||
permute(echeck[i],ofoo[SE->_offset],permute_type);
|
||||
else if (SE->_is_local)
|
||||
|
@ -88,14 +88,15 @@ int main (int argc, char ** argv)
|
||||
// replicate across fifth dimension
|
||||
////////////////////////////////////
|
||||
LatticeGaugeField Umu5d(FGrid);
|
||||
auto umu5d = Umu5d.View();
|
||||
auto umu = Umu.View();
|
||||
{
|
||||
auto umu5d = Umu5d.View(CpuWrite);
|
||||
auto umu = Umu.View(CpuRead);
|
||||
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
|
||||
for(int s=0;s<Ls;s++){
|
||||
umu5d[Ls*ss+s] = umu[ss];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
std::vector<LatticeColourMatrix> U(4,FGrid);
|
||||
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
|
@ -570,8 +570,8 @@ void TestConserved1(Action & Ddwf, Action & Ddwfrev,
|
||||
LatticeGaugeField Umu5d(FGrid);
|
||||
std::vector<LatticeColourMatrix> U(4,FGrid);
|
||||
{
|
||||
auto Umu5d_v = Umu5d.View();
|
||||
auto Umu_v = Umu.View();
|
||||
auto Umu5d_v = Umu5d.View(CpuWrite);
|
||||
auto Umu_v = Umu.View(CpuRead);
|
||||
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
|
||||
for(int s=0;s<Ls;s++){
|
||||
Umu5d_v[Ls*ss+s] = Umu_v[ss];
|
||||
@ -597,8 +597,8 @@ void TestConserved1(Action & Ddwf, Action & Ddwfrev,
|
||||
{
|
||||
RealD diag = 5.0 - Ddwf.M5;
|
||||
mass = Ddwf.mass;
|
||||
auto psi=result5.View();
|
||||
auto chi=tmp.View();
|
||||
auto psi=result5.View(CpuRead);
|
||||
auto chi=tmp.View(CpuWrite);
|
||||
thread_for(sss,UGrid->oSites(),{
|
||||
uint64_t ss= sss*Ls;
|
||||
typedef vSpinColourVector spinor;
|
||||
|
@ -98,9 +98,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
thread_foreach( i,mom_v,{
|
||||
Uprime_v[i](mu) =
|
||||
U_v[i](mu)
|
||||
|
@ -100,9 +100,9 @@ int main (int argc, char ** argv)
|
||||
|
||||
// fourth order exponential approx
|
||||
|
||||
auto mom_v = mom.View();
|
||||
auto U_v = U.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
|
||||
thread_foreach( i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
|
@ -110,9 +110,9 @@ int main (int argc, char** argv)
|
||||
PokeIndex<LorentzIndex>(mom, mommu, mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto U_v = U.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
|
@ -119,9 +119,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto U_v = U.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
|
@ -114,9 +114,9 @@ int main (int argc, char** argv)
|
||||
PokeIndex<LorentzIndex>(mom, mommu, mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto U_v = U.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
|
@ -85,9 +85,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
thread_foreach(i,mom_v,{ // exp(pmu dt) * Umu
|
||||
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt ;
|
||||
});
|
||||
|
@ -87,9 +87,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v= Uprime.View();
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto Uprime_v= Uprime.View(CpuWrite);
|
||||
auto U_v = U.View(CpuRead);
|
||||
thread_foreach(i,mom_v,{ // exp(pmu dt) * Umu
|
||||
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt ;
|
||||
});
|
||||
|
@ -105,9 +105,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
+ mom_v[i](mu)*U_v[i](mu)*dt
|
||||
|
@ -99,9 +99,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto U_v = U.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
|
@ -101,9 +101,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
+ mom_v[i](mu)*U_v[i](mu)*dt
|
||||
|
@ -112,9 +112,9 @@ int main (int argc, char** argv)
|
||||
PokeIndex<LorentzIndex>(mom, mommu, mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto U_v = U.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
|
@ -115,9 +115,9 @@ int main (int argc, char** argv)
|
||||
SU3::GaussianFundamentalLieAlgebraMatrix(RNG4, mommu); // Traceless antihermitian momentum; gaussian in lie alg
|
||||
|
||||
PokeIndex<LorentzIndex>(mom, mommu, mu);
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
// fourth order exponential approx
|
||||
thread_foreach( i, mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt + mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
|
||||
|
@ -101,9 +101,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
+ mom_v[i](mu)*U_v[i](mu)*dt
|
||||
|
@ -87,9 +87,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
thread_foreach(i,mom_v,{ // exp(pmu dt) * Umu
|
||||
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt ;
|
||||
});
|
||||
|
@ -105,9 +105,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
thread_foreach( i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu);
|
||||
Uprime_v[i](mu) += mom_v[i](mu)*U_v[i](mu)*dt ;
|
||||
|
@ -105,9 +105,9 @@ int main(int argc, char **argv)
|
||||
Hmom -= real(sum(trace(mommu * mommu)));
|
||||
PokeIndex<LorentzIndex>(mom, mommu, mu);
|
||||
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto U_v = U.View();
|
||||
auto mom_v = mom.View();
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
thread_foreach(ss,mom_v,
|
||||
{
|
||||
Uprime_v[ss]._internal[mu] = ProjectOnGroup(Exponentiate(mom_v[ss]._internal[mu], dt, 12) * U_v[ss]._internal[mu]);
|
||||
|
@ -114,9 +114,9 @@ int main (int argc, char ** argv)
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
auto mom_v = mom.View();
|
||||
auto U_v = U.View();
|
||||
auto Uprime_v = Uprime.View();
|
||||
auto mom_v = mom.View(CpuRead);
|
||||
auto U_v = U.View(CpuRead);
|
||||
auto Uprime_v = Uprime.View(CpuWrite);
|
||||
|
||||
thread_foreach(i,mom_v,{
|
||||
Uprime_v[i](mu) = U_v[i](mu)
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
@ -302,8 +300,8 @@ int main (int argc, char ** argv)
|
||||
int nb=nbasisc/2;
|
||||
CoarseAggregates.CreateSubspaceChebyshev(CRNG,PosdefLdop,nb,12.0,0.02,500,100,100,0.0);
|
||||
for(int n=0;n<nb;n++){
|
||||
auto subspace = CoarseAggregates.subspace[n].View();
|
||||
auto subspace_g5 = CoarseAggregates.subspace[n+nb].View();
|
||||
auto subspace = CoarseAggregates.subspace[n].View(CpuRead);
|
||||
auto subspace_g5 = CoarseAggregates.subspace[n+nb].View(CpuWrite);
|
||||
for(int nn=0;nn<nb;nn++){
|
||||
for(int site=0;site<Coarse5d->oSites();site++){
|
||||
subspace_g5[site](nn) = subspace[site](nn);
|
||||
|
Loading…
Reference in New Issue
Block a user