Skip to content

Commit 3ca01bb

Browse files
committed
optimize occupancy
1 parent a1a7a57 commit 3ca01bb

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bool isSorted(int *arr, int size) {
1313
}
1414

1515
int main() {
16-
const int SIZE = 1024; // Must be a multiple of 32 for this example
16+
const int SIZE = 1048576; // Must be a multiple of 32 for this example
1717

1818
// Allocate and initialize host array
1919
int *h_arr = new int[SIZE];

smem_bitonic_sort.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ __global__ void smemBitonicSort(int *arr, int size) {
9999
}
100100

101101
void launchBitonicSort(int *arr, int size) {
102-
const int BLOCK_SIZE = 1024;
102+
const int BLOCK_SIZE = 512;
103103
smemBitonicSort<<<(size + BLOCK_SIZE - 1) / BLOCK_SIZE, BLOCK_SIZE,
104104
BLOCK_SIZE * sizeof(int)>>>(arr, size);
105105
}

warp_bitonic_sort.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ __global__ void warpBitonicSort(int *arr, int size) {
7777
}
7878

7979
void launchBitonicSort(int *arr, int size) {
80-
const int BLOCK_SIZE = 256;
80+
const int BLOCK_SIZE = 512;
8181
warpBitonicSort<<<size / BLOCK_SIZE, BLOCK_SIZE>>>(arr, size);
8282
}

0 commit comments

Comments
 (0)