2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2019,2020, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
37 * \brief Definitions of interfaces for GPU state data propagator object.
39 * \author Artem Zhmurov <zhmurov@gmail.com>
41 * \ingroup module_mdtypes
49 # include "gromacs/gpu_utils/device_stream_manager.h"
50 # include "gromacs/gpu_utils/devicebuffer.h"
51 # include "gromacs/math/vectypes.h"
52 # include "gromacs/mdtypes/state_propagator_data_gpu.h"
53 # include "gromacs/timing/wallcycle.h"
54 # include "gromacs/utility/classhelpers.h"
56 # include "state_propagator_data_gpu_impl.h"
62 StatePropagatorDataGpu::Impl::Impl(const DeviceStreamManager& deviceStreamManager,
63 GpuApiCallBehavior transferKind,
64 int allocationBlockSizeDivisor,
65 gmx_wallcycle* wcycle) :
66 deviceContext_(deviceStreamManager.context()),
67 transferKind_(transferKind),
68 allocationBlockSizeDivisor_(allocationBlockSizeDivisor),
73 "GPU state propagator data object should only be constructed on the GPU code-paths.");
75 // We need to keep local copies for re-initialization.
76 pmeStream_ = &deviceStreamManager.stream(DeviceStreamType::Pme);
77 localStream_ = &deviceStreamManager.stream(DeviceStreamType::NonBondedLocal);
78 nonLocalStream_ = &deviceStreamManager.stream(DeviceStreamType::NonBondedNonLocal);
79 // PME stream is used in OpenCL for H2D coordinate transfer
80 updateStream_ = &deviceStreamManager.stream(
81 GMX_GPU_OPENCL ? DeviceStreamType::Pme : DeviceStreamType::UpdateAndConstraints);
83 // Map the atom locality to the stream that will be used for coordinates,
84 // velocities and forces transfers. Same streams are used for H2D and D2H copies.
85 // Note, that nullptr stream is used here to indicate that the copy is not supported.
86 xCopyStreams_[AtomLocality::Local] = updateStream_;
87 xCopyStreams_[AtomLocality::NonLocal] = nonLocalStream_;
88 xCopyStreams_[AtomLocality::All] = updateStream_;
90 vCopyStreams_[AtomLocality::Local] = updateStream_;
91 vCopyStreams_[AtomLocality::NonLocal] = nullptr;
92 vCopyStreams_[AtomLocality::All] = updateStream_;
94 fCopyStreams_[AtomLocality::Local] = localStream_;
95 fCopyStreams_[AtomLocality::NonLocal] = nonLocalStream_;
96 fCopyStreams_[AtomLocality::All] = updateStream_;
99 StatePropagatorDataGpu::Impl::Impl(const DeviceStream* pmeStream,
100 const DeviceContext& deviceContext,
101 GpuApiCallBehavior transferKind,
102 int allocationBlockSizeDivisor,
103 gmx_wallcycle* wcycle) :
104 deviceContext_(deviceContext),
105 transferKind_(transferKind),
106 allocationBlockSizeDivisor_(allocationBlockSizeDivisor),
111 "GPU state propagator data object should only be constructed on the GPU code-paths.");
113 GMX_ASSERT(pmeStream->isValid(), "GPU PME stream should be valid.");
114 pmeStream_ = pmeStream;
115 localStream_ = pmeStream; // For clearing the force buffer
116 nonLocalStream_ = nullptr;
117 updateStream_ = nullptr;
120 // Only local/all coordinates are allowed to be copied in PME-only rank/ PME tests.
121 // This it temporary measure to make it safe to use this class in those cases.
122 xCopyStreams_[AtomLocality::Local] = pmeStream_;
123 xCopyStreams_[AtomLocality::NonLocal] = nullptr;
124 xCopyStreams_[AtomLocality::All] = pmeStream_;
126 vCopyStreams_[AtomLocality::Local] = nullptr;
127 vCopyStreams_[AtomLocality::NonLocal] = nullptr;
128 vCopyStreams_[AtomLocality::All] = nullptr;
130 fCopyStreams_[AtomLocality::Local] = nullptr;
131 fCopyStreams_[AtomLocality::NonLocal] = nullptr;
132 fCopyStreams_[AtomLocality::All] = nullptr;
135 StatePropagatorDataGpu::Impl::~Impl() {}
137 void StatePropagatorDataGpu::Impl::reinit(int numAtomsLocal, int numAtomsAll)
139 wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
140 wallcycle_sub_start_nocount(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
142 numAtomsLocal_ = numAtomsLocal;
143 numAtomsAll_ = numAtomsAll;
146 if (allocationBlockSizeDivisor_ > 0)
148 numAtomsPadded = ((numAtomsAll_ + allocationBlockSizeDivisor_ - 1) / allocationBlockSizeDivisor_)
149 * allocationBlockSizeDivisor_;
153 numAtomsPadded = numAtomsAll_;
156 reallocateDeviceBuffer(&d_x_, numAtomsPadded, &d_xSize_, &d_xCapacity_, deviceContext_);
158 const size_t paddingAllocationSize = numAtomsPadded - numAtomsAll_;
159 if (paddingAllocationSize > 0)
161 // The PME stream is used here because the padding region of d_x_ is only in the PME task.
162 clearDeviceBufferAsync(&d_x_, numAtomsAll_, paddingAllocationSize, *pmeStream_);
165 reallocateDeviceBuffer(&d_v_, numAtomsAll_, &d_vSize_, &d_vCapacity_, deviceContext_);
166 const int d_fOldCapacity = d_fCapacity_;
167 reallocateDeviceBuffer(&d_f_, numAtomsAll_, &d_fSize_, &d_fCapacity_, deviceContext_);
169 // Clearing of the forces can be done in local stream since the nonlocal stream cannot reach
170 // the force accumulation stage before syncing with the local stream. Only done in CUDA,
171 // since the force buffer ops are not implemented in OpenCL.
172 if (GMX_GPU_CUDA && d_fCapacity_ != d_fOldCapacity)
174 clearDeviceBufferAsync(&d_f_, 0, d_fCapacity_, *localStream_);
177 wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
178 wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
181 std::tuple<int, int> StatePropagatorDataGpu::Impl::getAtomRangesFromAtomLocality(AtomLocality atomLocality)
183 int atomsStartAt = 0;
184 int numAtomsToCopy = 0;
185 switch (atomLocality)
187 case AtomLocality::All:
189 numAtomsToCopy = numAtomsAll_;
191 case AtomLocality::Local:
193 numAtomsToCopy = numAtomsLocal_;
195 case AtomLocality::NonLocal:
196 atomsStartAt = numAtomsLocal_;
197 numAtomsToCopy = numAtomsAll_ - numAtomsLocal_;
200 GMX_RELEASE_ASSERT(false,
201 "Wrong range of atoms requested in GPU state data manager. Should "
202 "be All, Local or NonLocal.");
204 GMX_ASSERT(atomsStartAt >= 0,
205 "The first elemtnt to copy has negative index. Probably, the GPU propagator state "
206 "was not initialized.");
207 GMX_ASSERT(numAtomsToCopy >= 0,
208 "Number of atoms to copy is negative. Probably, the GPU propagator state was not "
210 return std::make_tuple(atomsStartAt, numAtomsToCopy);
213 void StatePropagatorDataGpu::Impl::copyToDevice(DeviceBuffer<RVec> d_data,
214 const gmx::ArrayRef<const gmx::RVec> h_data,
216 AtomLocality atomLocality,
217 const DeviceStream& deviceStream)
219 GMX_UNUSED_VALUE(dataSize);
221 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
223 GMX_ASSERT(dataSize >= 0, "Trying to copy to device buffer before it was allocated.");
225 GMX_ASSERT(deviceStream.isValid(), "No stream is valid for copying with given atom locality.");
227 int atomsStartAt, numAtomsToCopy;
228 std::tie(atomsStartAt, numAtomsToCopy) = getAtomRangesFromAtomLocality(atomLocality);
230 if (numAtomsToCopy != 0)
232 GMX_ASSERT(atomsStartAt + numAtomsToCopy <= dataSize,
233 "The device allocation is smaller than requested copy range.");
234 GMX_ASSERT(atomsStartAt + numAtomsToCopy <= h_data.ssize(),
235 "The host buffer is smaller than the requested copy range.");
237 copyToDeviceBuffer(&d_data, reinterpret_cast<const RVec*>(&h_data.data()[atomsStartAt]),
238 atomsStartAt, numAtomsToCopy, deviceStream, transferKind_, nullptr);
242 void StatePropagatorDataGpu::Impl::copyFromDevice(gmx::ArrayRef<gmx::RVec> h_data,
243 DeviceBuffer<RVec> d_data,
245 AtomLocality atomLocality,
246 const DeviceStream& deviceStream)
248 GMX_UNUSED_VALUE(dataSize);
250 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
252 GMX_ASSERT(dataSize >= 0, "Trying to copy from device buffer before it was allocated.");
254 GMX_ASSERT(deviceStream.isValid(), "No stream is valid for copying with given atom locality.");
256 int atomsStartAt, numAtomsToCopy;
257 std::tie(atomsStartAt, numAtomsToCopy) = getAtomRangesFromAtomLocality(atomLocality);
259 if (numAtomsToCopy != 0)
261 GMX_ASSERT(atomsStartAt + numAtomsToCopy <= dataSize,
262 "The device allocation is smaller than requested copy range.");
263 GMX_ASSERT(atomsStartAt + numAtomsToCopy <= h_data.ssize(),
264 "The host buffer is smaller than the requested copy range.");
266 copyFromDeviceBuffer(reinterpret_cast<RVec*>(&h_data.data()[atomsStartAt]), &d_data,
267 atomsStartAt, numAtomsToCopy, deviceStream, transferKind_, nullptr);
271 DeviceBuffer<RVec> StatePropagatorDataGpu::Impl::getCoordinates()
276 void StatePropagatorDataGpu::Impl::copyCoordinatesToGpu(const gmx::ArrayRef<const gmx::RVec> h_x,
277 AtomLocality atomLocality)
279 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
280 const DeviceStream* deviceStream = xCopyStreams_[atomLocality];
281 GMX_ASSERT(deviceStream != nullptr,
282 "No stream is valid for copying positions with given atom locality.");
284 wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
285 wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
287 copyToDevice(d_x_, h_x, d_xSize_, atomLocality, *deviceStream);
289 // markEvent is skipped in OpenCL as:
290 // - it's not needed, copy is done in the same stream as the only consumer task (PME)
291 // - we don't consume the events in OpenCL which is not allowed by GpuEventSynchronizer (would leak memory).
292 // TODO: remove this by adding an event-mark free flavor of this function
295 xReadyOnDevice_[atomLocality].markEvent(*deviceStream);
298 wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
299 wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
302 GpuEventSynchronizer*
303 StatePropagatorDataGpu::Impl::getCoordinatesReadyOnDeviceEvent(AtomLocality atomLocality,
304 const SimulationWorkload& simulationWork,
305 const StepWorkload& stepWork)
307 // The provider of the coordinates may be different for local atoms. If the update is offloaded
308 // and this is not a neighbor search step, then the consumer needs to wait for the update
309 // to complete. Otherwise, the coordinates are copied from the host and we need to wait for
310 // the copy event. Non-local coordinates are always provided by the H2D copy.
312 // TODO: This should be reconsidered to support the halo exchange.
314 // In OpenCL no events are used as coordinate sync is not necessary
319 if (atomLocality == AtomLocality::Local && simulationWork.useGpuUpdate && !stepWork.doNeighborSearch)
321 return &xUpdatedOnDevice_;
325 return &xReadyOnDevice_[atomLocality];
329 void StatePropagatorDataGpu::Impl::waitCoordinatesCopiedToDevice(AtomLocality atomLocality)
331 wallcycle_start(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
332 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
333 xReadyOnDevice_[atomLocality].waitForEvent();
334 wallcycle_stop(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
337 GpuEventSynchronizer* StatePropagatorDataGpu::Impl::xUpdatedOnDevice()
339 return &xUpdatedOnDevice_;
342 void StatePropagatorDataGpu::Impl::copyCoordinatesFromGpu(gmx::ArrayRef<gmx::RVec> h_x, AtomLocality atomLocality)
344 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
345 const DeviceStream* deviceStream = xCopyStreams_[atomLocality];
346 GMX_ASSERT(deviceStream != nullptr,
347 "No stream is valid for copying positions with given atom locality.");
349 wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
350 wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
352 copyFromDevice(h_x, d_x_, d_xSize_, atomLocality, *deviceStream);
353 // Note: unlike copyCoordinatesToGpu this is not used in OpenCL, and the conditional is not needed.
354 xReadyOnHost_[atomLocality].markEvent(*deviceStream);
356 wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
357 wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
360 void StatePropagatorDataGpu::Impl::waitCoordinatesReadyOnHost(AtomLocality atomLocality)
362 wallcycle_start(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
363 xReadyOnHost_[atomLocality].waitForEvent();
364 wallcycle_stop(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
368 DeviceBuffer<RVec> StatePropagatorDataGpu::Impl::getVelocities()
373 void StatePropagatorDataGpu::Impl::copyVelocitiesToGpu(const gmx::ArrayRef<const gmx::RVec> h_v,
374 AtomLocality atomLocality)
376 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
377 const DeviceStream* deviceStream = vCopyStreams_[atomLocality];
378 GMX_ASSERT(deviceStream != nullptr,
379 "No stream is valid for copying velocities with given atom locality.");
381 wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
382 wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
384 copyToDevice(d_v_, h_v, d_vSize_, atomLocality, *deviceStream);
385 vReadyOnDevice_[atomLocality].markEvent(*deviceStream);
387 wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
388 wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
391 GpuEventSynchronizer* StatePropagatorDataGpu::Impl::getVelocitiesReadyOnDeviceEvent(AtomLocality atomLocality)
393 return &vReadyOnDevice_[atomLocality];
397 void StatePropagatorDataGpu::Impl::copyVelocitiesFromGpu(gmx::ArrayRef<gmx::RVec> h_v, AtomLocality atomLocality)
399 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
400 const DeviceStream* deviceStream = vCopyStreams_[atomLocality];
401 GMX_ASSERT(deviceStream != nullptr,
402 "No stream is valid for copying velocities with given atom locality.");
404 wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
405 wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
407 copyFromDevice(h_v, d_v_, d_vSize_, atomLocality, *deviceStream);
408 vReadyOnHost_[atomLocality].markEvent(*deviceStream);
410 wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
411 wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
414 void StatePropagatorDataGpu::Impl::waitVelocitiesReadyOnHost(AtomLocality atomLocality)
416 wallcycle_start(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
417 vReadyOnHost_[atomLocality].waitForEvent();
418 wallcycle_stop(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
422 DeviceBuffer<RVec> StatePropagatorDataGpu::Impl::getForces()
427 void StatePropagatorDataGpu::Impl::copyForcesToGpu(const gmx::ArrayRef<const gmx::RVec> h_f,
428 AtomLocality atomLocality)
430 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
431 const DeviceStream* deviceStream = fCopyStreams_[atomLocality];
432 GMX_ASSERT(deviceStream != nullptr,
433 "No stream is valid for copying forces with given atom locality.");
435 wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
436 wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
438 copyToDevice(d_f_, h_f, d_fSize_, atomLocality, *deviceStream);
439 fReadyOnDevice_[atomLocality].markEvent(*deviceStream);
441 wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
442 wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
445 GpuEventSynchronizer* StatePropagatorDataGpu::Impl::getForcesReadyOnDeviceEvent(AtomLocality atomLocality,
446 bool useGpuFBufferOps)
448 if ((atomLocality == AtomLocality::Local || atomLocality == AtomLocality::NonLocal) && useGpuFBufferOps)
450 return &fReducedOnDevice_;
454 return &fReadyOnDevice_[atomLocality];
458 GpuEventSynchronizer* StatePropagatorDataGpu::Impl::fReducedOnDevice()
460 return &fReducedOnDevice_;
463 void StatePropagatorDataGpu::Impl::copyForcesFromGpu(gmx::ArrayRef<gmx::RVec> h_f, AtomLocality atomLocality)
465 GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
466 const DeviceStream* deviceStream = fCopyStreams_[atomLocality];
467 GMX_ASSERT(deviceStream != nullptr,
468 "No stream is valid for copying forces with given atom locality.");
470 wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
471 wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
473 copyFromDevice(h_f, d_f_, d_fSize_, atomLocality, *deviceStream);
474 fReadyOnHost_[atomLocality].markEvent(*deviceStream);
476 wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
477 wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
480 void StatePropagatorDataGpu::Impl::waitForcesReadyOnHost(AtomLocality atomLocality)
482 wallcycle_start(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
483 fReadyOnHost_[atomLocality].waitForEvent();
484 wallcycle_stop(wcycle_, ewcWAIT_GPU_STATE_PROPAGATOR_DATA);
487 const DeviceStream* StatePropagatorDataGpu::Impl::getUpdateStream()
489 return updateStream_;
492 int StatePropagatorDataGpu::Impl::numAtomsLocal()
494 return numAtomsLocal_;
497 int StatePropagatorDataGpu::Impl::numAtomsAll()
503 StatePropagatorDataGpu::StatePropagatorDataGpu(const DeviceStreamManager& deviceStreamManager,
504 GpuApiCallBehavior transferKind,
505 int allocationBlockSizeDivisor,
506 gmx_wallcycle* wcycle) :
507 impl_(new Impl(deviceStreamManager, transferKind, allocationBlockSizeDivisor, wcycle))
511 StatePropagatorDataGpu::StatePropagatorDataGpu(const DeviceStream* pmeStream,
512 const DeviceContext& deviceContext,
513 GpuApiCallBehavior transferKind,
514 int allocationBlockSizeDivisor,
515 gmx_wallcycle* wcycle) :
516 impl_(new Impl(pmeStream, deviceContext, transferKind, allocationBlockSizeDivisor, wcycle))
520 StatePropagatorDataGpu::StatePropagatorDataGpu(StatePropagatorDataGpu&& /* other */) noexcept = default;
522 StatePropagatorDataGpu& StatePropagatorDataGpu::operator=(StatePropagatorDataGpu&& /* other */) noexcept = default;
524 StatePropagatorDataGpu::~StatePropagatorDataGpu() = default;
527 void StatePropagatorDataGpu::reinit(int numAtomsLocal, int numAtomsAll)
529 return impl_->reinit(numAtomsLocal, numAtomsAll);
532 std::tuple<int, int> StatePropagatorDataGpu::getAtomRangesFromAtomLocality(AtomLocality atomLocality)
534 return impl_->getAtomRangesFromAtomLocality(atomLocality);
538 DeviceBuffer<RVec> StatePropagatorDataGpu::getCoordinates()
540 return impl_->getCoordinates();
543 void StatePropagatorDataGpu::copyCoordinatesToGpu(const gmx::ArrayRef<const gmx::RVec> h_x,
544 AtomLocality atomLocality)
546 return impl_->copyCoordinatesToGpu(h_x, atomLocality);
549 GpuEventSynchronizer*
550 StatePropagatorDataGpu::getCoordinatesReadyOnDeviceEvent(AtomLocality atomLocality,
551 const SimulationWorkload& simulationWork,
552 const StepWorkload& stepWork)
554 return impl_->getCoordinatesReadyOnDeviceEvent(atomLocality, simulationWork, stepWork);
557 void StatePropagatorDataGpu::waitCoordinatesCopiedToDevice(AtomLocality atomLocality)
559 return impl_->waitCoordinatesCopiedToDevice(atomLocality);
562 GpuEventSynchronizer* StatePropagatorDataGpu::xUpdatedOnDevice()
564 return impl_->xUpdatedOnDevice();
567 void StatePropagatorDataGpu::copyCoordinatesFromGpu(gmx::ArrayRef<RVec> h_x, AtomLocality atomLocality)
569 return impl_->copyCoordinatesFromGpu(h_x, atomLocality);
572 void StatePropagatorDataGpu::waitCoordinatesReadyOnHost(AtomLocality atomLocality)
574 return impl_->waitCoordinatesReadyOnHost(atomLocality);
578 DeviceBuffer<RVec> StatePropagatorDataGpu::getVelocities()
580 return impl_->getVelocities();
583 void StatePropagatorDataGpu::copyVelocitiesToGpu(const gmx::ArrayRef<const gmx::RVec> h_v,
584 AtomLocality atomLocality)
586 return impl_->copyVelocitiesToGpu(h_v, atomLocality);
589 GpuEventSynchronizer* StatePropagatorDataGpu::getVelocitiesReadyOnDeviceEvent(AtomLocality atomLocality)
591 return impl_->getVelocitiesReadyOnDeviceEvent(atomLocality);
594 void StatePropagatorDataGpu::copyVelocitiesFromGpu(gmx::ArrayRef<RVec> h_v, AtomLocality atomLocality)
596 return impl_->copyVelocitiesFromGpu(h_v, atomLocality);
599 void StatePropagatorDataGpu::waitVelocitiesReadyOnHost(AtomLocality atomLocality)
601 return impl_->waitVelocitiesReadyOnHost(atomLocality);
605 DeviceBuffer<RVec> StatePropagatorDataGpu::getForces()
607 return impl_->getForces();
610 void StatePropagatorDataGpu::copyForcesToGpu(const gmx::ArrayRef<const gmx::RVec> h_f, AtomLocality atomLocality)
612 return impl_->copyForcesToGpu(h_f, atomLocality);
615 GpuEventSynchronizer* StatePropagatorDataGpu::getForcesReadyOnDeviceEvent(AtomLocality atomLocality,
616 bool useGpuFBufferOps)
618 return impl_->getForcesReadyOnDeviceEvent(atomLocality, useGpuFBufferOps);
621 GpuEventSynchronizer* StatePropagatorDataGpu::fReducedOnDevice()
623 return impl_->fReducedOnDevice();
626 void StatePropagatorDataGpu::copyForcesFromGpu(gmx::ArrayRef<RVec> h_f, AtomLocality atomLocality)
628 return impl_->copyForcesFromGpu(h_f, atomLocality);
631 void StatePropagatorDataGpu::waitForcesReadyOnHost(AtomLocality atomLocality)
633 return impl_->waitForcesReadyOnHost(atomLocality);
637 const DeviceStream* StatePropagatorDataGpu::getUpdateStream()
639 return impl_->getUpdateStream();
642 int StatePropagatorDataGpu::numAtomsLocal()
644 return impl_->numAtomsLocal();
647 int StatePropagatorDataGpu::numAtomsAll()
649 return impl_->numAtomsAll();