현재 연구 중 일부로 Fortran90에서 불쾌한 편미분 방정식을위한 커다란 비선형 해를 작성했습니다. 나는 메모리 손상 문제가 내 코드를 괴롭 히고 있으며이를 추적하려고 시도하고 있다고 생각하는 문제에 직면 해있다. 그렇게하기 위해, 나는 valgrind를 사용하기로 결정했습니다. 이것은 valgrind가 과거에 저에게 도움이 되었기 때문입니다. 불행히도, 난 내 코드 실행의 시작 부분에 권리가 발생하는 원인 불명의 오류 메시지가 표시하고, 아래를 참조하십시오 :Fortran90 valgrind 출력 도움말. 코드 실행의 시작 부분에 설명되지 않은 오류가 발생했습니다.
==18257== Memcheck, a memory error detector
==18257== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==18257== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==18257== Command: ./JFNKsolver
==18257==
==18257== Conditional jump or move depends on uninitialised value(s)
==18257== at 0x6F7F7D: __intel_sse2_strcpy (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x6AA1C0: for__open_proc (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x67EF6C: for__open_default (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x69878D: for_write_seq_lis (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x65BA69: MAIN__ (JFNKsolver.f90:146)
==18257== by 0x402DAD: main (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== Uninitialised value was created by a stack allocation
==18257== at 0x6AA07D: for__open_proc (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257==
==18257== Conditional jump or move depends on uninitialised value(s)
==18257== at 0x6F7F7D: __intel_sse2_strcpy (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x677DA5: for__add_to_lf_table (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x6ABA13: for__open_proc (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x67EF6C: for__open_default (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x69878D: for_write_seq_lis (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== by 0x65BA69: MAIN__ (JFNKsolver.f90:146)
==18257== by 0x402DAD: main (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257== Uninitialised value was created by a stack allocation
==18257== at 0x6AA07D: for__open_proc (in /home/cseinen/Documents/1_Thesis_Work/ThesisGit/Model/Source_Code/JFNKsolver)
==18257==
나는 valgrind --track-origins=yes ./JFNKsolver
내 코드를 실행하여이 오류가 발생했습니다.
이제는 일반적으로 이러한 오류는 초기화되지 않은 변수가 어딘가에서 사용된다는 것을 의미하지만 이상한 점은 코드에서 실제로 일어나기 전에 나타 났으며 테스트 인쇄를 통해 by 0x65BA69: MAIN__ (JFNKsolver.f90:146)
을 가리키고 있다는 것입니다. 성명서, 즉 아래 코드에 print *, "Test"
입니다.
program JFNKsolver
use modelparams
use initialization
use forcing
use domain_routines
use solver_routines
use var_routines
use csv_file
use validation_routines
use validsoln_routines
implicit none
real(kind = dbl_kind) :: &
time, &
norm_test
integer(kind = int_kind) :: &
nxT, nyT, &
nxN, nyN, &
nxU, nyU, &
nxV, nyV, &
nt, &
nU_pnts, &
nV_pnts, &
nT_pnts, &
nN_pnts, &
nHT_pnts, &
nHN_pnts, &
si, &
tmp_size, &
i, j, ij
integer(kind = int_kind), allocatable, dimension (:) :: &
indxUi, indxUj, &
indxVi, indxVj, &
indxTi, indxTj, &
indxNi, indxNj, &
haloTi, haloTj, &
haloNi, haloNj
real(kind = dbl_kind), allocatable, dimension (:) :: &
Au, res_NL, u_update, &
b, b_0, vpb_forc
integer(kind = int_kind), allocatable, dimension (:,:,:) :: &
ulmsk, vlmsk, &
uimsk, vimsk, &
Timsk, Nimsk, &
Tlmsk, Nlmsk
real(kind = dbl_kind), allocatable, dimension (:,:) :: &
ugrid, vgrid, &
uResgrid, vResgrid, &
uocn_u, uocn_v, &
vocn_u, vocn_v, &
uwnd_u, uwnd_v, &
vwnd_u, vwnd_v, &
h_u, h_v, h_T, &
A_T, &
P_T, P_N, &
zeta_T, zeta_N, &
eta_T, eta_N, &
Cw_u, Cw_v, &
dist_T, dist_N, &
dist_gx_T, &
dist_gy_T
print *, "Test"
주석 처리를 제거하고 종류 매개 변수를 modelparams 모듈에서 초기화했습니다. 누구나이 문제의 원인에 대해 통찰력을 줄 수 있습니까? use
문을 통해 사용중인 모듈에 연결할 수 있습니까? 원래 이것이 valgrind의 문제라고 생각했지만 지금은 메모리 손상의 영향을 보았습니다. 그리고 이것이 제가보고있는 유일한 오류라는 사실에주의를 기울였습니다.
참고 : 메모리 손상 문제가 있다고 생각하는 이유는 아무 것도 변경해서는 안되는 코드가있을 때만 내 솔버의 동작이 변경되기 때문입니다. 그것은 코드를 검증하는 데 도움을주기 위해 추가 한 기능이었고 이에 대한 광범위한 테스트를 수행했습니다.
감사합니다! 이러한 경고가 있다면 내가 인해 포트란과 valgrinds 부족에 궁금 해서요. ... 불행히도, 내가 얻는 다른 경고는 '== 6218 == 경고 : 주소 범위 설정 : 큰 범위 [0xa4d4040, 0x2532aa78] (정의되지 않음) == 6218 == 경고 : 주소 범위 설정 perms : 넓은 범위 [0xa4d4028, 0x2532aa90] (noaccess)' 내 연구에서, 이러한 것들이 valgrind 디버깅 목적으로 출력 된 경고라고 생각합니다. 버그를 구식 방식으로 찾아야 할 것처럼 보입니다. –
@ClintSeinen 행운을 빌어 요. 문제를 예제로 좁히면 다른 질문을 게시하십시오. – muddle