|
| 1 | +function synth(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}) |
| 2 | + @assert cfg.shtype.gpu |
| 3 | + @assert cfg.nlat != 0 |
| 4 | + @assert length(qlm) == cfg.nlm |
| 5 | + |
| 6 | + nx = cfg.shtype.contiguous_phi ? cfg.nphi : cfg.nlat_padded |
| 7 | + ny = cfg.shtype.contiguous_phi ? cfg.nlat_padded : cfg.nphi |
| 8 | + |
| 9 | + v = CuMatrix{Float64}(undef, nx, ny) |
| 10 | + synth!(cfg, qlm, v) |
| 11 | + return v |
| 12 | +end |
| 13 | + |
| 14 | +function synth(cfg::SHTnsCfg, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}) |
| 15 | + @assert cfg.shtype.gpu |
| 16 | + @assert cfg.nlat != 0 |
| 17 | + @assert length(slm) == length(tlm) == cfg.nlm |
| 18 | + |
| 19 | + nx = cfg.shtype.contiguous_phi ? cfg.nphi : cfg.nlat_padded |
| 20 | + ny = cfg.shtype.contiguous_phi ? cfg.nlat_padded : cfg.nphi |
| 21 | + |
| 22 | + utheta = CuMatrix{Float64}(undef, nx, ny) |
| 23 | + uphi = CuMatrix{Float64}(undef, nx, ny) |
| 24 | + synth!(cfg, slm, tlm, utheta, uphi) |
| 25 | + return utheta, uphi |
| 26 | +end |
| 27 | + |
| 28 | +function synth(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}) |
| 29 | + @assert cfg.shtype.gpu |
| 30 | + @assert cfg.nlat != 0 |
| 31 | + @assert length(qlm) == length(slm) == length(tlm) == cfg.nlm |
| 32 | + nx = cfg.shtype.contiguous_phi ? cfg.nphi : cfg.nlat_padded |
| 33 | + ny = cfg.shtype.contiguous_phi ? cfg.nlat_padded : cfg.nphi |
| 34 | + |
| 35 | + ur = CuMatrix{Float64}(undef, nx, ny) |
| 36 | + utheta = CuMatrix{Float64}(undef, nx, ny) |
| 37 | + uphi = CuMatrix{Float64}(undef, nx, ny) |
| 38 | + synth!(cfg, qlm, slm, tlm, ur, utheta, uphi) |
| 39 | + return ur, utheta, uphi |
| 40 | +end |
| 41 | + |
| 42 | + |
| 43 | +function synth!(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}, v::CuMatrix{Float64}) |
| 44 | + @assert cfg.shtype.gpu |
| 45 | + cu_SH_to_spat(cfg.cfg, qlm, v, cfg.lmax) |
| 46 | + return v |
| 47 | +end |
| 48 | + |
| 49 | +function synth!(cfg::SHTnsCfg, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}, utheta::T, uphi::T) where {T<:CuMatrix{Float64}} |
| 50 | + @assert cfg.shtype.gpu |
| 51 | + cu_SHsphtor_to_spat(cfg.cfg, slm, tlm, utheta, uphi, cfg.lmax) |
| 52 | + return utheta, uphi |
| 53 | +end |
| 54 | + |
| 55 | +function synth!(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}, ur::T, utheta::T, uphi::T) where {T<:CuMatrix{Float64}} |
| 56 | + @assert cfg.shtype.gpu |
| 57 | + cu_SHqst_to_spat(cfg.cfg, qlm, slm, tlm, ur, utheta, uphi, cfg.lmax) |
| 58 | + return ur, utheta, uphi |
| 59 | +end |
| 60 | + |
| 61 | + |
| 62 | +#complex to complex not available for CUDA (status: SHTns v3.7) |
| 63 | + |
| 64 | +# function synth_cplx(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}) |
| 65 | +# @assert cfg.shtype.gpu |
| 66 | +# @assert cfg.nlat != 0 |
| 67 | +# @assert length(qlm) == cfg.nlm_cplx |
| 68 | +# @assert cfg.lmax == cfg.mmax |
| 69 | + |
| 70 | +# nx = cfg.shtype.contiguous_phi ? cfg.nphi : cfg.nlat_padded |
| 71 | +# ny = cfg.shtype.contiguous_phi ? cfg.nlat_padded : cfg.nphi |
| 72 | + |
| 73 | +# v = CuMatrix{ComplexF64}(undef, nx, ny) |
| 74 | +# synth!(cfg, qlm, v) |
| 75 | +# return v |
| 76 | +# end |
| 77 | + |
| 78 | +# function synth_cplx(cfg::SHTnsCfg, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}) |
| 79 | +# @assert cfg.shtype.gpu |
| 80 | +# @assert cfg.nlat != 0 |
| 81 | +# @assert length(slm) == length(tlm) == cfg.nlm_cplx |
| 82 | +# @assert cfg.lmax == cfg.mmax |
| 83 | + |
| 84 | +# nx = cfg.shtype.contiguous_phi ? cfg.nphi : cfg.nlat_padded |
| 85 | +# ny = cfg.shtype.contiguous_phi ? cfg.nlat_padded : cfg.nphi |
| 86 | + |
| 87 | +# utheta = CuMatrix{ComplexF64}(undef, nx, ny) |
| 88 | +# uphi = CuMatrix{ComplexF64}(undef, nx, ny) |
| 89 | +# synth!(cfg, slm, tlm, utheta, uphi) |
| 90 | +# return utheta, uphi |
| 91 | +# end |
| 92 | + |
| 93 | +# function synth_cplx(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}) |
| 94 | +# @assert cfg.shtype.gpu |
| 95 | +# @assert cfg.nlat != 0 |
| 96 | +# @assert length(qlm) == length(slm) == length(tlm) == cfg.nlm_cplx |
| 97 | +# @assert cfg.lmax == cfg.mmax |
| 98 | + |
| 99 | +# nx = cfg.shtype.contiguous_phi ? cfg.nphi : cfg.nlat_padded |
| 100 | +# ny = cfg.shtype.contiguous_phi ? cfg.nlat_padded : cfg.nphi |
| 101 | + |
| 102 | +# ur = CuMatrix{ComplexF64}(undef, nx, ny) |
| 103 | +# utheta = CuMatrix{ComplexF64}(undef, nx, ny) |
| 104 | +# uphi = CuMatrix{ComplexF64}(undef, nx, ny) |
| 105 | +# synth!(cfg, qlm, slm, tlm, ur, utheta, uphi) |
| 106 | +# return ur, utheta, uphi |
| 107 | +# end |
| 108 | + |
| 109 | +# function synth!(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}, v::CuMatrix{ComplexF64}) |
| 110 | +# cu_SH_to_spat_cplx(cfg.cfg, qlm, v, cfg.lmax) |
| 111 | +# return v |
| 112 | +# end |
| 113 | + |
| 114 | +# function synth!(cfg::SHTnsCfg, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}, utheta::T, uphi::T) where {T<:CuMatrix{ComplexF64}} |
| 115 | +# cu_SHsphtor_to_spat_cplx(cfg.cfg, slm, tlm, utheta, uphi, cfg.lmax) |
| 116 | +# return utheta, uphi |
| 117 | +# end |
| 118 | + |
| 119 | +# function synth!(cfg::SHTnsCfg, qlm::CuVector{ComplexF64}, slm::CuVector{ComplexF64}, tlm::CuVector{ComplexF64}, ur::T, utheta::T, uphi::T) where {T<:CuMatrix{ComplexF64}} |
| 120 | +# cu_SHqst_to_spat_cplx(cfg.cfg, qlm, slm, tlm, ur, utheta, uphi, cfg.lmax) |
| 121 | +# return ur, utheta, uphi |
| 122 | +# end |
| 123 | + |
0 commit comments