subroutine read_parameters_solver_parallel_settings(self, json)
implicit none
class(type_input) :: self
type(json_file), intent(inout) :: json
logical :: found
character(:), allocatable :: key
key = join([solver_settings, parallel_settings, threads, is_parallel])
call json%get(key, self%basic%solver_settings%parallel_settings%threads%is_parallel, found)
call json%print_error_message(output_unit)
if (.not. found) then
call json%destroy()
call error_message(904, c_opt=key)
end if
if (self%basic%solver_settings%parallel_settings%threads%is_parallel) then
key = join([solver_settings, parallel_settings, threads, num_threads])
call json%get(key, self%basic%solver_settings%parallel_settings%threads%num_threads, found)
call json%print_error_message(output_unit)
if (.not. found) then
call json%destroy()
call error_message(904, c_opt=key)
else if (self%basic%solver_settings%parallel_settings%threads%num_threads <= 0) then
call json%destroy()
call error_message(905, c_opt=key)
end if
!$ if (self%basic%solver_settings%parallel_settings%threads%num_threads > omp_get_max_threads()) then
!$ call global_logger%log_warning(message="Number of threads exceeds available threads. Using maximum available threads.")
!$ self%basic%solver_settings%parallel_settings%threads%num_threads = omp_get_max_threads()
!$ end if
key = join([solver_settings, parallel_settings, threads, schedule])
call json%get(key, self%basic%solver_settings%parallel_settings%threads%schedule, found)
call json%print_error_message(output_unit)
if (.not. found) then
call global_logger%log_warning(message="Default schedule is set to 'static'.")
self%basic%solver_settings%parallel_settings%threads%schedule = "static"
else if (.not. any(valid_schedule_types(:) == self%basic%solver_settings%parallel_settings%threads%schedule)) then
call json%destroy()
call error_message(905, c_opt=key)
end if
key = join([solver_settings, parallel_settings, threads, dynamic_adjustment])
call json%get(key, self%basic%solver_settings%parallel_settings%threads%dynamic_adjustment, found)
call json%print_error_message(output_unit)
if (.not. found) then
call global_logger%log_warning(message="Default dynamic adjustment is set to 'false'.")
self%basic%solver_settings%parallel_settings%threads%dynamic_adjustment = .false.
end if
key = join([solver_settings, parallel_settings, threads, nested_parallelism])
call json%get(key, self%basic%solver_settings%parallel_settings%threads%nested_parallelism, found)
call json%print_error_message(output_unit)
if (.not. found) then
call global_logger%log_warning(message="Default nested parallelism is set to 'false'.")
self%basic%solver_settings%parallel_settings%threads%nested_parallelism = .false.
end if
key = join([solver_settings, parallel_settings, threads, max_active_levels])
call json%get(key, self%basic%solver_settings%parallel_settings%threads%max_active_levels, found)
call json%print_error_message(output_unit)
if (.not. found) then
call global_logger%log_warning(message="Default maximum active levels is set to 1.")
self%basic%solver_settings%parallel_settings%threads%max_active_levels = 1
else if (self%basic%solver_settings%parallel_settings%threads%max_active_levels < 0) then
call json%destroy()
call error_message(905, c_opt=key)
end if
end if
end subroutine read_parameters_solver_parallel_settings