tRaytracer only calls cudaFree(linarr) when it has been allocated - sphere - GP… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 03f15c4126707713021223f8c2fb19d12a9329b2 | |
parent de937c7ef7b26ad0befaea97dab04c59075edd64 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 14 Nov 2012 14:15:39 +0100 | |
Raytracer only calls cudaFree(linarr) when it has been allocated | |
Diffstat: | |
M src/Makefile | 2 +- | |
M src/device.cu | 6 ++++-- | |
M src/main.cpp | 2 +- | |
M src/raytracer.cuh | 8 ++++++-- | |
4 files changed, 12 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/src/Makefile b/src/Makefile | |
t@@ -66,7 +66,7 @@ INCLUDES+=-I. -I$(SDKPATH)/shared/inc -I$(SDKPATH)/inc -I$(C… | |
LDFLAGS+=-L$(CUDA_INSTALL_PATH)/lib | |
LDFLAGS+=-L$(SDKPATH)/../../shared/lib -L$(SDKPATH)/../lib | |
LDFLAGS+=-lcutil_x86_64 -lcuda -lcudart | |
-LDFLAGS+=-fopenmp | |
+LDFLAGS+=-fopenmp | |
#all: $(CCFILES) $(CUFILES) $(EXECUTABLE) raytracer | |
all: $(CCFILES) $(CUFILES) $(EXECUTABLE) folders | |
diff --git a/src/device.cu b/src/device.cu | |
t@@ -41,6 +41,7 @@ __host__ void DEM::initializeGPU(void) | |
int cudaDriverVersion; | |
int cudaRuntimeVersion; | |
+ checkForCudaErrors("Before initializing CUDA device"); | |
// Register number of devices | |
cudaGetDeviceCount(&devicecount); | |
t@@ -72,9 +73,9 @@ __host__ void DEM::initializeGPU(void) | |
} | |
// Comment following line when using a system only containing exclusive mode… | |
- cudaChooseDevice(&cudadevice, &prop); | |
+ //cudaChooseDevice(&cudadevice, &prop); | |
- checkForCudaErrors("After initializing CUDA device"); | |
+ checkForCudaErrors("While initializing CUDA device"); | |
} | |
// Start timer for kernel profiling | |
t@@ -331,6 +332,7 @@ __host__ void DEM::freeGlobalDeviceMemory() | |
cudaFree(dev_walls_mvfd); | |
cudaFree(dev_walls_force_partial); | |
cudaFree(dev_walls_force_pp); | |
+ checkForCudaErrors("During cudaFree calls"); | |
if (verbose == 1) | |
printf("Done\n"); | |
diff --git a/src/main.cpp b/src/main.cpp | |
t@@ -19,7 +19,6 @@ | |
#include "datatypes.h" | |
#include "sphere.h" | |
- | |
////////////////// | |
// MAIN ROUTINE // | |
////////////////// | |
t@@ -128,6 +127,7 @@ int main(const int argc, const char *argv[]) | |
// Otherwise, start iterating through time | |
else | |
dem.startTime(); | |
+ | |
} | |
} | |
diff --git a/src/raytracer.cuh b/src/raytracer.cuh | |
t@@ -517,8 +517,12 @@ __host__ void DEM::render( | |
// Free dynamically allocated global device memory | |
rt_freeGlobalDeviceMemory(); | |
- delete[] linarr; | |
- cudaFree(dev_linarr); | |
+ checkForCudaErrors("after rt_freeGlobalDeviceMemory"); | |
+ if (transfer == 1) { | |
+ delete[] linarr; | |
+ cudaFree(dev_linarr); | |
+ checkForCudaErrors("When calling cudaFree(dev_linarr)"); | |
+ } | |
//cudaPrintfDisplay(stdout, true); | |