Skip to content

Conversation

@joshkamm
Copy link
Member

@joshkamm joshkamm commented Jan 9, 2026

  • Implement changes
  • Look through pull request changes
  • Clean up code and retest

Github copilot pull request summary

This pull request introduces significant improvements to the build system and codebase to better support both GPU-accelerated and CPU-only builds. It adds conditional logic for CUDA/GPU dependencies, improves compatibility by providing CPU fallbacks or error messages for GPU-only routines, and introduces new utility functions and interface enhancements. The changes also clarify when GPU code is active and ensure that code paths are appropriately guarded.

Build system and GPU/CPU support:

  • Updated CMakeLists.txt in both examples and src/integrals to conditionally enable CUDA, set GPU/CPU-specific libraries, and provide clear messages about the build mode. Now, GPU dependencies and linking are only included when USE_ACC is enabled, while CPU-only builds avoid linking unused GPU libraries. (examples/CMakeLists.txt, src/integrals/CMakeLists.txt) [1] [2] [3]

Conditional GPU/CPU code execution:

  • Wrapped GPU-specific code in #if USE_ACC preprocessor guards throughout the codebase, especially in cuda_util.cpp and gpu_util.cpp. For CPU-only builds, functions that require GPU support now print an error and exit, preventing undefined behavior. (src/integrals/cuda_util.cpp, src/integrals/gpu_util.cpp) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]

Interface and utility function enhancements:

  • Added new utility and interface functions, such as mat_times_mat_at_cpu for matrix multiplication and an overloaded get_hcore function, improving flexibility and code reuse. (include/cpu_util.h, src/integrals/cpu_util.cpp, include/cintwrapper.h) [1] [2] [3]
  • Added a new interface function compute_integrals_g to integrals.h for more flexible integral computation.

Input handling and conditional output:

  • Modified logic in main.cpp to conditionally compute and write certain integrals (e.g., pVp) based on the X2C input parameter, making the code more configurable and efficient. [1] [2]

Minor cleanups and formatting:

  • Fixed header guards, improved formatting, and removed or reorganized includes for better clarity and maintainability. (include/cuda_util.h, include/cusp.h) [1] [2] [3]

These changes collectively make the codebase more robust, modular, and easier to maintain for both GPU and CPU environments.

@joshkamm joshkamm changed the title Mat times mat at cpu GPU/CPU interoperability and X2C functionality Jan 9, 2026
@joshkamm joshkamm merged commit d7bd88c into main Jan 9, 2026
1 check passed
@joshkamm joshkamm deleted the mat_times_mat_at_cpu branch January 9, 2026 21:20
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