Skip to content

Conversation

@goodstudyqaq
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a centralized CudaContext singleton class to manage GPU memory allocations across all CUDA kernels, replacing the previous per-module memory management approach. The refactoring consolidates device memory pointers into a single context object and introduces initialization functions (init_*_kernel_data()) to separate per-kernel data from shared context data.

Key Changes:

  • Introduces CudaContext singleton class to centralize GPU memory management
  • Replaces per-module device memory allocations with shared context pointers
  • Adds init_cuda_kernel_data() function to initialize all kernel-specific data
  • Updates nonbonded force calculations to use new _v2 versions
  • Adds check_cuda() helper function for CUDA error checking
  • Converts header guards from #ifndef to #pragma once

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/core/cuda/include/CudaContext.cuh New singleton class declaration with all shared GPU memory pointers
src/core/cuda/src/CudaContext.cu Implementation of context initialization, synchronization, and cleanup
src/core/utils.h Added check_cuda() function declaration for error handling
src/core/utils.cu Added check_cuda() implementation for CUDA error checking
src/core/system.cu Integrated context initialization, added init_cuda_kernel_data(), updated nonbonded force calls to _v2 versions
src/core/cuda/src/Cuda*Force.cu Refactored 15+ force calculation modules to use CudaContext instead of local allocations
src/core/cuda/include/Cuda*.cuh Updated headers to use #pragma once and added init_*_kernel_data() declarations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment on lines 104 to 106
ccharge_t* d_ccharges;
charge_t *d_charges;
p_atom_t *d_p_atoms;
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Missing semicolons after the member variable declarations. In C++, class member declarations require semicolons at the end. Lines 104-106 are missing semicolons.

Copilot uses AI. Check for mistakes.
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.

3 participants