|
@@ -793,6 +793,27 @@ void sig_ACK_handler(int sender_id){
|
|
|
}
|
|
|
} else if (tmp_inter_list->type == AGENT_REQ_CORES_PENDING) {
|
|
|
tmp_inter_list->type = AGENT_REQ_CORES;
|
|
|
+
|
|
|
+ /* Was added to avoid increasing counter inside signal handler, because it is not the same when asking for an offer or when getting a reply */
|
|
|
+ data_array_local[0] = tmp_inter_list->data.reg_arr.region_arr[0].C;
|
|
|
+ data_array_local[1] = tmp_inter_list->data.reg_arr.region_arr[0].r;
|
|
|
+ #ifdef PLAT_SCC
|
|
|
+ error = RCCE_put((t_vcharp)(&data_array[0]), (t_vcharp)(&data_array_local[0]), LINE_SIZE * sizeof(int), sender_id);
|
|
|
+ if (error != RCCE_SUCCESS) {
|
|
|
+ RCCE_error_string(error, error_str, &str_len);
|
|
|
+ printf("I am %d and i got an error in put data to %d with descr %s\n",node_id,sender_id,error_str);
|
|
|
+ }
|
|
|
+
|
|
|
+ RCCE_flag_write(&flag_data_written, RCCE_FLAG_SET, sender_id);
|
|
|
+ #else
|
|
|
+ mem_offset = sender_id * MAX_DATA_LIST_LEN * LINE_SIZE;
|
|
|
+ for (i=0; i<LINE_SIZE; i++)
|
|
|
+ data_array[mem_offset + i] = data_array_local[i];
|
|
|
+
|
|
|
+ sem_post(&flag_data_written[sender_id]);
|
|
|
+ //fprintf(log_file,"I free flag_data_written lock %d\n", sender_id);
|
|
|
+ #endif
|
|
|
+
|
|
|
free(tmp_inter_list->data.reg_arr.region_arr);
|
|
|
my_stats.message_size += sizeof(region);
|
|
|
my_stats.message_size += sizeof(app);
|
|
@@ -800,6 +821,27 @@ void sig_ACK_handler(int sender_id){
|
|
|
} else if (tmp_inter_list->type == SELFOPT_REQ_CORES_PENDING) {
|
|
|
my_stats.message_size += sizeof(app);
|
|
|
my_stats.message_size += sizeof(region);
|
|
|
+
|
|
|
+ /* Was added to avoid increasing counter inside signal handler, because it is not the same when asking for an offer or when getting a reply */
|
|
|
+ data_array_local[0] = tmp_inter_list->data.reg_arr.region_arr[0].C;
|
|
|
+ data_array_local[1] = tmp_inter_list->data.reg_arr.region_arr[0].r;
|
|
|
+ #ifdef PLAT_SCC
|
|
|
+ error = RCCE_put((t_vcharp)(&data_array[0]), (t_vcharp)(&data_array_local[0]), LINE_SIZE * sizeof(int), sender_id);
|
|
|
+ if (error != RCCE_SUCCESS) {
|
|
|
+ RCCE_error_string(error, error_str, &str_len);
|
|
|
+ printf("I am %d and i got an error in put data to %d with descr %s\n",node_id,sender_id,error_str);
|
|
|
+ }
|
|
|
+
|
|
|
+ RCCE_flag_write(&flag_data_written, RCCE_FLAG_SET, sender_id);
|
|
|
+ #else
|
|
|
+ mem_offset = sender_id * MAX_DATA_LIST_LEN * LINE_SIZE;
|
|
|
+ for (i=0; i<LINE_SIZE; i++)
|
|
|
+ data_array[mem_offset + i] = data_array_local[i];
|
|
|
+
|
|
|
+ sem_post(&flag_data_written[sender_id]);
|
|
|
+ //fprintf(log_file,"I free flag_data_written lock %d\n", sender_id);
|
|
|
+ #endif
|
|
|
+
|
|
|
tmp_inter_list->type = SELFOPT_REQ_CORES;
|
|
|
free(tmp_inter_list->data.reg_arr.region_arr);
|
|
|
clear = 0;
|
|
@@ -1738,9 +1780,30 @@ void sig_REQ_CORES_handler(int sender_id, int *inc_cnt, int cur_index_top) {
|
|
|
fflush(log_file);
|
|
|
|
|
|
if (core_inter_head[sender_id] == NULL && my_cores != NULL) {
|
|
|
- *inc_cnt = *inc_cnt + 1;
|
|
|
+ /* *inc_cnt = *inc_cnt + 1; */
|
|
|
|
|
|
/* 12.7.2017 really major change compared to TECS 8x6 to add an extra readline in REQ_CORES for artificial apps */
|
|
|
+ /* 31.7.2017 Change to data array in order to avoid inc_cnt */
|
|
|
+
|
|
|
+ #ifdef PLAT_SCC
|
|
|
+ RCCE_flag_write(&flag_data_written, RCCE_FLAG_UNSET, node_id);
|
|
|
+ scc_kill(sender_id, SIG_ACK, core_inter_head[sender_id]);
|
|
|
+
|
|
|
+ RCCE_wait_until(flag_data_written, RCCE_FLAG_SET);
|
|
|
+
|
|
|
+ error = RCCE_get((t_vcharp)(&data_array_local[0]), (t_vcharp)(&data_array[0]), LINE_SIZE * sizeof(int), node_id);
|
|
|
+ if (error != RCCE_SUCCESS) {
|
|
|
+ RCCE_error_string(error, error_str, &str_len);
|
|
|
+ printf("I am %d and i got an error in get data in sig_REQ_CORES_handler from %d with descr %s\n",node_id,sender_id,error_str);
|
|
|
+ }
|
|
|
+
|
|
|
+ #else
|
|
|
+ scc_kill(sender_id, SIG_ACK, core_inter_head[sender_id]);
|
|
|
+ sem_wait(&flag_data_written[node_id]);
|
|
|
+ my_RCCE_get(&data_array_local[0], &data_array[0], LINE_SIZE, node_id);
|
|
|
+ #endif
|
|
|
+
|
|
|
+ /*
|
|
|
#ifdef PLAT_SCC
|
|
|
RCCE_acquire_lock(node_id);
|
|
|
#else
|
|
@@ -1757,11 +1820,12 @@ void sig_REQ_CORES_handler(int sender_id, int *inc_cnt, int cur_index_top) {
|
|
|
fflush(log_file);
|
|
|
}
|
|
|
#else
|
|
|
- /* FIXME this will block in simulation if we do not add sem_post */
|
|
|
+ // FIXME this will block in simulation if we do not add sem_post
|
|
|
new_RCCE_get(sig_read_ar, sig_array, cur_index_top, LINE_SIZE, node_id);
|
|
|
#endif
|
|
|
|
|
|
- scc_kill(sender_id, SIG_ACK, NULL);
|
|
|
+ scc_kill(sender_id, SIG_ACK, NULL);
|
|
|
+ */
|
|
|
my_stats.msg_count++;
|
|
|
my_stats.distance += distance(node_id,sender_id);
|
|
|
req_app.id = sig_read_ar[2];
|
|
@@ -1801,8 +1865,12 @@ void sig_REQ_CORES_handler(int sender_id, int *inc_cnt, int cur_index_top) {
|
|
|
off_arr.offer_arr = (offer *) malloc(off_arr.num_of_offers * sizeof(offer));
|
|
|
core_inter_tail[sender_id]->next = NULL;
|
|
|
|
|
|
+ /*
|
|
|
cur_reg.C = sig_read_ar[8];
|
|
|
cur_reg.r = sig_read_ar[9];
|
|
|
+ */
|
|
|
+ cur_reg.C = data_array_local[0];
|
|
|
+ cur_reg.r = data_array_local[1];
|
|
|
fprintf(log_file,"Searching in C = %d r = %d\n",cur_reg.C,cur_reg.r);
|
|
|
fflush(log_file);
|
|
|
|