Minor performance optimizations for lbpm_color_simulator
This commit is contained in:
parent
443d4c9e91
commit
6dd8708204
@ -244,14 +244,12 @@ int main(int argc, char **argv)
|
|||||||
fwrite(Dm.id,1,Nx*Ny*Nz,OUTFILE);
|
fwrite(Dm.id,1,Nx*Ny*Nz,OUTFILE);
|
||||||
fclose(OUTFILE);
|
fclose(OUTFILE);
|
||||||
|
|
||||||
FILE *OUTFILE;
|
|
||||||
OUTFILE = fopen("Phase.dat","wb");
|
OUTFILE = fopen("Phase.dat","wb");
|
||||||
fwrite(Phase,8,Nx*Ny*Nz,OUTFILE);
|
fwrite(Phase.get(),8,Nx*Ny*Nz,OUTFILE);
|
||||||
fclose(OUTFILE);
|
fclose(OUTFILE);
|
||||||
|
|
||||||
FILE *OUTFILE;
|
|
||||||
OUTFILE = fopen("SignDist.dat","wb");
|
OUTFILE = fopen("SignDist.dat","wb");
|
||||||
fwrite(SignDist,8,Nx*Ny*Nz,OUTFILE);
|
fwrite(SignDist.get(),8,Nx*Ny*Nz,OUTFILE);
|
||||||
fclose(OUTFILE);
|
fclose(OUTFILE);
|
||||||
|
|
||||||
|
|
||||||
|
@ -871,7 +871,10 @@ int main(int argc, char **argv)
|
|||||||
run_analysis(timestep,RESTART_INTERVAL,rank_info,*Averages,last_ids,last_index,last_id_map,
|
run_analysis(timestep,RESTART_INTERVAL,rank_info,*Averages,last_ids,last_index,last_id_map,
|
||||||
Nx,Ny,Nz,pBC,beta,err,Phi,Pressure,Velocity,ID,f_even,f_odd,Den,
|
Nx,Ny,Nz,pBC,beta,err,Phi,Pressure,Velocity,ID,f_even,f_odd,Den,
|
||||||
LocalRestartFile,meshData,fillData,tpool,work_ids);
|
LocalRestartFile,meshData,fillData,tpool,work_ids);
|
||||||
PROFILE_SAVE("lbpm_color_simulator",false);
|
|
||||||
|
// Save the timers
|
||||||
|
if ( timestep%50==0 )
|
||||||
|
PROFILE_SAVE("lbpm_color_simulator",1);
|
||||||
}
|
}
|
||||||
tpool.wait_pool_finished();
|
tpool.wait_pool_finished();
|
||||||
PROFILE_STOP("Loop");
|
PROFILE_STOP("Loop");
|
||||||
|
@ -200,7 +200,6 @@ public:
|
|||||||
Averages.PrintComponents(timestep);
|
Averages.PrintComponents(timestep);
|
||||||
PROFILE_STOP("Compute dist",1);
|
PROFILE_STOP("Compute dist",1);
|
||||||
}
|
}
|
||||||
PROFILE_SAVE("lbpm_color_simulator",false);
|
|
||||||
ThreadPool::WorkItem::d_state = 2; // Change state to finished
|
ThreadPool::WorkItem::d_state = 2; // Change state to finished
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@ -290,16 +289,16 @@ void run_analysis( int timestep, int restart_interval,
|
|||||||
if ( (type&CopyAverages) != 0 ) {
|
if ( (type&CopyAverages) != 0 ) {
|
||||||
// Copy the members of Averages to the cpu (phase was copied above)
|
// Copy the members of Averages to the cpu (phase was copied above)
|
||||||
// Wait
|
// Wait
|
||||||
|
PROFILE_START("Copy-Pressure",1);
|
||||||
|
ComputePressureD3Q19(ID,f_even,f_odd,Pressure,Nx,Ny,Nz);
|
||||||
|
DeviceBarrier();
|
||||||
|
PROFILE_STOP("Copy-Pressure",1);
|
||||||
PROFILE_START("Copy-Wait",1);
|
PROFILE_START("Copy-Wait",1);
|
||||||
tpool.wait(wait.analysis);
|
tpool.wait(wait.analysis);
|
||||||
tpool.wait(wait.vis); // Make sure we are done using analysis before modifying
|
tpool.wait(wait.vis); // Make sure we are done using analysis before modifying
|
||||||
PROFILE_STOP("Copy-Wait",1);
|
PROFILE_STOP("Copy-Wait",1);
|
||||||
PROFILE_START("Copy-Pressure",1);
|
|
||||||
ComputePressureD3Q19(ID,f_even,f_odd,Pressure,Nx,Ny,Nz);
|
|
||||||
memcpy(Averages.Phase.get(),phase->get(),N*sizeof(double));
|
|
||||||
DeviceBarrier();
|
|
||||||
PROFILE_STOP("Copy-Pressure",1);
|
|
||||||
PROFILE_START("Copy-Averages",1);
|
PROFILE_START("Copy-Averages",1);
|
||||||
|
memcpy(Averages.Phase.get(),phase->get(),N*sizeof(double));
|
||||||
CopyToHost(Averages.Press.get(),Pressure,N*sizeof(double));
|
CopyToHost(Averages.Press.get(),Pressure,N*sizeof(double));
|
||||||
CopyToHost(Averages.Vel_x.get(),&Velocity[0],N*sizeof(double));
|
CopyToHost(Averages.Vel_x.get(),&Velocity[0],N*sizeof(double));
|
||||||
CopyToHost(Averages.Vel_y.get(),&Velocity[N],N*sizeof(double));
|
CopyToHost(Averages.Vel_y.get(),&Velocity[N],N*sizeof(double));
|
||||||
|
Loading…
Reference in New Issue
Block a user