File: test_contig.c

package info (click to toggle)
mpich 4.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 101,184 kB
  • sloc: ansic: 1,040,629; cpp: 82,270; javascript: 40,763; perl: 27,933; python: 16,041; sh: 14,676; xml: 14,418; f90: 12,916; makefile: 9,270; fortran: 8,046; java: 4,635; asm: 324; ruby: 103; awk: 27; lisp: 19; php: 8; sed: 4
file content (114 lines) | stat: -rw-r--r-- 3,544 bytes parent folder | download | duplicates (3)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * Copyright (C) by Argonne National Laboratory
 *     See COPYRIGHT in top-level directory
 */

#include "yaksa.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

int main(int argc, char **argv)
{
    int errs = 0;
    yaksa_type_t type;
    uintptr_t iov_len;

    yaksa_init(NULL);

    {
        yaksa_type_create_vector(5, 2, 2, YAKSA_TYPE__INT, NULL, &type);
        yaksa_iov_len(1, type, &iov_len);
        if (iov_len != 1) {
            printf("Test vector with consecutive blocks, got iov_len = %ld, expect 1\n", iov_len);
            errs++;
        }
        yaksa_type_free(type);
    }

    {
        intptr_t blklens[] = { 2, 2, 1, 3, 3 };
        intptr_t displs[] = { 1, 3, 5, 6, 9 };
        yaksa_type_create_indexed(5, blklens, displs, YAKSA_TYPE__DOUBLE, NULL, &type);
        yaksa_iov_len(1, type, &iov_len);
        if (iov_len != 1) {
            printf("Test indexed with consecutive blocks, got iov_len = %ld, expect 1\n", iov_len);
            errs++;
        }
        yaksa_type_free(type);
    }

    {
        intptr_t blklens[] = { 2, 2, 1, 3, 3 };
        intptr_t displs[] = { 1, 2, 3, 5, 9 };
        yaksa_type_create_indexed(5, blklens, displs, YAKSA_TYPE__DOUBLE, NULL, &type);
        yaksa_iov_len(1, type, &iov_len);
        if (iov_len == 1) {
            printf("Test indexed with non-consecutive blocks, got iov_len = %ld, expect 5\n",
                   iov_len);
            errs++;
        }
        yaksa_type_free(type);
    }

    {
        intptr_t displs[] = { 2, 4, 6, 8, 10 };
        yaksa_type_create_indexed_block(5, 2, displs, YAKSA_TYPE__DOUBLE, NULL, &type);
        yaksa_iov_len(1, type, &iov_len);
        if (iov_len != 1) {
            printf("Test indexed_block with consecutive blocks, got iov_len = %ld, expect 1\n",
                   iov_len);
            errs++;
        }
        yaksa_type_free(type);
    }

    {
        intptr_t displs[] = { 2, 3, 4, 7, 10 };
        yaksa_type_create_indexed_block(5, 2, displs, YAKSA_TYPE__DOUBLE, NULL, &type);
        yaksa_iov_len(1, type, &iov_len);
        if (iov_len == 1) {
            printf("Test indexed_block with non-consecutive blocks, got iov_len = %ld, expect 5\n",
                   iov_len);
            errs++;
        }
        yaksa_type_free(type);
    }

    {
        yaksa_type_t types[] =
            { YAKSA_TYPE__INT32_T, YAKSA_TYPE__INT32_T, YAKSA_TYPE__INT8_T, YAKSA_TYPE__INT8_T,
            YAKSA_TYPE__INT16_T
        };
        intptr_t blklens[] = { 1, 1, 4, 4, 2 };
        intptr_t displs[] = { 4, 8, 12, 16, 20 };
        yaksa_type_create_struct(5, blklens, displs, types, NULL, &type);
        yaksa_iov_len(1, type, &iov_len);
        if (iov_len != 1) {
            printf("Test struct with consecutive blocks, got iov_len = %ld, expect 1\n", iov_len);
            errs++;
        }
        yaksa_type_free(type);
    }

    {
        yaksa_type_t types[] =
            { YAKSA_TYPE__INT32_T, YAKSA_TYPE__INT32_T, YAKSA_TYPE__INT8_T, YAKSA_TYPE__INT8_T,
            YAKSA_TYPE__INT16_T
        };
        intptr_t blklens[] = { 1, 1, 4, 4, 2 };
        intptr_t displs[] = { 4, 12, 13, 14, 20 };
        yaksa_type_create_struct(5, blklens, displs, types, NULL, &type);
        yaksa_iov_len(1, type, &iov_len);
        if (iov_len == 1) {
            printf("Test struct with non-consecutive blocks, got iov_len = %ld, expect 5\n",
                   iov_len);
            errs++;
        }
        yaksa_type_free(type);
    }

    yaksa_finalize();

    return errs;
}