Skip to content

Commit

Permalink
Rename API
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Sep 23, 2024
1 parent bc952d7 commit 8f5adc1
Show file tree
Hide file tree
Showing 30 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergen
###############################################################################
# ODE solvers, callbacks etc.

ode = semidiscretize_gpu(semi, (0.0, 1.0)) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, (0.0, 1.0)) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/advection_basic_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergen
# ODE solvers, callbacks etc.

# Create ODE problem with time span from 0.0 to 1.0
ode = semidiscretize_gpu(semi, (0.0, 1.0)) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, (0.0, 1.0)) # from TrixiCUDA.jl

# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup
# and resets the timers
Expand Down
2 changes: 1 addition & 1 deletion examples/advection_basic_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergen
# ODE solvers, callbacks etc.

# Create ODE problem with time span from 0.0 to 1.0
ode = semidiscretize_gpu(semi, (0.0, 1.0)) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, (0.0, 1.0)) # from TrixiCUDA.jl

# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup
# and resets the timers
Expand Down
2 changes: 1 addition & 1 deletion examples/advection_basic_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergen
# ODE solvers, callbacks etc.

# Create ODE problem with time span from 0.0 to 1.0
ode = semidiscretize_gpu(semi, (0.0, 1.0)) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, (0.0, 1.0)) # from TrixiCUDA.jl

# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup
# and resets the timers
Expand Down
2 changes: 1 addition & 1 deletion examples/advection_mortar_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/advection_mortar_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 5.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_ec_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 0.4)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_ec_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 0.4)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_ec_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 0.4)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_shockcapturing_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_shockcapturing_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_shockcapturing_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 0.4)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_source_terms_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 2.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_source_terms_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 2.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/euler_source_terms_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 5.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/eulermulti_ec_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 0.4)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/eulermulti_ec_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solvers, callbacks etc.

tspan = (0.0, 0.4)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/hypdiff_nonperiodic_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 5.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/hypdiff_nonperiodic_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 5.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/hypdiff_nonperiodic_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 5.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/shallowwater_dirichlet_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/shallowwater_dirichlet_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/shallowwater_ec_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solver

tspan = (0.0, 2.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

###############################################################################
# Callbacks
Expand Down
2 changes: 1 addition & 1 deletion examples/shallowwater_ec_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
# ODE solver

tspan = (0.0, 2.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

###############################################################################
# Workaround to set a discontinuous bottom topography and initial condition for debugging and testing.
Expand Down
2 changes: 1 addition & 1 deletion examples/shallowwater_source_terms_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
2 changes: 1 addition & 1 deletion examples/shallowwater_source_terms_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize_gpu(semi, tspan) # from TrixiCUDA.jl
ode = semidiscretizeGPU(semi, tspan) # from TrixiCUDA.jl

summary_callback = SummaryCallback()

Expand Down
4 changes: 3 additions & 1 deletion src/TrixiCUDA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ include("auxiliary/auxiliary.jl")
include("semidiscretization/semidiscretization.jl")
include("solvers/solvers.jl")

# Change to use the Base.log and Base.sqrt - need to be fixed to avoid outputs
set_log_type!("log_Base")
set_sqrt_type!("sqrt_Base")

# Export the public APIs
export semidiscretize_gpu
export SemidiscretizationHyperbolicGPU
export semidiscretizeGPU

end
14 changes: 7 additions & 7 deletions src/semidiscretization/semidiscretization_hyperbolic.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function SemidiscretizationHyperbolic_gpu(mesh, equations, initial_condition, solver;
source_terms = nothing,
boundary_conditions = boundary_condition_periodic,
# `RealT` is used as real type for node locations etc.
# while `uEltype` is used as element type of solutions etc.
RealT = real(solver), uEltype = RealT,
initial_cache = NamedTuple())
function SemidiscretizationHyperbolicGPU(mesh, equations, initial_condition, solver;
source_terms = nothing,
boundary_conditions = boundary_condition_periodic,
# `RealT` is used as real type for node locations etc.
# while `uEltype` is used as element type of solutions etc.
RealT = real(solver), uEltype = RealT,
initial_cache = NamedTuple())
@assert ndims(mesh) == ndims(equations)

# cache = (; create_cache(mesh, equations, solver, RealT, uEltype)...,
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function rhs_gpu!(du_ode, u_ode, semi::SemidiscretizationHyperbolic, t)
end

# Ref: `semidiscretize` function in Trixi.jl
function semidiscretize_gpu(semi::SemidiscretizationHyperbolic, tspan)
function semidiscretizeGPU(semi::SemidiscretizationHyperbolic, tspan)
u0_ode = compute_coefficients(first(tspan), semi)

iip = true
Expand Down
4 changes: 2 additions & 2 deletions test/test_script.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4,
n_cells_max = 30_000)

semi = TrixiCUDA.SemidiscretizationHyperbolic_gpu(mesh, equations,
initial_condition_convergence_test, solver)
semi = TrixiCUDA.SemidiscretizationHyperbolicGPU(mesh, equations,
initial_condition_convergence_test, solver)

0 comments on commit 8f5adc1

Please sign in to comment.