Example 1: without persistency

Let us consider the product of a scalar by a matrix: the matrix must be multiplied in-place, and the computation time must be returned. This problem has one IN argument (the scalar factor), one INOUT argument (the matrix) and one OUT argument (the computation time), so its profile will be built as follows:
Image smprod

Here are the lines of C code to generate such a profile:

  double  factor;
  double *matrix;
  float  *time;
  // Init matrix at least, factor and time too would be better ...
  // ...
  diet_profile_t profile = diet_profile_alloc(0, 1, 2); // last_in, last_inout, last_out
  diet_scalar_set(diet_parameter(profile,0), &factor, 0, DIET_DOUBLE);
  diet_matrix_set(diet_parameter(profile,1), matrix,  0, DIET_DOUBLE, 5, 6, DIET_ROW_MAJOR);
  diet_scalar_set(diet_parameter(profile,2), NULL,    0, DIET_FLOAT);

NB1:
If there is no IN argument, last_in must be set to -1, if there is no INOUT argument, last_inout must be equal to last_in, and if there is no OUT argument, last_out must be equal to last_inout.
NB2:
The value argument for _set functions (3.4.1) is ignored for OUT arguments, since DIET allocates the necessary memory space when the corresponding data are transferred from the server, so set value to NULL.



The DIET Team - Mer 29 nov 2017 15:13:36 EST