[BACK]Return to ox.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / io

Diff for /OpenXM_contrib2/asir2000/io/ox.c between version 1.21 and 1.28

version 1.21, 2003/12/09 03:07:45 version 1.28, 2009/02/13 11:25:48
Line 44 
Line 44 
  * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY   * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  * $OpenXM: OpenXM_contrib2/asir2000/io/ox.c,v 1.20 2003/03/07 03:12:28 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/io/ox.c,v 1.27 2006/02/08 02:11:19 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 56 
Line 56 
   
 extern Obj VOIDobj;  extern Obj VOIDobj;
   
   extern int nserver_102, myrank_102;
 extern int ox_need_conv;  extern int ox_need_conv;
 int ox_usr1_sent, ox_int_received, critical_when_signal;  int ox_usr1_sent, ox_int_received, critical_when_signal;
 unsigned int ox_serial;  unsigned int ox_serial;
Line 119  static int available_cmo[] = {
Line 120  static int available_cmo[] = {
         CMO_ZZ, CMO_QQ, CMO_ZERO,          CMO_ZZ, CMO_QQ, CMO_ZERO,
         CMO_DMS_GENERIC, CMO_DMS_OF_N_VARIABLES,          CMO_DMS_GENERIC, CMO_DMS_OF_N_VARIABLES,
         CMO_RING_BY_NAME, CMO_DISTRIBUTED_POLYNOMIAL,          CMO_RING_BY_NAME, CMO_DISTRIBUTED_POLYNOMIAL,
       CMO_RATIONAL,
         CMO_RECURSIVE_POLYNOMIAL, CMO_UNIVARIATE_POLYNOMIAL,          CMO_RECURSIVE_POLYNOMIAL, CMO_UNIVARIATE_POLYNOMIAL,
         CMO_INDETERMINATE,          CMO_INDETERMINATE,
         CMO_TREE,          CMO_TREE,
Line 145  static int ox_asir_available_sm[] = {
Line 147  static int ox_asir_available_sm[] = {
         SM_mathcap, SM_setMathcap, SM_nop,          SM_mathcap, SM_setMathcap, SM_nop,
         SM_beginBlock, SM_endBlock,          SM_beginBlock, SM_endBlock,
         SM_set_rank_102, SM_tcp_accept_102, SM_tcp_connect_102, SM_reset_102,          SM_set_rank_102, SM_tcp_accept_102, SM_tcp_connect_102, SM_reset_102,
           SM_bcast_102, SM_reduce_102,
         0          0
 };  };
   
Line 401  void end_critical() {
Line 404  void end_critical() {
         }          }
 }  }
   
 extern FUNC registered_handler;  extern NODE user_int_handler;
   
 void ox_usr1_handler(int sig)  void ox_usr1_handler(int sig)
 {  {
           NODE t;
   
 #if !defined(VISUAL)  #if !defined(VISUAL)
         signal(SIGUSR1,ox_usr1_handler);          signal(SIGUSR1,ox_usr1_handler);
 #endif  #endif
Line 413  void ox_usr1_handler(int sig)
Line 418  void ox_usr1_handler(int sig)
                 ox_usr1_sent = 1;                  ox_usr1_sent = 1;
         } else {          } else {
                 ox_flushing = 1;                  ox_flushing = 1;
                 if ( registered_handler ) {                  if ( user_int_handler ) {
                         fprintf(stderr,                          fprintf(stderr,
                                 "usr1 : calling the registered exception handler...");                                  "usr1 : calling the registered exception handlers...");
                         bevalf(registered_handler,0);                          for ( t = user_int_handler; t; t = NEXT(t) )
                                   bevalf((FUNC)BDY(t),0);
                         fprintf(stderr, "done.\n");                          fprintf(stderr, "done.\n");
                 }                  }
                 ox_resetenv("usr1 : return to toplevel by SIGUSR1");                  ox_resetenv("usr1 : return to toplevel by SIGUSR1");
Line 456  void wait_for_data(int s)
Line 462  void wait_for_data(int s)
 {  {
         return;          return;
 }  }
   
   void wait_for_data_102(int rank)
   {
           return;
   }
 #else  #else
 int ox_data_is_available(int s)  int ox_data_is_available(int s)
 {  {
Line 508  void ox_send_data(int s,pointer p)
Line 519  void ox_send_data(int s,pointer p)
         ERR err;          ERR err;
   
         if ( ox_check && !ox_check_cmo(s,(Obj)p) ) {          if ( ox_check && !ox_check_cmo(s,(Obj)p) ) {
                 create_error(&err,ox_serial,"ox_send_data : Mathcap violation");                  create_error(&err,ox_serial,"ox_send_data : Mathcap violation",0);
                 p = (pointer)err;                  p = (pointer)err;
         }          }
         begin_critical();          begin_critical();
Line 529  void ox_send_data_102(int rank,pointer p)
Line 540  void ox_send_data_102(int rank,pointer p)
         ox_write_cmo_102(rank,p);          ox_write_cmo_102(rank,p);
         ox_flush_stream_102(rank);          ox_flush_stream_102(rank);
         end_critical();          end_critical();
   }
   
   void ox_bcast_102(int root)
   {
           Obj data;
           int r,mask,id,src,dst;
   
           r = myrank_102-root;
           if ( r == 0 )
                   data = (Obj)asir_pop_one();
   
           if ( r < 0 ) r += nserver_102;
           for ( mask = 1; mask < nserver_102; mask <<= 1 )
                   if ( r&mask ) {
                           src = myrank_102-mask;
                           if ( src < 0 ) src += nserver_102;
                           ox_recv_102(src,&id,&data);
                           break;
                   }
           for ( mask >>= 1; mask > 0; mask >>= 1 )
                   if ( (r+mask) < nserver_102 ) {
                           dst = myrank_102+mask;
                           if ( dst >= nserver_102 ) dst -= nserver_102;
                           ox_send_data_102(dst,data);
                   }
           asir_push_one(data);
   }
   
   /* func : an arithmetic funcion func(vl,a,b,*c) */
   
   void ox_reduce_102(int root,void (*func)())
   {
           Obj data,data0,t;
           int r,mask,id,src,dst;
   
           r = myrank_102-root;
           if ( r < 0 ) r += nserver_102;
           data = (Obj)asir_pop_one();
           for ( mask = 1; mask < nserver_102; mask <<= 1 )
                   if ( r&mask ) {
                           dst = (r-mask)+root;
                           if ( dst >= nserver_102 ) dst -= nserver_102;
                           ox_send_data_102(dst,data);
                           break;
                   } else {
                           src = r+mask;
                           if ( src < nserver_102 ) {
                                   src += root;
                                   if ( src >= nserver_102 ) src -= nserver_102;
                                   ox_recv_102(src,&id,&data0);
                                   (*func)(CO,data,data0,&t); data = t;
                           }
                   }
           asir_push_one(r?0:data);
 }  }
   
 void ox_send_cmd(int s,int id)  void ox_send_cmd(int s,int id)

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.28

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>