-
Notifications
You must be signed in to change notification settings - Fork 446
Use ieee intrinsics to avoid trapping ieee_inexact signals #7867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -331,6 +331,7 @@ subroutine InitCold(this, bounds) | |
| use SharedParamsMod , only : ParamsShareInst | ||
| use FuncPedotransferMod , only : pedotransf, get_ipedof | ||
| use RootBiophysMod , only : init_vegrootfr | ||
| use, intrinsic :: ieee_exceptions | ||
| ! | ||
| ! !ARGUMENTS: | ||
| class(soilstate_type) :: this | ||
|
|
@@ -468,10 +469,13 @@ subroutine InitCold(this, bounds) | |
| ! Try to read soil information from the file. | ||
| call ncd_io(ncid=ncid, varname='ZSOI', flag='read', data=zsoifl, dim1name=grlnd, readvar=readvar) | ||
| if (.not. readvar ) then | ||
| ! Variable ZSOI not found, use the ELM parameters. | ||
| if (ieee_support_halting(ieee_inexact)) then | ||
| call ieee_set_flag(ieee_all,.false.) | ||
| call ieee_set_halting_mode(ieee_inexact, .false.) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will turn off ieee_inexact trapping for everything that runs after this making it a global setting, not just for the land (unless the land is running on its own tasks). If we want to set these things globally, it should be done in the driver. Or you should set it back to "on".
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ieee_inexact trappings are already off for everything. None of our code could work if not the case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is essentially a no-op except for this nvida on perlmutter, which i can only hazard is a bug in the compiler or runtime.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh because ieee_support_halting(ieee_inexact) will be False everywhere except NVIDIA?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's even false with nvidia ! From the nvidia docs our current flag only captures it seems to be a bug in the code gen or AVX2 exp runtime. Found a similar issue of random inexact being tripped in 25.9 https://forums.developer.nvidia.com/t/nvfortran-25-9-spurious-floating-point-exception/346604
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry not the support halting but the actual halting flag is false |
||
| end if | ||
| do j = 1, nlevsoifl | ||
| zsoifl(j) = scalez*(exp(zecoeff*(j-0.5_r8))-1._r8) !node depths | ||
| end do | ||
| zsoifl(j) = scalez*(exp(zecoeff*(dble(j)-0.5_r8))-1._r8) !node depths | ||
| enddo | ||
| end if | ||
|
|
||
| dzsoifl(1) = 0.5_r8*(zsoifl(1)+zsoifl(2)) !thickness b/n two interfaces | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line turns off ALL floating point trapping which would override our DEBUG settings. This would have to be wrapped in an #ifdef CPRNIVIDIA if you really want this.