void send_data(int signum) {
int c;
- unsigned char data;
- int fd;
c=gd3_l->max_x*gd3_l->max_y*gd3_l->max_z;
- printf("%d <-\n",c);
-
- network_send(gnet->connection[0].fd,&dc,1);
- network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
- printf("debug: sent dc\n");
-
- network_send(gnet->connection[0].fd,(unsigned char *)gd3_l,
- sizeof(d3_lattice));
- network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
- printf("debug: sent d3_lattice\n");
-
- network_send(gnet->connection[0].fd,(unsigned char *)gmy_info,sizeof(info));
- network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
- printf("debug: sent info\n");
-
- network_send(gnet->connection[0].fd,gd3_l->status,c*sizeof(unsigned char));
- network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
- printf("debug: sent ac\n");
-
- network_send(gnet->connection[0].fd,(unsigned char *)gd3_l->extra,
- c*sizeof(int));
- network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
- printf("debug: sent cc\n");
-
- network_send(gnet->connection[0].fd,(unsigned char *)gi,sizeof(int));
- network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
- printf("debug: sent steps\n");
-
- if(signum==121) {
- printf("save test file\n");
- fd=open("./test.save",O_WRONLY|O_CREAT);
- write(fd,gd3_l,sizeof(d3_lattice));
- write(fd,gmy_info,sizeof(info));
- write(fd,gd3_l->status,c*sizeof(unsigned char));
- write(fd,gd3_l->extra,c*sizeof(int));
- close(fd);
- }
-
+ network_send_chan(gnet,0,&dc,1);
+ network_send_chan(gnet,0,(unsigned char *)gd3_l,sizeof(d3_lattice));
+ network_send_chan(gnet,0,(unsigned char *)gmy_info,sizeof(info));
+ network_send_chan(gnet,0,gd3_l->status,c*sizeof(unsigned char));
+ network_send_chan(gnet,0,(unsigned char *)gd3_l->extra,c*sizeof(int));
+ network_send_chan(gnet,0,(unsigned char *)gi,sizeof(int));
}
i++;
if(i%my_info.save_rate==0) {
dc=DC_OK;
- send_data(120);
+ send_data(0);
dc=DC_QUIT;
}
if(i%my_info.s_rate==0) sputter(&d3_l);
/* finished */
dc=DC_END;
- send_data(121);
+ send_data(0);
dc=DC_QUIT;
/* shutdown/free/close everything now ... */
int ret;
d3_lattice d3l;
info info;
- unsigned char data;
t_job *j;
j=(t_job *)priv.job.current->data;
- printf("receiving data from client (%d)\n",j->size);
- data=DATA_OK;
-
- /* initial data_ok to start transmit on client */
- network_send_chan(&(priv.net),gi,&data,sizeof(unsigned char));
+ printf("receiving data from client (#cells=%d)\n",j->size);
network_receive_chan(&(priv.net),gi,(unsigned char *)&d3l,
sizeof(d3_lattice));
- network_send_chan(&(priv.net),gi,&data,sizeof(unsigned char));
- printf("debug: got d3_lattice\n");
-
network_receive_chan(&(priv.net),gi,(unsigned char *)&info,sizeof(info));
- network_send_chan(&(priv.net),gi,&data,sizeof(unsigned char));
- printf("debug: got info\n");
-
network_receive_chan(&(priv.net),gi,j->ac,j->size*sizeof(unsigned char));
- network_send_chan(&(priv.net),gi,&data,sizeof(unsigned char));
- printf("debug: got ac\n");
-
network_receive_chan(&(priv.net),gi,(unsigned char *)j->cc,
j->size*sizeof(int));
- network_send_chan(&(priv.net),gi,&data,sizeof(unsigned char));
- printf("debug: got cc\n");
-
network_receive_chan(&(priv.net),gi,(unsigned char *)&(j->step),sizeof(int));
- network_send_chan(&(priv.net),gi,&data,sizeof(unsigned char));
- printf("debug: got steps\n");
if(dc!=DC_QUIT) {
snprintf(filename,128,"./data/nlsop_b%f_c%f_s%f_ds%d_dr%f_-_%d_of_%d.save",