YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
physicresource.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7
8#include <cstring>
9
10
11using namespace yarp::manager;
12
13
18{
19 cores = (size_t)0;
20 frequency = (double)0.0;
21 globalMemory = (Capacity)0;
22 sharedMemory = (Capacity)0;
23 constantMemory = (Capacity)0;
24 registerPerBlock = (size_t)0;
25 threadPerBlock = (size_t)0;
26 bOverlap = false;
27}
28
29
30GPU::GPU(const char* szName) : GenericResource("GPU")
31{
32 setName(szName);
33 cores = (size_t)0;
34 frequency = (double)0.0;
35 globalMemory = (Capacity)0;
36 sharedMemory = (Capacity)0;
37 constantMemory = (Capacity)0;
38 registerPerBlock = (size_t)0;
39 threadPerBlock = (size_t)0;
40 bOverlap = false;
41}
42
43
44GPU::GPU(const GPU &resource) : GenericResource(resource)
45{
46 compCompatibility = resource.compCompatibility;
47 cores = resource.cores;
48 frequency = resource.frequency;
49 globalMemory = resource.globalMemory;
50 sharedMemory = resource.sharedMemory;
51 constantMemory = resource.constantMemory;
52 registerPerBlock = resource.registerPerBlock;
53 threadPerBlock = resource.threadPerBlock;
54 bOverlap = resource.bOverlap;
55}
56
57
59{
60 GPU* resource = new GPU(*this);
61 return resource;
62}
63
64
66{
67 if (!getAvailability() || getDisable()) {
68 return false;
69 }
70
71 GPU* gpu = dynamic_cast<GPU*>(resource);
72 if (!gpu) {
73 return false;
74 }
75 bool ret = (!strlen(gpu->getCompCompatibility()))? true : (compCompatibility == std::string(gpu->getCompCompatibility()));
76 ret &= (cores >= gpu->getCores());
77 ret &= (frequency >= gpu->getFrequency());
78 ret &= (globalMemory >= gpu->getGlobalMemory());
79 ret &= (sharedMemory >= gpu->getSharedMemory());
80 ret &= (constantMemory >= gpu->getConstantMemory());
81 //ret &= (registerPerBlock == gpu->getRegisterPerBlock());
82 //ret &= (threadPerBlock == gpu->getThreadPerBlock());
83 ret &= (!gpu->getOverlap())? true : (bOverlap == gpu->getOverlap());
84 return ret;
85}
86
87GPU::~GPU() = default;
size_t size_t
bool ret
bool satisfy(GenericResource *resource) override
Capacity getGlobalMemory()
Capacity getSharedMemory()
Capacity getConstantMemory()
Node * clone() override
const char * getCompCompatibility()
void setName(const char *szName)
Definition resource.h:27
a Node of a Graph
Definition node.h:64