Next: Example 2: using 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
Here are the lines of C code to generate such a profile:
// 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);
- 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.
- 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 - Ven 18 nov 2011 18:13:39 PST