Skip to content

Commit 94186c4

Browse files
Merge pull request #1901 from CliMA/ck/update_copyto_bench
Update copyto benchmark
2 parents db5dae0 + 92b8b5b commit 94186c4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/DataLayouts/benchmark_copyto.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ import ClimaComms
99
@static pkgversion(ClimaComms) >= v"0.6" && ClimaComms.@import_required_backends
1010

1111
function benchmarkcopyto!(device, data, val, name)
12+
data_rhs = similar(data)
13+
fill!(data_rhs, val)
1214
println("Benchmarking ClimaCore copyto! for $name DataLayout")
13-
bc = Base.Broadcast.broadcasted(identity, val)
15+
bc = Base.Broadcast.broadcasted(identity, data_rhs)
16+
bcp = Base.Broadcast.broadcasted(identity, parent(data_rhs))
1417
trial = @benchmark ClimaComms.@cuda_sync $device Base.copyto!($data, $bc)
1518
show(stdout, MIME("text/plain"), trial)
1619
println()
1720
println("Benchmarking array copyto! for $name DataLayout")
1821
trial = @benchmark ClimaComms.@cuda_sync $device Base.copyto!(
1922
$(parent(data)),
20-
$bc,
23+
$bcp,
2124
)
2225
show(stdout, MIME("text/plain"), trial)
2326
println()
@@ -37,8 +40,9 @@ end
3740
data = DataF{S}(device_zeros(FT,Nf)); benchmarkcopyto!(device, data, 3, "DataF" ); @test all(parent(data) .== 3)
3841
data = IJFH{S, Nij, Nh}(device_zeros(FT,Nij,Nij,Nf,Nh)); benchmarkcopyto!(device, data, 3, "IJFH" ); @test all(parent(data) .== 3)
3942
data = IFH{S, Nij, Nh}(device_zeros(FT,Nij,Nf,Nh)); benchmarkcopyto!(device, data, 3, "IFH" ); @test all(parent(data) .== 3)
40-
data = IJF{S, Nij}(device_zeros(FT,Nij,Nij,Nf)); benchmarkcopyto!(device, data, 3, "IJF" ); @test all(parent(data) .== 3)
41-
data = IF{S, Nij}(device_zeros(FT,Nij,Nf)); benchmarkcopyto!(device, data, 3, "IF" ); @test all(parent(data) .== 3)
43+
# The parent array of IJF and IF datalayouts are MArrays, and can therefore not be passed into CUDA kernels on the RHS.
44+
# data = IJF{S, Nij}(device_zeros(FT,Nij,Nij,Nf)); benchmarkcopyto!(device, data, 3, "IJF" ); @test all(parent(data) .== 3)
45+
# data = IF{S, Nij}(device_zeros(FT,Nij,Nf)); benchmarkcopyto!(device, data, 3, "IF" ); @test all(parent(data) .== 3)
4246
data = VF{S, Nv}(device_zeros(FT,Nv,Nf)); benchmarkcopyto!(device, data, 3, "VF" ); @test all(parent(data) .== 3)
4347
data = VIJFH{S,Nv,Nij,Nh}(device_zeros(FT,Nv,Nij,Nij,Nf,Nh));benchmarkcopyto!(device, data, 3, "VIJFH" ); @test all(parent(data) .== 3)
4448
data = VIFH{S, Nv, Nij, Nh}(device_zeros(FT,Nv,Nij,Nf,Nh)); benchmarkcopyto!(device, data, 3, "VIFH" ); @test all(parent(data) .== 3)

0 commit comments

Comments
 (0)