diff options
Diffstat (limited to 'meson/test cases/fortran/16 openmp/main.f90')
-rw-r--r-- | meson/test cases/fortran/16 openmp/main.f90 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/meson/test cases/fortran/16 openmp/main.f90 b/meson/test cases/fortran/16 openmp/main.f90 new file mode 100644 index 000000000..26b792fe8 --- /dev/null +++ b/meson/test cases/fortran/16 openmp/main.f90 @@ -0,0 +1,18 @@ +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 |