1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Offload loops

This commit is contained in:
Peter Boyle 2020-06-10 19:59:11 -04:00
parent a7ffc61e82
commit 237ce92540

View File

@ -86,9 +86,9 @@ public:
// Move this elsewhere? FIXME
static inline void AddLink(Field &U, LinkField &W, int mu) { // U[mu] += W
autoView(U_v,U,CpuWrite);
autoView(W_v,W,CpuRead);
thread_for( ss, U.Grid()->oSites(), {
autoView(U_v,U,AcceleratorWrite);
autoView(W_v,W,AcceleratorRead);
accelerator_for( ss, U.Grid()->oSites(), 1, {
U_v[ss](mu) = U_v[ss](mu) + W_v[ss]();
});
}
@ -131,14 +131,13 @@ public:
//static std::chrono::duration<double> diff;
//auto start = std::chrono::high_resolution_clock::now();
autoView(U_v,U,CpuWrite);
autoView(P_v,P,CpuRead);
thread_for(ss, P.Grid()->oSites(),{
autoView(U_v,U,AcceleratorWrite);
autoView(P_v,P,AcceleratorRead);
accelerator_for(ss, P.Grid()->oSites(),1,{
for (int mu = 0; mu < Nd; mu++) {
U_v[ss](mu) = ProjectOnGroup(Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](mu));
}
});
//auto end = std::chrono::high_resolution_clock::now();
// diff += end - start;
// std::cout << "Time to exponentiate matrix " << diff.count() << " s\n";