GPU Workshop Sample Code
 All Data Structures Namespaces Files Functions Variables Macros Pages
Functions
prefixScan.cu File Reference

This sample demonstrates code for performing prefix scans using CUDA. More...

#include "../include/mycuda.h"
#include "../include/mycuda_scan.h"

Go to the source code of this file.

Functions

template<typename T >
void show (T *x, T *x_gold, int first, int n)
 Utility function for showing some test results. More...
 
template<typename T >
int check (T *x, T *x_gold, int n, char *str)
 Verify that host and device results are identical. More...
 
int main ()
 Perform blockwise prefix scan. More...
 

Detailed Description

This sample demonstrates code for performing prefix scans using CUDA.

Definition in file prefixScan.cu.

Function Documentation

template<typename T >
int check ( T *  x,
T *  x_gold,
int  n,
char *  str 
)

Verify that host and device results are identical.

Parameters
x(in) Vector of CUDA results
x_gold(in) Vector of host results
n(in) Number of elements to show
str(in) Label indicating vector being tested

Definition at line 30 of file prefixScan.cu.

int main ( void  )

Perform blockwise prefix scan.

Notes

  • Each thread handles one element of vector.

Definition at line 55 of file prefixScan.cu.

template<typename T >
void show ( T *  x,
T *  x_gold,
int  first,
int  n 
)

Utility function for showing some test results.

Parameters
x(in) Vector of CUDA results
x_gold(in) Vector of host results
first(in) Index of first element to show
n(in) Number of elements to show

Definition at line 14 of file prefixScan.cu.