Skip to content

Commit 07d1748

Browse files
committed
[documentation] Update the routines for the support of MPI
1 parent 6d9e7e7 commit 07d1748

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

docs/src/custom_workspaces.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ function Krylov.kdot(n::Integer, x::HaloVector{T}, y::HaloVector{T}) where T <:
157157
_x = x.data
158158
_y = y.data
159159
res = zero(real(T))
160-
for i = 1:mx-1
161-
for j = 1:nx-1
160+
for j = 1:nx-1
161+
for i = 1:mx-1
162162
res += _x[i,j] * conj(_y[i,j])
163163
end
164164
end
@@ -169,8 +169,8 @@ function Krylov.knorm(n::Integer, x::HaloVector{T}) where T <: FloatOrComplex
169169
mx, nx = size(x.data)
170170
_x = x.data
171171
res = zero(real(T))
172-
for i = 1:mx-1
173-
for j = 1:nx-1
172+
for j = 1:nx-1
173+
for i = 1:mx-1
174174
res += abs2(_x[i,j])
175175
end
176176
end
@@ -180,8 +180,8 @@ end
180180
function Krylov.kscal!(n::Integer, s::T, x::HaloVector{T}) where T <: FloatOrComplex
181181
mx, nx = size(x.data)
182182
_x = x.data
183-
for i = 1:mx-1
184-
for j = 1:nx-1
183+
for j = 1:nx-1
184+
for i = 1:mx-1
185185
_x[i,j] = s * _x[i,j]
186186
end
187187
end
@@ -191,8 +191,8 @@ end
191191
function Krylov.kdiv!(n::Integer, x::HaloVector{T}, s::T) where T <: FloatOrComplex
192192
mx, nx = size(x.data)
193193
_x = x.data
194-
for i = 1:mx-1
195-
for j = 1:nx-1
194+
for j = 1:nx-1
195+
for i = 1:mx-1
196196
_x[i,j] = _x[i,j] / s
197197
end
198198
end
@@ -203,8 +203,8 @@ function Krylov.kaxpy!(n::Integer, s::T, x::HaloVector{T}, y::HaloVector{T}) whe
203203
mx, nx = size(x.data)
204204
_x = x.data
205205
_y = y.data
206-
for i = 1:mx-1
207-
for j = 1:nx-1
206+
for j = 1:nx-1
207+
for i = 1:mx-1
208208
_y[i,j] += s * _x[i,j]
209209
end
210210
end
@@ -215,8 +215,8 @@ function Krylov.kaxpby!(n::Integer, s::T, x::HaloVector{T}, t::T, y::HaloVector{
215215
mx, nx = size(x.data)
216216
_x = x.data
217217
_y = y.data
218-
for i = 1:mx-1
219-
for j = 1:nx-1
218+
for j = 1:nx-1
219+
for i = 1:mx-1
220220
_y[i,j] = s * _x[i,j] + t * _y[i,j]
221221
end
222222
end
@@ -227,8 +227,8 @@ function Krylov.kcopy!(n::Integer, y::HaloVector{T}, x::HaloVector{T}) where T <
227227
mx, nx = size(x.data)
228228
_x = x.data
229229
_y = y.data
230-
for i = 1:mx-1
231-
for j = 1:nx-1
230+
for j = 1:nx-1
231+
for i = 1:mx-1
232232
_y[i,j] = _x[i,j]
233233
end
234234
end
@@ -239,8 +239,8 @@ function Krylov.kscalcopy!(n::Integer, y::HaloVector{T}, s::T, x::HaloVector{T})
239239
mx, nx = size(x.data)
240240
_x = x.data
241241
_y = y.data
242-
for i = 1:mx-1
243-
for j = 1:nx-1
242+
for j = 1:nx-1
243+
for i = 1:mx-1
244244
_y[i,j] = s * _x[i,j]
245245
end
246246
end
@@ -251,8 +251,8 @@ function Krylov.kdivcopy!(n::Integer, y::HaloVector{T}, x::HaloVector{T}, s::T)
251251
mx, nx = size(x.data)
252252
_x = x.data
253253
_y = y.data
254-
for i = 1:mx-1
255-
for j = 1:nx-1
254+
for j = 1:nx-1
255+
for i = 1:mx-1
256256
_y[i,j] = _x[i,j] / s
257257
end
258258
end
@@ -262,8 +262,8 @@ end
262262
function Krylov.kfill!(x::HaloVector{T}, val::T) where T <: FloatOrComplex
263263
mx, nx = size(x.data)
264264
_x = x.data
265-
for i = 1:mx-1
266-
for j = 1:nx-1
265+
for j = 1:nx-1
266+
for i = 1:mx-1
267267
_x[i,j] = val
268268
end
269269
end
@@ -274,8 +274,8 @@ function Krylov.kref!(n::Integer, x::HaloVector{T}, y::HaloVector{T}, c::T, s::T
274274
mx, nx = size(x.data)
275275
_x = x.data
276276
_y = y.data
277-
for i = 1:mx-1
278-
for j = 1:nx-1
277+
for j = 1:nx-1
278+
for i = 1:mx-1
279279
x_ij = _x[i,j]
280280
y_ij = _y[i,j]
281281
_x[i,j] = c * x_ij + s * y_ij
@@ -316,8 +316,8 @@ A = LaplacianOperator(Nx, Ny, Δx, Δy)
316316
# Create the right-hand side
317317
rhs = zeros(Float64, Nx+2, Ny+2)
318318
data = OffsetArray(rhs, 0:Nx+1, 0:Ny+1)
319-
for i in 1:Nx
320-
for j in 1:Ny
319+
for j in 1:Ny
320+
for i in 1:Nx
321321
xi = i * Δx
322322
yj = j * Δy
323323
data[i,j] = f(xi, yj)
@@ -504,7 +504,7 @@ import Krylov.FloatOrComplex
504504

505505

506506
function Krylov.kdot(n::Integer, x::MPIVector{T}, y::MPIVector{T}) where T <: FloatOrComplex
507-
data_dot = sum(x.data .* y.data)
507+
data_dot = sum(x.data .* conj.(y.data))
508508
res = MPI.Allreduce(data_dot, +, x.comm)
509509
return res
510510
end

0 commit comments

Comments
 (0)