Conversion from C code to CudaC code I get unpredictable results
Posted
by
Abhi
on Stack Overflow
See other posts from Stack Overflow
or by Abhi
Published on 2014-06-07T11:14:39Z
Indexed on
2014/06/08
9:25 UTC
Read the original article
Hit count: 241
include
include
include
include
define pi 3.14159265359
lo*lo*p-2*mu,freq=2.25*1e6,wavelength=(long double)lo/freq,dh=(long double)wavelength/
30.0,dt=(long double)dh/(lo*1.5);
(1000*dh));
(p*dh),lambdaplus2mudtbydh=(lambda+2*mu)*dt/dh,lambdadtbydh=lambda*dt/dh,dtmubydh=dt*mu/
dh;
double**U,long double**V){
for(int k=0,l=0;k<=yno-1 && l<=yno;k++,l++){
U[i+1][l]+=dtbyrhodh*(X[i+1][l+1]-X[i+1][l]+Z[i+1][l]-
Z[i][l]);
[k+1]-Y[j][k+1]);
}
double**U,long double**V){
for(int k=0,l=0;k<=yno-1 && l<=yno;k++,l++){
U[i+1][k])+lambdadtbydh*(V[i+1][k+1]-V[i][k+1]);
V[i][k+1])+lambdadtbydh*(U[i+1][k+1]-U[i+1][k]);
U[j][l]);
int main(){
clock_t start,end;
long double time_taken;
start=clock();
long double **X,**Y,**U,**V,**Z;int n=1;
X=Make2DDoubleArray(xno+2,yno+2);
Y=Make2DDoubleArray(xno+2,yno+2);
Z=Make2DDoubleArray(xno+1,yno+1);
U=Make2DDoubleArray(xno+2,yno+2);
V=Make2DDoubleArray(xno+2,yno+2);
for (n=1;n<=timesteps;n++){
}
end=clock();
time_taken=(long double)(end-start)/CLOCKS_PER_SEC;
printf("Time elapsed is %Lf\nGRID Size:%Lf*%Lf\nTime Steps
Taken:%d\n",time_taken,(xno),floor(yno),n);
return 0;
}
© Stack Overflow or respective owner