disk.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2013 Corentin Salingue
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #ifndef __DISK_H__
  18. #define __DISK_H__
  19. /** @file */
  20. #define STARPU_DISK_ALL 1
  21. #define STARPU_DISK_NO_RECLAIM 2
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26. #include <datawizard/copy_driver.h>
  27. #include <datawizard/malloc.h>
  28. /** interface to manipulate memory disk */
  29. void * _starpu_disk_alloc (unsigned node, size_t size) STARPU_ATTRIBUTE_MALLOC;
  30. void _starpu_disk_free (unsigned node, void *obj, size_t size);
  31. /** src_node is a disk node, dst_node is for the moment the STARPU_MAIN_RAM */
  32. int _starpu_disk_read(unsigned src_node, unsigned dst_node, void *obj, void *buf, off_t offset, size_t size, struct _starpu_async_channel * async_channel);
  33. /** src_node is for the moment the STARU_MAIN_RAM, dst_node is a disk node */
  34. int _starpu_disk_write(unsigned src_node, unsigned dst_node, void *obj, void *buf, off_t offset, size_t size, struct _starpu_async_channel * async_channel);
  35. int _starpu_disk_full_read(unsigned src_node, unsigned dst_node, void * obj, void ** ptr, size_t * size, struct _starpu_async_channel * async_channel);
  36. int _starpu_disk_full_write(unsigned src_node, unsigned dst_node, void * obj, void * ptr, size_t size, struct _starpu_async_channel * async_channel);
  37. int _starpu_disk_copy(unsigned node_src, void* obj_src, off_t offset_src, unsigned node_dst, void* obj_dst, off_t offset_dst, size_t size, struct _starpu_async_channel * async_channel);
  38. /** force the request to compute */
  39. void starpu_disk_wait_request(struct _starpu_async_channel *async_channel);
  40. /** return 1 if the request is finished, 0 if not finished */
  41. int starpu_disk_test_request(struct _starpu_async_channel *async_channel);
  42. void starpu_disk_free_request(struct _starpu_async_channel *async_channel);
  43. /** interface to compare memory disk */
  44. int _starpu_disk_can_copy(unsigned node1, unsigned node2);
  45. /** change disk flag */
  46. void _starpu_set_disk_flag(unsigned node, int flag);
  47. int _starpu_get_disk_flag(unsigned node);
  48. /** unregister disk */
  49. void _starpu_disk_unregister(void);
  50. void _starpu_swap_init(void);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* __DISK_H__ */