reverting flux bc changes

This commit is contained in:
James McClure 2019-05-20 20:37:50 -06:00
parent 79c2d2704c
commit 73c80fcbc7

View File

@ -2499,10 +2499,8 @@ extern "C" double ScaLBL_D3Q19_AAeven_Flux_BC_z(int *list, double *dist, double
// Allocate memory to store the sums // Allocate memory to store the sums
double din; double din;
double *sum; double sum[1];
double *dvcsum; double *dvcsum;
sum = new double [count];
//cudaMallocHost((void **)&sum,sizeof(double)*count);
cudaMalloc((void **)&dvcsum,sizeof(double)*count); cudaMalloc((void **)&dvcsum,sizeof(double)*count);
cudaMemset(dvcsum,0,sizeof(double)*count); cudaMemset(dvcsum,0,sizeof(double)*count);
int sharedBytes = 512*sizeof(double); int sharedBytes = 512*sizeof(double);
@ -2520,7 +2518,7 @@ extern "C" double ScaLBL_D3Q19_AAeven_Flux_BC_z(int *list, double *dist, double
} }
// Now read the total flux // Now read the total flux
cudaMemcpy(&sum,dvcsum,sizeof(double)*count,cudaMemcpyDeviceToHost); cudaMemcpy(&sum[0],dvcsum,sizeof(double),cudaMemcpyDeviceToHost);
din=sum[0]; din=sum[0];
err = cudaGetLastError(); err = cudaGetLastError();
if (cudaSuccess != err){ if (cudaSuccess != err){
@ -2545,10 +2543,8 @@ extern "C" double ScaLBL_D3Q19_AAodd_Flux_BC_z(int *neighborList, int *list, dou
// Allocate memory to store the sums // Allocate memory to store the sums
double din; double din;
double *sum; double sum[1];
double *dvcsum; double *dvcsum;
sum = new double [count];
//cudaMallocHost((void **)&sum,sizeof(double)*count);
cudaMalloc((void **)&dvcsum,sizeof(double)*count); cudaMalloc((void **)&dvcsum,sizeof(double)*count);
cudaMemset(dvcsum,0,sizeof(double)*count); cudaMemset(dvcsum,0,sizeof(double)*count);
int sharedBytes = 512*sizeof(double); int sharedBytes = 512*sizeof(double);
@ -2564,7 +2560,7 @@ extern "C" double ScaLBL_D3Q19_AAodd_Flux_BC_z(int *neighborList, int *list, dou
printf("CUDA error in ScaLBL_D3Q19_AAodd_Flux_BC_z (kernel): %s \n",cudaGetErrorString(err)); printf("CUDA error in ScaLBL_D3Q19_AAodd_Flux_BC_z (kernel): %s \n",cudaGetErrorString(err));
} }
// Now read the total flux // Now read the total flux
cudaMemcpy(&sum,dvcsum,sizeof(double)*count,cudaMemcpyDeviceToHost); cudaMemcpy(&sum[0],dvcsum,sizeof(double),cudaMemcpyDeviceToHost);
din=sum[0]; din=sum[0];
err = cudaGetLastError(); err = cudaGetLastError();
if (cudaSuccess != err){ if (cudaSuccess != err){
@ -2597,7 +2593,7 @@ extern "C" double ScaLBL_D3Q19_Flux_BC_Z(double *disteven, double *distodd, doub
dvc_D3Q19_Flux_BC_Z<<<GRID,512>>>(disteven, distodd, flux, dvcsum, Nx, Ny, Nz, outlet); dvc_D3Q19_Flux_BC_Z<<<GRID,512>>>(disteven, distodd, flux, dvcsum, Nx, Ny, Nz, outlet);
// Now read the total flux // Now read the total flux
cudaMemcpy(&sum[0],&dvcsum[0],sizeof(double),cudaMemcpyDeviceToHost); cudaMemcpy(&sum[0],dvcsum,sizeof(double),cudaMemcpyDeviceToHost);
// free the memory needed for reduction // free the memory needed for reduction