@c -*-texinfo-*-

@c This file is part of the StarPU Handbook.
@c Copyright (C) 2013  Universit@'e de Bordeaux 1
@c See the file starpu.texi for copying conditions.

@section Compilation

SCC support just needs the presence of the RCCE library.

MIC support actually needs two compilations of StarPU, one for the host and one for
the device. The @code{mic-configure} script can be used to achieve this: it basically
calls @code{configure} as appropriate from two new directories: @code{build_mic} and
@code{build_host}. @code{make} and @code{make install} can then be used as usual and will
recurse into both directories.

@c TODO: move to configuration section ?

It can be parameterized with the following environment variables:

@table @asis
@item @code{STARPU_MIC_HOST}
Defines the value of the @code{--host} parameter passed to @code{configure} for the
cross-compilation. The current default is @code{x86_64-k1om-linux}.

@item @code{STARPU_MIC_CC_PATH}
Defines the path to the MIC cross-compiler. The current default is @code{/usr/linux-k1om-4.7/bin/}.

@item @code{STARPU_COI_DIR}
Defines the path to the COI library. The current default is @code{/opt/intel/mic/coi}
@end table

@section Porting applications to MIC/SCC

The simplest way to port an application to MIC/SCC is to add the
@code{cpu_funcs_name} field in the codelet, to provide StarPU with the function
name of the CPU implementation. StarPU will thus simply use the existing CPU
implementation (cross-rebuilt in the MIC case). The functions have to be
globally-visible (i.e. not @code{static}) for StarPU to be able to look them up.

For SCC execution, @code{starpu_initialize} also has to be used instead of @code{starpu_init}, so
as to pass @code{argc} and @code{argv}.

@section Launching programs

SCC programs are started through RCCE

MIC programs are started from the host. StarPU automatically
starts the same program on MIC devices. It however needs to get
the MIC-cross-built binary. It will look for the file given by the
@code{STARPU_MIC_SINK_PROGRAM_NAME} environment variable or in the directory
given by the @code{STARPU_MIC_SINK_PROGRAM_PATH} environment variable, or in
the @code{mic_sink_program_path} field of the @code{starpu_config} structure.
It will also look in the current directory for the same binary name plus a
@code{-mic} or @code{_mic} suffix.
