Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cuda_lab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
cuda_lab
Commits
f74ad2f6
Commit
f74ad2f6
authored
Mar 05, 2014
by
Ravikishore
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/gkernel/cuda_lab
parents
5dd8c027
c97f960e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
main
gaurav/1_Assign/ex5/main
+0
-0
main.cu
gaurav/1_Assign/ex5/main.cu
+7
-6
main.cu
gaurav/1_Assign/ex6/main.cu
+3
-3
No files found.
gaurav/1_Assign/ex5/main
deleted
100755 → 0
View file @
5dd8c027
File deleted
gaurav/1_Assign/ex5/main.cu
View file @
f74ad2f6
...
...
@@ -38,14 +38,15 @@ __device__ void gradImage(float* imgIn, float* forwardDiffX, float* forwardDiffY
int ix = threadIdx.x + blockDim.x * blockIdx.x;
int iy = threadIdx.y + blockDim.y * blockIdx.y;
imgOut[ix + (iy * w)] = 0;
float value = 0.;
for(int i = 0; i < nc; i++)
{
forwardDiffX[ix + (iy * w) + (i * w * h)] = (ix < (w-2)) ? (imgIn[ix + (iy * w) + (i * w * h) + 1] - imgIn[ix + (iy * w) + (i * w * h)]) : 0;
forwardDiffY[ix + (iy * w) + (i * w * h)] = (iy < (h-2)) ? (imgIn[ix + ((iy + 1) * w) + (i * w * h)] - imgIn[ix + (iy * w) + (i * w * h)]) : 0;
imgOut[ix + (iy * w)] += pow(forwardDiffX[ix + (iy * w) + (i * w * h)] , 2) + pow(forwardDiffY[ix + (iy * w) + (i * w * h)] , 2);
int idx = ix + iy*w + i*w*h;
forwardDiffX[idx] = (ix < (w-2)) ? (imgIn[idx + 1] - imgIn[idx]) : 0;
forwardDiffY[idx] = (iy < (h-2)) ? (imgIn[idx + w] - imgIn[idx]) : 0;
value += pow(forwardDiffX[idx] , 2) + pow(forwardDiffY[idx] , 2);
}
imgOut[ix + (iy * w)] = sqrt(
imgOut[ix + (iy * w)]
);
imgOut[ix + (iy * w)] = sqrt(
value
);
}
__global__ void callKernel(float* imgIn, float* forwardDiffX, float* forwardDiffY, float* imgOut, int w, int h, int nc)
...
...
gaurav/1_Assign/ex6/main.cu
View file @
f74ad2f6
...
...
@@ -29,7 +29,7 @@
using namespace std;
// uncomment to use the camera
#define CAMERA
//
#define CAMERA
#define USING_GPU
...
...
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
getParam("gray", gray, argc, argv);
cout << "gray: " << gray << endl;
float sigma =
0.5
;
float sigma =
2.0
;
getParam("sigma", sigma, argc, argv);
cout << "sigma = " << sigma << endl;
...
...
@@ -274,7 +274,7 @@ int main(int argc, char **argv)
size_t count = w * h * nc;
// Thread Dimensions
dim3 block = dim3(16,
4
, nc);
dim3 block = dim3(16,
8
, nc);
dim3 grid = dim3((w + block.x - 1) / block.x, (h + block.y - 1) / block.y, 1);
// Allocating memory on the device
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment