430_mic_scc_support.doxy 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2017, 2019 CNRS
  4. * Copyright (C) 2011,2012,2016 Inria
  5. * Copyright (C) 2009-2011,2013-2016 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. /*! \page MICSCCSupport MIC Xeon Phi / SCC Support
  19. \section Compilation Compilation
  20. SCC support just needs the presence of the RCCE library.
  21. MIC Xeon Phi support actually needs two compilations of StarPU, one for the host and one for
  22. the device. The <c>PATH</c> environment variable has to include the path to the
  23. cross-compilation toolchain, for instance <c>/usr/linux-k1om-4.7/bin</c> .
  24. The <c>SINK_PKG_CONFIG_PATH</c> environment variable should include the path to the
  25. cross-compiled <c>hwloc.pc</c>.
  26. The script <c>mic-configure</c> can then be used to achieve the two compilations: it basically
  27. calls <c>configure</c> as appropriate from two new directories: <c>build_mic</c> and
  28. <c>build_host</c>. <c>make</c> and <c>make install</c> can then be used as usual and will
  29. recurse into both directories. If different \c configure options are needed
  30. for the host and for the mic, one can use <c>--with-host-param=--with-fxt</c>
  31. for instance to specify the <c>--with-fxt</c> option for the host only, or
  32. <c>--with-mic-param=--with-fxt</c> for the mic only.
  33. One can also run StarPU just natively on the Xeon Phi, i.e. it will only run
  34. directly on the Phi without any exchange with the host CPU. The binaries in
  35. <c>build_mic</c> can be run that way.
  36. For MPI support, you will probably have to specify different MPI compiler path
  37. or option for the host and the device builds, for instance:
  38. \verbatim
  39. ./mic-configure --with-mic-param=--with-mpicc="/.../mpiicc -mmic" \
  40. --with-host-param=--with-mpicc=/.../mpiicc
  41. \endverbatim
  42. In case you have troubles with the \c coi or \c scif libraries (the Intel paths are
  43. really not standard, it seems...), you can still make a build in native mode
  44. only, by using <c>mic-configure --enable-native-mic</c> (and notably without
  45. <c>--enable-mic</c> since in that case we don't need \c mic offloading support).
  46. \section PortingApplicationsToMICSCC Porting Applications To MIC Xeon Phi / SCC
  47. The simplest way to port an application to MIC Xeon Phi or SCC is to set the field
  48. starpu_codelet::cpu_funcs_name, to provide StarPU with the function
  49. name of the CPU implementation, so for instance:
  50. \verbatim
  51. struct starpu_codelet cl =
  52. {
  53. .cpu_funcs = {myfunc},
  54. .cpu_funcs_name = {"myfunc"},
  55. .nbuffers = 1,
  56. }
  57. \endverbatim
  58. StarPU will thus simply use the
  59. existing CPU implementation (cross-rebuilt in the MIC Xeon Phi case). The
  60. functions have to be globally-visible (i.e. not <c>static</c>) for
  61. StarPU to be able to look them up, and \c -rdynamic must be passed to \c gcc (or
  62. \c -export-dynamic to \c ld) so that symbols of the main program are visible.
  63. If you have used the starpu_codelet::where field, you additionally need to add in it
  64. ::STARPU_MIC for the Xeon Phi, and/or ::STARPU_SCC for the SCC.
  65. For non-native MIC Xeon Phi execution, the 'main' function of the application, on the sink, should call starpu_init() immediately upon start-up; the starpu_init() function never returns. On the host, the 'main' function may freely perform application related initialization calls as usual, before calling starpu_init().
  66. For MIC Xeon Phi, the application may programmatically detect whether executing on the sink or on the host, by checking whether the \ref STARPU_SINK environment variable is defined (on the sink) or not (on the host).
  67. For SCC execution, the function starpu_initialize() also has to be
  68. used instead of starpu_init(), so as to pass <c>argc</c> and
  69. <c>argv</c>.
  70. \section LaunchingPrograms Launching Programs
  71. SCC programs are started through RCCE.
  72. MIC programs are started from the host. StarPU automatically
  73. starts the same program on MIC devices. It however needs to get
  74. the MIC-cross-built binary. It will look for the file given by the
  75. environment variable \ref STARPU_MIC_SINK_PROGRAM_NAME or in the
  76. directory given by the environment variable \ref STARPU_MIC_SINK_PROGRAM_PATH,
  77. or in the field
  78. starpu_conf::mic_sink_program_path. It will also look in the current
  79. directory for the same binary name plus the suffix <c>-mic</c> or
  80. <c>_mic</c>.
  81. The testsuite can be started by simply running <c>make check</c> from the
  82. top directory. It will recurse into both <c>build_host</c> to run tests with only
  83. the host, and into <c>build_mic</c> to run tests with both the host and the MIC
  84. devices. Single tests with the host and the MIC can be run by starting
  85. <c>./loader-cross.sh ./the_test</c> from <c>build_mic/tests</c>.
  86. */