ForestVegetationSimulator icon indicating copy to clipboard operation
ForestVegetationSimulator copied to clipboard

IE, EM, and KT variants encountering Floating-point exceptions for basic keyfile

Open d-diaz opened this issue 1 year ago • 6 comments

I am now encountering Floating-point exceptions running these keyfiles from command line for FVS built on Linux and WSL. All other US variants that we have tests like this set up for are still running fine.

EM_BUILDTEST_KEYFILE

STDIDENT
12345 TEST
STDINFO          108       260         1
DESIGN            -1         1
INVYEAR       1990.0
NUMCYCLE        10.0
TREEFMT
(I4,I4,F6.0,I1,A3,F4.1,F3.1,2F3.0,F4.1,I1,
6I2,2I1,I2,2I3,2I1,F3.0)
TREEDATA        15.0
0101 100    501  1 51
0101 101    501  2 41
-999
PROCESS
STOP

IE_BUILDTEST_KEYFILE

STDIDENT
12345 TEST
STDINFO          118       260         1
DESIGN            -1         1
INVYEAR       1990.0
NUMCYCLE        10.0
TREEFMT
(I4,I4,F6.0,I1,A3,F4.1,F3.1,2F3.0,F4.1,I1,
6I2,2I1,I2,2I3,2I1,F3.0)
TREEDATA        15.0
0101 100    501  1 51
0101 101    501  2 41
-999
PROCESS
STOP

KT_BUILDTEST_KEYFILE

STDIDENT
12345 TEST
STDINFO                    571         1
DESIGN            -1         1
INVYEAR       1990.0
NUMCYCLE        10.0
TREEFMT
(I4,I4,F6.0,I1,A3,F4.1,F3.1,2F3.0,F4.1,I1,
6I2,2I1,I2,2I3,2I1,F3.0)
TREEDATA        15.0
0101 100    501  1 51
0101 101    501  2 41
-999
PROCESS
STOP

Here is what comes out:


Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x7faa20477960 in ???
#1  0x7faa20476ac5 in ???
#2  0x7faa2016651f in ???
#3  0x7faa203ddb58 in ???
#4  0x55fa3bf26907 in nvb_calcht2topd_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/nsvb.f:937
#5  0x55fa3bf266ad in nvb_ht2topdib_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/nsvb.f:613
#6  0x55fa3bf292cf in nvbc_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/nsvb.f:309
#7  0x55fa3bf8cc75 in volinitnvb_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/volinit.f:884
#8  0x55fa3bf9b10a in master.0.fvsvol
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/fvsvol.f:299
#9  0x55fa3bf99506 in natcrs_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/fvsvol.f:53
#10  0x55fa3bcbf6c1 in vols_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/vols.f:159
#11  0x55fa3bda1dca in update_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/update.f:108
#12  0x55fa3bd632fc in gradd_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/gradd.f:180
#13  0x55fa3bd9f082 in tregro_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/tregro.f:52
#14  0x55fa3bd616cd in fvs_
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/fvs.f:331
#15  0x55fa3bd70b51 in MAIN__
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/main.f:18
#16  0x55fa3bd70c40 in main
        at /root/projects/forestvegetationsimulator/bin/FVSkt_buildDir/main.f:39

d-diaz avatar Jan 31 '25 01:01 d-diaz

If I revert back to release version FS2024.4 these errors do not occur.

d-diaz avatar Jan 31 '25 19:01 d-diaz

Thanks David. That appears to be within the NVEL submodule. We updated our National Volume Estimator Library submodule version in the latest update so that makes sense why the previous version worked (still working to resolve the file case name issue). Your issue doesn't occur when using Windows, so I will have to work on debugging when I can get access to a machine with WSL.

wagnerds avatar Jan 31 '25 20:01 wagnerds

I'd be happy to share a Dockerfile example if y'all use Docker.

d-diaz avatar Jan 31 '25 22:01 d-diaz

I get a similar error building on the Windows side of my machine too.

>FVSie.exe --keywordfile=Fvsie.key

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0xb3ee3326
#1  0xb3edc247
#2  0xb3ec4616
#3  0xc6b41ace
#4  0xc9823e5e
#5  0xc96df357
#6  0xc96de365
#7  0xc6ca8379
#8  0xc6ac2f74
#9  0xc6b82f10
#10  0xc6ac2073
#11  0xc6b3a76f
#12  0xb3d1e149
#13  0xb3d1dee1
#14  0xb3d20c59
#15  0xb3d89ea4
#16  0xb3d9a404
#17  0xb3d986d5
#18  0xb3ac4d86
#19  0xb3b99616
#20  0xb3b59b6c
#21  0xb3b96a00
#22  0xb3b580d7
#23  0xb3b67744
#24  0xb3b67837
#25  0xb3a912ed
#26  0xb3a91405
#27  0xc8c4e8d6
#28  0xc979fbcb
#29  0xffffffff

d-diaz avatar Feb 01 '25 00:02 d-diaz

I was able to reproduce this issue on WSL. It is related to NVEL attempting to calculate a height to a merchantable top diameter, when the stem has a DBH of less than the top diameter it is looking for. A small bark ratio coefficient results in part of the equation being raised to a negative exponent and crashing.

I attempted to alter the flags and variables requested when passing control from FVS to NVEL for volume computation but that wasn't successful in resolving the issue.

I have passed the information along to NVEL for resolution. In the mean time, I would recommend back revving to the previous FVS version as you have, or even revving back the submodule version.

wagnerds avatar Feb 03 '25 11:02 wagnerds

I've gotten back the attached modification and it functioned in my tests in WSL. Please rename the attached file to .f, replace the file in the directory volume/NVEL with the attached and let me know if it resolves the issue. Thanks.

Apologies for having to rename the file, system does not allow for attachment of .f files directly.

nsvb.txt

wagnerds avatar Feb 18 '25 12:02 wagnerds

Hey @wagnerds are y’all expecting a fix upstream in NVEL for this? Or could y’all pursue an update in a fork of NVEL that could be swapped for the submodule for this repo? I’m not particularly happy about having to change capitalization in the NVEL submodule so that we can get reproducible builds of FVS on Linux as-is, and a custom file as a patch that’s not being tracked in version control will only take us further from a reproducible build.

d-diaz avatar Jul 17 '25 03:07 d-diaz

Hey @wagnerds are y’all expecting a fix upstream in NVEL for this? Or could y’all pursue an update in a fork of NVEL that could be swapped for the submodule for this repo? I’m not particularly happy about having to change capitalization in the NVEL submodule so that we can get reproducible builds of FVS on Linux as-is, and a custom file as a patch that’s not being tracked in version control will only take us further from a reproducible build.

@d-diaz We definitely understand the frustration and are still working to resolve. We will have some type of resolution by our October release.

wagnerds avatar Jul 18 '25 12:07 wagnerds

NVEL Corrections, including file casing, have been implemented.

wagnerds avatar Nov 06 '25 13:11 wagnerds