File: btl_uct_frag.c

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (68 lines) | stat: -rw-r--r-- 2,314 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2018      Los Alamos National Security, LLC. All rights
 *                         reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "btl_uct_frag.h"

static void mca_btl_uct_frag_completion_compat(uct_completion_t *uct_comp, ucs_status_t status)
{
    mca_btl_uct_uct_completion_t *comp = (mca_btl_uct_uct_completion_t
                                              *) ((uintptr_t) uct_comp
                                                  - offsetof(mca_btl_uct_uct_completion_t,
                                                             uct_comp));

    BTL_VERBOSE(("frag operation complete. frag = %p. status = %d", (void *) comp->frag, status));

    comp->status = status;
    opal_fifo_push(&comp->dev_context->completion_fifo, &comp->super.super);
}

#if UCT_API >= ((1L<<UCT_MAJOR_BIT)|(10L << UCT_MINOR_BIT))
static void mca_btl_uct_frag_completion(uct_completion_t *uct_comp) {
    mca_btl_uct_frag_completion_compat(uct_comp, uct_comp->status);
}
#else
static void mca_btl_uct_frag_completion(uct_completion_t *uct_comp, ucs_status_t status) {
    mca_btl_uct_frag_completion_compat(uct_comp, status);
}
#endif

static void mca_btl_uct_base_frag_constructor(mca_btl_uct_base_frag_t *frag)
{
    mca_btl_uct_reg_t *reg = (mca_btl_uct_reg_t *) frag->base.super.registration;

    /* zero everything out */
    memset((char *) frag + sizeof(frag->base), 0, sizeof(*frag) - sizeof(frag->base));

    OBJ_CONSTRUCT(&frag->comp, mca_btl_uct_uct_completion_t);

    frag->base.des_segments = frag->segments;
    frag->base.des_segment_count = 1;

    frag->comp.uct_comp.func = mca_btl_uct_frag_completion;
    frag->comp.uct_comp.count = 1;
    frag->comp.frag = frag;

    frag->segments[0].seg_addr.pval = frag->base.super.ptr;
    frag->uct_iov.buffer = frag->base.super.ptr;
    frag->uct_iov.stride = 0;
    frag->uct_iov.count = 1;
    if (reg) {
        frag->uct_iov.memh = reg->uct_memh;
    }
}

static void mca_btl_uct_base_frag_destructor(mca_btl_uct_base_frag_t *frag)
{
    OBJ_DESTRUCT(&frag->comp);
}

OBJ_CLASS_INSTANCE(mca_btl_uct_base_frag_t, mca_btl_base_descriptor_t,
                   mca_btl_uct_base_frag_constructor, mca_btl_uct_base_frag_destructor);