void_interface.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. {
  58. .ncpus = -1,
  59. .ncuda = 2,
  60. .nopencl = 1
  61. };
  62. if (starpu_init(&conf) == -ENODEV)
  63. goto enodev;
  64. register_data();
  65. summary = run_tests(&void_config);
  66. if (!summary)
  67. exit(EXIT_FAILURE);
  68. unregister_data();
  69. starpu_shutdown();
  70. data_interface_test_summary_print(stderr, summary);
  71. return data_interface_test_summary_success(summary);
  72. enodev:
  73. return STARPU_TEST_SKIPPED;
  74. }