Move GPU implementation to new interface
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 12 Dec 2014 15:56:27 +0000 (16:56 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 30 Apr 2015 08:43:05 +0000 (10:43 +0200)
commit7011af79f53f0ee74379e7465f0168539adedd87
tree84297589733492876734bf14c0a837c58d73b2ea
parent053201e3e8f899b850d7bd2e473f30476918370c
Move GPU implementation to new interface

This prepares for OpenCL implementation by updating the existing
preprocessor-based interface for GPU functions (that has real
implementations with a GPU build and null implementations without).
Some related changes to identifier names, comments and docs.

Renamed
s/ncuda_dev/n_dev/g
s/cuda_dev/dev/g
s/nb_cuda/nb_gpu/g
s/cu_nb/nb/g
s/cu_nbv/gpu_nbv/g
s/cuda_dev_info/gmx_device_info/g
so they were more generic, for when an OpenCL implementation wants to
share the same identifiers. Related, some _gpu_ had to become
_cuda_gpu_ because it will only have a CUDA implementation, other
_cuda_gpu_ had to become just _gpu_, some _cuda_ had to become _gpu_
or _cuda_gpu_. Some CUDA became GPU.

Several CUDA header files are moved from mdlib/nbnxn_cuda to files of
more generic names in mdlib. This is not great either, but
reorganizing the whole nbnxn code into a proper module, perhaps with
submodules is not within the scope of this change.

Updated naming of some data types to be struct gmx_name_t, per
style in Redmine #1490. Used some explicit forward declarations
instead of including files to get them. Removed typedefs for
opaque pointers.

Moved gpu_timing struct from
legacyheaders/types/nbnxn_cuda_types_ext.h to timing/gpu_timing.h, and
the remaining content to mdlib/nbnxn_gpu_types.h. So we no longer
install this internal-use-only header.

The last part of init_interaction_const() in forcrec.cpp is split off,
so that the construction phase can be moved to occur before
init_nb_verlet(), so that the "constants" are known before any JIT
compilation of GPU kernels takes place. Future work will address the
question of handling JIT compilation more flexibly, or in more than
one place (e.g. when things become compile-time constants after PME
tuning).

Converted some Doxygen style to new guidelines, added basic file-level
documentation, updated include guards.

Introduced gpu_set_host_malloc_and_free so the implementation-specific
details can be handled in the implementations.

Change-Id: I888722c92daeccc7f32987d9b6cb15544351b68d
38 files changed:
src/gromacs/domdec/domdec.cpp
src/gromacs/ewald/pme-load-balancing.c
src/gromacs/gmxlib/CMakeLists.txt
src/gromacs/gmxlib/copyrite.cpp
src/gromacs/gmxlib/cuda_tools/copyrite_gpu.cu
src/gromacs/gmxlib/cuda_tools/cudautils.cuh
src/gromacs/gmxlib/cuda_tools/pmalloc_cuda.cu
src/gromacs/gmxlib/cuda_tools/pmalloc_cuda.h
src/gromacs/gmxlib/gmx_detect_hardware.cpp
src/gromacs/gmxlib/gpu_utils/CMakeLists.txt
src/gromacs/gmxlib/gpu_utils/gpu_macros.h [new file with mode: 0644]
src/gromacs/gmxlib/gpu_utils/gpu_utils.cpp [new file with mode: 0644]
src/gromacs/gmxlib/gpu_utils/gpu_utils.cu
src/gromacs/gmxlib/gpu_utils/gpu_utils.h
src/gromacs/gmxlib/nrnb.c
src/gromacs/legacyheaders/force.h
src/gromacs/legacyheaders/types/hw_info.h
src/gromacs/math/utilities.h
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/nb_verlet.h
src/gromacs/mdlib/nbnxn_atomdata.c
src/gromacs/mdlib/nbnxn_consts.h
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_data_mgmt.cu
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_data_mgmt.h [deleted file]
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_jit_support.cu [new file with mode: 0644]
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_types.h
src/gromacs/mdlib/nbnxn_gpu.h [moved from src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.h with 56% similarity]
src/gromacs/mdlib/nbnxn_gpu_data_mgmt.h [new file with mode: 0644]
src/gromacs/mdlib/nbnxn_gpu_jit_support.h [new file with mode: 0644]
src/gromacs/mdlib/nbnxn_gpu_types.h [moved from src/gromacs/legacyheaders/types/nbnxn_cuda_types_ext.h with 55% similarity]
src/gromacs/mdlib/nbnxn_search.c
src/gromacs/mdlib/sim_util.cpp
src/gromacs/timing/gpu_timing.h [new file with mode: 0644]
src/gromacs/timing/wallcycle.c
src/gromacs/timing/wallcycle.h
src/programs/mdrun/md.cpp
src/programs/mdrun/runner.cpp