starpu_disk.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013 Corentin Salingue
  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 __STARPU_DISK_H__
  17. #define __STARPU_DISK_H__
  18. #include <sys/types.h>
  19. /* list of functions to use on disk */
  20. struct starpu_disk_ops {
  21. void * (*alloc) (void *base, size_t size);
  22. void (*free) (void *base, void *obj, size_t size);
  23. void * (*open) (void *base, void *pos, size_t size); /* open an existing file */
  24. void (*close) (void *base, void *obj, size_t size);
  25. int (*read) (void *base, void *obj, void *buf, off_t offset, size_t size);
  26. int (*write) (void *base, void *obj, const void *buf, off_t offset, size_t size);
  27. void * (*async_write) (void *base, void *obj, void *buf, off_t offset, size_t size);
  28. void * (*async_read) (void *base, void *obj, void *buf, off_t offset, size_t size);
  29. /* readv, writev, read2d, write2d, etc. */
  30. void * (*plug) (void *parameter);
  31. void (*unplug) (void *base);
  32. void * (*copy) (void *base_src, void* obj_src, off_t offset_src, void *base_dst, void* obj_dst, off_t offset_dst, size_t size);
  33. int (*bandwidth) (unsigned node);
  34. void (*wait_request) (void * async_channel);
  35. int (*test_request) (void * async_channel);
  36. void (*free_request)(void * async_channel);
  37. int (*full_read) (unsigned node, void * base, void * obj, void ** ptr, size_t * size);
  38. int (*full_write) (unsigned node, void * base, void * obj, void * ptr, size_t size);
  39. };
  40. /* Posix functions to use disk memory */
  41. extern struct starpu_disk_ops starpu_disk_stdio_ops;
  42. extern struct starpu_disk_ops starpu_disk_unistd_ops;
  43. extern struct starpu_disk_ops starpu_disk_unistd_o_direct_ops;
  44. extern struct starpu_disk_ops starpu_disk_leveldb_ops;
  45. void starpu_disk_close(unsigned node, void *obj, size_t size);
  46. void *starpu_disk_open(unsigned node, void *pos, size_t size);
  47. int starpu_disk_register(struct starpu_disk_ops *func, void *parameter, size_t size);
  48. #endif /* __STARPU_DISK_H__ */