#include #include "test_class.h" #pragma acc routine seq void set_test_num(const float test_num); #pragma acc routine seq void print_test_num(); class TestExecutable { public: TestExecutable(); ~TestExecutable(); void do_something(); private: TestClass test_class_; }; TestExecutable::TestExecutable() { const float test_num = 10.0f; test_class_ = TestClass(test_num); #pragma acc enter data copyin(this) } TestExecutable::~TestExecutable() { #pragma acc exit data delete(this) } #pragma acc routine seq void TestExecutable::do_something() { const float test_num = 20.0f; test_class_.set_test_num(test_num); test_class_.print_test_num(); } int main() { TestExecutable test_executable; test_executable; #pragma acc parallel { test_executable.do_something(); } return 0; }