Code Monkey home page Code Monkey logo

project2-stream-compaction's Introduction

CUDA Stream Compaction

###University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 2

Ju Yang

Tested on: Windows 7, i7-4710MQ @ 2.50GHz 8GB, GTX 870M 6870MB (Hasee Notebook K770E-i7)

result

TODOs finished:

1. naive.cu

global void naive_sum(int n,int* odata, int* idata);

void scan(int n, int *odata, const int *idata);

2. efficient.cu

global void prescan(int *g_odata, int g_idata, int n, inttemp);

void scan(int n, int *odata, const int *idata);

int compact(int n, int *odata, const int *idata);

3 thrust.cu

void scan(int n, int *odata, const int *idata);

4 cpu.cu

void scan(int n, int *odata, const int *idata);

int compactWithoutScan(int n, int *odata, const int *idata) ;

int compactWithScan(int n, int *odata, const int *idata);

5 common.cu

global void kernMapToBoolean(int n, int *bools, const int *idata);

global void kernScatter(int n, int *odata, const int *idata, const int *bools, const int *indices);

Modified the main.cpp a little bit for display.

Performance Graph

Scanning

result

Thrust Scanning

result

Compact

result

Analysis

Thrust

As we can see, the thrust::exclusive_scan is rather time-costing compared with other methods. Even if I used device_vector to store the data, it is still the slowest. But since I did not free the device_vectors, the non-pow2 as second round's speed is much faster. I think the reason is, when calling thrust functions, it will apply for some blocks/threads inside the GPU, and will release later on. Although I tried my best to avoid any read/write from CPU to GPU, the scan function still cost some time to arrange for some place.

Unfixed Known Bugs

1. When using multiple blocks, sometimes the result is not right. I think it is because __syncthreads() doesn't sync blocks?

2. Since I used only 1 block, when the SIZE is more than 1024(which is the limit), apperently the result is wrong.

3. CPU performace is much better, and sometimes the calculating time doesn't always raise with the SIZE.

       I think this is because the SIZE is still not large enough? 

project2-stream-compaction's People

Contributors

kainino0x avatar 0v0v0 avatar immiao avatar shrekshao avatar pjcozzi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.