Skip to content

Commit ccc6770

Browse files
committed
feat: Enable parameterised precision in the allocator.
1 parent 3edcb84 commit ccc6770

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/allocator.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module m_allocator
2+
use m_common, only: dp
3+
24
implicit none
35

46
type :: allocator_t
@@ -52,7 +54,7 @@ module m_allocator
5254
!! field. User code is currently responsible for incrementing
5355
!! the reference count.
5456
type(field_t), pointer :: next
55-
real, allocatable :: data(:, :, :)
57+
real(dp), allocatable :: data(:, :, :)
5658
integer :: refcount = 0
5759
integer :: id !! An integer identifying the memory block.
5860
end type field_t

src/cuda/allocator.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module m_cuda_allocator
22
use m_allocator, only: allocator_t, field_t
3+
use m_common, only: dp
4+
35
implicit none
46

57
type, extends(allocator_t) :: cuda_allocator_t
@@ -8,7 +10,7 @@ module m_cuda_allocator
810
end type cuda_allocator_t
911

1012
type, extends(field_t) :: cuda_field_t
11-
real, allocatable, device :: data_d(:, :, :)
13+
real(dp), allocatable, device :: data_d(:, :, :)
1214
end type cuda_field_t
1315

1416
interface cuda_field_t

src/vector3d.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module m_slab
22
use m_stencil, only: stencil
33
use m_tridiagsolv, only: tridiagsolv
44
use m_allocator, only: allocator_t, field_t
5+
use m_common, only: dp
56

67
implicit none
78

@@ -37,7 +38,7 @@ end subroutine transport_op
3738
function get_component_ptr(self, i) result(ptr)
3839
class(slab_t), intent(in) :: self
3940
integer, intent(in) :: i
40-
real, pointer :: ptr(:, :, :)
41+
real(dp), pointer :: ptr(:, :, :)
4142

4243
select case (i)
4344
case (1)

0 commit comments

Comments
 (0)