MPI并行运算报错:forrtl: severe (151): allocatable array is already allocated
PARALLEL LOOP
if(condition)then
allocate(x_full(nel_pp))
some statements
//deallocate(x_full) //right
end if
deallocate(x_full) //err
原因:在并行loop里allocate了内存,但没有在loop里deallocate内存。这导致在第二次迭代时,动态分配的内存未被释放,从而报错。
解决方法:
1.在loop里deallocate内存
2.在loop外allocate与deallocate内存