YAC 3.12.0
Yet Another Coupler
Loading...
Searching...
No Matches
interp_operator_sum_mvp_at_src.c File Reference
Include dependency graph for interp_operator_sum_mvp_at_src.c:

Go to the source code of this file.

Data Structures

struct  yac_interp_operator_sum_mvp_at_src
 

Functions

static int yac_interp_operator_sum_mvp_at_src_is_source (struct yac_interp_operator *interp)
 
static int yac_interp_operator_sum_mvp_at_src_is_target (struct yac_interp_operator *interp)
 
static void yac_interp_operator_sum_mvp_at_src_execute (struct yac_interp_operator *interp, double ***src_fields, double ***src_frac_masks, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
 
static void yac_interp_operator_sum_mvp_at_src_execute_put (struct yac_interp_operator *interp, double ***src_fields, double ***src_frac_masks, int is_target, double frac_mask_fallback_value, double scale_factor, double scale_summand)
 
static void yac_interp_operator_sum_mvp_at_src_execute_get (struct yac_interp_operator *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
 
static void yac_interp_operator_sum_mvp_at_src_execute_get_async (struct yac_interp_operator *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
 
static enum YAC_INTERP_TEST_STATUS yac_interp_operator_sum_mvp_at_src_execute_put_test (struct yac_interp_operator *interp)
 
static enum YAC_INTERP_TEST_STATUS yac_interp_operator_sum_mvp_at_src_execute_get_test (struct yac_interp_operator *interp)
 
static void yac_interp_operator_sum_mvp_at_src_execute_wait (struct yac_interp_operator *interp)
 
static struct yac_interp_operatoryac_interp_operator_sum_mvp_at_src_copy (struct yac_interp_operator *interp)
 
static void yac_interp_operator_sum_mvp_at_src_delete (struct yac_interp_operator *interp)
 
static struct yac_interp_operatoryac_interp_operator_sum_mvp_at_src_new_ (struct yac_collection_selection const *collection_selection, struct yac_interpolation_buffer halo_data, struct yac_interpolation_buffer result_data, struct yac_interpolation_exchange *src2halo, struct yac_interpolation_exchange *result2tgt, size_t tgt_count, size_t *prefix_num_src_per_tgt, double *weights, size_t *src_field_idx, size_t *src_idx, size_t num_src_fields, int with_frac_mask, int *ref_count)
 Internal constructor for the "sum_mvp_at_src" interpolation operator.
 
struct yac_interp_operatoryac_interp_operator_sum_mvp_at_src_new (struct yac_collection_selection const *collection_selection, Xt_redist *halo_redists, size_t tgt_count, size_t *num_src_per_tgt, double *weights, size_t *src_field_idx, size_t *src_idx, size_t num_src_fields, Xt_redist result_redist_, int with_frac_mask)
 Create a sum (weighted or unweighted) interpolation operator computed on the source processes.
 

Variables

static struct yac_interp_operator_vtable const interpolation_sum_mvp_at_src_vtable
 

Function Documentation

◆ yac_interp_operator_sum_mvp_at_src_copy()

static struct yac_interp_operator * yac_interp_operator_sum_mvp_at_src_copy ( struct yac_interp_operator * interp)
static

Definition at line 652 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_delete()

static void yac_interp_operator_sum_mvp_at_src_delete ( struct yac_interp_operator * interp)
static

Definition at line 679 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_execute()

static void yac_interp_operator_sum_mvp_at_src_execute ( struct yac_interp_operator * interp,
double *** src_fields,
double *** src_frac_masks,
double ** tgt_field,
double frac_mask_fallback_value,
double scale_factor,
double scale_summand )
static

Definition at line 354 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_execute_get()

static void yac_interp_operator_sum_mvp_at_src_execute_get ( struct yac_interp_operator * interp,
double ** tgt_field,
double frac_mask_fallback_value,
double scale_factor,
double scale_summand )
static

Definition at line 571 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_execute_get_async()

static void yac_interp_operator_sum_mvp_at_src_execute_get_async ( struct yac_interp_operator * interp,
double ** tgt_field,
double frac_mask_fallback_value,
double scale_factor,
double scale_summand )
static

Definition at line 587 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_execute_get_test()

static enum YAC_INTERP_TEST_STATUS yac_interp_operator_sum_mvp_at_src_execute_get_test ( struct yac_interp_operator * interp)
static

Definition at line 627 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_execute_put()

static void yac_interp_operator_sum_mvp_at_src_execute_put ( struct yac_interp_operator * interp,
double *** src_fields,
double *** src_frac_masks,
int is_target,
double frac_mask_fallback_value,
double scale_factor,
double scale_summand )
static

Definition at line 458 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_execute_put_test()

static enum YAC_INTERP_TEST_STATUS yac_interp_operator_sum_mvp_at_src_execute_put_test ( struct yac_interp_operator * interp)
static

Definition at line 613 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_execute_wait()

static void yac_interp_operator_sum_mvp_at_src_execute_wait ( struct yac_interp_operator * interp)
static

Definition at line 640 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:

◆ yac_interp_operator_sum_mvp_at_src_is_source()

static int yac_interp_operator_sum_mvp_at_src_is_source ( struct yac_interp_operator * interp)
static

Definition at line 336 of file interp_operator_sum_mvp_at_src.c.

◆ yac_interp_operator_sum_mvp_at_src_is_target()

static int yac_interp_operator_sum_mvp_at_src_is_target ( struct yac_interp_operator * interp)
static

Definition at line 345 of file interp_operator_sum_mvp_at_src.c.

◆ yac_interp_operator_sum_mvp_at_src_new_()

static struct yac_interp_operator * yac_interp_operator_sum_mvp_at_src_new_ ( struct yac_collection_selection const * collection_selection,
struct yac_interpolation_buffer halo_data,
struct yac_interpolation_buffer result_data,
struct yac_interpolation_exchange * src2halo,
struct yac_interpolation_exchange * result2tgt,
size_t tgt_count,
size_t * prefix_num_src_per_tgt,
double * weights,
size_t * src_field_idx,
size_t * src_idx,
size_t num_src_fields,
int with_frac_mask,
int * ref_count )
static

Internal constructor for the "sum_mvp_at_src" interpolation operator.

This function creates a source-side accumulation (sum) interpolation operator, where all source contributions are first locally combined (optionally weighted and/or masked) on the source processes before being redistributed to the target ranks using the provided exchange mappings (src2halo and result2tgt respectivily).

The operator represents the "sum over source" phase of the interpolation matrix-vector product (MVP) and performs the following conceptual operations:

  1. Halo Exchange: Local source fields (and optionally fractional masks) are communicated between source processes according to the src2halo exchange pattern to ensure each process has access to all source data required by its local stencils.
  2. Local Accumulation: Each process computes the contributions of its available source points to all target points assigned to it, according to the interpolation weights.
  3. Result Redistribution: The locally computed target sums are sent to their owning target ranks via the result2tgt exchange mapping.

Unlike the public constructor yac_interp_operator_sum_mvp_at_src_new(), this routine takes already prepared internal data structures, such as initialized interpolation buffers and exchange descriptors. It is also used internally by yac_interp_operator_sum_mvp_at_src_copy().

The resulting operator computes, for each target point t, the following:

\[
    T_t = \sum_{i \in S(t)} w_i \cdot S_{f(i)}[s(i)]
\]

where:

  • $S(t)$ is the set of source contributions for target t (including both locally owned and halo-exchanged source values),
  • $w_i$ is the interpolation weight associated with contribution i (or 1.0 if unweighted),
  • $f(i)$ identifies the source field index (or SIZE_MAX for a contribution originating from a remote process),
  • $s(i)$ is the local source index within that field (or the receive buffer)

If fractional masks are enabled (with_frac_mask != 0), each source value is multiplied by its corresponding mask before accumulation. The sum of all mask values for a given target is used to normalize the result; if the normalization denominator is zero, the provided fallback value (see frac_mask_fallback_value during execution) is used instead.

Parameters
[in]collection_selectionSelection of field collections to which this operator applies.
[in]halo_dataInterpolation buffer used to receive halo-exchanged source data from neighbouring processes (as defined by src2halo).
[in]result_dataInterpolation buffer holding locally computed target field results before redistribution to target ranks (as defined by result2tgt).
[in]src2haloExchange structure describing the halo redistribution pattern for source data between source processes.
[in]result2tgtExchange structure describing redistribution of computed target field results from source processes to target processes.
[in]tgt_countNumber of target points handled by this interpolation operator.
[in]prefix_num_src_per_tgtPrefix-sum array of length tgt_count + 1. Defines the cumulative number of source contributions per target point. The number of source entries for target i is given by: $ N_i = prefix\_num\_src\_per\_tgt[i+1] - prefix\_num\_src\_per\_tgt[i] $.
[in]weightsInterpolation weights for all source contributions (length = prefix_num_src_per_tgt[tgt_count]). If NULL, an unweighted sum is performed.
[in]src_field_idxArray mapping each source contribution to a source field index (same length as weights). The special value SIZE_MAX denotes a contribution from a halo (non-local) source.
[in]src_idxArray of source indices for each source contribution (same length as weights). Defines the position within the local source field data or halo buffer.
[in]num_src_fieldsNumber of source fields in the interpolation setup.
[in]with_frac_maskNon-zero enables fractional mask support. Both source values and masks are then redistributed via src2halo.
[in,out]ref_countOptional external reference counter. If non-NULL, it is incremented and stored. Upon deletion, it is decremented. This allows shared ownership of data arrays among copies of the same operator.
Returns
Newly allocated interpolation operator implementing "sum_mvp_at_src" semantics.
Remarks
  • The prefix-sum array (prefix_num_src_per_tgt) must satisfy prefix_num_src_per_tgt[0] == 0 and be strictly non-decreasing.
  • All MPI and yaxt exchange/buffer structures (src2halo, result2tgt, halo_data, result_data) must be fully initialized prior to calling this constructor.
  • The operator assumes consistent dimensions between source and result redistribution mappings.
  • Intended for internal use; end users should prefer yac_interp_operator_sum_mvp_at_src_new(), which automatically builds these structures from high-level interpolation metadata.

Definition at line 240 of file interp_operator_sum_mvp_at_src.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ interpolation_sum_mvp_at_src_vtable

struct yac_interp_operator_vtable const interpolation_sum_mvp_at_src_vtable
static
Initial value:
= {
}
static void yac_interp_operator_sum_mvp_at_src_execute_get_async(struct yac_interp_operator *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static enum YAC_INTERP_TEST_STATUS yac_interp_operator_sum_mvp_at_src_execute_get_test(struct yac_interp_operator *interp)
static void yac_interp_operator_sum_mvp_at_src_execute_wait(struct yac_interp_operator *interp)
static void yac_interp_operator_sum_mvp_at_src_execute_put(struct yac_interp_operator *interp, double ***src_fields, double ***src_frac_masks, int is_target, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static void yac_interp_operator_sum_mvp_at_src_delete(struct yac_interp_operator *interp)
static void yac_interp_operator_sum_mvp_at_src_execute_get(struct yac_interp_operator *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static void yac_interp_operator_sum_mvp_at_src_execute(struct yac_interp_operator *interp, double ***src_fields, double ***src_frac_masks, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static struct yac_interp_operator * yac_interp_operator_sum_mvp_at_src_copy(struct yac_interp_operator *interp)
static enum YAC_INTERP_TEST_STATUS yac_interp_operator_sum_mvp_at_src_execute_put_test(struct yac_interp_operator *interp)
static int yac_interp_operator_sum_mvp_at_src_is_source(struct yac_interp_operator *interp)
static int yac_interp_operator_sum_mvp_at_src_is_target(struct yac_interp_operator *interp)

Definition at line 46 of file interp_operator_sum_mvp_at_src.c.