Skip to content

Commit

Permalink
Merge pull request lammps#4009 from ndtrung81/gpu-updates-Dec23
Browse files Browse the repository at this point in the history
GPU package updates Dec 2023
  • Loading branch information
akohlmey authored Dec 13, 2023
2 parents 98feaa0 + 569c23a commit 0c4a1cb
Show file tree
Hide file tree
Showing 71 changed files with 9,239 additions and 44 deletions.
4 changes: 2 additions & 2 deletions cmake/Modules/Packages/GPU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ if(GPU_API STREQUAL "CUDA")
endif()

cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})

cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})

foreach(CU_OBJ ${GPU_GEN_OBJS})
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
Expand Down
11 changes: 11 additions & 0 deletions cmake/presets/gpu-cuda.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# preset that enables GPU and selects CUDA API

set(PKG_GPU ON CACHE BOOL "Build GPU package" FORCE)
set(GPU_API "cuda" CACHE STRING "APU used by GPU package" FORCE)
set(GPU_PREC "mixed" CACHE STRING "" FORCE)

set(CUDA_NVCC_FLAGS "-allow-unsupported-compiler" CACHE STRING "" FORCE)
set(CUDA_NVCC_FLAGS_DEBUG "-allow-unsupported-compiler" CACHE STRING "" FORCE)
set(CUDA_NVCC_FLAGS_MINSIZEREL "-allow-unsupported-compiler" CACHE STRING "" FORCE)
set(CUDA_NVCC_FLAGS_RELWITHDEBINFO "-allow-unsupported-compiler" CACHE STRING "" FORCE)
set(CUDA_NVCC_FLAGS_RELEASE "-allow-unsupported-compiler" CACHE STRING "" FORCE)
16 changes: 8 additions & 8 deletions doc/src/Commands_pair.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ OPT.
* :doc:`coul/long/soft (o) <pair_fep_soft>`
* :doc:`coul/msm (o) <pair_coul>`
* :doc:`coul/slater/cut <pair_coul_slater>`
* :doc:`coul/slater/long <pair_coul_slater>`
* :doc:`coul/slater/long (g) <pair_coul_slater>`
* :doc:`coul/shield <pair_coul_shield>`
* :doc:`coul/streitz <pair_coul>`
* :doc:`coul/tt <pair_coul_tt>`
Expand All @@ -110,7 +110,7 @@ OPT.
* :doc:`eam/he <pair_eam>`
* :doc:`edip (o) <pair_edip>`
* :doc:`edip/multi <pair_edip>`
* :doc:`edpd <pair_mesodpd>`
* :doc:`edpd (g) <pair_mesodpd>`
* :doc:`eff/cut <pair_eff>`
* :doc:`eim (o) <pair_eim>`
* :doc:`exp6/rx (k) <pair_exp6_rx>`
Expand Down Expand Up @@ -158,14 +158,14 @@ OPT.
* :doc:`lj/cut (gikot) <pair_lj>`
* :doc:`lj/cut/coul/cut (gko) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/cut/dielectric (o) <pair_dielectric>`
* :doc:`lj/cut/coul/cut/soft (o) <pair_fep_soft>`
* :doc:`lj/cut/coul/cut/soft (go) <pair_fep_soft>`
* :doc:`lj/cut/coul/debye (gko) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/debye/dielectric (o) <pair_dielectric>`
* :doc:`lj/cut/coul/dsf (gko) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/long (gikot) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/long/cs <pair_cs>`
* :doc:`lj/cut/coul/long/dielectric (o) <pair_dielectric>`
* :doc:`lj/cut/coul/long/soft (o) <pair_fep_soft>`
* :doc:`lj/cut/coul/long/soft (go) <pair_fep_soft>`
* :doc:`lj/cut/coul/msm (go) <pair_lj_cut_coul>`
* :doc:`lj/cut/coul/msm/dielectric <pair_dielectric>`
* :doc:`lj/cut/coul/wolf (o) <pair_lj_cut_coul>`
Expand Down Expand Up @@ -202,7 +202,7 @@ OPT.
* :doc:`lubricate/poly (o) <pair_lubricate>`
* :doc:`lubricateU <pair_lubricateU>`
* :doc:`lubricateU/poly <pair_lubricateU>`
* :doc:`mdpd <pair_mesodpd>`
* :doc:`mdpd (g) <pair_mesodpd>`
* :doc:`mdpd/rhosum <pair_mesodpd>`
* :doc:`meam (k) <pair_meam>`
* :doc:`meam/ms (k) <pair_meam>`
Expand Down Expand Up @@ -268,11 +268,11 @@ OPT.
* :doc:`smtbq <pair_smtbq>`
* :doc:`snap (ik) <pair_snap>`
* :doc:`soft (go) <pair_soft>`
* :doc:`sph/heatconduction <pair_sph_heatconduction>`
* :doc:`sph/heatconduction (g) <pair_sph_heatconduction>`
* :doc:`sph/idealgas <pair_sph_idealgas>`
* :doc:`sph/lj <pair_sph_lj>`
* :doc:`sph/lj (g) <pair_sph_lj>`
* :doc:`sph/rhosum <pair_sph_rhosum>`
* :doc:`sph/taitwater <pair_sph_taitwater>`
* :doc:`sph/taitwater (g) <pair_sph_taitwater>`
* :doc:`sph/taitwater/morris <pair_sph_taitwater_morris>`
* :doc:`spin/dipole/cut <pair_spin_dipole>`
* :doc:`spin/dipole/long <pair_spin_dipole>`
Expand Down
3 changes: 3 additions & 0 deletions doc/src/pair_coul_slater.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.. index:: pair_style coul/slater
.. index:: pair_style coul/slater/cut
.. index:: pair_style coul/slater/long
.. index:: pair_style coul/slater/long/gpu

