Skip to content

Commit

Permalink
Fortran bindings to set a memory space
Browse files Browse the repository at this point in the history
  • Loading branch information
anagainaru committed Mar 6, 2024
1 parent 8c2ef6f commit 096e9d6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bindings/Fortran/f2c/adios2_f2c_variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ void FC_GLOBAL(adios2_variable_steps_f2c,
}
}

void FC_GLOBAL(adios2_set_memory_space_f2c, ADIOS2_SET_MEMORY_SPACE_F2C)(
adios2_variable **variable, const int *mem, int *ierr)
{
*ierr = static_cast<int>(adios2_set_memory_space(*variable, static_cast<adios2_memory_space>(*mem));
}

void FC_GLOBAL(adios2_set_shape_f2c, ADIOS2_SET_SHAPE_F2C)(adios2_variable **variable,
const int *ndims, const int64_t *shape,
int *ierr)
Expand Down
3 changes: 3 additions & 0 deletions bindings/Fortran/modules/adios2_parameters_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ module adios2_parameters_mod
integer, parameter :: adios2_mode_deferred = 4
integer, parameter :: adios2_mode_sync = 5

integer, parameter :: adios2_memory_space_host = 1
integer, parameter :: adios2_memory_space_gpu = 2

! Step Mode
integer, parameter :: adios2_step_mode_append = 0
integer, parameter :: adios2_step_mode_update = 1
Expand Down
14 changes: 14 additions & 0 deletions bindings/Fortran/modules/adios2_variable_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ subroutine adios2_variable_steps(steps, variable, ierr)

end subroutine

subroutine adios2_set_memory_space_host(variable, ierr)
type(adios2_variable), intent(in) :: variable
integer, intent(out) :: ierr

call adios2_set_memory_space_f2c(variable%f2c, adios2_memory_space_host, ierr)
end subroutine

subroutine adios2_set_memory_space_gpu(variable, ierr)
type(adios2_variable), intent(in) :: variable
integer, intent(out) :: ierr

call adios2_set_memory_space_f2c(variable%f2c, adios2_memory_space_gpu, ierr)
end subroutine

subroutine adios2_set_shape(variable, ndims, shape_dims, ierr)
type(adios2_variable), intent(in) :: variable
integer, intent(in) :: ndims
Expand Down

0 comments on commit 096e9d6

Please sign in to comment.