Commit 347d5874 authored by Viktor Bogischef's avatar Viktor Bogischef

Reporting number of leaves per thread

Fixed interactive pv-split
Signed-off-by: 's avatarViktor Bogischef <bogischv@informatik.tu-muenchen.de>
parent 17980573
......@@ -89,10 +89,6 @@ void MyDomain::sendBoard()
void MyDomain::received(char* str)
{
for(int i=1;i<num_threads;i++)
MPI_Send (str, 1024, MPI_CHAR, i, 10,
MPI_COMM_WORLD);
if (strncmp(str, "quit", 4)==0) {
l.exit();
......
......@@ -26,6 +26,7 @@
int thread_rank;
int num_threads;
int *slaveleaves, *slavenodes;
FILE *file;
......@@ -308,10 +309,6 @@ int main(int argc, char* argv[])
while( len<499 && (c=fgetc(file)) != EOF)
global_tmp[len++] = (char) c;
global_tmp[len++]=0;
//printf("Gaurav\n");
//printf("%s",global_tmp);
//printf("Gaurav\n");
}
SearchStrategy* ss = SearchStrategy::create(strategyNo);
......@@ -325,6 +322,12 @@ int main(int argc, char* argv[])
if(thread_rank == 0) {
slaveleaves = (int*) malloc((num_threads-1)*sizeof(int));
slavenodes = (int*) malloc((num_threads-1)*sizeof(int));
int i;
for ( i = 0; i < num_threads-1; i++)
slaveleaves[i] = slavenodes[i] = 0;
MyDomain d(lport);
d.received(global_tmp);
......@@ -335,7 +338,10 @@ int main(int argc, char* argv[])
for (slave_id = 0; slave_id < num_threads-1; slave_id++)
MPI_Send(&slave_input, sizeof(Slave_Input), MPI_BYTE, slave_id + 1, 10, MPI_COMM_WORLD);
//printf("Average leaves visited per sec = %d k/s\n", avg_kleavesPerSec);
for (i = 0; i < num_threads-1; i++)
printf("Thread %d calculated %d leaves and %d nodes\n", i+1, slaveleaves[i], slavenodes[i]);
free(slaveleaves);
free(slavenodes);
}
else
{
......@@ -375,25 +381,6 @@ int main(int argc, char* argv[])
MPI_Send(&slave_output, sizeof(Slave_Output), MPI_BYTE, 0, 10, MPI_COMM_WORLD);
}
}
/*
int *avg_list;
avg_list = (int*)malloc(sizeof(int)*num_threads);
MPI_Gather (&avg_kleavesPerSec, 1, MPI_INT,
avg_list, 1, MPI_INT, 0, MPI_COMM_WORLD);
if(thread_rank == 0)
{
int average;
for(int i=0;i<num_threads;i++) {
average += avg_list[i];
}
printf("\n\n\n%d, %d, %d, %f, %s\n", num_threads, maxDepth, average, _msecs/1000.0, ss->_bestMove.name());
}*/
MPI_Finalize();
}
......@@ -15,7 +15,8 @@
extern int thread_rank;
extern int num_threads;
extern int *slaveleaves;
extern int *slavenodes;
/**
* Entry point for search
......@@ -184,6 +185,10 @@ int ABIDStrategy::pv_split(int alpha0, int beta0)
MPI_Waitany(num_slaves, rcv_rq, &slave_id, MPI_STATUS_IGNORE);
_sc->_leavesVisited += slave_output[slave_id].num_leaves;
_sc->_nodesVisited += slave_output[slave_id].num_nodes;
slaveleaves[slave_id] += slave_output[slave_id].num_leaves;
slavenodes[slave_id] += slave_output[slave_id].num_nodes;
value = slave_output[slave_id].eval;
if (value > currentValue)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment