2014-02-01から1ヶ月間の記事一覧

CUDA kernel return value shortcut

CUDA の kernel 関数からの戻り値を毎回 cudaMemcpy したくない時につかう template<class T> class CudaValue { private: T* ptr; public: CudaValue() { cudaMalloc(&ptr, sizeof(T)); } ~CudaValue() { cudaFree(ptr); } operator T() { T ret; cudaMemcpy(&ret, p</class>…

python & CUDA Integration

This template would be greatly helpful to whoever want to integrate python and cpptest.cu #include <iostream> namespace test { namespace cuda { extern "C" void hello() { std::cout << "Hello" << std::endl; } }} test.cpp #include <boost/python.hpp> #include <numpy/arrayobject.h> using name</numpy/arrayobject.h></boost/python.hpp></iostream>…