diff --git a/omp_hello.c b/omp_hello.c index 8d3567472777029d07f23811b7fde4954d0219f3..fdf5388b65bea1c1bed5a064efb4c9e17bd3e5e6 100644 --- a/omp_hello.c +++ b/omp_hello.c @@ -37,6 +37,16 @@ int main(int argc, char *argv[]) { int thread_count = strtol(argv[1], NULL, 10); int n_nodes = strtol(argv[2],NULL,10); + + // number of thread set to nearest , bigger divisor of nodes + if(n_nodes%thread_count!=0){ + while(n_nodes%thread_count!=0){ + thread_count++; + } + printf("Number of threads changed to %d so %d nodes can be equally divided\n" , thread_count, n_nodes); + } + + // Graph initialization graph = malloc(n_nodes*n_nodes*sizeof(int)); initGraph(graph,n_nodes);