starpu_disk.h 2.5 KB

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