42 integer :: dblock_size
43 integer :: zblock_size
44 integer :: sblock_size
45 integer :: cblock_size
65 use iso_c_binding,
only: c_int
66 integer(c_int),
value :: level
67 integer(c_int),
intent(out) :: size
68 integer(c_int),
intent(out) :: line_size
76 type(
cache_t),
public :: default_l1
82 function cache_t_init(data_size, line_size)
result(cache)
84 integer,
intent(in) :: data_size
85 integer,
intent(in) :: line_size
87 cache%size = data_size
88 cache%line_size = line_size
95 integer,
intent(in) :: level
96 type(
cache_t),
intent(in) :: default
99 integer :: data_size, line_size
103 if (data_size > 0) cache%size = data_size
104 if (line_size > 0) cache%line_size = line_size
119 type(
cache_t),
intent(in) :: l1_cache
120 type(
cache_t),
intent(in) :: l2_cache
122 integer,
parameter :: cpu_default_states_per_block = 4
127 this%dblock_size = this%l1%size / (cpu_default_states_per_block *
sizeof_real64)
128 this%dblock_size = this%dblock_size - mod(this%dblock_size, this%l1%line_size) - 2*this%l1%line_size
130 this%zblock_size = this%l1%size / (cpu_default_states_per_block *
sizeof_complex64)
131 this%zblock_size = this%zblock_size - mod(this%zblock_size, this%l1%line_size) - 2*this%l1%line_size
133 this%sblock_size = this%l1%size / (cpu_default_states_per_block *
sizeof_real32)
134 this%sblock_size = this%sblock_size - mod(this%sblock_size, this%l1%line_size) - 2*this%l1%line_size
136 this%cblock_size = this%l1%size / (cpu_default_states_per_block *
sizeof_complex32)
137 this%cblock_size = this%cblock_size - mod(this%cblock_size, this%l1%line_size) - 2*this%l1%line_size
subroutine hardware_init(this, l1_cache, l2_cache)
Initialise hardware object.
type(cache_t) function, public cache_detect(level, default)
Data cache of the given level of this CPU, or the default where it cannot be detected.
type(hardware_t), public cpu_hardware
Global instance of CPU hardware specification.
integer, parameter, public sizeof_real64
Number of bytes to store a variable of type real(real64)
integer, parameter, public sizeof_real32
Number of bytes to store a variable of type real(real32)
type(cache_t), public default_l2
type(cache_t) function cache_t_init(data_size, line_size)
Initialise cache object.
integer, parameter, public sizeof_complex64
Number of bytes to store a variable of type complex(real64)
integer, parameter, public sizeof_complex32
Number of bytes to store a variable of type complex(real32)
Block-size optimisation for L1 cache size.