void_interface.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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
  20. void fake_func(void *buffers[], void *arg)
  21. {
  22. (void) buffers;
  23. (void) arg;
  24. }
  25. static starpu_data_handle_t void_handle;
  26. static starpu_data_handle_t void2_handle;
  27. struct test_config void_config =
  28. {
  29. .cpu_func = fake_func,
  30. #ifdef STARPU_USE_CUDA
  31. .cuda_func = fake_func,
  32. #endif
  33. #ifdef STARPU_USE_OPENCL
  34. .opencl_func = fake_func,
  35. #endif
  36. #ifdef STARPU_USE_MIC
  37. .cpu_func_name = "fake_func",
  38. #endif
  39. .handle = &void_handle,
  40. .dummy_handle = &void2_handle,
  41. .copy_failed = SUCCESS,
  42. .name = "void_interface"
  43. };
  44. static void
  45. register_data(void)
  46. {
  47. starpu_void_data_register(&void_handle);
  48. starpu_void_data_register(&void2_handle);
  49. }
  50. static void
  51. unregister_data(void)
  52. {
  53. starpu_data_unregister(void_handle);
  54. starpu_data_unregister(void2_handle);
  55. }
  56. int
  57. main(int argc, char **argv)
  58. {
  59. 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. summary = run_tests(&void_config);
  69. if (!summary)
  70. exit(EXIT_FAILURE);
  71. unregister_data();
  72. starpu_shutdown();
  73. data_interface_test_summary_print(stderr, summary);
  74. return data_interface_test_summary_success(summary);
  75. enodev:
  76. return STARPU_TEST_SKIPPED;
  77. }