430_mic_scc_support.doxy 4.5 KB

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