Skip to content

Conversation

@BSchilperoort
Copy link

Issue addressed

Related to #646 - allows for parametric types of vectors in structs. The parametric types are also <:AbstractArray to allow for moving the data to GPU arrays instead of Julia native arrays.

To do;

Explanation

Adapt has been added as a dependency, to allow for moving arrays to GPU (e.g. CuArray or ROCArray)

Checklist

  • Updated tests or added new tests
  • Branch is up to date with master
  • Tests & pre-commit hooks pass
  • Updated documentation if needed
  • Updated changelog.qmd if needed

@BSchilperoort BSchilperoort changed the title Preparations to run intertial river routing on GPU Preparations to run inertial river routing on GPU Jul 2, 2025
width::Array{Float64, 2} # Flood width [m]
a::Array{Float64, 2} # Flow area (cumulative) [m²]
p::Array{Float64, 2} # Wetted perimeter (cumulative) [m]
@with_kw struct FloodPlainProfile{
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the {N} parameter was supposed to do here. Adding parametric types here broke that feature.

It also did not seem to be used anywhere, except for in the profile = FloodPlainProfile{n_depths}(; ... definition below. Removing this did not break any tests.

])
res_params = Wflow.ReservoirParameters(;
area = [200_000_000],
area = [2.0e8],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests were passing a Vector{Int}, which did not fail before despite the type of area being defined as Vector{Float64}. I guess some magical type casting was performed automatically?

Defining the type of area as <:AbstractArray{<:AbstractFloat} broke this however, so the arrays in this test had to be modified to have float elements.

@vers-w vers-w changed the base branch from master to gpu July 3, 2025 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant