no_unregister.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012-2013 Inria
  4. * Copyright (C) 2010-2013,2015,2017 CNRS
  5. * Copyright (C) 2012,2014-2016 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. #include <starpu.h>
  19. #include <stdlib.h>
  20. #include <unistd.h>
  21. #include "../helper.h"
  22. /*
  23. * Check that not unregistering a data is not too crashy
  24. */
  25. void dummy_func(void ** buffers, void * args)
  26. {
  27. (void) buffers;
  28. (void) args;
  29. }
  30. static struct starpu_codelet dummy_cl =
  31. {
  32. .modes = { STARPU_RW },
  33. .cpu_funcs = { dummy_func },
  34. .cpu_funcs_name = { "dummy_func" },
  35. .nbuffers = 1
  36. };
  37. int main(void)
  38. {
  39. int ret;
  40. int buffer[1024];
  41. starpu_data_handle_t handle;
  42. struct starpu_task *t1,*t2;
  43. #ifdef STARPU_HAVE_VALGRIND_H
  44. if(RUNNING_ON_VALGRIND) return STARPU_TEST_SKIPPED;
  45. #endif
  46. #ifdef STARPU_SANITIZE_LEAK
  47. return STARPU_TEST_SKIPPED;
  48. #endif
  49. ret = starpu_init(NULL);
  50. if (ret == -ENODEV)
  51. return STARPU_TEST_SKIPPED;
  52. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  53. starpu_variable_data_register(&handle, STARPU_MAIN_RAM, (uintptr_t)buffer, 1024*sizeof(int));
  54. t1 = starpu_task_create();
  55. t2 = starpu_task_create();
  56. t2->cl = &dummy_cl;
  57. t2->detach = 0;
  58. t2->handles[0] = handle;
  59. starpu_task_declare_deps_array(t2, 1, &t1);
  60. ret = starpu_task_submit(t2);
  61. if (ret == -ENODEV)
  62. return STARPU_TEST_SKIPPED;
  63. STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
  64. ret = starpu_task_submit(t1);
  65. if (ret == -ENODEV)
  66. return STARPU_TEST_SKIPPED;
  67. STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
  68. ret = starpu_task_wait(t2);
  69. if (ret == -ENODEV)
  70. return STARPU_TEST_SKIPPED;
  71. STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
  72. starpu_shutdown();
  73. return EXIT_SUCCESS;
  74. }