This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a version of MPIStateArrays that allows for traversing through…
… wrapper types Co-authored-by: Valentin Churavy <vchuravy@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
113 additions
and
38 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
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 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using MPI | ||
using Test | ||
using ClimateMachine | ||
using ClimateMachine.MPIStateArrays | ||
|
||
ClimateMachine.init() | ||
ArrayType = ClimateMachine.array_type() | ||
mpicomm = MPI.COMM_WORLD | ||
FT = Float32 | ||
Q = MPIStateArray{FT}(mpicomm, ArrayType, 4, 4, 4) | ||
Qb = reshape(Q, (16, 4, 1)); | ||
|
||
Q .= 1 | ||
Qb .= 1 | ||
|
||
@testset "MPIStateArray Reshape basics" begin | ||
ClimateMachine.gpu_allowscalar(true) | ||
@test minimum(Q[:] .== 1) | ||
@test minimum(Qb[:] .== 1) | ||
|
||
@test eltype(Qb) == Float32 | ||
@test size(Qb) == (16, 4, 1) | ||
|
||
fillval = 0.5f0 | ||
fill!(Qb, fillval) | ||
|
||
@test Qb[1] == fillval | ||
@test Qb[8, 1, 1] == fillval | ||
@test Qb[end] == fillval | ||
|
||
@test Array(Qb) == fill(fillval, 16, 4, 1) | ||
|
||
Qb[8, 1, 1] = 2fillval | ||
@test Qb[8, 1, 1] != fillval | ||
ClimateMachine.gpu_allowscalar(false) | ||
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