Skip to content

Commit c59ca85

Browse files
Technici4ngkemlin
authored andcommitted
Disable AMDGPU precompilation if !functional (JuliaMolSim#1159)
Thanks !
1 parent 1737d1c commit c59ca85

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

ext/DFTKAMDGPUExt.jl

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,25 @@ function LinearAlgebra.cholesky(A::Hermitian{T, <:AMDGPU.ROCArray}) where {T}
1313
LinearAlgebra.Cholesky(Acopy, A.uplo, info)
1414
end
1515

16-
# Precompilation block with a basic workflow
17-
@setup_workload begin
18-
# very artificial silicon ground state example
19-
a = 10.26
20-
lattice = a / 2 * [[0 1 1.];
21-
[1 0 1.];
22-
[1 1 0.]]
23-
pseudofile = joinpath(@__DIR__, "..", "test", "gth_pseudos", "Si.pbe-hgh.upf")
24-
Si = ElementPsp(:Si, Dict(:Si => pseudofile))
25-
atoms = [Si, Si]
26-
positions = [ones(3)/8, -ones(3)/8]
27-
magnetic_moments = [2, -2]
16+
# Ensure precompilation is only performed if an AMD GPU is available
17+
if AMDGPU.functional()
18+
# Precompilation block with a basic workflow
19+
@setup_workload begin
20+
# very artificial silicon ground state example
21+
a = 10.26
22+
lattice = a / 2 * [[0 1 1.];
23+
[1 0 1.];
24+
[1 1 0.]]
25+
pseudofile = joinpath(@__DIR__, "..", "test", "gth_pseudos", "Si.pbe-hgh.upf")
26+
Si = ElementPsp(:Si, Dict(:Si => pseudofile))
27+
atoms = [Si, Si]
28+
positions = [ones(3)/8, -ones(3)/8]
29+
magnetic_moments = [2, -2]
2830

29-
@compile_workload begin
30-
precompilation_workflow(lattice, atoms, positions, magnetic_moments;
31-
architecture=GPU(ROCArray))
31+
@compile_workload begin
32+
precompilation_workflow(lattice, atoms, positions, magnetic_moments;
33+
architecture=GPU(ROCArray))
34+
end
3235
end
3336
end
3437

0 commit comments

Comments
 (0)