~james-page/ubuntu/precise/openmpi1.5/new

« back to all changes in this revision

Viewing changes to test/predefined/ompi_predefined.c

  • Committer: Bazaar Package Importer
  • Author(s): Manuel Prinz
  • Date: 2009-04-23 14:01:21 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090423140121-vsi3pqa6g30j4qiy
Tags: 1.3.2-1
* New upstream release. (Closes: #520597, #515116)
  - Manpage and VampirTrace patches removed, included upstream.
* Fixed build issues on Alpha. Huge thanks to Arthur Loiret for providing
  access to his machines for testing! (Closes: #510845, #517543)
* Fixed build issues on Sparc. (Closes: #519725)
* Fixed manpage-has-errors-from-man lintian warnings.
* Faked SONAME change by renaming library package. (Closes: #512616)
* Made libopenmpi-dev depend on libibverbs-dev. (Closes: #522153)
* Support for "nocheck" build option in debian/rules.
* Updated Standards-Version in debian/control.
* Changed section of libopenmpi-dbg to "debug".
* Updated debian/copyright.

* Dirk Eddelbuettel removed himself from Uploaders. The team thanks Dirk
  for his long-term contribution and effort to get Open MPI back to life.
  I personally thank Dirk for encouraging me to become a Debian Developer
  and his support and mentoring on that way and beyond.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*   
 
2
 * Copyright (c) 2009      Sun Microsystems, Inc  All rights reserved.
 
3
 * Copyright (c) 2009      Cisco Systems, Inc  All rights reserved.
 
4
 * $COPYRIGHT$
 
5
 * 
 
6
 * Additional copyrights may follow
 
7
 * 
 
8
 * $HEADER$
 
9
 */
 
10
 
 
11
#include "ompi_config.h"
 
12
#include "ompi/communicator/communicator.h"
 
13
#include "ompi/group/group.h"
 
14
#include "ompi/request/request.h"
 
15
#include "ompi/op/op.h"
 
16
#include "ompi/datatype/datatype.h"
 
17
#include "ompi/win/win.h"
 
18
#include "ompi/info/info.h"
 
19
#include "ompi/file/file.h"
 
20
 
 
21
#include <stdlib.h>
 
22
 
 
23
#define GAP_CHECK(NAME, BASE, F1, F2, CGAP) {      \
 
24
   offset = (size_t)&BASE.F1 - (size_t)&BASE;       \
 
25
   exp_offset = ((size_t)&BASE.F2 - (size_t)&BASE) + sizeof(BASE.F2);   \
 
26
   printf(NAME" = %lu, %lu ", offset, sizeof(BASE.F1)); \
 
27
   if (CGAP && offset != exp_offset) printf("***"); \
 
28
   printf("\n"); \
 
29
   }
 
30
 
 
31
 
 
32
int main(int argc, char **argv) {
 
33
    ompi_communicator_t test_comm;
 
34
    ompi_group_t test_group;
 
35
    ompi_request_t test_req;
 
36
    ompi_op_t test_op;
 
37
    ompi_win_t test_win;
 
38
    ompi_info_t test_info;
 
39
    ompi_file_t test_file;
 
40
    size_t exp_offset, offset;
 
41
 
 
42
    /* Test Predefined communicator sizes */
 
43
    printf("ompi_predefined_communicator_t = %lu bytes\n", sizeof(ompi_predefined_communicator_t));
 
44
    printf("ompi_communicator_t = %lu bytes\n", sizeof(ompi_communicator_t));
 
45
    GAP_CHECK("c_base", test_comm, c_base, c_base, 0);
 
46
    GAP_CHECK("c_lock", test_comm, c_lock, c_base, 1);
 
47
    GAP_CHECK("c_name", test_comm, c_name, c_lock, 1);
 
48
    GAP_CHECK("c_contextid", test_comm, c_contextid, c_name, 1);
 
49
    GAP_CHECK("c_my_rank", test_comm, c_my_rank, c_contextid, 1);
 
50
    GAP_CHECK("c_flags", test_comm, c_flags, c_my_rank, 1);
 
51
    GAP_CHECK("c_id_available", test_comm, c_id_available, c_flags, 1);
 
52
    GAP_CHECK("c_id_start_index", test_comm, c_id_start_index, c_id_available,  1);
 
53
    GAP_CHECK("c_remote_group", test_comm, c_remote_group, c_local_group, 1);
 
54
    GAP_CHECK("c_local_comm", test_comm, c_local_comm,  c_remote_group,  1);
 
55
    GAP_CHECK("c_keyhash", test_comm, c_keyhash, c_local_comm,  1);
 
56
    GAP_CHECK("c_cube_dim", test_comm, c_cube_dim, c_keyhash,  1);
 
57
    GAP_CHECK("c_topo_component", test_comm, c_topo_component, c_cube_dim,  1);
 
58
    GAP_CHECK("c_topo", test_comm, c_topo, c_topo_component,  1);
 
59
    GAP_CHECK("c_topo_comm", test_comm, c_topo_comm, c_topo,  1);
 
60
    GAP_CHECK("c_topo_module", test_comm, c_topo_module, c_topo_comm,  1);
 
61
    GAP_CHECK("c_f_to_c_index", test_comm, c_f_to_c_index, c_topo_module, 1);
 
62
#ifdef OMPI_WANT_PERUSE
 
63
    GAP_CHECK("c_peruse_handles", test_comm, c_peruse_handles, c_f_to_c_index, 1);
 
64
    GAP_CHECK("error_handler", test_comm, error_handler, c_peruse_handles, 1);
 
65
#else
 
66
    GAP_CHECK("error_handler", test_comm, error_handler, c_f_to_c_index, 1);
 
67
#endif
 
68
    GAP_CHECK("errhandler_type", test_comm, errhandler_type, error_handler, 1);
 
69
    GAP_CHECK("c_pml_comm", test_comm, c_pml_comm, errhandler_type, 1);
 
70
    GAP_CHECK("c_coll", test_comm, c_coll, c_pml_comm, 1);
 
71
 
 
72
    /* Test Predefined group sizes */
 
73
    printf("=============================================\n");
 
74
    printf("ompi_predefined_group_t = %lu bytes\n", sizeof(ompi_predefined_group_t));
 
75
    printf("ompi_group_t = %lu bytes\n", sizeof(ompi_group_t));
 
76
    GAP_CHECK("grp_proc_count", test_group, grp_proc_count, grp_proc_count, 0);
 
77
    GAP_CHECK("grp_my_rank", test_group, grp_my_rank, grp_proc_count, 1);
 
78
    GAP_CHECK("grp_f_to_c_index", test_group, grp_f_to_c_index, grp_my_rank, 1);
 
79
    GAP_CHECK("grp_proc_pointers", test_group, grp_proc_pointers, grp_f_to_c_index, 1);
 
80
    GAP_CHECK("grp_flags", test_group, grp_flags, grp_proc_pointers, 1);
 
81
    GAP_CHECK("grp_parent_group_ptr", test_group, grp_parent_group_ptr, grp_flags, 1);
 
82
 
 
83
    /* Test Predefined request sizes */
 
84
    printf("=============================================\n");
 
85
    printf("ompi_predefined_request_t = %lu bytes\n", sizeof(ompi_predefined_request_t));
 
86
    printf("ompi_request_t = %lu bytes\n", sizeof(ompi_request_t));
 
87
    GAP_CHECK("super", test_req, super, super, 0);
 
88
    GAP_CHECK("req_type", test_req, req_type, super, 1);
 
89
    GAP_CHECK("req_status", test_req, req_status, req_type, 1);
 
90
    GAP_CHECK("req_complete", test_req, req_complete, req_status, 1);
 
91
    GAP_CHECK("req_state", test_req, req_state, req_complete, 1);
 
92
    GAP_CHECK("req_persistent", test_req, req_persistent, req_state, 1);
 
93
    GAP_CHECK("req_f_to_c_index", test_req, req_f_to_c_index, req_persistent, 1);
 
94
    GAP_CHECK("req_free", test_req, req_free, req_f_to_c_index, 1);
 
95
 
 
96
    /* Test Predefined op sizes */
 
97
    printf("=============================================\n");
 
98
    printf("ompi_predefined_op_t = %lu bytes\n", sizeof(ompi_predefined_op_t));
 
99
    printf("ompi_op_t = %lu bytes\n", sizeof(ompi_op_t));
 
100
    GAP_CHECK("super", test_op, super, super, 0)
 
101
    GAP_CHECK("o_name", test_op, o_name, super, 1)
 
102
    GAP_CHECK("o_flags", test_op, o_flags, o_name, 1)
 
103
    GAP_CHECK("o_f_to_c_index", test_op, o_f_to_c_index, o_flags, 1)
 
104
    GAP_CHECK("o_func", test_op, o_func, o_f_to_c_index, 1)
 
105
#if 0
 
106
    GAP_CHECK("o_3buff_instrinsic", test_op, o_3buff_intrinsic, o_func, 1)
 
107
#endif
 
108
    
 
109
    /* Test Predefined datatype sizes */
 
110
    printf("=============================================\n");
 
111
    printf("ompi_predefined_datatype_t = %lu bytes\n", sizeof(ompi_predefined_datatype_t));
 
112
    printf("ompi_datatype_t = %lu bytes\n", sizeof(ompi_datatype_t));
 
113
 
 
114
    /* Test Predefined win sizes */
 
115
    printf("=============================================\n");
 
116
    printf("ompi_predefined_win_t = %lu bytes\n", sizeof(ompi_predefined_win_t));
 
117
    printf("ompi_win_t = %lu bytes\n", sizeof(ompi_win_t));
 
118
    GAP_CHECK("w_base", test_win, w_base, w_base, 0);
 
119
    GAP_CHECK("w_lock", test_win, w_lock, w_base, 1);
 
120
    GAP_CHECK("w_name", test_win, w_name, w_lock, 1);
 
121
    GAP_CHECK("w_group", test_win, w_group, w_name, 1);
 
122
    GAP_CHECK("w_flags", test_win, w_flags, w_group, 1);
 
123
    GAP_CHECK("w_keyhash", test_win, w_keyhash, w_flags, 1);
 
124
    GAP_CHECK("w_f_to_c_index", test_win, w_f_to_c_index, w_keyhash, 1);
 
125
    GAP_CHECK("error_handler", test_win, error_handler, w_f_to_c_index, 1);
 
126
    GAP_CHECK("errhandler_type", test_win, errhandler_type, error_handler, 1);
 
127
    GAP_CHECK("w_disp_unit", test_win, w_disp_unit, errhandler_type, 1);
 
128
    GAP_CHECK("w_baseptr", test_win, w_baseptr, w_disp_unit, 1);
 
129
    GAP_CHECK("w_size", test_win, w_size, w_baseptr, 1);
 
130
    GAP_CHECK("w_mode", test_win, w_mode, w_size, 1);
 
131
    GAP_CHECK("w_osc_module", test_win, w_osc_module, w_size, 1);
 
132
 
 
133
    /* Test Predefined info sizes */
 
134
    printf("=============================================\n");
 
135
    printf("ompi_predefined_info_t = %lu bytes\n", sizeof(ompi_predefined_info_t));
 
136
    printf("ompi_info_t = %lu bytes\n", sizeof(ompi_info_t));
 
137
    GAP_CHECK("super", test_info, super, super, 0);
 
138
    GAP_CHECK("i_f_to_c_index", test_info, i_f_to_c_index, super, 1);
 
139
    GAP_CHECK("i_lock", test_info, i_lock, i_f_to_c_index, 1);
 
140
    GAP_CHECK("i_freed", test_info, i_freed, i_lock, 1);
 
141
 
 
142
    /* Test Predefined file sizes */
 
143
    printf("=============================================\n");
 
144
    printf("ompi_predefined_file_t = %lu bytes\n", sizeof(ompi_predefined_file_t));
 
145
    printf("ompi_file_t = %lu bytes\n", sizeof(ompi_file_t));
 
146
    GAP_CHECK("super", test_file, super, super, 0);
 
147
    GAP_CHECK("f_comm", test_file, f_comm, super, 1);
 
148
    GAP_CHECK("f_filename", test_file, f_filename, f_comm, 1);
 
149
    GAP_CHECK("f_amode", test_file, f_amode,  f_filename, 1);
 
150
    GAP_CHECK("f_info", test_file, f_info, f_amode,  1);
 
151
    GAP_CHECK("f_flags", test_file, f_flags, f_info,  1);
 
152
    GAP_CHECK("f_f_to_c_index", test_file, f_f_to_c_index, f_flags, 1);
 
153
    GAP_CHECK("error_handler", test_file, error_handler, f_f_to_c_index, 1);
 
154
    GAP_CHECK("errhandler_type", test_file, errhandler_type, error_handler, 1);
 
155
    GAP_CHECK("f_io_version", test_file, f_io_version, errhandler_type, 1);
 
156
    GAP_CHECK("f_io_selected_component", test_file, f_io_selected_component, f_io_version, 1);
 
157
    GAP_CHECK("f_io_selected_module", test_file, f_io_selected_module, f_io_selected_component, 1);
 
158
    GAP_CHECK("f_io_selected_data", test_file, f_io_selected_data, f_io_selected_module, 1);
 
159
    GAP_CHECK("f_io_requests", test_file, f_io_requests, f_io_selected_data, 1);
 
160
    GAP_CHECK("f_io_requests_lock", test_file, f_io_requests_lock, f_io_requests, 1);
 
161
    
 
162
    return 0;
 
163
}