http://code.google.com/p/komrade/

Note: Komrade has been superseded by Thrust. Refer to the Thrust website for further details and changes since the final Komrade v0.9 release.


What is Komrade?

Komrade is a CUDA library of parallel algorithms with an interface resembling the C++ Standard Template Library (STL). Komrade provides a high-level interface for GPU programming while remaining both fast and flexible.

Examples

Komrade is best explained through examples. The following source code generates random numbers on the host and transfers them to the device where they are sorted.

#include <komrade/host_vector.h>
#include <komrade/device_vector.h>
#include <komrade/generate.h>
#include <komrade/sort.h>
#include <cstdlib>

int main(void)
{
  // generate random data on the host
  komrade::host_vector<int> h_vec(20);
  komrade::generate(h_vec.begin(), h_vec.end(), rand);

  // transfer to device and sort
  komrade::device_vector<int> d_vec = h_vec;
  komrade::sort(d_vec.begin(), d_vec.end());

  return 0;
}

This code sample computes the sum of 100 random numbers on the GPU.

#include <komrade/host_vector.h>
#include <komrade/device_vector.h>
#include <komrade/generate.h>
#include <komrade/reduce.h>
#include <komrade/functional.h>
#include <cstdlib>

int main(void)
{
  // generate random data on the host
  komrade::host_vector<int> h_vec(100);
  komrade::generate(h_vec.begin(), h_vec.end(), rand);

  // transfer to device and compute sum
  komrade::device_vector<int> d_vec = h_vec;
  int x = komrade::reduce(d_vec.begin(), d_vec.end(), komrade::plus<int>());
  return 0;
}

Refer to the Tutorial page for further information and examples.

Acknowledgments

We wish to thank the following people who have made important intellectual and/or software contributions to Komrade:

Additionally, we thank the compiler group at NVIDIA for their continued improvements to nvcc. In particular, we appreciate the work Bastiaan Aarts has done to enhance nvcc's C++ support.

Reply via email to