starpu_disk.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 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 disk_ops starpu_disk_stdio_ops;
  34. /* interface to create and to free a memory disk */
  35. int starpu_disk_register(struct disk_ops * func, void *parameter, size_t size);
  36. void starpu_disk_unregister(unsigned node);
  37. #endif /* __STARPU_DISK_H__ */