file2.cu 537 B

12345678910111213141516171819202122232425
  1. #include "file2.h"
  2. result_type __device__ file1_func(int x);
  3. result_type_dynamic __device__ file2_func(int x)
  4. {
  5. const result_type r = file1_func(x);
  6. const result_type_dynamic rd{ r.input, r.sum, true };
  7. return rd;
  8. }
  9. static __global__ void file2_kernel(result_type_dynamic& r, int x)
  10. {
  11. // call static_func which is a method that is defined in the
  12. // static library that is always out of date
  13. r = file2_func(x);
  14. }
  15. int file2_launch_kernel(int x)
  16. {
  17. result_type_dynamic r;
  18. file2_kernel<<<1, 1>>>(r, x);
  19. return r.sum;
  20. }