21simgrid.doxy 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012, 2013, 2014 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \page SimGridSupport SimGrid Support
  9. StarPU can use Simgrid in order to simulate execution on an arbitrary
  10. platform.
  11. \section Preparing your application for simulation.
  12. There are a few technical details which need to be handled for an application to
  13. be simulated through Simgrid.
  14. If the application uses <c>gettimeofday</c> to make its
  15. performance measurements, the real time will be used, which will be bogus. To
  16. get the simulated time, it has to use starpu_timing_now() which returns the
  17. virtual timestamp in us.
  18. For some technical reason, the application's .c file which contains main() has
  19. to be recompiled with starpu.h, which in the simgrid case will #define main()
  20. into starpu_main(), and it is libstarpu which will provide the real main() and
  21. call the application's main().
  22. \section Calibration Calibration
  23. The idea is to first compile StarPU normally, and run the application,
  24. so as to automatically benchmark the bus and the codelets.
  25. \verbatim
  26. $ ./configure && make
  27. $ STARPU_SCHED=dmda ./examples/matvecmult/matvecmult
  28. [starpu][_starpu_load_history_based_model] Warning: model matvecmult
  29. is not calibrated, forcing calibration for this run. Use the
  30. STARPU_CALIBRATE environment variable to control this.
  31. $ ...
  32. $ STARPU_SCHED=dmda ./examples/matvecmult/matvecmult
  33. TEST PASSED
  34. \endverbatim
  35. Note that we force to use the scheduler <c>dmda</c> to generate
  36. performance models for the application. The application may need to be
  37. run several times before the model is calibrated.
  38. \section Simulation Simulation
  39. Then, recompile StarPU, passing \ref enable-simgrid "--enable-simgrid"
  40. to <c>./configure</c>, and re-run the application:
  41. \verbatim
  42. $ ./configure --enable-simgrid && make
  43. $ STARPU_SCHED=dmda ./examples/matvecmult/matvecmult
  44. TEST FAILED !!!
  45. \endverbatim
  46. It is normal that the test fails: since the computation are not actually done
  47. (that is the whole point of simgrid), the result is wrong, of course.
  48. If the performance model is not calibrated enough, the following error
  49. message will be displayed
  50. \verbatim
  51. $ STARPU_SCHED=dmda ./examples/matvecmult/matvecmult
  52. [starpu][_starpu_load_history_based_model] Warning: model matvecmult
  53. is not calibrated, forcing calibration for this run. Use the
  54. STARPU_CALIBRATE environment variable to control this.
  55. [starpu][_starpu_simgrid_execute_job][assert failure] Codelet
  56. matvecmult does not have a perfmodel, or is not calibrated enough
  57. \endverbatim
  58. The number of devices can be chosen as usual with \ref STARPU_NCPU,
  59. \ref STARPU_NCUDA, and \ref STARPU_NOPENCL. For now, only the number of
  60. cpus can be arbitrarily chosen. The number of CUDA and OpenCL devices have to be
  61. lower than the real number on the current machine.
  62. The amount of simulated GPU memory is for now unbound by default, but
  63. it can be chosen by hand through the \ref STARPU_LIMIT_CUDA_MEM,
  64. \ref STARPU_LIMIT_CUDA_devid_MEM, \ref STARPU_LIMIT_OPENCL_MEM, and
  65. \ref STARPU_LIMIT_OPENCL_devid_MEM environment variables.
  66. The Simgrid default stack size is small; to increase it use the
  67. parameter <c>--cfg=contexts/stack_size</c>, for example:
  68. \verbatim
  69. $ ./example --cfg=contexts/stack_size:8192
  70. TEST FAILED !!!
  71. \endverbatim
  72. \section SimulationOnAnotherMachine Simulation On Another Machine
  73. The simgrid support even permits to perform simulations on another machine, your
  74. desktop, typically. To achieve this, one still needs to perform the Calibration
  75. step on the actual machine to be simulated, then copy them to your desktop
  76. machine (the <c>$STARPU_HOME/.starpu</c> directory). One can then perform the
  77. Simulation step on the desktop machine, by setting the environment
  78. variable \ref STARPU_HOSTNAME to the name of the actual machine, to
  79. make StarPU use the performance models of the simulated machine even
  80. on the desktop machine.
  81. If the desktop machine does not have CUDA or OpenCL, StarPU is still able to
  82. use simgrid to simulate execution with CUDA/OpenCL devices, but the application
  83. source code will probably disable the CUDA and OpenCL codelets in thatcd sc
  84. case. Since during simgrid execution, the functions of the codelet are actually
  85. not called, one can use dummy functions such as the following to still permit
  86. CUDA or OpenCL execution:
  87. \snippet simgrid.c To be included. You should update doxygen if you see this text.
  88. */