401_out_of_core.doxy 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2014,2016-2017 CNRS
  4. * Copyright (C) 2013 Inria
  5. * Copyright (C) 2013-2014,2017 Université de Bordeaux
  6. * Copyright (C) 2013 Corentin Salingue
  7. *
  8. * StarPU is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation; either version 2.1 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * StarPU is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. *
  17. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  18. */
  19. /*! \page OutOfCore Out Of Core
  20. \section Introduction Introduction
  21. When using StarPU, one may need to store more data than what the main memory
  22. (RAM) can store. This part describes the method to add a new memory node on a
  23. disk and to use it.
  24. The principle is that one first registers a disk location, seen by StarPU as
  25. a <c>void*</c>, which can be for instance a Unix path for the stdio, unistd or unistd_o_direct case,
  26. or a database file path for a leveldb case, etc. The disk backend opens this
  27. place with the plug method.
  28. If the disk backend provides an alloc method, StarPU can then start using it
  29. to allocate room and store data there with the write method, without user
  30. intervention.
  31. The user can also use starpu_disk_open() to explicitly open an object within the
  32. disk, e.g. a file name in the stdio or unistd cases, or a database key in the
  33. leveldb case, and then use <c>starpu_*_register</c> functions to turn it into a StarPU
  34. data handle. StarPU will then automatically read and write data as appropriate.
  35. \section UseANewDiskMemory Use a new disk memory
  36. To use a disk memory node, you have to register it with this function:
  37. \code{.c}
  38. int new_dd = starpu_disk_register(&starpu_disk_unistd_ops, (void *) "/tmp/", 1024*1024*200);
  39. \endcode
  40. Here, we use the unistd library to realize the read/write operations, i.e.
  41. fread/fwrite. This structure must have a path where to store files, as well as
  42. the maximum size the software can afford storing on the disk.
  43. Don't forget to check if the result is correct!
  44. This can also be achieved by just setting environment variables:
  45. \verbatim
  46. export STARPU_DISK_SWAP=/tmp
  47. export STARPU_DISK_SWAP_BACKEND=unistd
  48. export STARPU_DISK_SWAP_SIZE=200
  49. \endverbatim
  50. The backend can be set to stdio, unistd, unistd_o_direct, or leveldb.
  51. When the register function is called, StarPU will benchmark the disk. This can
  52. take some time.
  53. <strong>Warning: the size thus has to be at least \ref STARPU_DISK_SIZE_MIN bytes ! </strong>
  54. StarPU will automatically try to evict unused data to this new disk. One can
  55. also use the standard StarPU memory node API, see the \ref API_Standard_Memory_Library
  56. and the \ref API_Data_Interfaces .
  57. The disk is unregistered during the starpu_shutdown().
  58. \section DiskFunctions Disk functions
  59. There are various ways to operate a disk memory node, described by the structure
  60. starpu_disk_ops. For instance, the variable #starpu_disk_unistd_ops
  61. uses read/write functions.
  62. All structures are in \ref API_Out_Of_Core.
  63. \section ExampleDiskCopy Examples: disk_copy
  64. \snippet disk_copy.c To be included. You should update doxygen if you see this text.
  65. \section ExampleDiskCompute Examples: disk_compute
  66. \snippet disk_compute.c To be included. You should update doxygen if you see this text.
  67. */