我正在尝试使用OpenMP来加速顺序的fortran95代码,如下所示。我无法确定在哪里/如何处理子例程和函数中的变量的private,shared,reduce等子句。
PROGRAM main
integer :: i, j, n, nw, nocsf
real(kind=dp) :: energy
type(nkappa) :: subshell
integer, dimension(:), allocatable :: ndx
n = asf_final%csf_set%nocsf + asf_initial%csf_set%nocsf
allocate( auger_csp%P(1:n_grasp2k), auger_csp%Q(1:n_grasp2k) )
allocate( cowf_csp%P(1:10), cowf_csp%Q(1:10) )
allocate( ndx(1:n) )
!$omp parallel do
!$omp& shared(auger_csp,cowf_csp,ndx, n)
!$omp& private(nw,nocsf,energy,subshell)
do i = 1,number_of_transitions
do j = 1,transition(i)%number_of_channels
energy = transition(i)%energy
auger%no_f = asf_cont%csf_set%nocsf
......
nw = asf_cont%csf_set%nwshells
nocsf = asf_cont%csf_set%nocsf
call anco_calculate_csf_matrix(asf_cont%csf_set,1,nocsf,1,nocsf)
subshell = nkappa(-1,transition(i)%channel(j)%kappa)
call cowf_iterate_csp(energy,subshell)
......
auger_csp = cowf_csp
......
allocate( auger%ndx_i(auger%no_i) )
......
deallocate( auger%ndx_f, auger%ndx_i, auger%matrix )
call deallocate_csf_basis(asf_cont%csf_set)
end do
call auger_transition_properties(transition(i))
end do
!$omp end parallel do
deallocate( ndx, auger_csp%P, auger_csp%Q)
END PROGRAM
它报告
"Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
double free or corruption (fasttop): 0x00007f1490000ac0 ***
Backtrace for this error:
Allocation would exceed memory limit"
有人可以给我一些建议吗?非常感谢您的专家帮助。