15out_of_core.doxy 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2013 Corentin Salingue
  4. * See the file version.doxy for copying conditions.
  5. */
  6. /*! \page OutOfCore Out Of Core
  7. \section Introduction Introduction
  8. When using StarPU, one may need to store more data than what the main memory
  9. (RAM) can store. This part describes the method to add a new memory node on a
  10. disk and to use it.
  11. The principle is that one first registers a disk location, seen by StarPU as
  12. a void*, which can be for instance a Unix path for the stdio or unistd case,
  13. or a database file path for a leveldb case, etc. The disk backend opens this
  14. place with the plug method.
  15. If the disk backend provides an alloc method, StarPU can then start using it
  16. to allocate room and store data there with the write method, without user
  17. intervention.
  18. The user can also use starpu_disk_open to explicitly open an object within the
  19. disk, e.g. a file name in the stdio or unistd cases, or a database key in the
  20. leveldb case, and then use starpu_*_register functions to turn it into a StarPU
  21. data handle. StarPU will then automatically read and write data as appropriate.
  22. \section UseANewDiskMemory Use a new disk memory
  23. To use a disk memory node, you have to register it with this function:
  24. \code{.c}
  25. int new_dd = starpu_disk_register(&starpu_disk_stdio_ops, (void *) "/tmp/", 1024*1024*200);
  26. \endcode
  27. Here, we use the stdio library to realize the read/write operations, i.e.
  28. fread/fwrite. This structure must have a path where to store files, as well as
  29. the maximum size the software can afford storing on the disk.
  30. Don't forget to check if the result is correct!
  31. When the register function is called, StarPU will benchmark the disk. This can
  32. take some time.
  33. <strong>Warning: the size thus has to be at least 1 MB!</strong>
  34. StarPU will automatically try to evict unused data to this new disk. One can
  35. also use the standard StarPU memory node API, see the \ref API_Standard_Memory_Library
  36. and the \ref API_Data_Interfaces .
  37. The disk is unregistered during the starpu_shutdown().
  38. \section DiskFunctions Disk functions
  39. There are various ways to operate a disk memory node, described by the structure
  40. starpu_disk_ops. For instance, the variable #starpu_disk_stdio_ops
  41. uses fread/fwrite functions.
  42. All structures are in \ref API_Out_Of_Core .
  43. \section ExampleDiskCopy Examples: disk_copy
  44. \snippet disk_copy.c To be included. You should update doxygen if you see this text.
  45. \section ExampleDiskCompute Examples: disk_compute
  46. \snippet disk_compute.c To be included. You should update doxygen if you see this text.
  47. */