BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
57 std::vector<AgentHandle::ElementIdx_t>
offset;
73 void Initialize(uint64_t num_agents, uint64_t num_boxes,
74 const std::vector<AgentHandle::ElementIdx_t>& offs,
106 uint64_t num_agents, uint64_t num_boxes,
107 const std::vector<AgentHandle::ElementIdx_t>& offs,
169 "\nWe detected a non-spherical object during the GPU "
170 "execution. This is currently not supported.");
173 auto* cell = bdm_static_cast<Cell*>(agent);
175 auto idxt3 = idx * 3;
176 mass[idx] = cell->GetMass();
179 const auto& tf = cell->GetTractorForce();
180 const auto& pos = cell->GetPosition();
182 for (uint64_t i = 0; i < 3; ++i) {
201 std::vector<AgentHandle::ElementIdx_t>
offset;
204 const std::vector<AgentHandle::ElementIdx_t>& offs);
212 real_t* cm,
const std::vector<AgentHandle::ElementIdx_t>& offs) {
223 auto* cell = bdm_static_cast<Cell*>(agent);
228 cell->UpdatePosition(new_pos);
229 if (param->bound_space) {
240 auto* rm = sim->GetResourceManager();
244 "MechanicalForcesOpCuda::operator()",
245 "MechanicalForcesOpCuda only works with UniformGridEnvironement.");
249 std::vector<AgentHandle::ElementIdx_t> offset(num_numa_nodes);
251 for (
int nn = 1; nn < num_numa_nodes; nn++) {
252 offset[nn] = offset[nn - 1] + rm->GetNumAgents(nn - 1);
255 auto total_num_agents = rm->GetNumAgents();
256 auto num_boxes = grid->boxes_.size();
261 i_->
Initialize(total_num_agents, num_boxes, offset, grid);
264 rm->ForEachAgentParallel(1000, *
i_);
268 #pragma omp parallel for
269 for (uint64_t i = 0; i < grid->boxes_.size(); ++i) {
270 auto& box = grid->boxes_[i];
275 offset[box.start_.GetNumaNode()] + box.start_.GetElementIdx();
285 auto* param = sim->GetParam();
286 auto* rm = sim->GetResourceManager();
288 uint32_t total_num_agents = rm->GetNumAgents();
289 auto num_boxes = grid->
boxes_.size();
291 if (
cdo_ ==
nullptr) {
295 num_boxes_ =
static_cast<uint32_t
>(1.25 * num_boxes);
303 "\nThe number of cells increased significantly (from ",
305 "), agent we allocate bigger GPU buffers\n");
313 "\nThe number of boxes increased significantly (from ",
314 num_boxes_,
" to ",
"), so we allocate bigger GPU buffers\n");
315 num_boxes_ =
static_cast<uint32_t
>(1.25 * num_boxes);
321 grid->GetLargestAgentSize() * grid->GetLargestAgentSize();
327 param->simulation_max_displacement, squared_radius, total_num_agents,
void operator()(Agent *agent, AgentHandle ah) override
static ThreadInfo * GetInstance()
void Initialize(uint64_t num_agents, uint64_t num_boxes, const std::vector< AgentHandle::ElementIdx_t > &offs, UniformGridEnvironment *g)
void ResizeCellBuffers(uint32_t num_cells)
void ResizeGridBuffers(uint32_t num_boxes)
uint64_t * current_timestamp
std::vector< AgentHandle::ElementIdx_t > offset
int GetNumaNodes() const
Returns the number of NUMA nodes on this machine.
void CudaAllocPinned(T **d, uint64_t elements)
std::vector< AgentHandle::ElementIdx_t > offset
~InitializeGPUData() override
virtual Shape GetShape() const =0
Contains code required by all agents.
void ApplyBoundingBox(Agent *agent, Param::BoundSpaceMode mode, real_t lb, real_t rb)
MechanicalForcesOpCudaKernel * cdo_
static void Info(const std::string &location, const Args &... parts)
Prints information message.
ResourceManager * GetResourceManager()
Returns the ResourceManager instance.
void CudaFreePinned(void *p)
uint64_t allocated_num_agents
bool is_non_spherical_object
static void Fatal(const std::string &location, const Args &... parts)
Prints fatal error message.
uint32_t total_num_agents_
~UpdateCPUResults() override
uint32_t * num_boxes_axis
real_t * cell_tractor_force
void operator()() override
uint64_t allocated_num_boxes
UniformGridEnvironment * grid
virtual void ForEachAgentParallel(Functor< void, Agent * > &function, Functor< bool, Agent * > *filter=nullptr)
const Param * GetParam() const
Returns the simulation parameters.
void LaunchMechanicalForcesKernel(const real_t *positions, const real_t *diameter, const real_t *tractor_force, const real_t *adherence, const uint32_t *box_id, const real_t *mass, const real_t timestep, const real_t max_displacement, const real_t squared_radius, const uint32_t num_agents, uint32_t *starts, uint16_t *lengths, uint64_t *timestamps, uint64_t current_timestamp, uint32_t *successors, uint32_t *num_boxes_axis, real_t *cell_movements)
NumaNode_t GetNumaNode() const
static Simulation * GetActive()
This function returns the currently active Simulation simulation.
UpdateCPUResults(real_t *cm, const std::vector< AgentHandle::ElementIdx_t > &offs)
void IsNonSphericalObjectPresent(const Agent *agent, bool *answer)
detail::InitializeGPUData * i_
void operator()(Agent *agent, AgentHandle ah) override
ElementIdx_t GetElementIdx() const