Skip to content

Fortran runtime error: Index '143' of dimension 1 of array 'cpu_use' above upper bound of 64 #436

@LMurphy186232

Description

@LMurphy186232

I recently compiled ED2 for use on a new-to-me HPC system. I got the following error at runtime:

At line 200 of file edmain.F90 Fortran runtime error: Index '143' of dimension 1 of array 'cpu_use' above upper bound of 64
with an unhelpful backtrace. I investigated this error, and I think I know what is happening.

This is the code in question in edmain.F90, which starts at line 178:

!---------------------------------------------------------------------------------------!
! Check OMP thread and processor use and availability. This is done outside the !
! preprocessor "if block" because it is possible to activate multithread without !
! compiling with mpif90. !
! !
! Note: One could use omp_get_num_threads() in loop, but that would depend on how many !
! threads were open at the time of its call. !
!---------------------------------------------------------------------------------------!
max_threads = 1
num_procs = 1
thread = 1
cpu = 1
thread_use(:) = 0
cpu_use(:) = 0
!$ max_threads = omp_get_max_threads()
!$ num_procs = omp_get_num_procs()

!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(thread,cpu)
do n = 1,max_threads
!$ thread = omp_get_thread_num() + 1
!$ cpu = findmycpu() + 1
thread_use(thread) = 1
cpu_use(cpu) = 1
end do
!$OMP END PARALLEL DO
!---------------------------------------------------------------------------------------!

The line "cpu = findmycpu() + 1" appears to be returning a CPU ID number, which may be larger than the "cpu_use" max array length of 64 on an HPC system. The array overrun is causing an error to be thrown.

I do not have the OMP coding chops to write a pull request to fix this, unfortunately, so I am filing a bug report instead. This appears to be needed for an informational banner (only?), so I just commented it out in my version, and I am back up and running.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions