void_interface.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012 INRIA
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include <starpu.h>
  17. #include "../test_interfaces.h"
  18. #include "../../../helper.h"
  19. static void fake_func(void *buffers[], void *arg)
  20. {
  21. (void) buffers;
  22. (void) arg;
  23. }
  24. static starpu_data_handle_t void_handle;
  25. static starpu_data_handle_t void2_handle;
  26. struct test_config void_config =
  27. {
  28. .cpu_func = fake_func,
  29. #ifdef STARPU_USE_CUDA
  30. .cuda_func = fake_func,
  31. #endif
  32. #ifdef STARPU_USE_OPENCL
  33. .opencl_func = fake_func,
  34. #endif
  35. .handle = &void_handle,
  36. .dummy_handle = &void2_handle,
  37. .copy_failed = 0,
  38. .name = "void_interface"
  39. };
  40. static void
  41. register_data(void)
  42. {
  43. starpu_void_data_register(&void_handle);
  44. starpu_void_data_register(&void2_handle);
  45. }
  46. static void
  47. unregister_data(void)
  48. {
  49. starpu_data_unregister(void_handle);
  50. starpu_data_unregister(void2_handle);
  51. }
  52. int
  53. main(void)
  54. {
  55. data_interface_test_summary *summary;
  56. struct starpu_conf conf;
  57. starpu_conf_init(&conf);
  58. conf.ncuda = 2;
  59. conf.nopencl = 1;
  60. if (starpu_init(&conf) == -ENODEV || starpu_cpu_worker_get_count() == 0)
  61. goto enodev;
  62. register_data();
  63. summary = run_tests(&void_config);
  64. if (!summary)
  65. exit(EXIT_FAILURE);
  66. unregister_data();
  67. starpu_shutdown();
  68. data_interface_test_summary_print(stderr, summary);
  69. return data_interface_test_summary_success(summary);
  70. enodev:
  71. return STARPU_TEST_SKIPPED;
  72. }