Porting of C++/STL/OpenMP code to C++/Thrust/OpenACC

Dear all,

I want to convert an existing code (C++, heavy use of STL containers, OpenMP, MPI) so that it can run on GPUs too. The code models wave propagation and uses a classic finite-difference time-domain implementation. My idea is to replace the STL containers with Thrust containers and to replace OpenMP with OpenACC. Using Thrust to replace STL was suggested to me during a (failed) submission to a Hackathon and I think it is a good idea too in case (in the future) I want to directly use CUDA.

So my questions are:

  1. do you agree that this is a good strategy? or not? (please explain why if you want)
  2. Do you have any suggestions/tips/best practices on how to successfully achieve this conversion?
  3. Do you have any material to recommend? (I already own and read the two OpenACC books)

Thanks a lot and do not hesitate to ask for info or clarification!

Hi filippo82,

I don’t have a lot of experience with moving a STL container based program to Thrust myself, but do believe it’s a good strategy.

I would suggest starting with the Thrust web page: https://developer.nvidia.com/thrust

There’s also a blog post on interoperability with OpenACC at https://devblogs.nvidia.com/3-versatile-openacc-interoperability-techniques/

-Mat