Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental AMDGPU support #858

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Experimental AMDGPU support #858

wants to merge 2 commits into from

Conversation

mfherbst
Copy link
Member

@mfherbst mfherbst commented May 17, 2023

Should work in theory, but so far entirely untested.

OK before this works we need at least these things in Yggdrasil and properly exposed (e.g. via AbstractFFT):

Copy link

@pxl-th pxl-th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FFT seems to be working fine.
Segfalts come from missing rocSOLVER qr used in ortho_qr.
I'm going to add it in AMDGPU.

src/workarounds/roc_arrays.jl Show resolved Hide resolved
@pxl-th
Copy link

pxl-th commented Aug 4, 2023

Now amgpu_simple.jl fails with:

ERROR: LoadError: Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] assertscalar(op::String)
   @ GPUArraysCore ~/.julia/packages/GPUArraysCore/uOYfN/src/GPUArraysCore.jl:103
 [3] getindex
   @ ~/.julia/packages/GPUArrays/5XhED/src/host/indexing.jl:9 [inlined]
 [4] mul!(Hψ::ROCMatrix{ComplexF64, AMDGPU.Runtime.Mem.HIPBuffer}, H::Hamiltonian, ψ::ROCMatrix{ComplexF64, AMDGPU.Runtime.Mem.HIPBuffer})
   @ DFTK ~/code/DFTK.jl/src/terms/Hamiltonian.jl:83
 [5] *(H::Hamiltonian, ψ::ROCMatrix{ComplexF64, AMDGPU.Runtime.Mem.HIPBuffer})
   @ DFTK ~/code/DFTK.jl/src/terms/Hamiltonian.jl:88
 [6] top-level scope
   @ ~/code/DFTK.jl/examples/amdgpu_simple.jl:23
in expression starting at /home/pxl-th/code/DFTK.jl/examples/amdgpu_simple.jl:23

@pxl-th
Copy link

pxl-th commented Aug 5, 2023

Same issue is with CUDA though

@mfherbst
Copy link
Member Author

mfherbst commented Aug 6, 2023

Hi @pxl-th Thanks for your help. Yes, that probably should not happen. I'll take a look.

@mfherbst
Copy link
Member Author

mfherbst commented Aug 6, 2023

I tried to use the code with AMDGPU.jl master, but I get some issues, see JuliaGPU/AMDGPU.jl#461.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gpu Label for GPU-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants