処理するファイルが30000あり、各ファイルは80000x5行です。すべてのファイルを読み取り、各行の平均を見つけるためにそれらを処理する必要があります。ファイルからすべてのデータを読み取って抽出するコードを作成しました。私のコードはFortranにあります。(30000 X 800000)の配列があります私のプログラムは(3300 X 80000)を超えることができませんでした。各ファイルの4列目を300ファイルステップで追加する必要があります。つまり、1番目のファイルの4番目の列と301番目のファイルの4番目の列、2番目のファイルの4番目の列と302番目のファイルの4番目の列などです。これは理由だと思いますかFortranが処理できる配列のサイズの制限についてはどうでしょうか。もしそうなら、Fortranが処理できる配列のサイズを増やす方法はありますか?ファイルの数はどうですか?私のコードは次のようになります:このプログラムはうまく動作します。
implicit double precision (a-h,o-z),integer(i-n)
dimension x(78805,5),y(78805,5),den(78805,5)
dimension b(3300,78805),bb(78805)
character*70,fn
nf = 3300 ! NUMBER OF FILES
nj = 78804 ! Number of rows in file.
ns = 300 ! No. of steps for files.
ncores = 11 ! No of Cores
c--------------------------------------------------------------------
c--------------------------------------------------------------------
!Initialization
do i = 0,nf
do j = 1, nj
x(j,1) = 0.0
y(j,2) = 0.0
den(j,4) = 0.0
c a(i,j) = 0.0
b(i,j) = 0.0
c aa(j) = 0.0
bb(j) = 0.0
end do
end do
c-------!Body program-----------------------------------------------
iout = 6 ! Output Files upto "ns" no.
DO i= 1,nf ! LOOP FOR THE NUMBER OF FILES
write(fn,10)i
open(1,file=fn)
do j=1,nj ! Loop for the no of rows in the domain
read(1,*)x(j,1),y(j,2),den(j,4)
if(i.le.ns) then
c a(i,j) = prob(j,3)
b(i,j) = den(j,4)
else
c a(i,j) = prob(j,3) + a(i-ns,j)
b(i,j) = den(j,4) + b(i-ns,j)
end if
end do
close(1)
c ----------------------------------------------------------
c -----Write Out put [Probability and density matrix]-------
c ----------------------------------------------------------
if(i.ge.(nf-ns)) then
do j = 1, nj
c aa(j) = a(i,j)/(ncores*1.0)
bb(j) = b(i,j)/(ncores*1.0)
write(iout,*) int(x(j,1)),int(y(j,2)),bb(j)
end do
close(iout)
iout = iout + 1
end if
END DO
10 format(i0,'.txt')
END