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

Port XC term instantiation and forces to GPU #1061

Merged
merged 5 commits into from
Feb 19, 2025
Merged

Conversation

abussy
Copy link
Collaborator

@abussy abussy commented Feb 14, 2025

Applied similar strategy as PR #1056 in order to port the XC term to the GPU.

The _force_xc function makes this a little bit awkward for the forces.

src/terms/xc.jl Outdated
.* (-2T(π)) .* G .* im
./ sqrt(basis.model.unit_cell_volume))
Gs = G_vectors(basis)
work = to_device(basis.architecture, zeros(Complex{TT}, length(Gs)))
Copy link
Member

Choose a reason for hiding this comment

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

Can't you allocate the zeros directly on the device (see zeros_like function in DFTK)

src/terms/xc.jl Outdated
Comment on lines 173 to 174
nlcc_groups = [(igroup, group) for (igroup, group) in enumerate(basis.model.atom_groups)
if has_core_density(model.atoms[first(group)])]
if has_core_density(basis.model.atoms[first(group)])]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use filter here ... and then only add the igroup in the for loop in _forces_xc below. I find it a little strange that the index is added, but this is not really used for anything in this function, but only in the called function. That's a little surprising.

@abussy
Copy link
Collaborator Author

abussy commented Feb 19, 2025

Implemented suggested changes and type instabilities in AtomicLocal and AtomicNonlocal forces. For the Xc term, the function barrier is still necessary.

@mfherbst mfherbst enabled auto-merge (squash) February 19, 2025 12:36
@mfherbst mfherbst merged commit d0845fe into JuliaMolSim:master Feb 19, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants