test_interfaces.h 2.7 KB

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