The Meson Build System http://mesonbuild.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
545 B

program main
use, intrinsic :: iso_fortran_env, only: stderr=>error_unit
use omp_lib, only: omp_get_max_threads
implicit none
integer :: N, ierr
character(80) :: buf ! can't be allocatable in this use case. Just set arbitrarily large.
call get_environment_variable('OMP_NUM_THREADS', buf, status=ierr)
if (ierr/=0) error stop 'environment variable OMP_NUM_THREADS could not be read'
read(buf,*) N
if (omp_get_max_threads() /= N) then
write(stderr, *) 'Max Fortran threads: ', omp_get_max_threads(), '!=', N
error stop
endif
end program