pair_style coul/slater command
==============================
Expand All @@ -11,6 +12,8 @@ pair_style coul/slater/cut command
pair_style coul/slater/long command
===================================

Accelerator Variants: *coul/slater/long/gpu*

Syntax
""""""

Expand Down
6 changes: 4 additions & 2 deletions doc/src/pair_fep_soft.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.. index:: pair_style lj/cut/soft
.. index:: pair_style lj/cut/soft/omp
.. index:: pair_style lj/cut/coul/cut/soft
.. index:: pair_style lj/cut/coul/cut/soft/gpu
.. index:: pair_style lj/cut/coul/cut/soft/omp
.. index:: pair_style lj/cut/coul/long/soft
.. index:: pair_style lj/cut/coul/long/soft/gpu
.. index:: pair_style lj/cut/coul/long/soft/omp
.. index:: pair_style lj/cut/tip4p/long/soft
.. index:: pair_style lj/cut/tip4p/long/soft/omp
Expand All @@ -27,12 +29,12 @@ Accelerator Variants: *lj/cut/soft/omp*
pair_style lj/cut/coul/cut/soft command
=======================================

Accelerator Variants: *lj/cut/coul/cut/soft/omp*
Accelerator Variants: *lj/cut/coul/cut/soft/gpu*, *lj/cut/coul/cut/soft/omp*

pair_style lj/cut/coul/long/soft command
========================================

Accelerator Variants: *lj/cut/coul/long/soft/omp*
Accelerator Variants: *lj/cut/coul/long/soft/gpu*, *lj/cut/coul/long/soft/omp*

pair_style lj/cut/tip4p/long/soft command
=========================================
Expand Down
6 changes: 6 additions & 0 deletions doc/src/pair_mesodpd.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
.. index:: pair_style edpd
.. index:: pair_style edpd/gpu
.. index:: pair_style mdpd
.. index:: pair_style mdpd/gpu
.. index:: pair_style mdpd/rhosum
.. index:: pair_style tdpd

pair_style edpd command
=======================

Accelerator Variants: *edpd/gpu*

pair_style mdpd command
=======================

Accelerator Variants: *mdpd/gpu*

pair_style mdpd/rhosum command
==============================

Expand Down
3 changes: 3 additions & 0 deletions doc/src/pair_sph_heatconduction.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.. index:: pair_style sph/heatconduction
.. index:: pair_style sph/heatconduction/gpu

pair_style sph/heatconduction command
=====================================

Accelerator Variants: *sph/heatconduction/gpu*

Syntax
""""""

Expand Down
3 changes: 3 additions & 0 deletions doc/src/pair_sph_lj.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.. index:: pair_style sph/lj
.. index:: pair_style sph/lj/gpu

pair_style sph/lj command
=========================

Accelerator Variants: *sph/lj/gpu*

