tmake sure dphi values are saved in output files - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
(HTM) git clone git://src.adamsgaard.dk/sphere
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 8384dea2ebcbf7f35b1557e37e298dca23be7948
(DIR) parent 3fb22ab2e5449c3004c500252975c65e9f4cd57a
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Fri, 7 Nov 2014 13:54:55 +0100
make sure dphi values are saved in output files
Diffstat:
M src/device.cu | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/src/device.cu b/src/device.cu
t@@ -2036,12 +2036,14 @@ __host__ void DEM::startTime()
}
// Zero all dphi values right after they are used in fluid
- // solution
- setDarcyZeros<Float> <<<dimGridFluid, dimBlockFluid>>>
- (dev_darcy_dphi);
- cudaThreadSynchronize();
- checkForCudaErrorsIter(
- "After setDarcyZeros(dev_darcy_dphi)", iter);
+ // solution, unless a file is written in this step.
+ if (filetimeclock < time.file_dt) {
+ setDarcyZeros<Float> <<<dimGridFluid, dimBlockFluid>>>
+ (dev_darcy_dphi);
+ cudaThreadSynchronize();
+ checkForCudaErrorsIter(
+ "After setDarcyZeros(dev_darcy_dphi)", iter);
+ }
if (PROFILING == 1)
startTimer(&kernel_tic);
t@@ -2184,6 +2186,14 @@ __host__ void DEM::startTime()
checkForCudaErrorsIter("After transferFromGlobalDeviceMemory()",
iter);
+ // Empty the dphi values after device to host transfer
+ setDarcyZeros<Float> <<<dimGridFluid, dimBlockFluid>>>
+ (dev_darcy_dphi);
+ cudaThreadSynchronize();
+ checkForCudaErrorsIter(
+ "After setDarcyZeros(dev_darcy_dphi) after transfer", iter);
+
+
// Pause the CPU thread until all CUDA calls previously issued are
// completed
cudaThreadSynchronize();