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.
- Loading branch information
Showing
10 changed files
with
163 additions
and
50 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
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