version 1.1, 2018/09/19 05:45:08 |
version 1.6, 2020/10/06 06:31:20 |
|
|
* 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: OpenXM_contrib2/asir2018/io/ox.c,v 1.5 2020/03/29 17:01:55 fujimoto Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 204 void create_my_mathcap(char *system) |
|
Line 204 void create_my_mathcap(char *system) |
|
/* sm tag */ |
/* sm tag */ |
n0 = 0; |
n0 = 0; |
if ( !strcmp(system,"asir") ) { |
if ( !strcmp(system,"asir") ) { |
for ( i = 0; k = asir_available_sm[i]; i++ ) { |
for ( i = 0; (k = asir_available_sm[i]) != 0; i++ ) { |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
} |
} |
} else if ( !strcmp(system,"ox_asir") ) { |
} else if ( !strcmp(system,"ox_asir") ) { |
for ( i = 0; k = ox_asir_available_sm[i]; i++ ) { |
for ( i = 0; (k = ox_asir_available_sm[i]) != 0; i++ ) { |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
} |
} |
NEXT(n) = 0; |
NEXT(n) = 0; |
} else if ( !strcmp(system,"ox_plot") ) { |
} else if ( !strcmp(system,"ox_plot") ) { |
for ( i = 0; k = ox_plot_available_sm[i]; i++ ) { |
for ( i = 0; (k = ox_plot_available_sm[i]) != 0; i++ ) { |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
} |
} |
NEXT(n) = 0; |
NEXT(n) = 0; |
Line 224 void create_my_mathcap(char *system) |
|
Line 224 void create_my_mathcap(char *system) |
|
/* ox tag */ |
/* ox tag */ |
MKUSINT(tag,OX_DATA); |
MKUSINT(tag,OX_DATA); |
/* cmo tag */ |
/* cmo tag */ |
for ( n0 = 0, i = 0; k = available_cmo[i]; i++ ) { |
for ( n0 = 0, i = 0; (k = available_cmo[i]) != 0; i++ ) { |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; |
} |
} |
NEXT(n) = 0; MKLIST(cmolist,n0); |
NEXT(n) = 0; MKLIST(cmolist,n0); |
Line 299 void mclist_to_mc(LIST mclist,struct mathcap *mc) |
|
Line 299 void mclist_to_mc(LIST mclist,struct mathcap *mc) |
|
{ |
{ |
int l,i,j; |
int l,i,j; |
NODE n,t,oxcmo,cap; |
NODE n,t,oxcmo,cap; |
int *ptr; |
unsigned int *ptr; |
|
|
/* |
/* |
[ |
[ |
Line 322 void mclist_to_mc(LIST mclist,struct mathcap *mc) |
|
Line 322 void mclist_to_mc(LIST mclist,struct mathcap *mc) |
|
n = NEXT(n); |
n = NEXT(n); |
t = BDY((LIST)BDY(n)); |
t = BDY((LIST)BDY(n)); |
mc->nsmcap = length(t); |
mc->nsmcap = length(t); |
mc->smcap = (int *)MALLOC_ATOMIC(mc->nsmcap*sizeof(int)); |
mc->smcap = (unsigned int *)MALLOC_ATOMIC(mc->nsmcap*sizeof(unsigned int)); |
for ( j = 0, ptr = mc->smcap; j < mc->nsmcap; j++, t = NEXT(t) ) |
for ( j = 0, ptr = mc->smcap; j < mc->nsmcap; j++, t = NEXT(t) ) |
ptr[j] = BDY((USINT)BDY(t)); |
ptr[j] = BDY((USINT)BDY(t)); |
|
|
Line 339 void mclist_to_mc(LIST mclist,struct mathcap *mc) |
|
Line 339 void mclist_to_mc(LIST mclist,struct mathcap *mc) |
|
/* cap ->BDY(CMOlistj) */ |
/* cap ->BDY(CMOlistj) */ |
l = length(cap); |
l = length(cap); |
mc->oxcap[j].ncap = l; |
mc->oxcap[j].ncap = l; |
mc->oxcap[j].cap = (unsigned int *)CALLOC(l+1,sizeof(unsigned int)); |
mc->oxcap[j].cap = (int *)CALLOC(l+1,sizeof(int)); |
for ( t = cap, ptr = mc->oxcap[j].cap, i = 0; i < l; t = NEXT(t), i++ ) |
for ( t = cap, ptr = (unsigned int *)mc->oxcap[j].cap, i = 0; i < l; t = NEXT(t), i++ ) |
ptr[i] = BDY((USINT)BDY(t)); |
ptr[i] = BDY((USINT)BDY(t)); |
} |
} |
/* check of no_ox_reset */ |
/* check of no_ox_reset */ |
Line 398 int check_by_mc(int s,unsigned int oxtag,unsigned int |
|
Line 398 int check_by_mc(int s,unsigned int oxtag,unsigned int |
|
if ( i == noxcap ) |
if ( i == noxcap ) |
return 0; |
return 0; |
ncap = oxcap[i].ncap; |
ncap = oxcap[i].ncap; |
cap = oxcap[i].cap; |
cap = (unsigned int *)oxcap[i].cap; |
for ( j = 0; j < ncap; j++ ) |
for ( j = 0; j < ncap; j++ ) |
if ( cap[j] == cmotag ) |
if ( cap[j] == cmotag ) |
break; |
break; |
Line 408 int check_by_mc(int s,unsigned int oxtag,unsigned int |
|
Line 408 int check_by_mc(int s,unsigned int oxtag,unsigned int |
|
return 1; |
return 1; |
} |
} |
|
|
|
#if !defined(VISUAL_CONSOLE) |
|
extern int Im_ox_plot; |
|
#if defined(ANDROID) |
|
int Im_ox_plot = 0; |
|
#endif |
|
#endif |
|
|
void begin_critical() { |
void begin_critical() { |
critical_when_signal = 1; |
critical_when_signal = 1; |
} |
} |
Line 437 void ox_usr1_handler(int sig) |
|
Line 444 void ox_usr1_handler(int sig) |
|
#if !defined(VISUAL) && !defined(__MINGW32__) |
#if !defined(VISUAL) && !defined(__MINGW32__) |
set_signal_for_restart(SIGUSR1,ox_usr1_handler); |
set_signal_for_restart(SIGUSR1,ox_usr1_handler); |
#endif |
#endif |
|
#if !defined(VISUAL_CONSOLE) |
|
if ( Im_ox_plot ) { |
|
ox_flushing = 1; |
|
ox_send_sync(0); |
|
return; |
|
} |
|
#endif |
if ( critical_when_signal ) { |
if ( critical_when_signal ) { |
fprintf(stderr,"usr1 : critical\n"); |
fprintf(stderr,"usr1 : critical\n"); |
ox_usr1_sent = 1; |
ox_usr1_sent = 1; |
Line 459 void ox_usr1_handler(int sig) |
|
Line 473 void ox_usr1_handler(int sig) |
|
|
|
void clear_readbuffer() |
void clear_readbuffer() |
{ |
{ |
#if defined(linux) |
#if defined(ANDROID) |
iofp[0].in->_IO_read_ptr = iofp[0].in->_IO_read_end; |
fpurge(iofp[0].in); |
|
#elif defined(linux) |
|
// iofp[0].in->_IO_read_ptr = iofp[0].in->_IO_read_end; |
|
__fpurge(iofp[0].in); |
#elif defined(__FreeBSD__) |
#elif defined(__FreeBSD__) |
fpurge(iofp[0].in); |
fpurge(iofp[0].in); |
#endif |
#endif |
Line 702 void ox_send_local_ring_102(int rank,VL vl) |
|
Line 719 void ox_send_local_ring_102(int rank,VL vl) |
|
|
|
unsigned int ox_recv(int s, int *id, Obj *p) |
unsigned int ox_recv(int s, int *id, Obj *p) |
{ |
{ |
unsigned int cmd,serial; |
int cmd,serial; |
USINT ui; |
USINT ui; |
|
|
wait_for_data(s); |
wait_for_data(s); |
Line 731 unsigned int ox_recv(int s, int *id, Obj *p) |
|
Line 748 unsigned int ox_recv(int s, int *id, Obj *p) |
|
|
|
unsigned int ox_recv_102(int rank, int *id, Obj *p) |
unsigned int ox_recv_102(int rank, int *id, Obj *p) |
{ |
{ |
unsigned int cmd,serial; |
int cmd,serial; |
USINT ui; |
USINT ui; |
|
|
wait_for_data_102(rank); |
wait_for_data_102(rank); |
Line 785 void ox_get_result(int s,Obj *rp) |
|
Line 802 void ox_get_result(int s,Obj *rp) |
|
void ox_read_int(int s, int *n) |
void ox_read_int(int s, int *n) |
{ |
{ |
ox_need_conv = iofp[s].conv; |
ox_need_conv = iofp[s].conv; |
read_int((FILE *)iofp[s].in,n); |
read_int((FILE *)iofp[s].in,(unsigned int *)n); |
} |
} |
|
|
void ox_read_int_102(int rank, int *n) |
void ox_read_int_102(int rank, int *n) |
{ |
{ |
ox_need_conv = iofp_102[rank].conv; |
ox_need_conv = iofp_102[rank].conv; |
read_int((FILE *)iofp_102[rank].in,n); |
read_int((FILE *)iofp_102[rank].in,(unsigned int *)n); |
} |
} |
|
|
void ox_read_cmo(int s, Obj *rp) |
void ox_read_cmo(int s, Obj *rp) |
Line 812 void ox_read_local(int s, Obj *rp) |
|
Line 829 void ox_read_local(int s, Obj *rp) |
|
int id; |
int id; |
|
|
ox_need_conv = iofp[s].conv; |
ox_need_conv = iofp[s].conv; |
read_int((FILE *)iofp[s].in,&id); |
read_int((FILE *)iofp[s].in,(unsigned int *)&id); |
switch ( id ) { |
switch ( id ) { |
case ASIR_VL: |
case ASIR_VL: |
loadvl((FILE *)iofp[s].in); |
loadvl((FILE *)iofp[s].in); |
Line 832 void ox_read_local_102(int rank, Obj *rp) |
|
Line 849 void ox_read_local_102(int rank, Obj *rp) |
|
int id; |
int id; |
|
|
ox_need_conv = iofp_102[rank].conv; |
ox_need_conv = iofp_102[rank].conv; |
read_int((FILE *)iofp_102[rank].in,&id); |
read_int((FILE *)iofp_102[rank].in,(unsigned int *)&id); |
switch ( id ) { |
switch ( id ) { |
case ASIR_VL: |
case ASIR_VL: |
loadvl((FILE *)iofp_102[rank].in); |
loadvl((FILE *)iofp_102[rank].in); |
Line 850 void ox_read_local_102(int rank, Obj *rp) |
|
Line 867 void ox_read_local_102(int rank, Obj *rp) |
|
void ox_write_int(int s, int n) |
void ox_write_int(int s, int n) |
{ |
{ |
ox_need_conv = iofp[s].conv; |
ox_need_conv = iofp[s].conv; |
write_int((FILE *)iofp[s].out,&n); |
write_int((FILE *)iofp[s].out,(unsigned int *)&n); |
} |
} |
|
|
void ox_write_int_102(int rank, int n) |
void ox_write_int_102(int rank, int n) |
{ |
{ |
ox_need_conv = iofp_102[rank].conv; |
ox_need_conv = iofp_102[rank].conv; |
write_int((FILE *)iofp_102[rank].out,&n); |
write_int((FILE *)iofp_102[rank].out,(unsigned int *)&n); |
} |
} |
|
|
void ox_write_cmo(int s, Obj obj) |
void ox_write_cmo(int s, Obj obj) |