Skip to content

Commit 311a605

Browse files
abussyniklasschmitz
authored andcommitted
Enable precompilation on AMD GPUs (#1131)
1 parent f3b3589 commit 311a605

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

ext/DFTKAMDGPUExt.jl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module DFTKAMDGPUExt
22
using AMDGPU
3+
using PrecompileTools
34
using LinearAlgebra
4-
import DFTK: GPU
5+
import DFTK: GPU, precompilation_workflow
56
using DFTK
67

78
DFTK.synchronize_device(::GPU{<:AMDGPU.ROCArray}) = AMDGPU.synchronize()
@@ -12,4 +13,23 @@ function LinearAlgebra.cholesky(A::Hermitian{T, <:AMDGPU.ROCArray}) where {T}
1213
LinearAlgebra.Cholesky(Acopy, A.uplo, info)
1314
end
1415

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]
28+
29+
@compile_workload begin
30+
precompilation_workflow(lattice, atoms, positions, magnetic_moments;
31+
architecture=GPU(ROCArray))
32+
end
33+
end
34+
1535
end

0 commit comments

Comments
 (0)