-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
65 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
/Manifest.toml | ||
|
||
.DS_Store | ||
.DS_Store | ||
|
||
# For developer use only | ||
/test/trixi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,4 @@ | ||
using TrixiGPU, CUDA | ||
using Test | ||
|
||
@testset "Test auxiliary functions" begin | ||
@testset "CUDA congifurator 1D" begin | ||
function kernel_add!(a, b, c) | ||
i = threadIdx().x | ||
c[i] = a[i] + b[i] | ||
return | ||
end | ||
|
||
N = 256 | ||
a = CuArray(fill(1.0f0, N)) | ||
b = CuArray(fill(2.0f0, N)) | ||
c = CuArray(zeros(Float32, N)) | ||
|
||
sample_kernel = @cuda threads=N kernel_add!(a, b, c) | ||
@test configurator_1d(sample_kernel, a) == (threads = 256, blocks = 1) | ||
end | ||
end | ||
@testset "Test auxiliary functions" begin end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
using Trixi, TrixiGPU | ||
using CUDA: @cuda, CuArray | ||
using Test | ||
|
||
# @testset "Test solver functions" begin | ||
|
||
# weak_form_kernel = @cuda launch=false weak_form_kernel!(du, derivative_dhat, flux_arr) | ||
# end | ||
|
||
# The header part for testing basic kernels in 1D | ||
advection_velocity = 1.0f0 | ||
equations = LinearScalarAdvectionEquation1D(advection_velocity) | ||
|
||
du = CuArray{Float64}(undef, 10, 10, 10) | ||
derivative_dhat = CuArray{Float64}(undef, 10, 10) | ||
flux_arr = CuArray{Float64}(undef, 10, 10, 10) | ||
coordinates_min = -1.0f0 | ||
coordinates_max = 1.0f0 | ||
mesh = TreeMesh(coordinates_min, | ||
coordinates_max, | ||
initial_refinement_level = 4, | ||
n_cells_max = 30_000) | ||
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) | ||
|
||
function initial_condition_sine_wave(x, t, equations) | ||
SVector(1.0f0 + 0.5f0 * sinpi(sum(x - equations.advection_velocity * t))) | ||
end | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver) | ||
|
||
@unpack mesh, equations, initial_condition, boundary_conditions, source_terms, solver, cache = semi | ||
|
||
t = 0.0f0 | ||
tspan = (0.0f0, 1.0f0) | ||
|
||
ode = semidiscretize(semi, tspan) | ||
u_ode = copy(ode.u0) | ||
du_ode = similar(u_ode) | ||
u = Trixi.wrap_array(u_ode, mesh, equations, solver, cache) | ||
du = Trixi.wrap_array(du_ode, mesh, equations, solver, cache) | ||
|
||
du, u = TrixiGPU.copy_to_device!(du, u) | ||
|
||
weak_form_kernel = @cuda launch=false TrixiGPU.weak_form_kernel!(du, derivative_dhat, | ||
flux_arr, equations) | ||
weak_form_kernel(du, | ||
derivative_dhat, | ||
flux_arr, equations; | ||
TrixiGPU.configurator_3d(weak_form_kernel, du)...,) | ||
TrixiGPU.cuda_volume_integral!(du, u, mesh, | ||
Trixi.have_nonconservative_terms(equations), equations, | ||
solver.volume_integral, solver) |