401_out_of_core.doxy 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. /*! \page OutOfCore Out Of Core
  17. \section Introduction Introduction
  18. When using StarPU, one may need to store more data than what the main memory
  19. (RAM) can store. This part describes the method to add a new memory node on a
  20. disk and to use it.
  21. The principle is that one first registers a disk location, seen by StarPU as
  22. a <c>void*</c>, which can be for instance a Unix path for the stdio, unistd or unistd_o_direct case,
  23. or a database file path for a leveldb case, etc. The disk backend opens this
  24. place with the plug method.
  25. If the disk backend provides an alloc method, StarPU can then start using it
  26. to allocate room and store data there with the write method, without user
  27. intervention.
  28. The user can also use starpu_disk_open() to explicitly open an object within the
  29. disk, e.g. a file name in the stdio or unistd cases, or a database key in the
  30. leveldb case, and then use <c>starpu_*_register</c> functions to turn it into a StarPU
  31. data handle. StarPU will then automatically read and write data as appropriate.
  32. \section UseANewDiskMemory Use a new disk memory
  33. To use a disk memory node, you have to register it with this function:
  34. \code{.c}
  35. int new_dd = starpu_disk_register(&starpu_disk_unistd_ops, (void *) "/tmp/", 1024*1024*200);
  36. \endcode
  37. Here, we use the unistd library to realize the read/write operations, i.e.
  38. fread/fwrite. This structure must have a path where to store files, as well as
  39. the maximum size the software can afford storing on the disk.
  40. Don't forget to check if the result is correct!
  41. This can also be achieved by just setting environment variables:
  42. \verbatim
  43. export STARPU_DISK_SWAP=/tmp
  44. export STARPU_DISK_SWAP_BACKEND=unistd
  45. export STARPU_DISK_SWAP_SIZE=200
  46. \endverbatim
  47. The backend can be set to stdio, unistd, unistd_o_direct, or leveldb.
  48. When the register function is called, StarPU will benchmark the disk. This can
  49. take some time.
  50. <strong>Warning: the size thus has to be at least \ref STARPU_DISK_SIZE_MIN bytes ! </strong>
  51. StarPU will automatically try to evict unused data to this new disk. One can
  52. also use the standard StarPU memory node API, see the \ref API_Standard_Memory_Library
  53. and the \ref API_Data_Interfaces .
  54. The disk is unregistered during the starpu_shutdown().
  55. \section DiskFunctions Disk functions
  56. There are various ways to operate a disk memory node, described by the structure
  57. starpu_disk_ops. For instance, the variable #starpu_disk_unistd_ops
  58. uses read/write functions.
  59. All structures are in \ref API_Out_Of_Core.
  60. \section ExampleDiskCopy Examples: disk_copy
  61. \snippet disk_copy.c To be included. You should update doxygen if you see this text.
  62. \section ExampleDiskCompute Examples: disk_compute
  63. \snippet disk_compute.c To be included. You should update doxygen if you see this text.
  64. */