/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/state_propagator_data_gpu.h"
-#if GMX_GPU == GMX_GPU_NONE
+#if !GMX_GPU
namespace gmx
{
{
};
-StatePropagatorDataGpu::StatePropagatorDataGpu(const void * /* pmeStream */,
- const void * /* localStream */,
- const void * /* nonLocalStream */,
- const void * /* deviceContext */,
+StatePropagatorDataGpu::StatePropagatorDataGpu(const DeviceStreamManager& /* deviceStreamManager */,
GpuApiCallBehavior /* transferKind */,
- int /* paddingSize */)
- : impl_(nullptr)
+ int /* allocationBlockSizeDivisor */,
+ gmx_wallcycle* /* wcycle */) :
+ impl_(nullptr)
{
}
-StatePropagatorDataGpu::StatePropagatorDataGpu(StatePropagatorDataGpu && /* other */) noexcept = default;
+StatePropagatorDataGpu::StatePropagatorDataGpu(const DeviceStream* /* pmeStream */,
+ const DeviceContext& /* deviceContext */,
+ GpuApiCallBehavior /* transferKind */,
+ int /* allocationBlockSizeDivisor */,
+ gmx_wallcycle* /* wcycle */) :
+ impl_(nullptr)
+{
+}
+
+StatePropagatorDataGpu::StatePropagatorDataGpu(StatePropagatorDataGpu&& /* other */) noexcept = default;
-StatePropagatorDataGpu &StatePropagatorDataGpu::operator=(StatePropagatorDataGpu && /* other */) noexcept = default;
+StatePropagatorDataGpu& StatePropagatorDataGpu::operator=(StatePropagatorDataGpu&& /* other */) noexcept = default;
StatePropagatorDataGpu::~StatePropagatorDataGpu() = default;
-void StatePropagatorDataGpu::reinit(int /* numAtomsLocal */,
- int /* numAtomsAll */)
+void StatePropagatorDataGpu::reinit(int /* numAtomsLocal */, int /* numAtomsAll */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-std::tuple<int, int> StatePropagatorDataGpu::getAtomRangesFromAtomLocality(AtomLocality /* atomLocality */)
+std::tuple<int, int> StatePropagatorDataGpu::getAtomRangesFromAtomLocality(AtomLocality /* atomLocality */) const
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
return std::make_tuple(0, 0);
}
-DeviceBuffer<float> StatePropagatorDataGpu::getCoordinates()
+DeviceBuffer<RVec> StatePropagatorDataGpu::getCoordinates()
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
- return DeviceBuffer<float> {};
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+ return {};
}
-GpuEventSynchronizer* StatePropagatorDataGpu::getCoordinatesReadyOnDeviceEvent(AtomLocality /* atomLocality */)
+GpuEventSynchronizer* StatePropagatorDataGpu::getCoordinatesReadyOnDeviceEvent(
+ AtomLocality /* atomLocality */,
+ const SimulationWorkload& /* simulationWork */,
+ const StepWorkload& /* stepWork */,
+ GpuEventSynchronizer* /* gpuCoordinateHaloLaunched */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
return nullptr;
}
-void StatePropagatorDataGpu::copyCoordinatesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_x */,
- AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::waitCoordinatesCopiedToDevice(AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-void StatePropagatorDataGpu::waitCoordinatesReadyOnHost(AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::consumeCoordinatesCopiedToDeviceEvent(AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-void StatePropagatorDataGpu::copyCoordinatesFromGpu(gmx::ArrayRef<gmx::RVec> /* h_x */,
- AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::resetCoordinatesCopiedToDeviceEvent(AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
+void StatePropagatorDataGpu::setXUpdatedOnDeviceEvent(GpuEventSynchronizer* /* xUpdatedOnDeviceEvent */)
+{
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+}
-DeviceBuffer<float> StatePropagatorDataGpu::getVelocities()
+void StatePropagatorDataGpu::copyCoordinatesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_x */,
+ AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
- return DeviceBuffer<float> {};
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-void StatePropagatorDataGpu::copyVelocitiesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_v */,
- AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::waitCoordinatesReadyOnHost(AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-GpuEventSynchronizer* StatePropagatorDataGpu::getVelocitiesReadyOnDeviceEvent(AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::copyCoordinatesFromGpu(gmx::ArrayRef<gmx::RVec> /* h_x */,
+ AtomLocality /* atomLocality */,
+ GpuEventSynchronizer* /*dependency */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
- return nullptr;
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-void StatePropagatorDataGpu::copyVelocitiesFromGpu(gmx::ArrayRef<gmx::RVec> /* h_v */,
- AtomLocality /* atomLocality */)
+DeviceBuffer<RVec> StatePropagatorDataGpu::getVelocities()
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+ return {};
}
-void StatePropagatorDataGpu::waitVelocitiesReadyOnHost(AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::copyVelocitiesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_v */,
+ AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
+void StatePropagatorDataGpu::copyVelocitiesFromGpu(gmx::ArrayRef<gmx::RVec> /* h_v */,
+ AtomLocality /* atomLocality */)
+{
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+}
-DeviceBuffer<float> StatePropagatorDataGpu::getForces()
+void StatePropagatorDataGpu::waitVelocitiesReadyOnHost(AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
- return DeviceBuffer<float> {};
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+}
+
+
+DeviceBuffer<RVec> StatePropagatorDataGpu::getForces()
+{
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+ return {};
+}
+
+void StatePropagatorDataGpu::copyForcesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_f */,
+ AtomLocality /* atomLocality */)
+{
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+}
+
+void StatePropagatorDataGpu::clearForcesOnGpu(AtomLocality /* atomLocality */,
+ GpuEventSynchronizer* /* dependency */)
+{
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+}
+
+GpuEventSynchronizer* StatePropagatorDataGpu::getLocalForcesReadyOnDeviceEvent(StepWorkload /* stepWork */,
+ SimulationWorkload /* simulationWork */)
+{
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+ return nullptr;
+}
+
+GpuEventSynchronizer* StatePropagatorDataGpu::fReducedOnDevice(AtomLocality /*atomLocality*/)
+{
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
+ return nullptr;
}
-void StatePropagatorDataGpu::copyForcesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_f */,
- AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::consumeForcesReducedOnDeviceEvent(AtomLocality /*atomLocality*/)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-GpuEventSynchronizer* StatePropagatorDataGpu::getForcesReadyOnDeviceEvent(AtomLocality /* atomLocality */)
+GpuEventSynchronizer* StatePropagatorDataGpu::fReadyOnDevice(AtomLocality /*atomLocality*/)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called insted of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
return nullptr;
}
-void StatePropagatorDataGpu::copyForcesFromGpu(gmx::ArrayRef<gmx::RVec> /* h_f */,
- AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::copyForcesFromGpu(gmx::ArrayRef<gmx::RVec> /* h_f */,
+ AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-void StatePropagatorDataGpu::waitForcesReadyOnHost(AtomLocality /* atomLocality */)
+void StatePropagatorDataGpu::waitForcesReadyOnHost(AtomLocality /* atomLocality */)
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
}
-void* StatePropagatorDataGpu::getUpdateStream()
+const DeviceStream* StatePropagatorDataGpu::getUpdateStream()
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
return nullptr;
}
-int StatePropagatorDataGpu::numAtomsLocal()
+int StatePropagatorDataGpu::numAtomsLocal() const
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
return 0;
}
-int StatePropagatorDataGpu::numAtomsAll()
+int StatePropagatorDataGpu::numAtomsAll() const
{
- GMX_ASSERT(false, "A CPU stub method from GPU state propagator data was called instead of one from GPU implementation.");
+ GMX_ASSERT(!impl_,
+ "A CPU stub method from GPU state propagator data was called instead of one from "
+ "GPU implementation.");
return 0;
}
-} // namespace gmx
+} // namespace gmx
-#endif // GMX_GPU == GMX_GPU_NONE
+#endif // !GMX_GPU