A general C++ CUDA integration framework example I present a simple C++ integration

HI everybody,

I want to introduce you my little framework to manage CUDA in my C++ program.

And I hope I will motivate another person to help me to do the same with texture and cuda Array.

Here the following code I can use in a C++ program (It’s pleasant is’nt it !)

//--| Initialiaze Cuda librairie


	//--| Create a host and device memory interface

	cuda_lib::gpu_vector<float> device_mem;

	cuda_lib::cpu_vector<float> host_mem;

	//--| Allocate memory



	//--| Affect data to the cpu vector


	for(int i=0;i<10;++i)

  cout<<" "<<host_mem[i];



  //--| Transfert CPU data to GPU data


 //--| Test a little computation : (vector+=4)


 //--| Transfert GPU data to CPU data


 //--| Display the result :


  for(int i=0;i<10;++i)

  cout<<" "<<host_mem[i];


	catch(exception & e)


  cout<<endl<<"Exception : "<< e.what()<<endl;

  int i=0; cin>>i;



If you want take a look (attachments or link) :

go on : THe example code

I wait all your comment and some help to manage with succes a CPP framework to use texture (I have done some test but without success).

:w00t: Enjoy it.

I have try to respect cuda style (note the << and >> operator for the memory transfert)
Cuda.zip (24 KB)


Can’t believe I haven’t come across this before. That syntax looks very nice and Boost-like.

Any news of the project?

If you are interestes in something similar. We are developing a CUDA Template library at our institute. Everybody is welcome to share some ideas and collaborate. Therefore we started a SF project:

Best Regards,
Manuel Werlberger


The cudatemplate URL gets redirected to URL above and says “Invalid project”

ok? It doesn’t do that for me??


Invalid project for me too :( Looks like interesting work!

Ok. Strange.

You can go to http://www.gpu4vision.org . In the download section there is a link to the CUDA templates which links towards SF.

Also a search for cuda in SF brings up the link http://sourceforge.net/projects/cudatemplates/

If it still does not work, please post here again.

Best regards,