Commit 654c8934c91160c2a206f6950546ab93528b0c58
1 parent
685a889c
CUDA_CALLABLE fix and CUDA_UNCALLABLE implementation
Showing
3 changed files
with
10 additions
and
10 deletions
Show diff stats
stim/cuda/cudatools/callable.h
stim/math/vec3.h
@@ -243,9 +243,9 @@ public: | @@ -243,9 +243,9 @@ public: | ||
243 | return false; | 243 | return false; |
244 | } | 244 | } |
245 | 245 | ||
246 | -#ifndef __NVCC__ | 246 | +//#ifndef __CUDA_ARCH__ |
247 | /// Outputs the vector as a string | 247 | /// Outputs the vector as a string |
248 | - std::string str() const{ | 248 | +CUDA_UNCALLABLE std::string str() const{ |
249 | std::stringstream ss; | 249 | std::stringstream ss; |
250 | 250 | ||
251 | const size_t N = 3; | 251 | const size_t N = 3; |
@@ -261,7 +261,7 @@ public: | @@ -261,7 +261,7 @@ public: | ||
261 | 261 | ||
262 | return ss.str(); | 262 | return ss.str(); |
263 | } | 263 | } |
264 | -#endif | 264 | +//#endif |
265 | 265 | ||
266 | size_t size(){ return 3; } | 266 | size_t size(){ return 3; } |
267 | 267 |
stim/visualization/colormap.h
@@ -166,14 +166,12 @@ static void gpu2gpu(T* gpuSource, unsigned char* gpuDest, unsigned int nVals, T | @@ -166,14 +166,12 @@ static void gpu2gpu(T* gpuSource, unsigned char* gpuDest, unsigned int nVals, T | ||
166 | gridX = 65535; | 166 | gridX = 65535; |
167 | } | 167 | } |
168 | dim3 dimGrid(gridX, gridY); | 168 | dim3 dimGrid(gridX, gridY); |
169 | - //int gridDim = (nVals + blockDim - 1)/blockDim; | ||
170 | if(cm == cmGrayscale) | 169 | if(cm == cmGrayscale) |
171 | applyGrayscale<<<dimGrid, blockDim>>>(gpuSource, gpuDest, nVals, minVal, maxVal); | 170 | applyGrayscale<<<dimGrid, blockDim>>>(gpuSource, gpuDest, nVals, minVal, maxVal); |
172 | else if(cm == cmBrewer) | 171 | else if(cm == cmBrewer) |
173 | { | 172 | { |
174 | initBrewer(); | 173 | initBrewer(); |
175 | applyBrewer<<<dimGrid, blockDim>>>(gpuSource, gpuDest, nVals, minVal, maxVal); | 174 | applyBrewer<<<dimGrid, blockDim>>>(gpuSource, gpuDest, nVals, minVal, maxVal); |
176 | - //HANDLE_ERROR(cudaMemset(gpuDest, 0, sizeof(unsigned char) * nVals * 3)); | ||
177 | destroyBrewer(); | 175 | destroyBrewer(); |
178 | } | 176 | } |
179 | 177 | ||
@@ -190,13 +188,9 @@ static void gpu2cpu(T* gpuSource, unsigned char* cpuDest, unsigned int nVals, T | @@ -190,13 +188,9 @@ static void gpu2cpu(T* gpuSource, unsigned char* cpuDest, unsigned int nVals, T | ||
190 | unsigned char* gpuDest; | 188 | unsigned char* gpuDest; |
191 | HANDLE_ERROR(cudaMalloc( (void**)&gpuDest, sizeof(unsigned char) * nVals * 3 )); | 189 | HANDLE_ERROR(cudaMalloc( (void**)&gpuDest, sizeof(unsigned char) * nVals * 3 )); |
192 | 190 | ||
193 | - //HANDLE_ERROR(cudaMemset(gpuSource, 0, sizeof(T) * nVals)); | ||
194 | - | ||
195 | //create the image on the gpu | 191 | //create the image on the gpu |
196 | gpu2gpu(gpuSource, gpuDest, nVals, minVal, maxVal, cm); | 192 | gpu2gpu(gpuSource, gpuDest, nVals, minVal, maxVal, cm); |
197 | - | ||
198 | - //HANDLE_ERROR(cudaMemset(gpuDest, 0, sizeof(unsigned char) * nVals * 3)); | ||
199 | - | 193 | + |
200 | //copy the image from the GPU to the CPU | 194 | //copy the image from the GPU to the CPU |
201 | HANDLE_ERROR(cudaMemcpy(cpuDest, gpuDest, sizeof(unsigned char) * nVals * 3, cudaMemcpyDeviceToHost)); | 195 | HANDLE_ERROR(cudaMemcpy(cpuDest, gpuDest, sizeof(unsigned char) * nVals * 3, cudaMemcpyDeviceToHost)); |
202 | 196 |