Skip to content

Commit

Permalink
Introduce a System class in the core (#4741)
Browse files Browse the repository at this point in the history
Fixes #4615

Description of changes:
- completely rewrite the `EspressoSystemInterface` class
   - the new `System` class uses composition for GPU particle data management, resource deallocation, and globals
   - GPU particle data management now uses standard `thrust` vectors and properly deallocates device memory
   - simplify the `espressomd.system.System` class
- simplify GPU code
   - 9 CUDA global variables were removed (partial fix for #2628)
   - ~300 lines of CUDA code were removed
  • Loading branch information
kodiakhq[bot] authored Jun 16, 2023
2 parents 44a4c14 + 6ec1150 commit a78400b
Show file tree
Hide file tree
Showing 53 changed files with 1,747 additions and 1,829 deletions.
12 changes: 6 additions & 6 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ add_library(
dpd.cpp
energy.cpp
errorhandling.cpp
EspressoSystemInterface.cpp
forcecap.cpp
forces.cpp
ghosts.cpp
Expand All @@ -48,11 +47,12 @@ add_library(
rotate_system.cpp
rotation.cpp
Observable_stat.cpp
SystemInterface.cpp
thermostat.cpp
tuning.cpp
virtual_sites.cpp
exclusions.cpp
system/GpuParticleData.cpp
system/System.cpp
PartCfg.cpp
EspressoSystemStandAlone.cpp
TabulatedPotential.cpp)
Expand All @@ -61,13 +61,13 @@ set_target_properties(espresso_core PROPERTIES CXX_CLANG_TIDY
"${ESPRESSO_CXX_CLANG_TIDY}")

if(ESPRESSO_BUILD_WITH_CUDA)
target_sources(espresso_core PRIVATE cuda_init.cpp cuda_interface.cpp)
target_sources(espresso_core PRIVATE cuda/init.cpp)
espresso_add_gpu_library(
espresso_cuda SHARED cuda_common_cuda.cu cuda_init_cuda.cu
CudaHostAllocator.cu magnetostatics/barnes_hut_gpu_cuda.cu
espresso_cuda SHARED cuda/common_cuda.cu cuda/init_cuda.cu
cuda/CudaHostAllocator.cu magnetostatics/barnes_hut_gpu_cuda.cu
magnetostatics/dipolar_direct_sum_gpu_cuda.cu
electrostatics/mmm1d_gpu_cuda.cu electrostatics/p3m_gpu_cuda.cu
electrostatics/p3m_gpu_error_cuda.cu EspressoSystemInterface_cuda.cu)
electrostatics/p3m_gpu_error_cuda.cu system/GpuParticleData_cuda.cu)
add_library(espresso::cuda ALIAS espresso_cuda)
target_link_libraries(
espresso_cuda PRIVATE CUDA::cuda_driver CUDA::cudart CUDA::cufft
Expand Down
74 changes: 0 additions & 74 deletions src/core/CudaDeviceAllocator.hpp

This file was deleted.

61 changes: 0 additions & 61 deletions src/core/EspressoSystemInterface.cpp

This file was deleted.

157 changes: 0 additions & 157 deletions src/core/EspressoSystemInterface.hpp

This file was deleted.

Loading

0 comments on commit a78400b

Please sign in to comment.