test_interfaces.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011,2012 Inria
  4. * Copyright (C) 2011,2012,2015,2017,2019 CNRS
  5. * Copyright (C) 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. #ifndef TEST_INTERFACES_H
  19. #define TEST_INTERFACES_H
  20. #include "../../helper.h"
  21. /*
  22. * Users do not know about this enum. They only know that SUCCESS is 0, and
  23. * FAILURE is 1. Therefore, the values of SUCCESS and FAILURE shall not be
  24. * changed.
  25. */
  26. enum exit_code
  27. {
  28. SUCCESS = 0,
  29. FAILURE = 1,
  30. UNTESTED = 2,
  31. NO_DEVICE = 3,
  32. TASK_SUBMISSION_FAILURE = 4
  33. };
  34. struct test_config
  35. {
  36. /** we use pointers as we want to allow static initializations in the main application */
  37. /* A pointer to a registered handle */
  38. starpu_data_handle_t *handle;
  39. /* A pointer to a registered handle, that will be used to test
  40. * RAM to RAM copy. The values it points to should be different from
  41. * the ones pointed to by the previous handle. */
  42. starpu_data_handle_t *dummy_handle;
  43. /* StarPU codelets. The following functions should :
  44. * 1) Check that the values are correct
  45. * 2) Negate every element
  46. */
  47. starpu_cpu_func_t cpu_func;
  48. starpu_cuda_func_t cuda_func;
  49. starpu_opencl_func_t opencl_func;
  50. char *cpu_func_name;
  51. /* The previous codelets must update this field at the end of their
  52. * execution. copy_failed must be FAILURE if the copy failed, SUCCESS otherwise. */
  53. enum exit_code copy_failed;
  54. /* A human-readable name for the test */
  55. const char *name;
  56. };
  57. struct data_interface_test_summary
  58. {
  59. int success;
  60. /* Copy methods */
  61. int cpu_to_cpu;
  62. int cpu_to_cuda;
  63. int cuda_to_cuda;
  64. int cuda_to_cpu;
  65. int cpu_to_cuda_async;
  66. int cuda_to_cpu_async;
  67. int cuda_to_cuda_async;
  68. int cpu_to_opencl;
  69. int opencl_to_cpu;
  70. int cpu_to_opencl_async;
  71. int opencl_to_cpu_async;
  72. int cpu_to_mic;
  73. int mic_to_cpu;
  74. int cpu_to_mic_async;
  75. int mic_to_cpu_async;
  76. /* Other stuff */
  77. int compare;
  78. int to_pointer;
  79. int pointer_is_inside;
  80. int pack;
  81. };
  82. void data_interface_test_summary_print(FILE *f, struct data_interface_test_summary *summary);
  83. int data_interface_test_summary_success(struct data_interface_test_summary *summary);
  84. void run_tests(struct test_config*, struct data_interface_test_summary *summary);
  85. #endif /* !TEST_INTERFACES_H */