Skip to content

Commit

Permalink
real thread-safety for get_staples and const qualifier for in_gaugefield
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrzewa committed Sep 26, 2012
1 parent c2a452b commit 13b1e70
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gauge_monomial.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void gauge_derivative(const int id, hamiltonian_field_t * const hf) {
for(mu=0;mu<4;mu++) {
z=&hf->gaugefield[i][mu];
xm=&hf->derivative[i][mu];
v=get_staples(i,mu, hf->gaugefield);
get_staples(&v,i,mu, (const su3**) hf->gaugefield);
_su3_times_su3d(w,*z,v);
_trace_lambda_mul_add_assign((*xm), factor, w);

Expand Down
14 changes: 6 additions & 8 deletions get_staples.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@
#include "get_staples.h"


su3 get_staples(int x, int mu, su3 ** in_gauge_field) {
void get_staples(su3* const staple, const int x, const int mu, const su3 ** in_gauge_field) {

int iy;
su3 ALIGN v,st;
su3 *w1,*w2,*w3;
su3 ALIGN st;
const su3 *w1,*w2,*w3;

#ifdef _KOJAK_INST
#pragma pomp inst begin(staples)
#endif


_su3_zero(v);
_su3_zero(*staple);
for(int k=0;k<4;k++) {
if(k!=mu){
w1=&in_gauge_field[x][k];
Expand All @@ -52,7 +51,7 @@ su3 get_staples(int x, int mu, su3 ** in_gauge_field) {
/* st = w2 * w3^d */
_su3_times_su3d(st,*w2,*w3);
/* v = v + w1 * st */
_su3_times_su3_acc(v,*w1,st);
_su3_times_su3_acc(*staple,*w1,st);

iy=g_idn[x][k];
w1=&in_gauge_field[iy][k];
Expand All @@ -61,10 +60,9 @@ su3 get_staples(int x, int mu, su3 ** in_gauge_field) {
/* st = w2 * w3 */
_su3_times_su3(st,*w2,*w3);
/* v = v + w1^d * st */
_su3d_times_su3_acc(v,*w1,st);
_su3d_times_su3_acc(*staple,*w1,st);
}
}
return v;
#ifdef _KOJAK_INST
#pragma pomp inst end(staples)
#endif
Expand Down
2 changes: 1 addition & 1 deletion get_staples.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@

#include"su3.h"

su3 get_staples(int x, int mu, su3 ** in_gauge_field);
void get_staples(su3* const staple, const int x, const int mu, const su3 ** in_gauge_field);

#endif
6 changes: 3 additions & 3 deletions overrelaxation.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void overrel_sweep(){
{
ix=g_ipt[x0][x1][x2][x3];
for(mu=0;mu<4;mu++){
v=get_staples(ix,mu,g_gauge_field);
get_staples(&v,ix,mu,g_gauge_field);
flip_subgroup(ix,mu,v,1);
flip_subgroup(ix,mu,v,2);
flip_subgroup(ix,mu,v,3);
Expand All @@ -205,7 +205,7 @@ void overrel_sweep(){
{
ix=g_ipt[x0][x1][x2][x3];
for(mu=0;mu<4;mu++){
v=get_staples(ix,mu,g_gauge_field);
get_staples(&v,ix,mu,g_gauge_field);
flip_subgroup(ix,mu,v,1);
flip_subgroup(ix,mu,v,2);
flip_subgroup(ix,mu,v,3);
Expand All @@ -221,7 +221,7 @@ void overrel_sweep(){
static su3 v;
for(mu=0;mu<4;mu++){
for(ix=0;ix<VOLUME;ix++){
v=get_staples(ix,mu,g_gauge_field);
get_staples(&v,ix,mu,g_gauge_field);
flip_subgroup(ix,mu,v,1);
flip_subgroup(ix,mu,v,2);
flip_subgroup(ix,mu,v,3);
Expand Down
2 changes: 1 addition & 1 deletion sf_gauge_monomial.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void sf_gauge_derivative(const int id, hamiltonian_field_t * const hf) {
for(mu=0;mu<4;mu++) {
z=&hf->gaugefield[i][mu];
xm=&hf->derivative[i][mu];
v=get_staples(i,mu, hf->gaugefield);
get_staples(&v,i,mu, (const su3**) hf->gaugefield);
_su3_times_su3d(w,*z,v);
_trace_lambda_mul_add_assign((*xm), factor, w);

Expand Down

0 comments on commit 13b1e70

Please sign in to comment.