Support pinning in HostAllocator
commit543f83db962d1c1faee55b32c0f82dadc9e411c9
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 11 Nov 2017 19:50:20 +0000 (11 12:50 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 21 Nov 2017 06:34:56 +0000 (21 07:34 +0100)
tree326b083ca004cfa8f85e2b58eae7e3c6a14e124b
parent651ae33950f8bf37a11de6ae075512134c94ff42
Support pinning in HostAllocator

We want the resize / reserve behaviour to handle page locking that is
useful for efficient GPU transfer, while making it possible to avoid
locking more pages than required for that vector. By embedding the
pin()/unpin() behaviour into malloc() and free() for the allocation
policy, this can be safely handled in all cases.

Additionally, high-level code can now choose for any individual vector
when and whether a pinning policy is required, and even manually
pin and unpin in any special cases that might arise.

When using the policy that does not support pinning, we now use
AlignedAllocator, so that we minimize memory consumption.

Change-Id: I807464222c7cc7718282b1e08204f563869322a0
15 files changed:
src/gromacs/gpu_utils/CMakeLists.txt
src/gromacs/gpu_utils/cudautils.cuh
src/gromacs/gpu_utils/hostallocator.cpp
src/gromacs/gpu_utils/hostallocator.h
src/gromacs/gpu_utils/pinning.cu [new file with mode: 0644]
src/gromacs/gpu_utils/pinning.h [moved from src/gromacs/gpu_utils/hostallocator.cu with 55% similarity]
src/gromacs/gpu_utils/tests/devicetransfers.cpp
src/gromacs/gpu_utils/tests/devicetransfers.cu
src/gromacs/gpu_utils/tests/devicetransfers.h
src/gromacs/gpu_utils/tests/hostallocator.cpp
src/gromacs/mdlib/mdatoms.cpp
src/gromacs/mdlib/mdatoms.h
src/gromacs/utility/allocator.h
src/gromacs/utility/tests/alignedallocator-impl.h [copied from src/gromacs/utility/tests/alignedallocator.cpp with 73% similarity]
src/gromacs/utility/tests/alignedallocator.cpp