void_interface.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), 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. 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 = SUCCESS,
  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 main(int argc, char **argv)
  53. {
  54. struct data_interface_test_summary summary;
  55. struct starpu_conf conf;
  56. starpu_conf_init(&conf);
  57. conf.ncuda = 2;
  58. conf.nopencl = 1;
  59. int ret = starpu_initialize(&conf, &argc, &argv);
  60. if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
  61. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  62. if(starpu_cpu_worker_get_count() == 0)
  63. {
  64. starpu_shutdown();
  65. return STARPU_TEST_SKIPPED;
  66. }
  67. register_data();
  68. run_tests(&void_config, &summary);
  69. unregister_data();
  70. starpu_shutdown();
  71. data_interface_test_summary_print(stderr, &summary);
  72. return data_interface_test_summary_success(&summary);
  73. enodev:
  74. return STARPU_TEST_SKIPPED;
  75. }