作为初学者,我无法给出更深的解释,一般应该是内存操作出现了问题(memory corruption),比如说如下代码:
也有可能是申请了内存空间,没有释放,程序执行到一定阶段时,便会报错。
MPI程序,一不小心就会出现很多错误,并且调试起来灰常复杂……
有人建议使用valgrind http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind
“With valgrind you will find your bug in less then five minutes, without it you could waste hours
futzing around before finding the exact problem.”
这个东东好像挺复杂的,调试出一堆结果,看不太懂……
无奈,只好一行一行的仔细检查代码了……
mpiexec -n 2 valgrind --tool=memcheck -q --num-callers=20 ./simple -malloc off