Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ipc.h

Go to the documentation of this file.
00001 
00006 #ifndef ___IPC_H___
00007 #define ___IPC_H___
00008 
00009 #include <stdlib.h>
00010 /* platform-independent types i32, etc. */
00011 #include "ind_types.h"
00012 
00013 
00014 /* Defines and typedefs */
00015 
00016 /* Assume long long type is available except under a few architectures */
00017 #ifdef _CRAYMPP
00018 #ifdef __cplusplus
00019 #define LONG_LONG_UNAVAILABLE
00020 #endif
00021 #endif
00022 
00023 /* Datatypes for copy operations */
00024 /* Based on MPI datatypes, with C equivalent shown as comments */
00025 typedef unsigned int ipc_datatype;
00026 typedef int ipc_status;
00027 
00028 #define IPC_RAW8                ((ipc_datatype)1)  
00029 #define IPC_RAW32               ((ipc_datatype)2)  
00030 #define IPC_RAW64               ((ipc_datatype)3)  
00031 #define IPC_CHAR                ((ipc_datatype)4)  
00032 #define IPC_SHORT               ((ipc_datatype)5)  
00033 #define IPC_INT                 ((ipc_datatype)6)  
00034 #define IPC_LONG                ((ipc_datatype)7)  
00035 #define IPC_LONG_LONG           ((ipc_datatype)8)  
00036 #define IPC_UNSIGNED_CHAR       ((ipc_datatype)9)  
00037 #define IPC_UNSIGNED_SHORT      ((ipc_datatype)10) 
00038 #define IPC_UNSIGNED            ((ipc_datatype)11) 
00039 #define IPC_UNSIGNED_LONG       ((ipc_datatype)12) 
00040 #define IPC_FLOAT               ((ipc_datatype)13) 
00041 #define IPC_DOUBLE              ((ipc_datatype)14) 
00042 #define IPC_LONG_DOUBLE         ((ipc_datatype)15) 
00045 #define IPC_NO_ERROR 0
00046 
00047 #define IPC_EXIT_NORMAL                 0
00048 #define IPC_EXIT_WRONG_USAGE            1
00049 #define IPC_EXIT_FILE_PROBLEM           2
00050 #define IPC_EXIT_PARAM_VALUE_ERROR      3
00051 #define IPC_EXIT_OUT_OF_MEMORY          4
00052 #define IPC_EXIT_TOO_MANY_ERRORS        5
00053 
00054 /*
00055   Values for debug_level in ipc_notify() and ipc_msg_level
00056 */
00057 #define IPC_NONE     -10
00058 #define IPC_ERROR     -6
00059 #define IPC_WARNING   -4
00060 #define IPC_CAUTION   -2
00061 #define IPC_ALERT      0
00062 #define IPC_SUMMARY    2
00063 #define IPC_STD        4
00064 #define IPC_VERBOSE    6
00065 #define IPC_OVERWHELM 10
00066 
00067 /*
00068   Values for print_pe on messages
00069   IPC_ONE defaults to parent PE
00070 */
00071 #define IPC_ONE  0
00072 #define IPC_ALL -1
00073 
00074 /* Parameters that can be changed by external programs */
00075 extern int ipc_msg_level;
00076 extern int ipc_exit_on_error_num;
00077 extern int ipc_max_errors;  
00078 extern int ipc_max_warnings;
00079 extern int ipc_msg_forceall_level;
00080 extern int ipc_msg_synch_level;
00081 
00082 /* Documentation for parameters */
00083 extern const char* ipc_msg_level_docstring;
00084 extern const char* ipc_exit_on_error_num_docstring;
00085 extern const char* ipc_max_errors_docstring;
00086 extern const char* ipc_max_warnings_docstring;
00087 extern const char* ipc_msg_forceall_level_docstring;
00088 extern const char* ipc_msg_synch_level_docstring;
00089 
00090 /* General interprocess communication routines */
00091 int        ipc_datatype_size(ipc_datatype datatype);
00092 int        ipc_num_processes(void);
00093 int        ipc_my_process(void); 
00094 void       ipc_barrier(void); 
00095 void       ipc_set_barrier(void);
00096 
00097 /*  User interface for copying data to and from a remote process */
00098 
00099 /* C user interface -- no inherent type-checking */
00100 #ifndef __cplusplus
00101 ipc_status ipc_put(void *data, ipc_datatype datatype, size_t count, int process);
00102 ipc_status ipc_get(void *data, ipc_datatype datatype, size_t count, int process);
00103 ipc_status ipc_put_to(void *target_data, void *source_data, ipc_datatype datatype, size_t count, int process);
00104 ipc_status ipc_get_to(void *target_data, void *source_data, ipc_datatype datatype, size_t count, int process);
00105 
00106 
00107 /* C++ user interface -- two overloaded versions per ipc_datatype:
00108    one C-compatible version allowing weak form of runtime 
00109    type-checking, the other fully type-safe but incompatible. */
00110 #else
00111 #define IPC_CALL_PROTO(name, type,ipc_type) \
00112 ipc_status ipc_ ## name         (type *data,                                        size_t count, int process); \
00113 ipc_status ipc_ ## name         (type *data,                 ipc_datatype datatype, size_t count, int process); \
00114 ipc_status ipc_ ## name ## _to  (type *target, type *source,                        size_t count, int process); \
00115 ipc_status ipc_ ## name ## _to  (type *target, type *source, ipc_datatype datatype, size_t count, int process) 
00116 
00117 /* IPC_CALL_PROTO(put, signed char      ,IPC_CHAR            );  */
00118 IPC_CALL_PROTO(put, signed short     ,IPC_SHORT           ); 
00119 IPC_CALL_PROTO(put, signed int       ,IPC_INT             ); 
00120 IPC_CALL_PROTO(put, signed long      ,IPC_LONG            ); 
00121 #ifndef LONG_LONG_UNAVAILABLE
00122 IPC_CALL_PROTO(put, signed long long ,IPC_LONG_LONG       );
00123 #endif
00124 IPC_CALL_PROTO(put, unsigned char    ,IPC_UNSIGNED_CHAR   ); 
00125 IPC_CALL_PROTO(put, unsigned short   ,IPC_UNSIGNED_SHORT  ); 
00126 IPC_CALL_PROTO(put, unsigned int     ,IPC_UNSIGNED        ); 
00127 IPC_CALL_PROTO(put, unsigned long    ,IPC_UNSIGNED_LONG   ); 
00128 IPC_CALL_PROTO(put, float            ,IPC_FLOAT           ); 
00129 IPC_CALL_PROTO(put, double           ,IPC_DOUBLE          ); 
00130 #ifndef LONG_DOUBLE_UNAVAILABLE
00131 IPC_CALL_PROTO(put, long double      ,IPC_LONG_DOUBLE     ); 
00132 #endif
00133 
00134 /* IPC_CALL_PROTO(get, signed char      ,IPC_CHAR         );  */
00135 IPC_CALL_PROTO(get, signed short     ,IPC_SHORT           ); 
00136 IPC_CALL_PROTO(get, signed int       ,IPC_INT             ); 
00137 IPC_CALL_PROTO(get, signed long      ,IPC_LONG            ); 
00138 #ifndef LONG_LONG_UNAVAILABLE
00139 IPC_CALL_PROTO(get, signed long long ,IPC_LONG_LONG       );
00140 #endif
00141 IPC_CALL_PROTO(get, unsigned char    ,IPC_UNSIGNED_CHAR   ); 
00142 IPC_CALL_PROTO(get, unsigned short   ,IPC_UNSIGNED_SHORT  ); 
00143 IPC_CALL_PROTO(get, unsigned int     ,IPC_UNSIGNED        ); 
00144 IPC_CALL_PROTO(get, unsigned long    ,IPC_UNSIGNED_LONG   ); 
00145 IPC_CALL_PROTO(get, float            ,IPC_FLOAT           ); 
00146 IPC_CALL_PROTO(get, double           ,IPC_DOUBLE          ); 
00147 #ifndef LONG_DOUBLE_UNAVAILABLE
00148 IPC_CALL_PROTO(get, long double      ,IPC_LONG_DOUBLE     ); 
00149 #endif
00150 #undef IPC_CALL_PROTO
00151 
00152 #endif
00153 
00154 
00160 #define IPC_PUT_RAW_PROTO(bits) \
00161 ipc_status ipc_put ## bits(void *data, size_t count, int process);
00162 IPC_PUT_RAW_PROTO(8)
00163 IPC_PUT_RAW_PROTO(32)
00164 IPC_PUT_RAW_PROTO(64)
00165 #undef IPC_PUT_RAW_PROTO
00166 
00167 #define IPC_GET_RAW_PROTO(bits) \
00168 ipc_status ipc_get ## bits(void *data, size_t count, int process);
00169 IPC_GET_RAW_PROTO(8)
00170 IPC_GET_RAW_PROTO(32)
00171 IPC_GET_RAW_PROTO(64)
00172 #undef IPC_GET_RAW_PROTO
00173 
00174 /* Message, warning, and exit routines */
00175 void ipc_pe_msg_delay( double scale );
00176 void ipc_init(void);
00177 void ipc_init_logfile(const char *basefilename);
00178      
00179 void ipc_log(    int print_pe,                    const char *format, ...);
00180 int  ipc_notify( int print_pe, int message_level, const char *format, ...);
00181 void ipc_exit(   int status,                      const char *format, ...);
00182 void ipc_abort(  int status,                      const char *format, ...);
00183 
00184 
00185 /*
00186   Functions provided as convenient markers for a debugger
00187   to break when an error or warning occurs; not intended
00188   to be called directly
00189 */
00190 void ipc_error(   void );
00191 void ipc_warning( void );
00192 
00193 #endif
00194 
00195      

Generated at Mon Aug 21 00:30:54 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000