starpu_disk.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. ssize_t (*read) (void *base, void *obj, void *buf, off_t offset, size_t size); /* ~= pread */
  25. ssize_t (*write) (void *base, void *obj, const void *buf, off_t offset, size_t size);
  26. /* readv, writev, read2d, write2d, etc. */
  27. void * (*plug) (void *parameter);
  28. void (*unplug) (void *base);
  29. 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);
  30. int (*bandwidth) (unsigned node);
  31. };
  32. /* Posix functions to use disk memory */
  33. extern struct starpu_disk_ops starpu_disk_stdio_ops;
  34. extern struct starpu_disk_ops starpu_disk_unistd_ops;
  35. extern struct starpu_disk_ops starpu_disk_unistd_o_direct_ops;
  36. /*functions to add an existing memory */
  37. void starpu_disk_close(unsigned node, void *obj, size_t size);
  38. void * starpu_disk_open(unsigned node, void *pos, size_t size);
  39. /* interface to create and to free a memory disk */
  40. int starpu_disk_register(struct starpu_disk_ops * func, void *parameter, size_t size);
  41. #endif /* __STARPU_DISK_H__ */