Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDDD56
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathias Berggren
TDDD56
Commits
773e09c8
Commit
773e09c8
authored
5 years ago
by
matbe320
Browse files
Options
Downloads
Patches
Plain Diff
Lab5: Code cleanup
parent
4829349c
Branches
Lab5_2D-indexing
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Lab5/filter.cu
+4
-9
4 additions, 9 deletions
Lab5/filter.cu
with
4 additions
and
9 deletions
Lab5/filter.cu
+
4
−
9
View file @
773e09c8
...
...
@@ -39,18 +39,13 @@
#define maxKernelSizeX BLOCK_W
#define maxKernelSizeY BLOCK_H
//
#define
B
LOC
K_SIZE 16 // total number of threads per block = 256
// #define GRID_SIZE 8 // total number of blocks per grid = 256
#define LOC
AL_MEM_SIZE (FILTER_W * FILTER_H)
__global__
void
filter
(
unsigned
char
*
image
,
unsigned
char
*
out
,
const
unsigned
int
imagesizex
,
const
unsigned
int
imagesizey
,
const
int
kernelsizex
,
const
int
kernelsizey
)
{
__shared__
unsigned
char
local_memory
[
FILTER_W
*
FILTER_H
*
3
];
// __shared__ unsigned char local_memory[(BLOCK_W + RADIUS) * 3 * (BLOCK_H + RADIUS)];
// map from blockIdx to pixel position
unsigned
blockNumInGrid
=
blockIdx
.
x
+
gridDim
.
x
*
blockIdx
.
y
;
unsigned
threadNumInBlock
=
threadIdx
.
x
+
blockDim
.
x
*
threadIdx
.
y
;
unsigned
threadsPerBlock
=
blockDim
.
x
*
blockDim
.
y
;
__shared__
unsigned
char
local_memory
[
LOCAL_MEM_SIZE
*
3
];
int
x
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
int
y
=
blockIdx
.
y
*
blockDim
.
y
+
threadIdx
.
y
;
...
...
@@ -64,7 +59,7 @@ __global__ void filter(unsigned char *image, unsigned char *out, const unsigned
int
blockOffsetY
=
blockIdx
.
y
*
blockDim
.
y
;
/* Changed while loop here also, might need to include some stuff with - RADIUS here also */
while
((
block_y
*
FILTER_W
+
block_x
)
<
(
FILTER_W
*
FILTER_H
)
)
while
((
block_y
*
FILTER_W
+
block_x
)
<
LOCAL_MEM_SIZE
)
{
int
global_y
=
max
(
blockOffsetY
+
block_y
-
RADIUS
,
0
);
int
global_x
=
max
(
blockOffsetX
+
block_x
-
RADIUS
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment