Re: Questions on performance methods


Jonathan L Dubois (dubois@bec.physics.udel.edu)
Sat, 28 Nov 1998 14:28:39 -0500 (EST)


On Sat, 28 Nov 1998, Kazushige Goto wrote:

> Actually, sqrt routine is pretty "sparse" because of calculation
> dependencies. If it's possible to store temporary array in the lump,
> you may use my sqrtv(vectorlized sqrt) routine. This sqrtv routine is
> 5 times faster than normal sqrt routine. But you showed only kernel
> routine, so I do not know whether it's possible to be faster or not.
> In this case, it's important "how to call" r12 routine.
>
> So, you should show the routines which call r12 routine.

The loop which calls r12 is shown below.
N could be as large as 10000

int find_jastrow(double *result,int j,struct coord *q,double r[3],double b){
  int i;
  double rij;
  double tmp;

  tmp = 1.0;
  if(b>0){
    for(i=0;i < N;i++){
      if(i!=j){
        r12(&rij,q[i].x,r);
        if(rij > b){
          tmp *= (1.0 - b/rij);
        }
        else{
          *result = 0;
          return 0;
        }
      }
    }
  }
  *result = tmp;
  return 1;
}

void r12(double *rij,double *x1,double *x2){
int i;
double tmp1,tmp2;

  tmp2 = 0;
  for(i=0;i<3;i++){
    tmp1 = x1[i]-x2[i];
    tmp2 += tmp1*tmp1;
  }
  tmp2 = sqrt(tmp2);
  *rij = tmp2;
}

The only problem I foresee with doing all the sqrts in r12 at once is that
I occasionally get some computational savings when (rij <= b) The
probability of this occurring is usually fairly low but it increases with
N and is not easily predicted ahead of time. It will also probably
require some restructuring since q[i] is an array of structures which
contain information other than the 3vectors of interest here.

Jonathan DuBois



This archive was generated by hypermail 2.0b3 on Sun Nov 29 1998 - 08:32:29 EST