On Sat, Nov 6, 2010 at 18:00, Jack Bryan <dtustudy68_at_[hidden]> wrote:
> About my MPI program bugs:
> I used GDB and got the error:
> Program received signal SIGSEGV, Segmentation fault.
> 0: 0x0000003a31c62184 in fwrite () from /lib64/libc.so.6
Clearly fwrite was called with invalid parameters, but you don't give enough
information for anyone to explain why. Compile your program with debugging
symbols and print the whole stack trace, e.g. with "backtrace full". Also
> class CNSGA2
> allocate mem for var;
> some deallocate statement;
> some pointers;
> evaluate(); // it is a function
This isn't even close to valid code since you can't have statements in the
> CNSGA2* nsga2a = new CNSGA2(true); // true or false are only for different
> CNSGA2* nsga2b = new CNSGA2(false);
> if (myRank == 0) // scope1
> initialize the objects of nsga2a or nsga2b;
> broadcast some parameters, which are got from scope1.
> According to the parameters, define a datatype (myData) so that all workers
> use that to do recv and send.
> if (myRank == 0) // scope2
> send out myData to workers by the datatype defined above;
> if (myRank != 0)
> newCNSGA2 myNsga2;
> recv data from master and work on the recved data;
> myNsga2.evaluate(recv data);
> send back results;
According to the above, rank 0 never receives the results from before. You
should paste valid code.