Skip to content

Commit

Permalink
GetNewUnit: increase allowed number of open files to 16384 (#1392)
Browse files Browse the repository at this point in the history
As of GCC 4.5 and Ifort ~10, the maximum allowed unit number is 2**31-1.
We are setting this to 16384, which is the limit on Eagle.

However, the OS may impose a limit:
- macos -- 256 (change with ulimit -n)
- linux -- 1024 typically (change with ulimit -n -- may require elevated permissions on clusters)
- windows -- probably 255 (`_setmaxstdio` to change)
  • Loading branch information
andrew-platt authored Dec 28, 2022
1 parent efc8089 commit c51790c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/nwtc-library/src/NWTC_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,11 @@ SUBROUTINE GetNewUnit ( UnIn, ErrStat, ErrMsg )
INTEGER :: Un ! Unit number
LOGICAL :: Opened ! Flag indicating whether or not a file is opened.
INTEGER(IntKi), PARAMETER :: StartUnit = 10 ! Starting unit number to check (numbers less than 10 reserved)
INTEGER(IntKi), PARAMETER :: MaxUnit = 99 ! The maximum unit number available (or 10 less than the number of files you want to have open at a time)
! NOTE: maximum unit numbers in fortran 90 and later is 2**31-1. However, there are limits within the OS.
! macos -- 256 (change with ulimit -n)
! linux -- 1024 (change with ulimit -n)
! windows -- 512 (not sure how to change -- ADP)
INTEGER(IntKi), PARAMETER :: MaxUnit = 1024 ! The maximum unit number available (or 10 less than the number of files you want to have open at a time)
CHARACTER(ErrMsgLen) :: Msg ! Temporary error message


Expand Down

0 comments on commit c51790c

Please sign in to comment.