You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solving a matrix differential equation yields a matrix solution (as expected) on a CPU, but on a GPU a vector solution is returned.
Suppose that the following is executed on the REPL:
using LinearAlgebra, DifferentialEquations, DiffEqGPU
dim = 2;
t0 = 0.0f0;
tf = 1.0f0;
steps = 11;
jobs = Float32[-1.0 1.0 1.0 1.0 0.0 0.0; -2.0 1.0 1.0 1.0 0.0 0.0];
tstep = (tf-t0)/(steps-1)
function du!(du, u, p, t)
@inbounds begin
du[1,1] = 1;#lower_d[1,1];
du[1,2] = 1;#lower_d[1,2];
du[2,1] = 1;#lower_d[2,1];
du[2,2] = 1;#lower_d[2,2];
end
nothing
end
# Create the initial state
u0 = zeros(Complex{Float32},dim,dim);
u0[1,1] = 1;
prob = ODEProblem{true}(du!,u0,(t0,tf),jobs[1,:]);
# Define how the problem is modified for each job
# i defines the trajectory number in the ensembleproblem
# repeat is true if the problem is being repeated
function prob_func(prob,i,repeat)
return remake(prob,p=jobs[i,:])
end
ensemble_prob = EnsembleProblem(prob,
prob_func=prob_func,
safetycopy=false)
The elements of the output seem to be an array of vectors, not matrices.
The text was updated successfully, but these errors were encountered:
BillyKalfus
changed the title
Ensemble Simulation produce solutions with different dimensionality between CPU and GPU
Ensemble simulations produce solutions with different dimensionality between CPU and GPU
Aug 26, 2020
Thanks for the report. Yes, it looks like this is an artifact of how the SPMD kernel is generated and it should get a reshape before changing back to the CPU.
ChrisRackauckas
changed the title
Ensemble simulations produce solutions with different dimensionality between CPU and GPU
Ensemble simulations produce solutions with different dimensionality between CPU and GPU (vec's the solution)
Dec 20, 2022
Solving a matrix differential equation yields a matrix solution (as expected) on a CPU, but on a GPU a vector solution is returned.
Suppose that the following is executed on the REPL:
The system is then solved on the CPU with:
Inspecting an element of the solution yields:
u0
anddu
are matrices ofComplex{Float32}
, as are the elements of the solution array.Running this on the GPU by changing
ensemblealg
yields:The elements of the output seem to be an array of vectors, not matrices.
The text was updated successfully, but these errors were encountered: