That sounds like a good start.
Type: Posts; User: Salem
That sounds like a good start.
For me, splitting the code into two or three functions would help with the overall program clarity.
200+ lines in main is a bit much.
So did you do any testing like I suggested?
Since you decided to trim away any possibility that we might have to run your code, I can only suggest some ideas for debugging your own code.
Start with
for( i=0; i < (log(nprocs)/log(2));...