void_interface.c 2.2 KB

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