no_unregister.c 2.1 KB

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