data_interface.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  4. *
  5. * This program 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. * This program 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 <datawizard/datawizard.h>
  17. unsigned starpu_get_handle_interface_id(starpu_data_handle handle)
  18. {
  19. return handle->ops->interfaceid;
  20. }
  21. void *starpu_data_get_interface_on_node(starpu_data_handle handle, unsigned memory_node)
  22. {
  23. return handle->interface[memory_node];
  24. }
  25. void _starpu_register_data_handle(starpu_data_handle *handleptr, uint32_t home_node,
  26. void *interface,
  27. struct starpu_data_interface_ops_t *ops)
  28. {
  29. starpu_data_handle handle =
  30. starpu_data_state_create(ops);
  31. STARPU_ASSERT(handleptr);
  32. *handleptr = handle;
  33. /* fill the interface fields with the appropriate method */
  34. ops->register_data_handle(handle, home_node, interface);
  35. _starpu_register_new_data(handle, home_node, 0);
  36. }
  37. /* register data interface ? (do we need to register ?) descr = type enum, required to get an id ! */