@@ -18,11 +18,11 @@ module SLB4MPI_runtime_load_balancer_m
1818
1919 type, extends(load_balancer_t) :: runtime_load_balancer_t
2020 class(load_balancer_t), allocatable :: balancer ! < actual load balancer
21- contains
21+ contains
2222 procedure :: initialize
2323 procedure :: get_range
2424 procedure :: clean
25- end type
25+ end type runtime_load_balancer_t
2626
2727 interface
2828
@@ -45,42 +45,42 @@ module SLB4MPI_runtime_load_balancer_m
4545 subroutine initialize (lb , communicator , lower_bound , upper_bound , min_chunk_size , max_chunk_size )
4646 use , intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer
4747 class(runtime_load_balancer_t), intent (inout ) :: lb
48- integer (MPI_INTEGER_KIND), intent (in ) :: communicator
49- integer (8 ), intent (in ) :: lower_bound, upper_bound
50- integer (8 ), optional , intent (in ) :: min_chunk_size, max_chunk_size
48+ integer (MPI_INTEGER_KIND), intent (in ) :: communicator
49+ integer (8 ), intent (in ) :: lower_bound, upper_bound
50+ integer (8 ), optional , intent (in ) :: min_chunk_size, max_chunk_size
5151
5252 if (load_balancer_type == ENV_LOAD_BALANCER) then
53- block
54- use , intrinsic :: iso_fortran_env, only: error_unit
55- character (len= 80 ) :: envval
56- logical :: ok
57- call get_environment_variable(" SLB4MPI_LOAD_BALANCER" , envval)
58- call SLB4MPI_set_schedule(trim (envval), ok)
59- if (len_trim (envval) /= 0 .and. (.not. ok .or. trim (envval) == ' env' )) then
60- write (error_unit, ' (A)' ) " SLB4MPI_LOAD_BALANCER environmental variable is not set properly!"
61- write (error_unit, ' (A)' ) " Actual value is '" // trim (envval) // " '"
62- write (error_unit, ' (A)' ) " Possible values are: static, local_static, dynamic, guided, work_stealing"
63- write (error_unit, ' (A)' ) " static load balancer will be used!"
64- call SLB4MPI_set_schedule(" static" )
65- else if (len_trim (envval) == 0 ) then
66- call SLB4MPI_set_schedule(" static" )
67- end if
68- end block
53+ block
54+ use , intrinsic :: iso_fortran_env, only: error_unit
55+ character (len= 80 ) :: envval
56+ logical :: ok
57+ call get_environment_variable(" SLB4MPI_LOAD_BALANCER" , envval)
58+ call SLB4MPI_set_schedule(trim (envval), ok)
59+ if (len_trim (envval) /= 0 .and. (.not. ok .or. trim (envval) == ' env' )) then
60+ write (error_unit, ' (A)' ) " SLB4MPI_LOAD_BALANCER environmental variable is not set properly!"
61+ write (error_unit, ' (A)' ) " Actual value is '" // trim (envval) // " '"
62+ write (error_unit, ' (A)' ) " Possible values are: static, local_static, dynamic, guided, work_stealing"
63+ write (error_unit, ' (A)' ) " static load balancer will be used!"
64+ call SLB4MPI_set_schedule(" static" )
65+ else if (len_trim (envval) == 0 ) then
66+ call SLB4MPI_set_schedule(" static" )
67+ end if
68+ end block
6969 end if
7070
7171 select case (load_balancer_type)
72- case (STATIC_LOAD_BALANCER)
73- allocate (static_load_balancer_t :: lb% balancer)
74- case (LOCAL_STATIC_LOAD_BALANCER)
75- allocate (local_static_load_balancer_t :: lb% balancer)
76- case (DYNAMIC_LOAD_BALANCER)
77- allocate (dynamic_load_balancer_t :: lb% balancer)
78- case (GUIDED_LOAD_BALANCER)
79- allocate (guided_load_balancer_t :: lb% balancer)
80- case (WORK_STEALING_LOAD_BALANCER)
81- allocate (work_stealing_load_balancer_t :: lb% balancer)
82- case default
83- error stop " Unknown load balancer"
72+ case (STATIC_LOAD_BALANCER)
73+ allocate (static_load_balancer_t :: lb% balancer)
74+ case (LOCAL_STATIC_LOAD_BALANCER)
75+ allocate (local_static_load_balancer_t :: lb% balancer)
76+ case (DYNAMIC_LOAD_BALANCER)
77+ allocate (dynamic_load_balancer_t :: lb% balancer)
78+ case (GUIDED_LOAD_BALANCER)
79+ allocate (guided_load_balancer_t :: lb% balancer)
80+ case (WORK_STEALING_LOAD_BALANCER)
81+ allocate (work_stealing_load_balancer_t :: lb% balancer)
82+ case default
83+ error stop " Unknown load balancer"
8484 end select
8585
8686 call lb% balancer% initialize(communicator, lower_bound, upper_bound, min_chunk_size, max_chunk_size)
@@ -125,21 +125,21 @@ subroutine SLB4MPI_set_schedule(lbtype, ok)
125125 logical , optional , intent (out ) :: ok
126126 logical :: ok_
127127 ok_ = .true.
128- select case (lbtype)
129- case (" env" )
130- load_balancer_type = ENV_LOAD_BALANCER
131- case (" static" )
132- load_balancer_type = STATIC_LOAD_BALANCER
133- case (" local_static" )
134- load_balancer_type = LOCAL_STATIC_LOAD_BALANCER
135- case (" dynamic" )
136- load_balancer_type = DYNAMIC_LOAD_BALANCER
137- case (" guided" )
138- load_balancer_type = GUIDED_LOAD_BALANCER
139- case (" work_stealing" )
140- load_balancer_type = WORK_STEALING_LOAD_BALANCER
141- case default
142- ok_ = .false.
128+ select case (lbtype)
129+ case (" env" )
130+ load_balancer_type = ENV_LOAD_BALANCER
131+ case (" static" )
132+ load_balancer_type = STATIC_LOAD_BALANCER
133+ case (" local_static" )
134+ load_balancer_type = LOCAL_STATIC_LOAD_BALANCER
135+ case (" dynamic" )
136+ load_balancer_type = DYNAMIC_LOAD_BALANCER
137+ case (" guided" )
138+ load_balancer_type = GUIDED_LOAD_BALANCER
139+ case (" work_stealing" )
140+ load_balancer_type = WORK_STEALING_LOAD_BALANCER
141+ case default
142+ ok_ = .false.
143143 end select
144144 if (present (ok)) ok = ok_
145145 end subroutine SLB4MPI_set_schedule
0 commit comments