Skip to content

Commit cc78f4d

Browse files
committed
fix rocm test
1 parent 1413c6f commit cc78f4d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

test/test_rocm.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,38 @@ function run_test(N, n, T, solver_type)
55

66
# Set up tensors based on solver type
77
if solver_type == :batched
8-
MT = ROCArray{T}
8+
M = ROCArray
99

1010
# Initialize the solver
11-
data = initialize_batched(N, n, T)
11+
data = initialize_batched(N, n, T, M)
1212

1313
# Create test data
14-
A_tensor = MT(zeros(n, n, N))
15-
B_tensor = MT(zeros(n, n, N-1))
14+
A_tensor = M(zeros(n, n, N))
15+
B_tensor = M(zeros(n, n, N-1))
1616

1717
# Generate positive definite A matrices and random B matrices
1818
AMDGPU.@allowscalar for i in 1:N
1919
temp = randn(T, n, n)
20-
A_tensor[:, :, i] .= MT(temp * temp' + n * I)
20+
A_tensor[:, :, i] .= M(temp * temp' + n * I)
2121
end
2222

2323
AMDGPU.@allowscalar for i in 1:N-1
2424
temp = randn(T, n, n)
25-
B_tensor[:, :, i] .= MT(temp)
25+
B_tensor[:, :, i] .= M(temp)
2626
end
2727

2828
# Copy data to solver
2929
copyto!(data.A_tensor, A_tensor)
3030
copyto!(data.B_tensor, B_tensor)
3131

3232
# Create solution vector x and right-hand side d
33-
x_list = Vector{MT}(undef, N)
33+
x_list = Vector{M}(undef, N)
3434
for i in 1:N
35-
x_list[i] = MT(rand(T, n, 1))
35+
x_list[i] = M(rand(T, n, 1))
3636
end
3737

3838
# Compute right-hand side d = Ax
39-
d_tensor = MT(zeros(T, n, 1, N))
39+
d_tensor = M(zeros(T, n, 1, N))
4040
d_tensor[:, :, 1] = A_tensor[:, :, 1] * x_list[1] + B_tensor[:, :, 1] * x_list[2]
4141
@views for i = 2:N-1
4242
d_tensor[:, :, i] = B_tensor[:, :, i-1]' * x_list[i-1] + A_tensor[:, :, i] * x_list[i] + B_tensor[:, :, i] * x_list[i+1]
@@ -47,38 +47,38 @@ function run_test(N, n, T, solver_type)
4747
copyto!(data.d_tensor, d_tensor)
4848

4949
elseif solver_type == :sequential
50-
MT = ROCArray{T}
50+
M = ROCArray
5151

5252
# Initialize the solver
53-
data = initialize_seq(N, n, T)
53+
data = initialize_seq(N, n, T, M)
5454

5555
# Create test data
56-
A_tensor = MT(zeros(n, n, N))
57-
B_tensor = MT(zeros(n, n, N-1))
56+
A_tensor = M(zeros(n, n, N))
57+
B_tensor = M(zeros(n, n, N-1))
5858

5959
# Generate positive definite A matrices and random B matrices
6060
AMDGPU.@allowscalar for i in 1:N
6161
temp = randn(T, n, n)
62-
A_tensor[:, :, i] .= MT(temp * temp' + n * I)
62+
A_tensor[:, :, i] .= M(temp * temp' + n * I)
6363
end
6464

6565
AMDGPU.@allowscalar for i in 1:N-1
6666
temp = randn(T, n, n)
67-
B_tensor[:, :, i] .= MT(temp)
67+
B_tensor[:, :, i] .= M(temp)
6868
end
6969

7070
# Copy data to solver
7171
copyto!(data.A_tensor, A_tensor)
7272
copyto!(data.B_tensor, B_tensor)
7373

7474
# Create solution vector x and right-hand side d
75-
x_list = Vector{MT}(undef, N)
75+
x_list = Vector{M}(undef, N)
7676
for i in 1:N
77-
x_list[i] = MT(rand(T, n, 1))
77+
x_list[i] = M(rand(T, n, 1))
7878
end
7979

8080
# Compute right-hand side d = Ax
81-
d_tensor = MT(zeros(T, n, 1, N))
81+
d_tensor = M(zeros(T, n, 1, N))
8282
d_tensor[:, :, 1] = A_tensor[:, :, 1] * x_list[1] + B_tensor[:, :, 1] * x_list[2]
8383
@views for i = 2:N-1
8484
d_tensor[:, :, i] = B_tensor[:, :, i-1]' * x_list[i-1] + A_tensor[:, :, i] * x_list[i] + B_tensor[:, :, i] * x_list[i+1]

0 commit comments

Comments
 (0)