1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-09 21:50:45 +01: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 // Move this elsewhere? FIXME
static inline void AddLink(Field &U, LinkField &W, int mu) { // U[mu] += W static inline void AddLink(Field &U, LinkField &W, int mu) { // U[mu] += W
autoView(U_v,U,CpuWrite); autoView(U_v,U,AcceleratorWrite);
autoView(W_v,W,CpuRead); autoView(W_v,W,AcceleratorRead);
thread_for( ss, U.Grid()->oSites(), { accelerator_for( ss, U.Grid()->oSites(), 1, {
U_v[ss](mu) = U_v[ss](mu) + W_v[ss](); U_v[ss](mu) = U_v[ss](mu) + W_v[ss]();
}); });
} }
@ -131,14 +131,13 @@ public:
//static std::chrono::duration<double> diff; //static std::chrono::duration<double> diff;
//auto start = std::chrono::high_resolution_clock::now(); //auto start = std::chrono::high_resolution_clock::now();
autoView(U_v,U,CpuWrite); autoView(U_v,U,AcceleratorWrite);
autoView(P_v,P,CpuRead); autoView(P_v,P,AcceleratorRead);
thread_for(ss, P.Grid()->oSites(),{ accelerator_for(ss, P.Grid()->oSites(),1,{
for (int mu = 0; mu < Nd; mu++) { for (int mu = 0; mu < Nd; mu++) {
U_v[ss](mu) = ProjectOnGroup(Exponentiate(P_v[ss](mu), ep, Nexp) * U_v[ss](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(); //auto end = std::chrono::high_resolution_clock::now();
// diff += end - start; // diff += end - start;
// std::cout << "Time to exponentiate matrix " << diff.count() << " s\n"; // std::cout << "Time to exponentiate matrix " << diff.count() << " s\n";