GPI-2  1.0.0
GASPI.h
Go to the documentation of this file.
1 /*
2 Copyright (c) Fraunhofer ITWM - Carsten Lojewski <lojewski@itwm.fhg.de>, 2013
3 
4 This file is part of GPI-2.
5 
6 GPI-2 is free software; you can redistribute it
7 and/or modify it under the terms of the GNU General Public License
8 version 3 as published by the Free Software Foundation.
9 
10 GPI-2 is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with GPI-2. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
29 #ifndef GPI2_H
30 #define GPI2_H
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 #define GASPI_MAJOR_VERSION (1)
38 #define GASPI_MINOR_VERSION (0)
39 #define GASPI_REVISION (0)
40 
41 #define GASPI_BLOCK (0xffffffff)
42 #define GASPI_TEST (0x0)
43 #define GASPI_MAX_NODES (65536)
44 #define GASPI_SN_PORT (10840)
45 #define GASPI_MAX_GROUPS (32)
46 #define GASPI_MAX_MSEGS (32)
47 #define GASPI_GROUP_ALL (0)
48 #define GASPI_MAX_QP (16)
49 #define GASPI_COLL_QP (GASPI_MAX_QP)
50 #define GASPI_PASSIVE_QP (GASPI_MAX_QP+1)
51 #define GASPI_MAX_TSIZE_C ((1ul<<31ul)-1ul)
52 #define GASPI_MAX_TSIZE_P ((1ul<<16ul)-1ul)
53 #define GASPI_MAX_QSIZE (4096)
54 #define GASPI_MAX_NOTIFICATION (65536)
55 
56  typedef char gaspi_char;
57  typedef unsigned char gaspi_uchar;
58  typedef short gaspi_short;
59  typedef unsigned short gaspi_ushort;
60  typedef int gaspi_int;
61  typedef unsigned int gaspi_uint;
62  typedef long gaspi_long;
63  typedef unsigned long gaspi_ulong;
64  typedef float gaspi_float;
65  typedef double gaspi_double;
66 
67  typedef unsigned int gaspi_timeout_t;
68  typedef unsigned short gaspi_rank_t;
69  typedef unsigned char gaspi_group_t;
70  typedef unsigned int gaspi_number_t;
71  typedef void *gaspi_pointer_t;
72  typedef void *gaspi_state_t;
73  typedef unsigned char *gaspi_state_vector_t;
74  typedef unsigned char gaspi_queue_id_t;
75  typedef unsigned long gaspi_size_t;
76  typedef unsigned long gaspi_alloc_t;
77  typedef unsigned char gaspi_segment_id_t;
78  typedef unsigned long gaspi_offset_t;
79  typedef unsigned long gaspi_atomic_value_t;
80  typedef unsigned long gaspi_time_t;
81  typedef unsigned short gaspi_notification_id_t;
82  typedef unsigned int gaspi_notification_t;
83  typedef unsigned int gaspi_statistic_counter_t;
84  typedef char * gaspi_string_t;
85 
86 
91  typedef enum
92  {
93  GASPI_ERROR = -1,
94  GASPI_SUCCESS = 0,
95  GASPI_TIMEOUT = 1
97 
102  typedef enum
103  {
104  GASPI_IB = 0,
108  } gaspi_network_t;
109 
114  typedef enum
115  {
120 
125  typedef enum
126  {
127  GASPI_TYPE_INT = 0,
128  GASPI_TYPE_UINT = 1,
129  GASPI_TYPE_FLOAT = 2,
130  GASPI_TYPE_DOUBLE = 3,
131  GASPI_TYPE_LONG = 4,
132  GASPI_TYPE_ULONG = 5
134 
139  typedef enum
140  {
141  GASPI_STATE_HEALTHY = 0,
142  GASPI_STATE_CORRUPT = 1
144 
150  {
153  };
154 
159  typedef struct gaspi_config
160  {
161  gaspi_uint logger;
162  gaspi_uint net_info;
163  gaspi_uint netdev_id;
164  gaspi_uint mtu;
165  gaspi_uint port_check;
166  gaspi_uint user_net;
168  gaspi_uint queue_depth;
169  gaspi_uint qp_count;
170  gaspi_number_t group_max;
171  gaspi_number_t segment_max;
172  gaspi_size_t transfer_size_max;
173  gaspi_number_t notification_num;
174  gaspi_number_t passive_queue_size_max;
175  gaspi_number_t passive_transfer_size_max;
176  gaspi_size_t allreduce_buf_size;
177  gaspi_number_t allreduce_elem_max;
178  gaspi_number_t build_infrastructure;
179 
180  } gaspi_config_t;
181 
186  typedef enum
187  {
188  GASPI_STATISTIC_ARGUMENT_NONE
190 
191 
192 
193 
194  typedef gaspi_return_t (*gaspi_reduce_operation_t) (gaspi_pointer_t const
195  operand_one,
196  gaspi_pointer_t const
197  operand_two,
198  gaspi_pointer_t const
199  result,
200  gaspi_state_t const
201  state,
202  const gaspi_number_t
203  num,
204  const gaspi_size_t
205  element_size,
206  const gaspi_timeout_t
207  timeout_ms);
208 
217 
226 
234  gaspi_return_t gaspi_version (float *version);
235 
244  gaspi_return_t gaspi_proc_init (const gaspi_timeout_t timeout_ms);
245 
255  gaspi_return_t gaspi_proc_term (const gaspi_timeout_t timeout_ms);
256 
264  gaspi_return_t gaspi_proc_rank (gaspi_rank_t * const rank);
265 
274  gaspi_return_t gaspi_proc_num (gaspi_rank_t * const proc_num);
275 
285  gaspi_return_t gaspi_proc_kill (const gaspi_rank_t rank,
286  const gaspi_timeout_t timeout_ms);
287 
297  gaspi_return_t gaspi_connect (const gaspi_rank_t rank,
298  const gaspi_timeout_t timeout_ms);
299 
309  gaspi_return_t gaspi_disconnect (const gaspi_rank_t rank,
310  const gaspi_timeout_t timeout_ms);
311 
319  gaspi_return_t gaspi_group_create (gaspi_group_t * const group);
320 
328  gaspi_return_t gaspi_group_delete (const gaspi_group_t group);
329 
338  gaspi_return_t gaspi_group_add (const gaspi_group_t group,
339  const gaspi_rank_t rank);
340 
350  gaspi_return_t gaspi_group_commit (const gaspi_group_t group,
351  const gaspi_timeout_t timeout_ms);
352 
360  gaspi_return_t gaspi_group_num (gaspi_number_t * const group_num);
361 
371  gaspi_return_t gaspi_group_size (const gaspi_group_t group,
372  gaspi_number_t * const group_size);
373 
382  gaspi_return_t gaspi_group_ranks (const gaspi_group_t group,
383  gaspi_rank_t * const group_ranks);
384 
392  gaspi_return_t gaspi_group_max (gaspi_number_t * const group_max);
393 
403  gaspi_return_t gaspi_segment_alloc (const gaspi_segment_id_t segment_id,
404  const gaspi_size_t size,
405  const gaspi_alloc_t alloc_policy);
413  gaspi_return_t gaspi_segment_delete (const gaspi_segment_id_t segment_id);
414 
426  gaspi_return_t gaspi_segment_register (const gaspi_segment_id_t segment_id,
427  const gaspi_rank_t rank,
428  const gaspi_timeout_t timeout_ms);
429 
444  gaspi_return_t gaspi_segment_create (const gaspi_segment_id_t segment_id,
445  const gaspi_size_t size,
446  const gaspi_group_t group,
447  const gaspi_timeout_t timeout_ms,
448  const gaspi_alloc_t alloc_policy);
449 
457  gaspi_return_t gaspi_segment_num (gaspi_number_t * const segment_num);
458 
467  gaspi_return_t gaspi_segment_list (const gaspi_number_t num,
468  gaspi_segment_id_t *
469  const segment_id_list);
470 
479  gaspi_return_t gaspi_segment_ptr (const gaspi_segment_id_t segment_id,
480  gaspi_pointer_t * ptr);
481 
491  gaspi_return_t gaspi_segment_size (const gaspi_segment_id_t segment_id,
492  const gaspi_rank_t rank,
493  gaspi_size_t * const size);
494 
502  gaspi_return_t gaspi_segment_max (gaspi_number_t * const segment_max);
503 
505 
506 
521  gaspi_return_t gaspi_write (const gaspi_segment_id_t segment_id_local,
522  const gaspi_offset_t offset_local,
523  const gaspi_rank_t rank,
524  const gaspi_segment_id_t segment_id_remote,
525  const gaspi_offset_t offset_remote,
526  const gaspi_size_t size,
527  const gaspi_queue_id_t queue,
528  const gaspi_timeout_t timeout_ms);
545  gaspi_return_t gaspi_read (const gaspi_segment_id_t segment_id_local,
546  const gaspi_offset_t offset_local,
547  const gaspi_rank_t rank,
548  const gaspi_segment_id_t segment_id_remote,
549  const gaspi_offset_t offset_remote,
550  const gaspi_size_t size,
551  const gaspi_queue_id_t queue,
552  const gaspi_timeout_t timeout_ms);
553 
570  gaspi_return_t gaspi_write_list (const gaspi_number_t num,
571  gaspi_segment_id_t *
572  const segment_id_local,
573  gaspi_offset_t * const offset_local,
574  const gaspi_rank_t rank,
575  gaspi_segment_id_t *
576  const segment_id_remote,
577  gaspi_offset_t * const offset_remote,
578  gaspi_size_t * const size,
579  const gaspi_queue_id_t queue,
580  const gaspi_timeout_t timeout_ms);
581 
599  gaspi_return_t gaspi_read_list (const gaspi_number_t num,
600  gaspi_segment_id_t * const segment_id_local,
601  gaspi_offset_t * const offset_local,
602  const gaspi_rank_t rank,
603  gaspi_segment_id_t *
604  const segment_id_remote,
605  gaspi_offset_t * const offset_remote,
606  gaspi_size_t * const size,
607  const gaspi_queue_id_t queue,
608  const gaspi_timeout_t timeout_ms);
618  gaspi_return_t gaspi_wait (const gaspi_queue_id_t queue,
619  const gaspi_timeout_t timeout_ms);
620 
622 
632  gaspi_return_t gaspi_barrier (const gaspi_group_t group,
633  const gaspi_timeout_t timeout_ms);
634 
649  gaspi_return_t gaspi_allreduce (gaspi_pointer_t const buffer_send,
650  gaspi_pointer_t const buffer_receive,
651  const gaspi_number_t num,
652  const gaspi_operation_t operation,
653  const gaspi_datatype_t datatyp,
654  const gaspi_group_t group,
655  const gaspi_timeout_t timeout_ms);
656 
657  gaspi_return_t gaspi_allreduce_user (gaspi_pointer_t const buffer_send,
658  gaspi_pointer_t const buffer_receive,
659  const gaspi_number_t num,
660  const gaspi_size_t element_size,
661  gaspi_reduce_operation_t const
662  reduce_operation,
663  gaspi_state_t const reduce_state,
664  const gaspi_group_t group,
665  const gaspi_timeout_t timeout_ms);
666 
668 
669 
683  gaspi_return_t gaspi_atomic_fetch_add (const gaspi_segment_id_t segment_id,
684  const gaspi_offset_t offset,
685  const gaspi_rank_t rank,
686  const gaspi_atomic_value_t val_add,
687  gaspi_atomic_value_t * const val_old,
688  const gaspi_timeout_t timeout_ms);
703  gaspi_return_t gaspi_atomic_compare_swap (const gaspi_segment_id_t
704  segment_id,
705  const gaspi_offset_t offset,
706  const gaspi_rank_t rank,
707  const gaspi_atomic_value_t
708  comparator,
709  const gaspi_atomic_value_t
710  val_new,
711  gaspi_atomic_value_t *
712  const val_old,
713  const gaspi_timeout_t timeout_ms);
715 
717 
718 
730  gaspi_return_t gaspi_passive_send (const gaspi_segment_id_t
731  segment_id_local,
732  const gaspi_offset_t offset_local,
733  const gaspi_rank_t rank,
734  const gaspi_size_t size,
735  const gaspi_timeout_t timeout_ms);
736 
749  gaspi_return_t gaspi_passive_receive (const gaspi_segment_id_t
750  segment_id_local,
751  const gaspi_offset_t offset_local,
752  gaspi_rank_t * const rem_rank,
753  const gaspi_size_t size,
754  const gaspi_timeout_t timeout_ms);
756 
758 
759 
772  gaspi_return_t gaspi_notify (const gaspi_segment_id_t segment_id_remote,
773  const gaspi_rank_t rank,
774  const gaspi_notification_id_t notification_id,
775  const gaspi_notification_t notification_value,
776  const gaspi_queue_id_t queue,
777  const gaspi_timeout_t timeout_ms);
778 
791  gaspi_return_t gaspi_notify_waitsome (const gaspi_segment_id_t
792  segment_id_local,
793  const gaspi_notification_id_t
794  notification_begin,
795  const gaspi_number_t num,
796  gaspi_notification_id_t *
797  const first_id,
798  const gaspi_timeout_t timeout_ms);
799 
809  gaspi_return_t gaspi_notify_reset (const gaspi_segment_id_t
810  segment_id_local,
811  const gaspi_notification_id_t
812  notification_id,
813  gaspi_notification_t *
814  const old_notification_val);
815 
833  gaspi_return_t gaspi_write_notify (const gaspi_segment_id_t
834  segment_id_local,
835  const gaspi_offset_t offset_local,
836  const gaspi_rank_t rank,
837  const gaspi_segment_id_t
838  segment_id_remote,
839  const gaspi_offset_t offset_remote,
840  const gaspi_size_t size,
841  const gaspi_notification_id_t
842  notification_id,
843  const gaspi_notification_t
844  notification_value,
845  const gaspi_queue_id_t queue,
846  const gaspi_timeout_t timeout_ms);
847 
867  gaspi_return_t gaspi_write_list_notify (const gaspi_number_t num,
868  gaspi_segment_id_t *
869  const segment_id_local,
870  gaspi_offset_t * const offset_local,
871  const gaspi_rank_t rank,
872  gaspi_segment_id_t *
873  const segment_id_remote,
874  gaspi_offset_t *
875  const offset_remote,
876  gaspi_size_t * const size,
877  const gaspi_segment_id_t
878  segment_id_notification,
879  const gaspi_notification_id_t
880  notification_id,
881  const gaspi_notification_t
882  notification_value,
883  const gaspi_queue_id_t queue,
884  const gaspi_timeout_t timeout_ms);
885 
887 
889 
890 
898  gaspi_return_t gaspi_queue_size (const gaspi_queue_id_t queue,
899  gaspi_number_t * const queue_size);
900 
908  gaspi_return_t gaspi_queue_num (gaspi_number_t * const queue_num);
909 
919  gaspi_return_t gaspi_queue_size_max (gaspi_number_t * const queue_size_max);
920 
931  const transfer_size_min);
932 
942  const transfer_size_max);
943 
952  gaspi_return_t gaspi_notification_num (gaspi_number_t * const notification_num);
953 
963  const
964  passive_transfer_size_max);
965 
973  gaspi_return_t gaspi_allreduce_buf_size (gaspi_size_t * const buf_size);
974 
982  gaspi_return_t gaspi_allreduce_elem_max (gaspi_number_t * const elem_max);
983 
992  gaspi_return_t gaspi_rw_list_elem_max (gaspi_number_t * const elem_max);
993 
1001  gaspi_return_t gaspi_network_type (gaspi_network_t * const network_type);
1002 
1010  gaspi_return_t gaspi_time_ticks (gaspi_time_t * const ticks);
1011 
1019  gaspi_return_t gaspi_cpu_frequency (gaspi_float * const cpu_mhz);
1020 
1028  gaspi_return_t gaspi_machine_type (char const machine_type[16]);
1029 
1038  gaspi_return_t gaspi_state_vec_get (gaspi_state_vector_t state_vector);
1039 
1040 
1046  void gaspi_printf (const char *fmt, ...);
1047 
1052  void gaspi_print_affinity_mask ();
1053 
1058  gaspi_return_t gaspi_set_socket_affinity (const gaspi_uchar socket);
1059 
1061 
1062 
1063 
1070  gaspi_return_t gaspi_statistic_verbosity_level(gaspi_number_t _verbosity_level);
1071 
1079  gaspi_return_t gaspi_statistic_counter_max(gaspi_statistic_counter_t* counter_max);
1080 
1093  gaspi_statistic_counter_info(gaspi_statistic_counter_t counter
1094  , gaspi_statistic_argument_t* counter_argument
1095  , gaspi_string_t* counter_name
1096  , gaspi_string_t* counter_description
1097  , gaspi_number_t* verbosity_level
1098  );
1099 
1110  gaspi_statistic_counter_get ( gaspi_statistic_counter_t counter
1111  , gaspi_number_t argument
1112  , gaspi_number_t *value
1113  );
1114 
1122  gaspi_return_t gaspi_statistic_counter_reset (gaspi_statistic_counter_t counter);
1123 
1125 
1126 #ifdef __cplusplus
1127 }
1128 #endif
1129 
1130 #endif