15out_of_core.doxy 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_unistd_ops, (void *) "/tmp/", 1024*1024*200);
  26. \endcode
  27. Here, we use the unistd 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. This can also be achieved by just setting environment variables:
  32. \verbatim
  33. export STARPU_DISK_SWAP=/tmp
  34. export STARPU_DISK_SWAP_BACKEND=unistd
  35. export STARPU_DISK_SWAP_SIZE=$((200*1024*1024))
  36. \endverbatim
  37. When the register function is called, StarPU will benchmark the disk. This can
  38. take some time.
  39. <strong>Warning: the size thus has to be at least 1 MB!</strong>
  40. StarPU will automatically try to evict unused data to this new disk. One can
  41. also use the standard StarPU memory node API, see the \ref API_Standard_Memory_Library
  42. and the \ref API_Data_Interfaces .
  43. The disk is unregistered during the starpu_shutdown().
  44. \section DiskFunctions Disk functions
  45. There are various ways to operate a disk memory node, described by the structure
  46. starpu_disk_ops. For instance, the variable #starpu_disk_unistd_ops
  47. uses read/write functions.
  48. All structures are in \ref API_Out_Of_Core .
  49. \section ExampleDiskCopy Examples: disk_copy
  50. \snippet disk_copy.c To be included. You should update doxygen if you see this text.
  51. \section ExampleDiskCompute Examples: disk_compute
  52. \snippet disk_compute.c To be included. You should update doxygen if you see this text.
  53. */