void_interface.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. 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. #ifdef STARPU_USE_MIC
  36. .cpu_func_name = "fake_func",
  37. #endif
  38. .handle = &void_handle,
  39. .dummy_handle = &void2_handle,
  40. .copy_failed = SUCCESS,
  41. .name = "void_interface"
  42. };
  43. static void
  44. register_data(void)
  45. {
  46. starpu_void_data_register(&void_handle);
  47. starpu_void_data_register(&void2_handle);
  48. }
  49. static void
  50. unregister_data(void)
  51. {
  52. starpu_data_unregister(void_handle);
  53. starpu_data_unregister(void2_handle);
  54. }
  55. int
  56. main(int argc, char **argv)
  57. {
  58. data_interface_test_summary *summary;
  59. struct starpu_conf conf;
  60. starpu_conf_init(&conf);
  61. conf.ncuda = 2;
  62. conf.nopencl = 1;
  63. conf.nmic = -1;
  64. if (starpu_initialize(&conf, &argc, &argv) == -ENODEV || starpu_cpu_worker_get_count() == 0)
  65. goto enodev;
  66. register_data();
  67. summary = run_tests(&void_config);
  68. if (!summary)
  69. exit(EXIT_FAILURE);
  70. unregister_data();
  71. starpu_shutdown();
  72. data_interface_test_summary_print(stderr, summary);
  73. return data_interface_test_summary_success(summary);
  74. enodev:
  75. return STARPU_TEST_SKIPPED;
  76. }