Syntax
""""""

Expand Down
3 changes: 3 additions & 0 deletions doc/src/pair_sph_taitwater.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.. index:: pair_style sph/taitwater
.. index:: pair_style sph/taitwater/gpu

pair_style sph/taitwater command
================================

Accelerator Variants: *sph/taitwater/gpu*

Syntax
""""""

Expand Down
1 change: 1 addition & 0 deletions examples/PACKAGES/dpd-meso/mdpd/in.mdpd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes

atom_style mdpd
comm_modify vel yes

region mdpd block -25 25 -10 10 -10 10 units box
create_box 1 mdpd
Expand Down
2 changes: 1 addition & 1 deletion lib/gpu/Makefile.linux_multi
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CUDA_PRECISION = -D_SINGLE_DOUBLE

CUDA_INCLUDE = -I$(CUDA_HOME)/include
CUDA_LIB = -L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib64/stubs
CUDA_OPTS = -DUNIX -O3 --use_fast_math $(LMP_INC) -Xcompiler -fPIC
CUDA_OPTS = -DUNIX -O3 --use_fast_math $(LMP_INC) -Xcompiler -fPIC -allow-unsupported-compiler

CUDR_CPP = mpicxx -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1 -fPIC -std=c++11
CUDR_OPTS = -O2 $(LMP_INC) # -xHost -no-prec-div -ansi-alias
Expand Down
2 changes: 1 addition & 1 deletion lib/gpu/geryon/ocl_mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ namespace ucl_opencl {
#include "ucl_print.h"
#undef UCL_PRINT_ALLOW

} // namespace ucl_cudart
} // namespace ucl_opencl

#endif
8 changes: 1 addition & 7 deletions lib/gpu/lal_amoeba.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,7 @@ int AmoebaT::polar_real(const int eflag, const int vflag) {

const int BX=this->block_size();
const int GX=static_cast<int>(ceil(static_cast<double>(ainum)/(BX/this->_threads_per_atom)));
/*
const int cus = this->device->gpu->cus();
while (GX < cus && GX > 1) {
BX /= 2;
GX=static_cast<int>(ceil(static_cast<double>(ainum)/(BX/this->_threads_per_atom)));
}
*/

this->time_pair.start();

// Build the short neighbor list if not done yet
Expand Down
6 changes: 4 additions & 2 deletions lib/gpu/lal_base_dpd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ int BaseDPDT::init_atomic(const int nlocal, const int nall,
const int max_nbors, const int maxspecial,
const double cell_size, const double gpu_split,
FILE *_screen, const void *pair_program,
const char *k_name, const int onetype) {
const char *k_name, const int onetype,
const int extra_fields) {
screen=_screen;

int gpu_nbor=0;
Expand All @@ -75,7 +76,8 @@ int BaseDPDT::init_atomic(const int nlocal, const int nall,
bool charge = false;
bool rot = false;
bool vel = true;
int success=device->init(*ans,charge,rot,nlocal,nall,maxspecial,vel);
_extra_fields = extra_fields;
int success=device->init(*ans,charge,rot,nlocal,nall,maxspecial,vel,_extra_fields/4);
if (success!=0)
return success;

Expand Down
5 changes: 2 additions & 3 deletions lib/gpu/lal_base_dpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class BaseDPD {
const int maxspecial, const double cell_size,
const double gpu_split, FILE *screen,
const void *pair_program, const char *k_name,
const int onetype=0);
const int onetype=0, const int extra_fields=0);

/// Estimate the overhead for GPU context changes and CPU driver
void estimate_gpu_overhead();
Expand Down Expand Up @@ -167,7 +167,6 @@ class BaseDPD {
/// Atom Data
Atom<numtyp,acctyp> *atom;


// ------------------------ FORCE/ENERGY DATA -----------------------

Answer<numtyp,acctyp> *ans;
Expand Down Expand Up @@ -199,7 +198,7 @@ class BaseDPD {

protected:
bool _compiled;
int _block_size, _threads_per_atom, _onetype;
int _block_size, _threads_per_atom, _onetype, _extra_fields;
double _max_bytes, _max_an_bytes;
double _gpu_overhead, _driver_overhead;
UCL_D_Vec<int> *_nbor_data;
Expand Down
Loading

0 comments on commit 0c4a1cb

Please sign in to comment.